Commit 55d67351 by 宋祥

1.采购入库实体类和XML

parent f2d28b86
......@@ -7,6 +7,54 @@ package com.baosight.hpjx.hp.constant;
public class HPSqlConstant {
/**
* HPKC001 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC001 {
// 统计
public static final String STAT_DATE = "HPKC001.statDate";
}
/**
* HPKC002 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC002 {
// 统计
public static final String STAT_DATE = "HPKC002.statDate";
}
/**
* HPKC003 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC003 {
// 统计
public static final String STAT_DATE = "HPKC003.statDate";
}
/**
* HPKC004 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC004 {
// 统计
public static final String STAT_DATE = "HPKC004.statDate";
}
/**
* HPKC005 SQL 定义
*
* @author:songx
......@@ -32,6 +80,8 @@ public class HPSqlConstant {
public static final String QUERY_SUM = "HPKC006.querySum";
// 锁
public static final String LOCK = "HPKC006.lock";
// 统计
public static final String STAT_DATE = "HPKC006.statDate";
}
/**
......@@ -46,6 +96,8 @@ public class HPSqlConstant {
public static final String QUERY_SUM = "HPKC007.querySum";
// 锁
public static final String LOCK = "HPKC007.lock";
// 统计
public static final String STAT_DATE = "HPKC007.statDate";
}
/**
......
......@@ -177,25 +177,25 @@ public class ServiceHPKC009 extends ServiceBase {
private List<HPKC009> statCg(Map queryMap) {
Map<String, HPKC009> kc009Map = new HashMap();
// 1.1、期末库存
List<HPKC001> aItems = dao.query("HPKC001.statDate", new HashMap<>());
List<HPKC001> aItems = dao.query(HPSqlConstant.HPKC001.STAT_DATE, new HashMap<>());
// 1.2、收入
queryMap.put("createdTimeFrom", queryMap.get("yesterFrom") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterTo") + "235959");
List<HPKC001> bKc001s = dao.query("HPKC001.statDate", queryMap);
List<HPKC001> bKc001s = dao.query(HPSqlConstant.HPKC001.STAT_DATE, queryMap);
Map<String, HPKC001> bKc001Map = bKc001s.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getMaterialType() + "#" + item.getMaterialCode() + "#"
+ item.getSpec(), item -> item));
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 1.3、发出
List<HPKC002> cKc002s = dao.query("HPKC002.statDate", queryMap);
List<HPKC002> cKc002s = dao.query(HPSqlConstant.HPKC002.STAT_DATE, queryMap);
Map<String, HPKC002> cKc001Map = cKc002s.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getMaterialType() + "#" + item.getMaterialCode() + "#"
+ item.getSpec(), item -> item));
+ item.getInventType() + "#" + item.getInventCode() + "#"
+ item.getInventRecordId(), item -> item));
// 1.4、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
queryMap.put("kcType", HPConstant.KcType.CG);
List<HPKC009> dKc009s = dao.query("HPKC009.query", new HashMap<>());
List<HPKC009> dKc009s = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> dKc009Map = dKc009s.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode() + "#"
......@@ -203,24 +203,24 @@ public class ServiceHPKC009 extends ServiceBase {
// 根据期末库存生成收发存对象
for (HPKC001 aItem : aItems) {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWhCode() + "#" + aItem.getMaterialType() + "#"
+ aItem.getMaterialCode() + "#" + aItem.getSpec();
+ aItem.getWhCode() + "#" + aItem.getInventType() + "#"
+ aItem.getInventCode() + "#" + aItem.getInventRecordId();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(aItem.getMaterialType());
kc009.setInventCode(aItem.getMaterialCode());
kc009.setInventType(aItem.getInventType());
kc009.setInventCode(aItem.getInventCode());
kc009.setKcType(HPConstant.KcType.CG);
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
// 期末
kc009.setEndAmount(BigDecimal.valueOf(aItem.getQuantity()));
kc009.setEndAmount(aItem.getAmount());
kc009.setEndWeight(aItem.getWeight());
// 收入
HPKC001 bKc001 = bKc001Map.get(key);
kc009.setEnterAmount(bKc001 == null ? BigDecimal.ZERO : BigDecimal.valueOf(bKc001.getQuantity()));
kc009.setEnterAmount(bKc001 == null ? BigDecimal.ZERO : bKc001.getAmount());
kc009.setEnterWeight(bKc001 == null ? BigDecimal.ZERO : bKc001.getWeight());
// 发出
HPKC002 cKc002 = cKc001Map.get(key);
kc009.setOuterAmount(cKc002 == null ? BigDecimal.ZERO : BigDecimal.valueOf(cKc002.getQuantity()));
kc009.setOuterAmount(cKc002 == null ? BigDecimal.ZERO : cKc002.getAmount());
kc009.setOuterWeight(cKc002 == null ? BigDecimal.ZERO : cKc002.getWeight());
// 期初
HPKC009 dKc009 = dKc009Map.get(key);
......@@ -247,23 +247,23 @@ public class ServiceHPKC009 extends ServiceBase {
private List<HPKC009> statSc(Map queryMap) {
Map<String, HPKC009> kc009Map = new HashMap();
// 1.1、期末库存
List<HPKC003> aItems = dao.query("HPKC003.statDate", new HashMap<>());
List<HPKC003> aItems = dao.query(HPSqlConstant.HPKC003.STAT_DATE, new HashMap<>());
// 1.2、收入
queryMap.put("createdTimeFrom", queryMap.get("yesterday") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959");
List<HPKC003> bItems = dao.query("HPKC003.statDate", queryMap);
List<HPKC003> bItems = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
Map<String, HPKC003> bItemMap = bItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.3、发出
List<HPKC004> cItems = dao.query("HPKC004.statDate", queryMap);
List<HPKC004> cItems = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
Map<String, HPKC004> cItemMap = cItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.4、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
queryMap.put("kcType", HPConstant.KcType.SC);
List<HPKC009> dItems = dao.query("HPKC009.query", new HashMap<>());
List<HPKC009> dItems = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
......@@ -315,23 +315,23 @@ public class ServiceHPKC009 extends ServiceBase {
private List<HPKC009> statQt(Map queryMap) {
Map<String, HPKC009> kc009Map = new HashMap();
// 1.1、期末库存
List<HPKC006> aItems = dao.query("HPKC006.statDate", new HashMap<>());
List<HPKC006> aItems = dao.query(HPSqlConstant.HPKC006.STAT_DATE, new HashMap<>());
// 1.2、收入
queryMap.put("createdTimeFrom", queryMap.get("yesterday") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959");
List<HPKC006> bItems = dao.query("HPKC006.statDate", queryMap);
List<HPKC006> bItems = dao.query(HPSqlConstant.HPKC006.STAT_DATE, queryMap);
Map<String, HPKC006> bItemMap = bItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.3、发出
List<HPKC007> cItems = dao.query("HPKC007.statDate", queryMap);
List<HPKC007> cItems = dao.query(HPSqlConstant.HPKC007.STAT_DATE, queryMap);
Map<String, HPKC007> cItemMap = cItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.4、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
queryMap.put("kcType", HPConstant.KcType.QT);
List<HPKC009> dItems = dao.query("HPKC009.query", new HashMap<>());
List<HPKC009> dItems = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> dItemMap = dItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
......
......@@ -27,27 +27,72 @@
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialType">
MATERIAL_TYPE = #materialType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialCode">
MATERIAL_CODE = #materialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<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="purchaseCode">
PURCHASE_CODE = #purchaseCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</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="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="weight">
WEIGHT = #weight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remarks">
REMARKS = #remarks#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="oldPurchaseCode">
OLD_PURCHASE_CODE = #oldPurchaseCode#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -133,17 +178,17 @@
COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
MATERIAL_TYPE AS "materialType",
MATERIAL_CODE AS "materialCode",
SPEC AS "spec",
COALESCE(SUM(QUANTITY), 0) AS "quantity",
INVENT_TYPE AS "inventType",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC001
WHERE 1=1
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, MATERIAL_TYPE, MATERIAL_CODE, SPEC
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE, INVENT_RECORD_ID
</select>
</sqlMap>
......@@ -27,27 +27,69 @@
</sql>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialType">
MATERIAL_TYPE = #materialType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialCode">
MATERIAL_CODE = #materialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<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="reqCode">
REQ_CODE = #reqCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</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="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="weight">
WEIGHT = #weight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remarks">
REMARKS = #remarks#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002">
......@@ -128,17 +170,17 @@
COMPANY_CODE AS "companyCode",
DEP_CODE AS "depCode",
WH_CODE AS "whCode",
MATERIAL_TYPE AS "materialType",
MATERIAL_CODE AS "materialCode",
SPEC AS "spec",
COALESCE(SUM(QUANTITY), 0) AS "quantity",
INVENT_TYPE AS "inventType",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId",
COALESCE(SUM(AMOUNT), 0) AS "amount",
COALESCE(SUM(WEIGHT), 0) AS "weight"
FROM ${hpjxSchema}.T_HPKC002
WHERE 1=1
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, MATERIAL_TYPE, MATERIAL_CODE, SPEC
GROUP BY COMPANY_CODE, DEP_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE, INVENT_RECORD_ID
</select>
</sqlMap>
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