Commit 3891d88f by 宋祥

1.生产库存收发存统计

parent 2bf7b156
......@@ -189,7 +189,7 @@ public class HPSqlConstant {
public class HPKC010A {
// 按日期删除
public static final String DELETE_BY_TIME = "HPKC009.deleteByTime";
public static final String DELETE_BY_TIME = "HPKC010A.deleteByTime";
// 备份数量
public static final String BACKUP = "HPKC010A.backup";
}
......@@ -207,6 +207,20 @@ public class HPSqlConstant {
}
/**
* HPKC011A SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC011A {
// 按日期删除
public static final String DELETE_BY_TIME = "HPKC011A.deleteByTime";
// 备份数量
public static final String BACKUP = "HPKC011A.backup";
}
/**
* HPPZ010 SQL 定义
*
* @author:songx
......
package com.baosight.hpjx.hp.kc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.math.BigDecimal;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.data.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
......@@ -17,7 +16,7 @@ import java.util.Map;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-02-23 13:43:22 create
* @history 2024-02-23 16:22:11 create
*/
public class HPKC009A extends DaoEPBase {
......@@ -38,10 +37,10 @@ public class HPKC009A extends DaoEPBase {
public static final String FIELD_WH_NAME = "whName"; /* 仓库名称*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_PRDT_CODE = "prdtCode"; /* 产品编码*/
public static final String FIELD_PRDT_NAME = "prdtName"; /* 产品名称*/
public static final String FIELD_PART_CODE = "partCode"; /* 零件编码*/
public static final String FIELD_PART_NAME = "partName"; /* 零件名称*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 部件编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 部件名称*/
public static final String FIELD_SUB_INVENT_CODE = "subInventCode"; /* 零件编码*/
public static final String FIELD_SUB_INVENT_NAME = "subInventName"; /* 零件名称*/
public static final String FIELD_INIT_AMOUNT = "initAmount"; /* 期初数量*/
public static final String FIELD_INIT_WEIGHT = "initWeight"; /* 期初重量*/
public static final String FIELD_ENTER_AMOUNT = "enterAmount"; /* 入库数量*/
......@@ -68,10 +67,10 @@ public class HPKC009A extends DaoEPBase {
public static final String COL_WH_NAME = "WH_NAME"; /* 仓库名称*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_PRDT_CODE = "PRDT_CODE"; /* 产品编码*/
public static final String COL_PRDT_NAME = "PRDT_NAME"; /* 产品名称*/
public static final String COL_PART_CODE = "PART_CODE"; /* 零件编码*/
public static final String COL_PART_NAME = "PART_NAME"; /* 零件名称*/
public static final String COL_INVENT_CODE = "INVENT_CODE"; /* 部件编码*/
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 部件名称*/
public static final String COL_SUB_INVENT_CODE = "SUB_INVENT_CODE"; /* 零件编码*/
public static final String COL_SUB_INVENT_NAME = "SUB_INVENT_NAME"; /* 零件名称*/
public static final String COL_INIT_AMOUNT = "INIT_AMOUNT"; /* 期初数量*/
public static final String COL_INIT_WEIGHT = "INIT_WEIGHT"; /* 期初重量*/
public static final String COL_ENTER_AMOUNT = "ENTER_AMOUNT"; /* 入库数量*/
......@@ -104,10 +103,10 @@ public class HPKC009A extends DaoEPBase {
private String whName = " "; /* 仓库名称*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String prdtCode = " "; /* 产品编码*/
private String prdtName = " "; /* 产品名称*/
private String partCode = " "; /* 零件编码*/
private String partName = " "; /* 零件名称*/
private String inventCode = " "; /* 部件编码*/
private String inventName = " "; /* 部件名称*/
private String subInventCode = " "; /* 零件编码*/
private String subInventName = " "; /* 零件名称*/
private BigDecimal initAmount = new BigDecimal(0.000); /* 期初数量*/
private BigDecimal initWeight = new BigDecimal(0.000); /* 期初重量*/
private BigDecimal enterAmount = new BigDecimal(0.000); /* 入库数量*/
......@@ -186,19 +185,19 @@ public class HPKC009A extends DaoEPBase {
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRDT_CODE);
eiColumn.setDescName("产品编码");
eiColumn = new EiColumn(FIELD_INVENT_CODE);
eiColumn.setDescName("部件编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRDT_NAME);
eiColumn.setDescName("产品名称");
eiColumn = new EiColumn(FIELD_INVENT_NAME);
eiColumn.setDescName("部件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PART_CODE);
eiColumn = new EiColumn(FIELD_SUB_INVENT_CODE);
eiColumn.setDescName("零件编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PART_NAME);
eiColumn = new EiColumn(FIELD_SUB_INVENT_NAME);
eiColumn.setDescName("零件名称");
eiMetadata.addMeta(eiColumn);
......@@ -523,68 +522,68 @@ public class HPKC009A extends DaoEPBase {
this.projName = projName;
}
/**
* get the prdtCode - 产品编码.
* @return the prdtCode
* get the inventCode - 部件编码.
* @return the inventCode
*/
public String getPrdtCode() {
return this.prdtCode;
public String getInventCode() {
return this.inventCode;
}
/**
* set the prdtCode - 产品编码.
* set the inventCode - 部件编码.
*
* @param prdtCode - 产品编码
* @param inventCode - 部件编码
*/
public void setPrdtCode(String prdtCode) {
this.prdtCode = prdtCode;
public void setInventCode(String inventCode) {
this.inventCode = inventCode;
}
/**
* get the prdtName - 产品名称.
* @return the prdtName
* get the inventName - 部件名称.
* @return the inventName
*/
public String getPrdtName() {
return this.prdtName;
public String getInventName() {
return this.inventName;
}
/**
* set the prdtName - 产品名称.
* set the inventName - 部件名称.
*
* @param prdtName - 产品名称
* @param inventName - 部件名称
*/
public void setPrdtName(String prdtName) {
this.prdtName = prdtName;
public void setInventName(String inventName) {
this.inventName = inventName;
}
/**
* get the partCode - 零件编码.
* @return the partCode
* get the subInventCode - 零件编码.
* @return the subInventCode
*/
public String getPartCode() {
return this.partCode;
public String getSubInventCode() {
return this.subInventCode;
}
/**
* set the partCode - 零件编码.
* set the subInventCode - 零件编码.
*
* @param partCode - 零件编码
* @param subInventCode - 零件编码
*/
public void setPartCode(String partCode) {
this.partCode = partCode;
public void setSubInventCode(String subInventCode) {
this.subInventCode = subInventCode;
}
/**
* get the partName - 零件名称.
* @return the partName
* get the subInventName - 零件名称.
* @return the subInventName
*/
public String getPartName() {
return this.partName;
public String getSubInventName() {
return this.subInventName;
}
/**
* set the partName - 零件名称.
* set the subInventName - 零件名称.
*
* @param partName - 零件名称
* @param subInventName - 零件名称
*/
public void setPartName(String partName) {
this.partName = partName;
public void setSubInventName(String subInventName) {
this.subInventName = subInventName;
}
/**
* get the initAmount - 期初数量.
......@@ -769,10 +768,10 @@ public class HPKC009A extends DaoEPBase {
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_CODE)), prdtCode));
setPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_NAME)), prdtName));
setPartCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_CODE)), partCode));
setPartName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_NAME)), partName));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setSubInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUB_INVENT_CODE)), subInventCode));
setSubInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SUB_INVENT_NAME)), subInventName));
setInitAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INIT_AMOUNT)), initAmount));
setInitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INIT_WEIGHT)), initWeight));
setEnterAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_ENTER_AMOUNT)), enterAmount));
......@@ -807,10 +806,10 @@ public class HPKC009A extends DaoEPBase {
map.put(FIELD_WH_NAME, StringUtils.toString(whName, eiMetadata.getMeta(FIELD_WH_NAME)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_PRDT_CODE, StringUtils.toString(prdtCode, eiMetadata.getMeta(FIELD_PRDT_CODE)));
map.put(FIELD_PRDT_NAME, StringUtils.toString(prdtName, eiMetadata.getMeta(FIELD_PRDT_NAME)));
map.put(FIELD_PART_CODE, StringUtils.toString(partCode, eiMetadata.getMeta(FIELD_PART_CODE)));
map.put(FIELD_PART_NAME, StringUtils.toString(partName, eiMetadata.getMeta(FIELD_PART_NAME)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_SUB_INVENT_CODE, StringUtils.toString(subInventCode, eiMetadata.getMeta(FIELD_SUB_INVENT_CODE)));
map.put(FIELD_SUB_INVENT_NAME, StringUtils.toString(subInventName, eiMetadata.getMeta(FIELD_SUB_INVENT_NAME)));
map.put(FIELD_INIT_AMOUNT, StringUtils.toString(initAmount, eiMetadata.getMeta(FIELD_INIT_AMOUNT)));
map.put(FIELD_INIT_WEIGHT, StringUtils.toString(initWeight, eiMetadata.getMeta(FIELD_INIT_WEIGHT)));
map.put(FIELD_ENTER_AMOUNT, StringUtils.toString(enterAmount, eiMetadata.getMeta(FIELD_ENTER_AMOUNT)));
......
......@@ -3,19 +3,16 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.domain.HPKC009;
import com.baosight.hpjx.hp.kc.domain.HPKC009A;
import com.baosight.hpjx.hp.kc.domain.HPKC010A;
import com.baosight.hpjx.hp.kc.domain.HPKC011A;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
......@@ -166,98 +163,64 @@ public class ServiceHPKC009A extends ServiceBase {
List<HPKC009A> newKc009As = new ArrayList<>();
// 1.1、期末库存
queryMap.put("dateProc", queryMap.get("yesterTo"));
List<HPKC010A> endKcs = dao.query(HPKC010A.QUERY, queryMap);
// 1.2、采购入库
List<HPKC011A> endKcs = dao.query(HPKC011A.QUERY, queryMap);
queryMap.put("createdTimeFrom", queryMap.get("yesterFrom") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterTo") + "235959");
List<HPKC001> cgRks = dao.query(HPSqlConstant.HPKC001.STAT_DATE, queryMap);
Map<String, HPKC001> cgRkMap = cgRks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.3、生产入库
// List<HPKC003> scRks = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
// Map<String, HPKC003> scRkMap = scRks.stream().collect(Collectors.toMap(item ->
// buildKey(item.getCompanyCode(), item.getDepCode(), item.getPartType(), item.getPartCode(),
// item.getWhCode(), null), item -> item));
// 1.4、其他入库
List<HPKC006> qtRks = dao.query(HPSqlConstant.HPKC006.STAT_DATE, queryMap);
Map<String, HPKC006> qtRkMap = qtRks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.5、生产领料
List<HPKC002> scCks = dao.query(HPSqlConstant.HPKC002.STAT_DATE, queryMap);
Map<String, HPKC002> scCkMap = scCks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
List<HPKC003> scRks = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
Map<String, HPKC003> scRkMap = scRks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getWhCode(), item.getProjCode(),
item.getPrdtCode(), item.getPartCode()), item -> item));
// 1.6、销售出库
// List<HPKC004> xsCks = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
// Map<String, HPKC004> xsCkMap = xsCks.stream().collect(Collectors.toMap(item ->
// buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventCode(), item.getSubInventCode(),
// item.getWhCode(), ""), item -> item));
// 1.7、其它出库
List<HPKC007> qtCks = dao.query(HPSqlConstant.HPKC007.STAT_DATE, queryMap);
Map<String, HPKC007> qtCkMap = qtCks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
List<HPKC004> xsCks = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
Map<String, HPKC004> xsCkMap = xsCks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getWhCode(), item.getProjCode(),
item.getInventCode(), item.getSubInventCode()), item -> item));
// 1.8、盘点差异数量
List<HPKC005> pdDiffs = dao.query(HPSqlConstant.HPKC005.STAT_DATE, queryMap);
Map<String, HPKC005> pdDiffMap = pdDiffs.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// List<HPKC005> pdDiffs = dao.query(HPSqlConstant.HPKC005.STAT_DATE, queryMap);
// Map<String, HPKC005> pdDiffMap = pdDiffs.stream().collect(Collectors.toMap(item ->
// buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
// item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.9、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
List<HPKC009> initKcs = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> initKcMap = initKcs.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
List<HPKC009A> initKcs = dao.query(HPKC009A.QUERY, new HashMap<>());
Map<String, HPKC009A> initKcMap = initKcs.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getWhCode(), item.getProjCode(),
item.getInventCode(), item.getSubInventCode()), item -> item));
// 根据期末库存生成收发存对象
for (HPKC010A endKc : endKcs) {
String key = buildKey(endKc.getCompanyCode(), endKc.getDepCode(), endKc.getInventType(),
endKc.getInventCode(), endKc.getWhCode(), endKc.getInventRecordId());
HPKC009A kc009 = BeanUtils.copy(endKc, HPKC009A.class);
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
// 1.1期末
kc009.setEndAmount(endKc.getAmount());
kc009.setEndWeight(endKc.getWeight());
// 1.4、入库
// kc009.setEnterAmount(kc009.getCgEnterAmount().add(kc009.getScEnterAmount())
// .add(kc009.getQtEnterAmount()));
// kc009.setEnterWeight(kc009.getCgEnterWeight().add(kc009.getScEnterWeight())
// .add(kc009.getQtEnterWeight()));
// // 1.5、生产领料
// HPKC002 scCk = scCkMap.get(key);
// kc009.setScOuterAmount(scCk == null ? BigDecimal.ZERO : scCk.getAmount());
// kc009.setScOuterWeight(scCk == null ? BigDecimal.ZERO : scCk.getWeight());
// // 1.6、销售出库
// HPKC004 xsCk = null;//xsCkMap.get(key);
// kc009.setXsOuterAmount(xsCk == null ? BigDecimal.ZERO : xsCk.getAmount());
// kc009.setXsOuterWeight(xsCk == null ? BigDecimal.ZERO : xsCk.getWeight());
// // 1.7、其他出库
// HPKC007 qtCk = qtCkMap.get(key);
// kc009.setQtOuterAmount(qtCk == null ? BigDecimal.ZERO : qtCk.getAmount());
// kc009.setQtOuterWeight(qtCk == null ? BigDecimal.ZERO : qtCk.getWeight());
// // 1.8、出库
// kc009.setOuterAmount(kc009.getScOuterAmount().add(kc009.getXsOuterAmount())
// .add(kc009.getQtOuterAmount()));
// kc009.setOuterWeight(kc009.getScOuterWeight().add(kc009.getXsOuterWeight())
// .add(kc009.getQtOuterWeight()));
for (HPKC011A endKc : endKcs) {
String key = buildKey(endKc.getCompanyCode(), endKc.getDepCode(), endKc.getWhCode(),
endKc.getProjCode(), endKc.getInventCode(), endKc.getSubInventCode());
HPKC009A newKc009a = BeanUtils.copy(endKc, HPKC009A.class);
newKc009a.setDateType(queryMap.get("dateType").toString());
newKc009a.setDateProc(queryMap.get("yesterDate").toString());
// 1.1、期末
newKc009a.setEndAmount(endKc.getAmount());
newKc009a.setEndWeight(endKc.getWeight());
// 1.2、入库
HPKC003 scRk = scRkMap.get(key);
newKc009a.setEnterAmount(scRk == null ? BigDecimal.ZERO : scRk.getAmount());
newKc009a.setEnterWeight(scRk == null ? BigDecimal.ZERO : scRk.getWeight());
// 1.3、出库
HPKC004 xsCk = xsCkMap.get(key);
newKc009a.setOuterAmount(xsCk == null ? BigDecimal.ZERO : xsCk.getAmount());
newKc009a.setOuterWeight(xsCk == null ? BigDecimal.ZERO : xsCk.getWeight());
// 1.8、盘点差异数量
HPKC005 pdDiff = pdDiffMap.get(key);
kc009.setPdDiffAmount(pdDiff == null ? BigDecimal.ZERO : pdDiff.getDiffAmount());
kc009.setPdDiffWeight(pdDiff == null ? BigDecimal.ZERO : pdDiff.getDiffWeight());
// HPKC005 pdDiff = pdDiffMap.get(key);
// kc009.setPdDiffAmount(pdDiff == null ? BigDecimal.ZERO : pdDiff.getDiffAmount());
// kc009.setPdDiffWeight(pdDiff == null ? BigDecimal.ZERO : pdDiff.getDiffWeight());
// 1.9、期初
HPKC009 initKc = initKcMap.get(key);
HPKC009A initKc = initKcMap.get(key);
if (initKc != null) {
kc009.setInitAmount(initKc.getEndAmount());
kc009.setInitWeight(initKc.getEndWeight());
newKc009a.setInitAmount(initKc.getEndAmount());
newKc009a.setInitWeight(initKc.getEndWeight());
} else {
kc009.setInitAmount(kc009.getEndAmount().subtract(kc009.getPdDiffAmount())
.add(kc009.getOuterAmount()).subtract(kc009.getEnterAmount()));
kc009.setInitWeight(kc009.getEndWeight().subtract(kc009.getPdDiffWeight())
.add(kc009.getOuterWeight()).subtract(kc009.getEnterWeight()));
newKc009a.setInitAmount(newKc009a.getEndAmount().subtract(newKc009a.getPdDiffAmount())
.add(newKc009a.getOuterAmount()).subtract(newKc009a.getEnterAmount()));
newKc009a.setInitWeight(newKc009a.getEndWeight().subtract(newKc009a.getPdDiffWeight())
.add(newKc009a.getOuterWeight()).subtract(newKc009a.getEnterWeight()));
}
newKc009As.add(kc009);
newKc009As.add(newKc009a);
}
return newKc009As;
}
......@@ -265,28 +228,42 @@ public class ServiceHPKC009A extends ServiceBase {
/**
* 设置基础信息
*
* @param kc009s
* @param kc009as
*/
private void setBaseInfo(List<HPKC009A> kc009s) {
private void setBaseInfo(List<HPKC009A> kc009as) {
// 仓库名称
List<String> whCodes = kc009s.stream().map(HPKC009A::getWhCode).collect(Collectors.toList());
List<String> whCodes = kc009as.stream().map(HPKC009A::getWhCode).collect(Collectors.toList());
Map<String, HPPZ007> mapPz007 = HPPZTools.HpPz007.map(whCodes);
// 存货名称
List<String> inventCodes = kc009s.stream().map(HPKC009A::getPrdtCode).collect(Collectors.toList());
Map<String, HPPZ004> mapPz004 = HPPZTools.HpPz004.map(inventCodes);
for (HPKC009A kc009 : kc009s) {
// 项目名称
List<String> projCodes = kc009as.stream().map(HPKC009A::getProjCode).collect(Collectors.toList());
Map<String, HPSC001> sc001Map = HPSCTools.HpSc001.map(projCodes);
// 部件名称
List<String> inventCodes = kc009as.stream().map(HPKC009A::getInventCode).collect(Collectors.toList());
Map<String, HPPZ004> pz004Map = HPPZTools.HpPz004.map(inventCodes);
// 零件名称
List<String> subInventCodes = kc009as.stream().map(HPKC009A::getSubInventCode).collect(Collectors.toList());
Map<String, HPPZ004> subPz004Map = HPPZTools.HpPz004.map(subInventCodes);
for (HPKC009A kc009a : kc009as) {
// 仓库名称
String whCode = kc009.getWhCode();
String whCode = kc009a.getWhCode();
HPPZ007 pz007 = mapPz007 == null ? null : mapPz007.get(whCode);
kc009.setWhName(pz007 == null ? "" : pz007.getWhName());
// 存货名称
String inventCode = kc009.getPrdtCode();
HPPZ004 pz004 = mapPz004 == null ? null : mapPz004.get(inventCode);
kc009.setPrdtName(pz004 == null ? "" : pz004.getInventName());
kc009a.setWhName(pz007 == null ? "" : pz007.getWhName());
// 项目名称
String projCode = kc009a.getProjCode();
HPSC001 sc001 = sc001Map == null ? null : sc001Map.get(projCode);
kc009a.setProjName(sc001 == null ? "" : sc001.getProjName());
// 部件名称
String inventCode = kc009a.getInventCode();
HPPZ004 pz004 = pz004Map == null ? null : pz004Map.get(inventCode);
kc009a.setInventName(pz004 == null ? "" : pz004.getInventName());
// 零件名称
String subInventCode = kc009a.getSubInventCode();
HPPZ004 subPz004 = subPz004Map == null ? null : subPz004Map.get(subInventCode);
kc009a.setSubInventName(subPz004 == null ? "" : subPz004.getInventName());
// 创建时间
kc009.setCreatedBy(UserSession.getLoginName());
kc009.setCreatedName(UserSession.getLoginCName());
kc009.setCreatedTime(DateUtils.shortDateTime());
kc009a.setCreatedBy(UserSession.getLoginName());
kc009a.setCreatedName(UserSession.getLoginCName());
kc009a.setCreatedTime(DateUtils.shortDateTime());
}
}
......@@ -295,19 +272,19 @@ public class ServiceHPKC009A extends ServiceBase {
*
* @param companyCode
* @param depCode
* @param inventType
* @param inventCode
* @param whCode
* @param inventRecordId
* @param projCode
* @param inventCode
* @param subInventCode
* @return
*/
private String buildKey(Object companyCode, Object depCode, Object inventType, Object inventCode,
Object whCode, Object inventRecordId) {
private String buildKey(Object companyCode, Object depCode, Object whCode, Object projCode, Object inventCode,
Object subInventCode) {
return ObjectUtils.trimToEmpty(companyCode) + "#"
+ ObjectUtils.trimToEmpty(depCode) + "#"
+ ObjectUtils.trimToEmpty(inventType) + "#"
+ ObjectUtils.trimToEmpty(inventCode) + "#"
+ ObjectUtils.trimToEmpty(whCode) + "#"
+ ObjectUtils.trimToEmpty(inventRecordId);
+ ObjectUtils.trimToEmpty(projCode) + "#"
+ ObjectUtils.trimToEmpty(inventCode) + "#"
+ ObjectUtils.trimToEmpty(subInventCode);
}
}
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.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 ServiceHPKC011A extends ServiceBase {
/**
* 备份数据
*
* @param inInfo
* @return
*/
public EiInfo backup(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("dateProc", LocalDate.now().minusDays(1).format(DateUtils.SHORT_DATE));
// 清除数据
dao.delete(HPSqlConstant.HPKC011A.DELETE_BY_TIME, queryMap);
// 备份数据
dao.insert(HPSqlConstant.HPKC011A.BACKUP, queryMap);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("备份数据成功");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
}
......@@ -18,10 +18,10 @@
WH_NAME as "whName", <!-- 仓库名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRDT_CODE as "prdtCode", <!-- 产品编码 -->
PRDT_NAME as "prdtName", <!-- 产品名称 -->
PART_CODE as "partCode", <!-- 零件编码 -->
PART_NAME as "partName", <!-- 零件名称 -->
INVENT_CODE as "inventCode", <!-- 部件编码 -->
INVENT_NAME as "inventName", <!-- 部件名称 -->
SUB_INVENT_CODE as "subInventCode", <!-- 零件编码 -->
SUB_INVENT_NAME as "subInventName", <!-- 零件名称 -->
INIT_AMOUNT as "initAmount", <!-- 期初数量 -->
INIT_WEIGHT as "initWeight", <!-- 期初重量 -->
ENTER_AMOUNT as "enterAmount", <!-- 入库数量 -->
......@@ -80,17 +80,17 @@
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtCode">
PRDT_CODE = #prdtCode#
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
PRDT_NAME = #prdtName#
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partCode">
PART_CODE = #partCode#
<isNotEmpty prepend=" AND " property="subInventCode">
SUB_INVENT_CODE = #subInventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partName">
PART_NAME = #partName#
<isNotEmpty prepend=" AND " property="subInventName">
SUB_INVENT_NAME = #subInventName#
</isNotEmpty>
</sql>
......@@ -105,7 +105,7 @@
</dynamic>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.gxzl.common.mc.domain.THpkc009a">
<select id="query" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.kc.domain.HPKC009A">
SELECT
<include refid="column"/>
FROM ${hpjxSchema}.T_HPKC009A
......@@ -151,10 +151,10 @@
WH_NAME, <!-- 仓库名称 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PRDT_CODE, <!-- 产品编码 -->
PRDT_NAME, <!-- 产品名称 -->
PART_CODE, <!-- 零件编码 -->
PART_NAME, <!-- 零件名称 -->
INVENT_CODE, <!-- 部件编码 -->
INVENT_NAME, <!-- 部件名称 -->
SUB_INVENT_CODE, <!-- 零件编码 -->
SUB_INVENT_NAME, <!-- 零件名称 -->
INIT_AMOUNT, <!-- 期初数量 -->
INIT_WEIGHT, <!-- 期初重量 -->
ENTER_AMOUNT, <!-- 入库数量 -->
......@@ -168,7 +168,7 @@
) VALUES (
#companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#dateType#, #dateProc#, #whCode#, #whName#, #projCode#, #projName#,
#prdtCode#, #prdtName#, #partCode#, #partName#, #initAmount#, #initWeight#,
#inventCode#, #inventName#, #subInventCode#, #subInventName#, #initAmount#, #initWeight#,
#enterAmount#, #enterWeight#, #outerAmount#, #outerWeight#, #pdDiffAmount#,
#pdDiffWeight#, #endAmount#, #endWeight#
)
......
......@@ -191,16 +191,16 @@
<!-- 备份数据 -->
<insert id="backup">
INSERT INTO ${hpjxSchema}.T_HPKC011A (
COMPANY_CODE, DEP_CODE, DATE_PROC, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, WEIGHT,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,
UPDATED_TIME, VERSION
COMPANY_CODE, DEP_CODE, DATE_PROC, WH_CODE, WH_NAME, PROD_NO, PROJ_CODE,
PROJ_NAME, INVENT_CODE, INVENT_NAME, SUB_INVENT_CODE, SUB_INVENT_NAME, LENGTH,
WIDTH, THICK, AMOUNT, UNIT_WEIGHT, WEIGHT, REMARK, CREATED_BY, CREATED_NAME,
CREATED_TIME, UPDATED_BY, UPDATED_NAME, UPDATED_TIME, VERSION
)
SELECT
COMPANY_CODE, DEP_CODE, #dateProc#, WH_CODE, WH_NAME, INVENT_TYPE,
INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, AMOUNT, WEIGHT,
CREATED_BY, CREATED_NAME, CREATED_TIME, UPDATED_BY, UPDATED_NAME,
UPDATED_TIME, VERSION
COMPANY_CODE, DEP_CODE, #dateProc#, WH_CODE, WH_NAME, PROD_NO, PROJ_CODE,
PROJ_NAME, INVENT_CODE, INVENT_NAME, SUB_INVENT_CODE, SUB_INVENT_NAME, LENGTH,
WIDTH, THICK, AMOUNT, UNIT_WEIGHT, WEIGHT, REMARK, CREATED_BY, CREATED_NAME,
CREATED_TIME, UPDATED_BY, UPDATED_NAME, UPDATED_TIME, VERSION
FROM ${hpjxSchema}.T_HPKC011
</insert>
......
<?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">
<!-- table information
Generate time : 2024-01-10 9:33:44
Version : 1.0
tableName :hpjx.t_hpsc001
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
PROJ_TYPE TINYINT,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRINC1 VARCHAR,
PRINC2 VARCHAR,
STATUS TINYINT,
CREATED_BY VARCHAR,
CREATED_TIME DATETIME,
UPDATED_BY VARCHAR,
UPDATED_TIME DATETIME,
DEP_CODE VARCHAR
-->
<sqlMap namespace="HPSC001">
<select id="query" parameterClass="java.util.HashMap"
......@@ -66,6 +48,9 @@
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCodes">
PROJ_CODE IN <iterate close=")" open="(" conjunction="," property="projCodes">#projCodes[]#</iterate>
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isEmpty property="orderBy">
CREATED_TIME desc
......@@ -101,6 +86,9 @@
<isNotEmpty prepend=" AND " property="materialStatus">
MATERIAL_STATUS = #materialStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCodes">
PROJ_CODE IN <iterate close=")" open="(" conjunction="," property="projCodes">#projCodes[]#</iterate>
</isNotEmpty>
</select>
<!--
......
......@@ -3,7 +3,16 @@ package com.baosight.hpjx.hp.sc.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC003;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.domain.HPSC005C;
import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.domain.HPSC007;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.StringUtils;
......@@ -137,6 +146,35 @@ public class HPSCTools {
AssertUtils.isNull(results, String.format("项目编码[%s]信息不存在", projCode));
return results.get(0);
}
/**
* 查询
*
* @param projCodes
* @return
*/
public static List<HPSC001> list(List<String> projCodes) {
if (CollectionUtils.isEmpty(projCodes)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("projCodes", projCodes);
return DaoBase.getInstance().query("HPSC001.query", queryMap);
}
/**
* 查询
*
* @param projCodes
* @return
*/
public static Map<String, HPSC001> map(List<String> projCodes) {
List<HPSC001> results = list(projCodes);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPSC001::getProjCode, item -> item));
}
}
/**
......
......@@ -78,7 +78,7 @@ function tearAssign(prodOrderNo) {
/**
* 生产订单详情
*
* @param productionOrderNo
* @param prodOrderNo
*/
function tearDetails(prodOrderNo) {
JSColorbox.open({
......
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