Commit c5b99dea by 江和松

汉光自动任务逻辑编写

1.每日统计收发库存
2.每月收发库存统计
3.备份实时库存
parent 0364fded
...@@ -106,12 +106,29 @@ public class HGSqlConstant { ...@@ -106,12 +106,29 @@ public class HGSqlConstant {
* @author:songx * @author:songx
* @date:2024/1/20,16:45 * @date:2024/1/20,16:45
*/ */
public class HgKc003 { public class HGKC003 {
// 模块名称 // 模块名称
private static final String MODULE_NAME = "HGKC003."; private static final String MODULE_NAME = "HGKC003.";
// 锁 // 锁
public static final String LOCK = MODULE_NAME + "lock"; public static final String LOCK = MODULE_NAME + "lock";
// 统计
public static final String STAT_DATE = "HGKC003.statDate";
}
/**
* HPKC003 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HgKc003A {
// 统计
public static final String STAT_DATE = "HGKC003A.statDate";
// 锁
public static final String LOCK = "HGKC003A.lock";
} }
/** /**
...@@ -181,18 +198,21 @@ public class HGSqlConstant { ...@@ -181,18 +198,21 @@ public class HGSqlConstant {
public static final String LOCK = "HGKC008A.lock"; public static final String LOCK = "HGKC008A.lock";
} }
/** /**
* HGKC003 SQL 定义 * HGKC004 SQL 定义
* *
* @author:songx * @author:songx
* @date:2024/1/20,16:45 * @date:2024/1/20,16:45
*/ */
public class HGKC003 { public class HGKC004 {
// 统计 // 统计
public static final String STAT_DATE = "HGKC003.statDate"; public static final String STAT_DATE = "HGKC004.statDate";
// 锁 // 锁
public static final String LOCK = "HGKC003.lock"; public static final String LOCK = "HGKC004.lock";
// 修改打印状态
public static final String UPDATE_PRINT = "HGKC004.updatePrint";
} }
/** /**
...@@ -201,14 +221,14 @@ public class HGSqlConstant { ...@@ -201,14 +221,14 @@ public class HGSqlConstant {
* @author:songx * @author:songx
* @date:2024/1/20,16:45 * @date:2024/1/20,16:45
*/ */
public class HGKC004 { public class HGKC004A {
// 统计 // 统计
public static final String STAT_DATE = "HGKC004.statDate"; public static final String STAT_DATE = "HGKC004A.statDate";
// 锁 // 锁
public static final String LOCK = "HGKC004.lock"; public static final String LOCK = "HGKC004A.lock";
// 修改打印状态 // 修改打印状态
public static final String UPDATE_PRINT = "HGKC004.updatePrint"; public static final String UPDATE_PRINT = "HGKC004A.updatePrint";
} }
/** /**
......
...@@ -22,12 +22,15 @@ public class HGKC010A extends HGKC010 { ...@@ -22,12 +22,15 @@ public class HGKC010A extends HGKC010 {
public static final String FIELD_APPLY_QTY = "applyQty"; /* 申请数量*/ public static final String FIELD_APPLY_QTY = "applyQty"; /* 申请数量*/
public static final String FIELD_APPLY_REMARK = "applyRemark"; /* 申请说明*/ public static final String FIELD_APPLY_REMARK = "applyRemark"; /* 申请说明*/
public static final String FIELD_DATE_PROC = "dateProc"; /* 日期*/
public static final String COL_APPLY_QTY = "APPLY_QTY"; /* 申请数量*/ public static final String COL_APPLY_QTY = "APPLY_QTY"; /* 申请数量*/
public static final String COL_APPLY_REMARK = "APPLY_REMARK"; /* 申请说明*/ public static final String COL_APPLY_REMARK = "APPLY_REMARK"; /* 申请说明*/
public static final String COL_DATE_PROC = "DATE_PROC"; /* 日期*/
private BigDecimal applyQty = new BigDecimal(0.000); /* 申请数量*/ private BigDecimal applyQty = new BigDecimal(0.000); /* 申请数量*/
private String applyRemark = " "; /* 申请说明*/ private String applyRemark = " "; /* 申请说明*/
private String dateProc = " "; /* 日期*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -46,6 +49,10 @@ public class HGKC010A extends HGKC010 { ...@@ -46,6 +49,10 @@ public class HGKC010A extends HGKC010 {
eiColumn.setDescName("申请说明"); eiColumn.setDescName("申请说明");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DATE_PROC);
eiColumn.setDescName("日期");
eiMetadata.addMeta(eiColumn);
} }
...@@ -56,23 +63,31 @@ public class HGKC010A extends HGKC010 { ...@@ -56,23 +63,31 @@ public class HGKC010A extends HGKC010 {
super.initMetaData(); super.initMetaData();
initMetaData(); initMetaData();
} }
public BigDecimal getApplyQty() { public BigDecimal getApplyQty() {
return applyQty; return applyQty;
} }
public void setApplyQty(BigDecimal applyQty) { public void setApplyQty(BigDecimal applyQty) {
this.applyQty = applyQty; this.applyQty = applyQty;
} }
public String getApplyRemark() { public String getApplyRemark() {
return applyRemark; return applyRemark;
} }
public void setApplyRemark(String applyRemark) { public void setApplyRemark(String applyRemark) {
this.applyRemark = applyRemark; this.applyRemark = applyRemark;
} }
public String getDateProc() {
return dateProc;
}
public void setDateProc(String dateProc) {
this.dateProc = dateProc;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -83,8 +98,9 @@ public class HGKC010A extends HGKC010 { ...@@ -83,8 +98,9 @@ public class HGKC010A extends HGKC010 {
super.fromMap(map); super.fromMap(map);
setApplyQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_APPLY_QTY)), applyQty)); setApplyQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_APPLY_QTY)), applyQty));
setApplyRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_APPLY_REMARK)), applyRemark)); setApplyRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_APPLY_REMARK)), applyRemark));
setDateProc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DATE_PROC)), dateProc));
} }
/** /**
* set the value to Map. * set the value to Map.
*/ */
...@@ -94,6 +110,7 @@ public class HGKC010A extends HGKC010 { ...@@ -94,6 +110,7 @@ public class HGKC010A extends HGKC010 {
Map map = super.toMap(); Map map = super.toMap();
map.put(FIELD_APPLY_QTY, StringUtils.toString(applyQty, eiMetadata.getMeta(FIELD_APPLY_QTY))); map.put(FIELD_APPLY_QTY, StringUtils.toString(applyQty, eiMetadata.getMeta(FIELD_APPLY_QTY)));
map.put(FIELD_APPLY_REMARK, StringUtils.toString(applyRemark, eiMetadata.getMeta(FIELD_APPLY_REMARK))); map.put(FIELD_APPLY_REMARK, StringUtils.toString(applyRemark, eiMetadata.getMeta(FIELD_APPLY_REMARK)));
map.put(FIELD_DATE_PROC, StringUtils.toString(dateProc, eiMetadata.getMeta(FIELD_DATE_PROC)));
return map; return map;
} }
......
...@@ -5,7 +5,6 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -5,7 +5,6 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.*; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ007; import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
...@@ -170,14 +169,18 @@ public class ServiceHGKC009 extends ServiceBase { ...@@ -170,14 +169,18 @@ public class ServiceHGKC009 extends ServiceBase {
Map<String, HGKC006A> qtRkMap = this.listInvData(queryMap, HGSqlConstant.HGKC006A.STAT_DATE); Map<String, HGKC006A> qtRkMap = this.listInvData(queryMap, HGSqlConstant.HGKC006A.STAT_DATE);
// 1.5、生产领料 // 1.5、生产领料
Map<String, HGKC008A> scCkMap = this.listInvData(queryMap, HGSqlConstant.HGKC008A.STAT_DATE); Map<String, HGKC008A> scCkMap = this.listInvData(queryMap, HGSqlConstant.HGKC008A.STAT_DATE);
// 1.6、生产入库
Map<String, HGKC003> scRkMap = this.listInvData(queryMap, HGSqlConstant.HGKC003.STAT_DATE);
// 1.7、其它出库 // 1.7、其它出库
Map<String, HGKC007A> qtCkMap = this.listInvData(queryMap, HGSqlConstant.HGKC007A.STAT_DATE); Map<String, HGKC007A> qtCkMap = this.listInvData(queryMap, HGSqlConstant.HGKC007A.STAT_DATE);
// 1.8、盘点差异数量 // 1.8、盘点差异数量
Map<String, HGKC005> pdDiffMap = this.listInvData(queryMap, HGSqlConstant.HGKC005.STAT_DATE); Map<String, HGKC005> pdDiffMap = this.listInvData(queryMap, HGSqlConstant.HGKC005.STAT_DATE);
// 1.9、期初库存 // 1.9、期初库存
Map<String, HGKC009> initKcMap = this.listInvData(queryMap, HGKC009.QUERY); Map<String, HGKC009> initKcMap = this.listInvData(queryMap, HGKC009.QUERY);
// 2.0 销售出库
Map<String, HGKC004A> xsCkMap = this.listInvData(queryMap, HGSqlConstant.HGKC004A.STAT_DATE);
// 根据期末库存生成收发存对象 // 根据期末库存生成收发存对象
return buildKcBean(queryMap, endKcs, cgRkMap, qtRkMap, scCkMap, qtCkMap, pdDiffMap, initKcMap); return buildKcBean(queryMap, endKcs, cgRkMap, qtRkMap, scCkMap, qtCkMap, pdDiffMap, initKcMap,scRkMap,xsCkMap);
} }
/** /**
...@@ -186,16 +189,19 @@ public class ServiceHGKC009 extends ServiceBase { ...@@ -186,16 +189,19 @@ public class ServiceHGKC009 extends ServiceBase {
* @param queryMap * @param queryMap
* @param endKcs * @param endKcs
* @param cgRkMap * @param cgRkMap
* @param qtCkMap
* @param scCkMap
* @param qtRkMap * @param qtRkMap
* @param scCkMap
* @param qtCkMap
* @param pdDiffMap * @param pdDiffMap
* @param initKcMap * @param initKcMap
* @param scRkMap
* @param xsCkMap
* @return * @return
*/ */
private List<HGKC009> buildKcBean(Map queryMap, Map<String, HGKC010A> endKcs, Map<String, HGKC001> cgRkMap, private List<HGKC009> buildKcBean(Map queryMap, Map<String, HGKC010A> endKcs, Map<String, HGKC001> cgRkMap,
Map<String, HGKC006A> qtRkMap, Map<String, HGKC008A> scCkMap, Map<String, HGKC007A> qtCkMap, Map<String, HGKC006A> qtRkMap, Map<String, HGKC008A> scCkMap, Map<String, HGKC007A> qtCkMap,
Map<String, HGKC005> pdDiffMap, Map<String, HGKC009> initKcMap) { Map<String, HGKC005> pdDiffMap, Map<String, HGKC009> initKcMap, Map<String, HGKC003> scRkMap,
Map<String, HGKC004A> xsCkMap) {
List<HGKC009> newKc009s = new ArrayList<>(); List<HGKC009> newKc009s = new ArrayList<>();
for (Map.Entry<String, HGKC010A> entry : endKcs.entrySet()) { for (Map.Entry<String, HGKC010A> entry : endKcs.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
...@@ -223,10 +229,22 @@ public class ServiceHGKC009 extends ServiceBase { ...@@ -223,10 +229,22 @@ public class ServiceHGKC009 extends ServiceBase {
HGKC008A scCk = scCkMap.get(key); HGKC008A scCk = scCkMap.get(key);
kc009.setScOuterAmount(scCk == null ? BigDecimal.ZERO : scCk.getInvQty()); kc009.setScOuterAmount(scCk == null ? BigDecimal.ZERO : scCk.getInvQty());
kc009.setScOuterWeight(scCk == null ? BigDecimal.ZERO : scCk.getInvWeight()); kc009.setScOuterWeight(scCk == null ? BigDecimal.ZERO : scCk.getInvWeight());
// 1.6、生产入库
HGKC003 scRk = scRkMap.get(key);
kc009.setScEnterAmount(scRk == null ? BigDecimal.ZERO : scRk.getInvQty());
kc009.setScEnterWeight(scRk == null ? BigDecimal.ZERO : scRk.getInvWeight());
// 1.7、其他出库 // 1.7、其他出库
HGKC007A qtCk = qtCkMap.get(key); HGKC007A qtCk = qtCkMap.get(key);
kc009.setQtOuterAmount(qtCk == null ? BigDecimal.ZERO : qtCk.getInvQty()); kc009.setQtOuterAmount(qtCk == null ? BigDecimal.ZERO : qtCk.getInvQty());
kc009.setQtOuterWeight(qtCk == null ? BigDecimal.ZERO : qtCk.getInvWeight()); kc009.setQtOuterWeight(qtCk == null ? BigDecimal.ZERO : qtCk.getInvWeight());
// 2.0、销售出库
HGKC004A xsCk = xsCkMap.get(key);
kc009.setXsOuterAmount(xsCk == null ? BigDecimal.ZERO : xsCk.getQuantity());
kc009.setXsOuterWeight(xsCk == null ? BigDecimal.ZERO : xsCk.getWeight());
// 1.8、出库 // 1.8、出库
kc009.setOuterAmount(kc009.getScOuterAmount().add(kc009.getXsOuterAmount()) kc009.setOuterAmount(kc009.getScOuterAmount().add(kc009.getXsOuterAmount())
.add(kc009.getQtOuterAmount())); .add(kc009.getQtOuterAmount()));
......
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/25,18:49
*/
public class ServiceHGKC010A extends ServiceBase {
/**
* 备份数据
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存管理",operType = "插入",operDesc = "实时库存管理-备份数据")
public EiInfo backup(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("dateProc", LocalDate.now().minusDays(1).format(DateUtils.SHORT_DATE));
// 清除数据
dao.delete(HGSqlConstant.HGKC010A.DELETE_BY_TIME, queryMap);
// 备份数据
dao.insert(HGSqlConstant.HGKC010A.BACKUP, queryMap);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("备份数据成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
}
...@@ -358,4 +358,22 @@ ...@@ -358,4 +358,22 @@
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC003 SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC003
</select> </select>
<!-- 统计库存 -->
<select id="statDate" resultClass="com.baosight.hggp.hg.kc.domain.HGKC003">
SELECT
COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
PROJ_CODE AS "projCode",
PART_CODE AS "partCode",
COALESCE(SUM(INV_QTY), 0) AS "invQty",
COALESCE(SUM(INV_WEIGHT), 0) AS "invWeight"
FROM ${hggpSchema}.HGKC003
WHERE 1=1
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, PROJ_CODE, PART_CODE
</select>
</sqlMap> </sqlMap>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
Generate time : 2024-05-28 10:42:29
Version : 1.0
schema : hggp
tableName : HGKC004
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
PARENT_ID BIGINT NOT NULL,
RECEIPT_DATE VARCHAR,
SALE_OUT_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
STATUS TINYINT
-->
<sqlMap namespace="HGKC004"> <sqlMap namespace="HGKC004">
<typeAlias alias="HGKC004" type="com.baosight.hggp.hg.kc.domain.HGKC004"/> <typeAlias alias="HGKC004" type="com.baosight.hggp.hg.kc.domain.HGKC004"/>
...@@ -119,7 +96,7 @@ ...@@ -119,7 +96,7 @@
<select id="query" parameterClass="HashMap" resultClass="HGKC004"> <select id="query" parameterClass="HashMap" resultClass="HGKC004">
SELECT SELECT
<include refid="column"/> <include refid="column"/>
FROM ${hggpSchema}.HGKC004 WHERE 1=1 FROM ${hggpSchema}.HGKC004 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
...@@ -236,27 +213,6 @@ ...@@ -236,27 +213,6 @@
WHERE ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate> WHERE ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update> </update>
<!-- 统计库存 -->
<select id="statDate" resultClass="HGKC004">
SELECT
ACCOUNT_CODE AS "accountCode",
COMPANY_CODE as "companyCode",
COMPANY_NAME as "companyName",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
PROJ_CODE AS "projCode",
INVENT_CODE AS "inventCode",
SUB_INVENT_CODE AS "subInventCode",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hggpSchema}.HGKC004
WHERE 1=1
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, PROJ_CODE, INVENT_CODE, SUB_INVENT_CODE,FACTORY_CODE,FACTORY_NAME
</select>
<select id="queryList" parameterClass="HashMap" resultClass="HGKC004"> <select id="queryList" parameterClass="HashMap" resultClass="HGKC004">
SELECT SELECT
<include refid="column"/> <include refid="column"/>
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
Generate time : 2024-05-28 10:42:29
Version : 1.0
schema : hggp
tableName : HGKC004A
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
INVENT_RECORD_ID BIGINT,
INVENT_TYPE VARCHAR,
INVENT_CODE VARCHAR NOT NULL,
INVENT_NAME VARCHAR NOT NULL,
INV_QTY DECIMAL,
INV_UNIT_WEIGHT DECIMAL,
INV_WEIGHT DECIMAL,
PARENT_ID BIGINT,
PRICE DECIMAL,
AMOUNT DECIMAL
-->
<sqlMap namespace="HGKC004A"> <sqlMap namespace="HGKC004A">
<typeAlias alias="HGKC004A" type="com.baosight.hggp.hg.kc.domain.HGKC004A"/> <typeAlias alias="HGKC004A" type="com.baosight.hggp.hg.kc.domain.HGKC004A"/>
...@@ -242,85 +215,24 @@ ...@@ -242,85 +215,24 @@
ID = #id# ID = #id#
</update> </update>
<!-- <!-- 统计库存 -->
<isNotEmpty prepend=" AND " property="id"> <select id="statDate" resultClass="HGKC004">
ID = #id# SELECT
</isNotEmpty> a.ACCOUNT_CODE AS "accountCode",
<isNotEmpty prepend=" AND " property="accountCode"> a.COMPANY_CODE as "companyCode",
ACCOUNT_CODE = #accountCode# a.COMPANY_NAME as "companyName",
</isNotEmpty> a.DEP_CODE AS "depCode",
<isNotEmpty prepend=" AND " property="depCode"> b.WH_CODE AS "whCode",
DEP_CODE = #depCode# b.PROJ_CODE AS "projCode",
</isNotEmpty> a.INVENT_CODE AS "inventCode",
<isNotEmpty prepend=" AND " property="createdBy"> COALESCE(SUM(QUANTITY), 0) AS "quantity",
CREATED_BY = #createdBy# COALESCE(SUM(WEIGHT), 0) AS "weight"
</isNotEmpty> FROM ${hggpSchema}.HGKC004A a LEFT JOIN ${hggpSchema}.HGKC004 b on a.PARENT_ID = b.ID
<isNotEmpty prepend=" AND " property="createdName"> WHERE 1=1
CREATED_NAME = #createdName# <isNotEmpty prepend=" AND " property="createdTimeFrom">
</isNotEmpty> a.CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
<isNotEmpty prepend=" AND " property="createdTime"> </isNotEmpty>
CREATED_TIME = #createdTime# GROUP BY a.ACCOUNT_CODE,a.COMPANY_CODE,a.COMPANY_NAME, a.DEP_CODE, b.WH_CODE, b.PROJ_CODE, a.INVENT_CODE
</isNotEmpty> </select>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="length">
LENGTH = #length#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="width">
WIDTH = #width#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="thick">
THICK = #thick#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
QUANTITY = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unitWeight">
UNIT_WEIGHT = #unitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="weight">
WEIGHT = #weight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="price">
PRICE = #price#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
-->
</sqlMap> </sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGKC010A">
<sql id="column">
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
LENGTH as "length", <!-- 长度 -->
WIDTH as "width", <!-- 宽度 -->
THICK as "thick", <!-- 厚度 -->
INV_QTY as "invQty", <!-- 库存数量 -->
INV_UNIT_WEIGHT as "invUnitWeight", <!-- 库存单重 -->
INV_WEIGHT as "invWeight", <!-- 库存重量 -->
FACTORY_CODE as "factoryCode", <!-- 厂区编码 -->
FACTORY_NAME as "factoryName" <!-- 厂区名称 -->
</sql>
<sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<include refid="idCondition"/>
<include refid="customCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dateProc">
DATE_PROC = #dateProc#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="specId">
SPEC_ID = #specId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="material">
MATERIAL = #material#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unit">
UNIT = #unit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
FACTORY_NAME = #factoryName#
</isNotEmpty>
</sql>
<sql id="idCondition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</sql>
<sql id="customCondition">
<include refid="BaseCondition.specCondition"/>
<include refid="BaseCondition.createdTimeCondition"/>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID DESC
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.kc.domain.HGKC010A">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGKC010A
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGKC010A WHERE 1=1
<include refid="condition"/>
</select>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGKC010A WHERE ID = #id#
</delete>
<!-- 按时间删除数据 -->
<delete id="deleteByTime">
DELETE FROM ${hggpSchema}.HGKC010A WHERE DATE_PROC = #dateProc#
</delete>
<!-- 备份数据 -->
<insert id="backup">
INSERT INTO ${hggpSchema}.HGKC010A (
ACCOUNT_CODE,COMPANY_CODE,COMPANY_NAME, DEP_CODE, DATE_PROC, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, SPEC_ID,SPEC, MATERIAL, UNIT,LENGTH,WIDTH,THICK, INV_QTY, INV_UNIT_WEIGHT, INV_WEIGHT,
FACTORY_CODE, FACTORY_NAME,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,UPDATED_TIME
)
SELECT
ACCOUNT_CODE,COMPANY_CODE,COMPANY_NAME, DEP_CODE, #dateProc#, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, SPEC_ID,SPEC, MATERIAL, UNIT,LENGTH,WIDTH,THICK, INV_QTY, INV_UNIT_WEIGHT, INV_WEIGHT,
FACTORY_CODE, FACTORY_NAME,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME, UPDATED_TIME
FROM ${hggpSchema}.HGKC010
</insert>
</sqlMap>
...@@ -287,7 +287,7 @@ public class HGKCTools { ...@@ -287,7 +287,7 @@ public class HGKCTools {
} }
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("depositNos", depositNos); paramMap.put("depositNos", depositNos);
DaoBase.getInstance().update(HGSqlConstant.HgKc003.LOCK, paramMap); DaoBase.getInstance().update(HGSqlConstant.HGKC003.LOCK, paramMap);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment