Commit 4a86cb76 by liuyang

Merge branch 'dev' of https://gitlab.baocloud.cn/bggf/smart/hp-smart into dev

parents ad712b3c 76039d5d
......@@ -217,6 +217,20 @@ public class HPSqlConstant {
}
/**
* HPSC004 SQL名称定义
*
* @author:songx
* @date:2024/2/5,10:16
*/
public class HPSC004 {
// 锁
public static final String LOCK = "HPSC004.lock";
// 更新时间完工情况
public static final String UPDATE_COMPLETE = "HPSC004.updateComplete";
}
/**
* @author:songx
* @date:2024/2/5,10:16
*/
......
......@@ -182,9 +182,9 @@ public class ServiceHPKC001 extends ServiceBase {
// 去除日期字符串中的-
fKc001.setReceiptDate(StringUtil.removeHorizontalLine(fKc001.getReceiptDate()));
// 仓库名称
fKc001.setWhName(HPPZTools.getPz007ByCode(fKc001.getWhCode()).getWhName());
fKc001.setWhName(HPPZTools.HpPz007.getByCode(fKc001.getWhCode()).getWhName());
// 存货名称
fKc001.setInventName(HPPZTools.getPz004ByCode(fKc001.getInventCode()).getInventName());
fKc001.setInventName(HPPZTools.HpPz004.getByCode(fKc001.getInventCode()).getInventName());
}
/**
......
......@@ -85,8 +85,11 @@ public class ServiceHPKC003 extends ServiceBase {
try {
List<Map> resultRows = eiInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> prodNos = ObjectUtils.listKey(resultRows, "prodNo");
// 锁
List<String> prodOrderNos = ObjectUtils.listKey(resultRows, "prodOrderNo");
// 锁库存
HPKCTools.HpKc003.lock(prodNos);
// 锁生产计划明细
HPSCTools.HpSc004.lock(prodOrderNos);
// 查询数据
Map<String, HPKC003> dbKc003Map = HPKCTools.HpKc003.map(prodNos);
for (Map resultRow : resultRows) {
......@@ -103,7 +106,7 @@ public class ServiceHPKC003 extends ServiceBase {
newKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
DaoUtils.insert(HPKC003.INSERT, newKc003);
// 同步生产计划
DaoUtils.update("HPSC004.update", this.synchronousPlan(newKc003));
HPSCTools.syncPlan(newKc003.getProdOrderNo(), newKc003.getAmount());
// 更新生产任务已完成数量
HPSCTools.HpSc005a.updateCompleteNum(newKc003.getProdTaskNo(), newKc003.getAmount());
// 修改库存
......@@ -118,27 +121,4 @@ public class ServiceHPKC003 extends ServiceBase {
return eiInfo;
}
/**
* 新增入库及删除入库单做同步计划订单
* @param hpkc003
*/
public HPSC004 synchronousPlan(HPKC003 hpkc003) {
HPSC004 hpsc004 = (HPSC004) this.dao.get("HPSC004.queryDetail", "productionOrderNo", hpkc003.getProdOrderNo());
AssertUtils.isNull(hpsc004, String.format("生产订单[%s]对应的任务计划不存在", hpkc003.getProdOrderNo()));
BigDecimal actualCompletionNum = hpkc003.getAmount().add(hpsc004.getActualCompletionNum());
BigDecimal actualCompletionUnitWt = hpkc003.getWeight().add(hpsc004.getActualCompletionUnitWt());
hpsc004.setActualCompletionNum(actualCompletionNum);
hpsc004.setActualCompletionUnitWt(actualCompletionUnitWt);
//计算是否生产完成
if (hpsc004.getNum().compareTo(actualCompletionNum) < 0
&& hpsc004.getUnitWt().compareTo(actualCompletionUnitWt) < 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
hpsc004.setActualCompletionDate(DateUtils.toDateStr(new Date(),DateUtils.DEFAULT_DATETIME_PATTERN));
} else {
hpsc004.setActualCompletionDate("");
}
return hpsc004;
}
}
......@@ -88,11 +88,13 @@ public class ServiceHPKC003A extends ServiceEPBase {
List<String> prodOrderNos = ObjectUtils.listKey(resultRows, "prodOrderNo");
// 任务号
List<String> prodTaskNos = ObjectUtils.listKey(resultRows, "prodTaskNo");
// 锁订单
// 锁生产计划
HPSCTools.HpSc004.lock(prodOrderNos);
// 锁生产订单
HPSCTools.HpSc005.lock(prodOrderNos);
// 锁任务
// 锁生产任务
HPSCTools.HpSc005a.lock(prodTaskNos);
// 查询任务信息
// 查询生产任务信息
Map<String, HPSC005B> dbSc005bMap = HPSCTools.HpSc005b.map(prodTaskNos);
// 数据校验
for (Map row : resultRows) {
......@@ -100,8 +102,7 @@ public class ServiceHPKC003A extends ServiceEPBase {
BigDecimal applyNum = MapUtils.getBigDecimal(row, "applyNum");
HPSC005B fSc005b = new HPSC005B();
fSc005b.fromMap(row);
AssertUtils.isEmpty(whCode, String.format("任务号[%s]的仓库不存在为空",
fSc005b.getProdTaskNo()));
AssertUtils.isEmpty(whCode, String.format("任务号[%s]的仓库不存在为空", fSc005b.getProdTaskNo()));
HPSC005B dbSc005b = dbSc005bMap.get(fSc005b.getProdTaskNo());
AssertUtils.isTrue(ProdOrderStatusEnum.NOT_ASSIGN.getCode().equals(dbSc005b.getStatus()),
String.format("生产任务ID[%s]状态不是已分派,不允许操作", fSc005b.getId()));
......@@ -127,11 +128,13 @@ public class ServiceHPKC003A extends ServiceEPBase {
newKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
newKc003.setDocumentDate(DateUtils.shortDate());
newKc003.setWhCode(whCode);
newKc003.setWhName(HPPZTools.getPz007ByCode(whCode).getWhName());
newKc003.setWhName(HPPZTools.HpPz007.getByCode(whCode).getWhName());
newKc003.setAmount(applyNum);
newKc003.setWeight(applyNum.multiply(dbSc005b.getUnitWt()));
newKc003.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC003.INSERT, newKc003);
// 同步生产计划
HPSCTools.syncPlan(newKc003.getProdOrderNo(), newKc003.getAmount());
// 更新生产任务已完成数量
HPSCTools.HpSc005a.updateCompleteNum(fSc005b.getProdTaskNo(), applyNum);
// 修改库存
......
......@@ -141,9 +141,9 @@ public class ServiceHPKC005 extends ServiceBase {
// 去除日期字符串中的-
fKc005.setReceiptDate(StringUtil.removeHorizontalLine(fKc005.getReceiptDate()));
// 仓库名称
fKc005.setWhName(HPPZTools.getPz007ByCode(fKc005.getWhCode()).getWhName());
fKc005.setWhName(HPPZTools.HpPz007.getByCode(fKc005.getWhCode()).getWhName());
// 存货名称
fKc005.setInventName(HPPZTools.getPz004ByCode(fKc005.getInventCode()).getInventName());
fKc005.setInventName(HPPZTools.HpPz004.getByCode(fKc005.getInventCode()).getInventName());
// 差异数量
fKc005.setDiffAmount(fKc005.getEntityAmount().subtract(fKc005.getBookAmount()));
// 差异重量
......
......@@ -198,7 +198,7 @@ public class ServiceHPKC006 extends ServiceBase {
// 去除日期字符串中的-
fKc006.setReceiptDate(StringUtil.removeHorizontalLine(fKc006.getReceiptDate()));
// 仓库名称
fKc006.setWhName(HPPZTools.getPz007ByCode(fKc006.getWhCode()).getWhName());
fKc006.setWhName(HPPZTools.HpPz007.getByCode(fKc006.getWhCode()).getWhName());
// 存货名称
//fKc006.setInventName(HPPZTools.getPz004ByCode(fKc006.getInventCode()).getInventName());
}
......
......@@ -183,9 +183,9 @@ public class ServiceHPKC007 extends ServiceBase {
// 去除日期字符串中的-
fKc007.setReceiptDate(StringUtil.removeHorizontalLine(fKc007.getReceiptDate()));
// 仓库名称
fKc007.setWhName(HPPZTools.getPz007ByCode(fKc007.getWhCode()).getWhName());
fKc007.setWhName(HPPZTools.HpPz007.getByCode(fKc007.getWhCode()).getWhName());
// 存货名称
fKc007.setInventName(HPPZTools.getPz004ByCode(fKc007.getInventCode()).getInventName());
fKc007.setInventName(HPPZTools.HpPz004.getByCode(fKc007.getInventCode()).getInventName());
}
/**
......
......@@ -89,7 +89,7 @@ public class ServiceHPKC008 extends ServiceBase {
// 去除日期字符串中的-
fKc008.setDateMonth(StringUtil.removeHorizontalLine(fKc008.getDateMonth()));
// 存货名称
fKc008.setInventName(HPPZTools.getPz004ByCode(fKc008.getInventCode()).getInventName());
fKc008.setInventName(HPPZTools.HpPz004.getByCode(fKc008.getInventCode()).getInventName());
// 计算总金额
fKc008.setTotalPrice(fKc008.getAmount().multiply(fKc008.getPrice()));
// 生成单据号
......@@ -120,7 +120,7 @@ public class ServiceHPKC008 extends ServiceBase {
// 去除日期字符串中的-
fKc008.setDateMonth(StringUtil.removeHorizontalLine(fKc008.getDateMonth()));
// 存货名称
fKc008.setInventName(HPPZTools.getPz004ByCode(fKc008.getInventCode()).getInventName());
fKc008.setInventName(HPPZTools.HpPz004.getByCode(fKc008.getInventCode()).getInventName());
// 计算总金额
fKc008.setTotalPrice(fKc008.getAmount().multiply(fKc008.getPrice()));
DaoUtils.update(HPKC008.UPDATE, fKc008);
......
......@@ -285,10 +285,10 @@ public class ServiceHPKC009 extends ServiceBase {
private void setBaseInfo(List<HPKC009> kc009s) {
// 仓库名称
List<String> whCodes = kc009s.stream().map(HPKC009::getWhCode).collect(Collectors.toList());
Map<String, HPPZ007> mapPz007 = HPPZTools.mapPz007(whCodes);
Map<String, HPPZ007> mapPz007 = HPPZTools.HpPz007.map(whCodes);
// 存货名称
List<String> inventCodes = kc009s.stream().map(HPKC009::getInventCode).collect(Collectors.toList());
Map<String, HPPZ004> mapPz004 = HPPZTools.mapPz004(inventCodes);
Map<String, HPPZ004> mapPz004 = HPPZTools.HpPz004.map(inventCodes);
for (HPKC009 kc009 : kc009s) {
// 仓库名称
String whCode = kc009.getWhCode();
......
......@@ -77,7 +77,7 @@ public class ServiceHPPZ006 extends ServiceBase {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
// 存货名称
fPz006.setInventName(HPPZTools.getPz004ByCode(fPz006.getInventCode()).getInventName());
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.jointSpec(fPz006.getLength(),fPz006.getWidth(),fPz006.getThick()));
DaoUtils.insert(HPPZ006.INSERT, fPz006);
}
......@@ -126,7 +126,7 @@ public class ServiceHPPZ006 extends ServiceBase {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
// 存货名称
fPz006.setInventName(HPPZTools.getPz004ByCode(fPz006.getInventCode()).getInventName());
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.jointSpec(fPz006.getLength(),fPz006.getWidth(),fPz006.getThick()));
DaoUtils.update(HPPZ006.UPDATE, fPz006);
}
......
......@@ -116,7 +116,7 @@ public class ServiceHPPZ011 extends ServiceBase {
*/
private void add(HPPZ011 fPz011) {
// 校验厂区名是否存在
HPPZ011 dbPz011 = HPPZTools.getPz011ByName(fPz011.getFactoryName());
HPPZ011 dbPz011 = HPPZTools.HpPz011.getByName(fPz011.getFactoryName());
if (dbPz011 != null) {
fPz011.setFactoryCode(dbPz011.getFactoryCode());
} else {
......
......@@ -142,7 +142,9 @@
FACTORY_NAME as "factoryName" <!-- 厂区名称 -->
FROM ${hpjxSchema}.T_HPPZ011
WHERE DELETE_FLAG = 0
<include refid="condition"/>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
ORDER BY FACTORY_CODE ASC
</select>
......@@ -175,7 +177,7 @@
<isNotEmpty prepend=" AND " property="factoryCode">
A.FACTORY_CODE = #factoryCode#
</isNotEmpty>
ORDER BY FACTORY_CODE ASC
ORDER BY A.FACTORY_CODE ASC
</select>
</sqlMap>
......@@ -53,138 +53,167 @@ public class HPPZTools {
AssertUtils.isEmpty(results, String.format("厂区生产组ID[%s]不存在", id));
return results.get(0);
}
}
/**
* 查询存货
*
* @param inventCode
* @return
*/
public static HPPZ004 getPz004ByCode(String inventCode) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
Map queryMap = new HashMap();
queryMap.put("inventCode", inventCode);
List<HPPZ004> pz004s = DaoBase.getInstance().query("HPPZ004.query", queryMap);
AssertUtils.isNull(pz004s, String.format("存货编码[%s]不存在", inventCode));
return pz004s.get(0);
}
/**
* 查询仓库
*
* @param whCode
* @return
*/
public static HPPZ007 getPz007ByCode(String whCode) {
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
Map queryMap = new HashMap();
queryMap.put("whCode", whCode);
List<HPPZ007> pz007s = DaoBase.getInstance().query("HPPZ007.queryByWhCode", queryMap);
AssertUtils.isNull(pz007s, String.format("仓库编码[%s]不存在", whCode));
return pz007s.get(0);
}
/**
* 查询存货信息
*
* @param inventCodes
* @return
*/
public static List<HPPZ004> listPz004(List<String> inventCodes) {
if (CollectionUtils.isEmpty(inventCodes)) {
return null;
/**
* 查询厂区信息
*
* @param factoryName
* @return
*/
public static HPPZ011 getByName(String factoryName) {
AssertUtils.isEmpty(factoryName, "厂区名称不能为空");
Map queryMap = new HashMap();
queryMap.put("factoryName", factoryName);
List<HPPZ011> dbPz011s = DaoBase.getInstance().query(HPSqlConstant.HPPZ011.GET, queryMap);
return CollectionUtils.isEmpty(dbPz011s) ? null : dbPz011s.get(0);
}
Map queryMap = new HashMap();
queryMap.put("inventCodes", inventCodes);
return DaoBase.getInstance().query(HPPZ004.QUERY, queryMap);
}
/**
* 查询存货信息
* HPPZ004 公共DAO定义
*
* @param inventCodes
* @return
* @author:songx
* @date:2024/2/6,13:37
*/
public static Map<String, HPPZ004> mapPz004(List<String> inventCodes) {
List<HPPZ004> pz004s = listPz004(inventCodes);
if (CollectionUtils.isEmpty(pz004s)) {
return null;
public static class HpPz004 {
/**
* 查询存货
*
* @param inventCode
* @return
*/
public static HPPZ004 getByCode(String inventCode) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
Map queryMap = new HashMap();
queryMap.put("inventCode", inventCode);
List<HPPZ004> pz004s = DaoBase.getInstance().query(HPPZ004.QUERY, queryMap);
AssertUtils.isNull(pz004s, String.format("存货编码[%s]不存在", inventCode));
return pz004s.get(0);
}
return pz004s.stream().collect(Collectors.toMap(HPPZ004::getInventCode, item -> item));
}
/**
* 查询仓库信息
*
* @param whCodes
* @return
*/
public static List<HPPZ007> listPz007(List<String> whCodes) {
if (CollectionUtils.isEmpty(whCodes)) {
return null;
/**
* 查询存货信息
*
* @param inventCodes
* @return
*/
public static List<HPPZ004> list(List<String> inventCodes) {
if (CollectionUtils.isEmpty(inventCodes)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("inventCodes", inventCodes);
return DaoBase.getInstance().query(HPPZ004.QUERY, queryMap);
}
Map queryMap = new HashMap();
queryMap.put("whCodes", whCodes);
return DaoBase.getInstance().query("HPPZ007.query", queryMap);
}
/**
* 查询仓库信息
*
* @param whCodes
* @return
*/
public static Map<String, HPPZ007> mapPz007(List<String> whCodes) {
List<HPPZ007> pz007s = listPz007(whCodes);
if (CollectionUtils.isEmpty(pz007s)) {
return null;
/**
* 查询存货信息
*
* @param inventCodes
* @return
*/
public static Map<String, HPPZ004> map(List<String> inventCodes) {
List<HPPZ004> pz004s = list(inventCodes);
if (CollectionUtils.isEmpty(pz004s)) {
return null;
}
return pz004s.stream().collect(Collectors.toMap(HPPZ004::getInventCode, item -> item));
}
return pz007s.stream().collect(Collectors.toMap(HPPZ007::getWhCode, item -> item));
}
/**
* 查询企业信息
* HPPZ007 公共DAO定义
*
* @param companyCode
* @return
*/
public static HPPZ009 getPz009(String companyCode) {
AssertUtils.isEmpty(companyCode, "企业编码不能为空");
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
List<HPPZ009> pz009s = DaoBase.getInstance().query("HPPZ009.query", queryMap);
return CollectionUtils.isEmpty(pz009s) ? null : pz009s.get(0);
}
/**
* 查询厂区信息
*
* @param factoryName
* @return
* @author:songx
* @date:2024/2/6,13:37
*/
public static HPPZ011 getPz011ByName(String factoryName) {
AssertUtils.isEmpty(factoryName, "厂区名称不能为空");
Map queryMap = new HashMap();
queryMap.put("factoryName", factoryName);
List<HPPZ011> dbPz011s = DaoBase.getInstance().query(HPSqlConstant.HPPZ011.GET, queryMap);
return CollectionUtils.isEmpty(dbPz011s) ? null : dbPz011s.get(0);
public static class HpPz007 {
/**
* 查询仓库
*
* @param whCode
* @return
*/
public static HPPZ007 getByCode(String whCode) {
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
Map queryMap = new HashMap();
queryMap.put("whCode", whCode);
List<HPPZ007> pz007s = DaoBase.getInstance().query(HPPZ007.QUERY, queryMap);
AssertUtils.isNull(pz007s, String.format("仓库编码[%s]不存在", whCode));
return pz007s.get(0);
}
/**
* 查询仓库信息
*
* @param whCodes
* @return
*/
public static List<HPPZ007> list(List<String> whCodes) {
if (CollectionUtils.isEmpty(whCodes)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("whCodes", whCodes);
return DaoBase.getInstance().query("HPPZ007.query", queryMap);
}
/**
* 查询仓库信息
*
* @param whCodes
* @return
*/
public static Map<String, HPPZ007> map(List<String> whCodes) {
List<HPPZ007> pz007s = list(whCodes);
if (CollectionUtils.isEmpty(pz007s)) {
return null;
}
return pz007s.stream().collect(Collectors.toMap(HPPZ007::getWhCode, item -> item));
}
}
/**
* 企业是否启用
* HPPZ009 公共DAO定义
*
* @param companyCode
* @return
* @author:songx
* @date:2024/2/6,13:37
*/
public static boolean isValid(String companyCode) {
HPPZ009 pz009 = getPz009(companyCode);
if (pz009 == null) {
return false;
public static class HpPz009 {
/**
* 查询企业信息
*
* @param companyCode
* @return
*/
public static HPPZ009 getByCode(String companyCode) {
AssertUtils.isEmpty(companyCode, "企业编码不能为空");
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
List<HPPZ009> pz009s = DaoBase.getInstance().query("HPPZ009.query", queryMap);
return CollectionUtils.isEmpty(pz009s) ? null : pz009s.get(0);
}
/**
* 企业是否启用
*
* @param companyCode
* @return
*/
public static boolean isValid(String companyCode) {
HPPZ009 pz009 = getByCode(companyCode);
if (pz009 == null) {
return false;
}
return CommonConstant.YesNo.YES_1.equals(pz009.getValidFlag());
}
return CommonConstant.YesNo.YES_1.equals(pz009.getValidFlag());
}
/**
* 拼接规格
* @param length
......
......@@ -132,7 +132,7 @@ public class ServiceHPSC002 extends ServiceBase {
hppz002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
hppz002.setTotalWt(totalWt);
if (StringUtils.isNotEmpty(hppz002.getPrdtCode()) && !hppz002.getParentId().equals("root")) {
hppz002.setPrdtName(HPPZTools.getPz004ByCode(hppz002.getPrdtCode()).getInventName());
hppz002.setPrdtName(HPPZTools.HpPz004.getByCode(hppz002.getPrdtCode()).getInventName());
}
DaoUtils.update("HPSC002.update", hppz002.toMap());
}
......
<?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
Generate time : 2024-01-17 10:33:49
Version : 1.0
schema : hpjx
tableName : T_HPSC003
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
PROJ_TYPE TINYINT,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PLAN_INFO_NO VARCHAR,
PRDT_CODE VARCHAR,
PRDT_NAME VARCHAR,
PLAN_COMPLETION_DATE VARCHAR,
STATUS TINYINT,
CREATED_BY VARCHAR,
CREATED_TIME DATETIME,
UPDATED_BY VARCHAR,
UPDATED_TIME DATETIME,
DEP_CODE VARCHAR,
REMARK VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC003">
<sql id="condition">
......@@ -132,54 +111,6 @@
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projType">
PROJ_TYPE = #projType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planInfoNo">
PLAN_INFO_NO = #planInfoNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtCode">
PRDT_CODE = #prdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
PRDT_NAME LIKE ('%$prdtName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planCompletionDate">
PLAN_COMPLETION_DATE = #planCompletionDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO hpjx.T_HPSC003 (ID,
COMPANY_CODE, <!-- 企业编码 预留 -->
......
......@@ -110,6 +110,13 @@
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#, <!-- 修改人 -->
UPDATED_NAME = #updatedName#, <!-- 修改人名称 -->
UPDATED_TIME = #updatedTime# <!-- 修改时间 -->
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC004">
SELECT
......@@ -170,108 +177,6 @@
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deptCode">
DEPT_CODE = #deptCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentPrdtName">
PARENT_PRDT_NAME = #parentPrdtName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="type">
TYPE = #type#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="leaf">
LEAF = #leaf#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="sort">
SORT = #sort#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="icon">
ICON = #icon#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtCode">
PRDT_CODE = #prdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
PRDT_NAME = #prdtName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="num">
NUM = #num#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="unitWt">
UNIT_WT = #unitWt#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWt">
TOTAL_WT = #totalWt#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath1">
FILE_PATH1 = #filePath1#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath2">
FILE_PATH2 = #filePath2#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath3">
FILE_PATH3 = #filePath3#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath4">
FILE_PATH4 = #filePath4#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="filePath5">
FILE_PATH5 = #filePath5#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planCommentDate">
PLAN_COMMENT_DATE = #planCommentDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planCompletionDate">
PLAN_COMPLETION_DATE = #planCompletionDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="actualCompletionDate">
ACTUAL_COMPLETION_DATE = #actualCompletionDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="actualCompletionNum">
ACTUAL_COMPLETION_NUM = #actualCompletionNum#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="actualCompletionUnitWt">
ACTUAL_COMPLETION_UNIT_WT = #actualCompletionUnitWt#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="delStatus">
DEL_STATUS = #delStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO hpjx.T_HPSC004 (ID,
COMPANY_CODE, <!-- 企业编码 预留 -->
......@@ -382,6 +287,17 @@
ID = #id#
</update>
<!-- 更新完成数量、重量、时间 -->
<update id="updateComplete">
UPDATE hpjx.T_HPSC004
SET
ACTUAL_COMPLETION_DATE = #actualCompletionDate#, <!-- 实际完工日期 -->
ACTUAL_COMPLETION_NUM = #actualCompletionNum#, <!-- 实际完工数量 -->
ACTUAL_COMPLETION_UNIT_WT = #actualCompletionUnitWt#, <!-- 实际完工重量 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<select id="queryDetail" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC004">
SELECT
......@@ -447,6 +363,19 @@
ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hpjxSchema}.T_HPSC004
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty prepend=" AND " property="prodOrderNo">
PRODUCTION_ORDER_NO = #prodOrderNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodOrderNos">
PRODUCTION_ORDER_NO IN <iterate close=")" open="(" conjunction="," property="prodOrderNos">#prodOrderNos[]#</iterate>
</isNotEmpty>
</update>
<!-- 零部件下拉框 -->
<select id="queryInventComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT
......
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.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
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.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -62,7 +68,33 @@ public class HPSCTools {
} else {
updateMap.put("status", 0);
}
DaoBase.getInstance().update(HPSqlConstant.HPSC005.UPDATE_ASSIGN_NUM, updateMap);
DaoUtils.update(HPSqlConstant.HPSC005.UPDATE_ASSIGN_NUM, updateMap);
}
/**
* 新增入库及删除入库单做同步计划订单
*
* @param prodOrderNo
* @param num
*/
public static void syncPlan(String prodOrderNo, BigDecimal num) {
HPSC004 dbSc004 = HPSCTools.HpSc004.get(prodOrderNo);
AssertUtils.isNull(dbSc004, String.format("生产订单计划[%s]不存在", prodOrderNo));
BigDecimal completionNum = num.add(dbSc004.getActualCompletionNum());
AssertUtils.isGt(BigDecimal.ZERO, completionNum, "更新后的生产计划完成数量小于0,请检查");
BigDecimal completionUnitWt = completionNum.multiply(dbSc004.getUnitWt());
// 计算重量
HPSC004 newSc004 = new HPSC004();
newSc004.setId(dbSc004.getId());
newSc004.setActualCompletionNum(completionNum);
newSc004.setActualCompletionUnitWt(completionUnitWt);
// 计算是否生产完成
if (dbSc004.getNum().compareTo(completionNum) == 0) {
newSc004.setActualCompletionDate(DateUtils.shortDateTime());
} else {
newSc004.setActualCompletionDate("");
}
DaoUtils.update(HPSqlConstant.HPSC004.UPDATE_COMPLETE, newSc004);
}
/**
......@@ -113,6 +145,59 @@ public class HPSCTools {
}
}
/**
* HPSC005公共DAO定义
*
* @author:songx
* @date:2024/2/4,10:17
*/
public static class HpSc004 {
/**
* 锁
*
* @param prodOrderNo
* @return
*/
public static void lock(String prodOrderNo) {
if (StringUtils.isBlank(prodOrderNo)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("prodOrderNo", prodOrderNo);
DaoBase.getInstance().update(HPSqlConstant.HPSC004.LOCK, queryMap);
}
/**
* 锁
*
* @param prodOrderNos
* @return
*/
public static void lock(List<String> prodOrderNos) {
if (CollectionUtils.isEmpty(prodOrderNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("prodOrderNos", prodOrderNos);
DaoBase.getInstance().update(HPSqlConstant.HPSC004.LOCK, queryMap);
}
/**
* 查询
*
* @param prodOrderNo
* @return
*/
public static HPSC004 get(String prodOrderNo) {
AssertUtils.isNull(prodOrderNo, "生产订单号不能为空");
Map queryMap = new HashMap();
queryMap.put("productionOrderNo", prodOrderNo);
List<HPSC004> results = DaoBase.getInstance().query(HPSC004.QUERY, queryMap);
AssertUtils.isNull(results, String.format("生产订单号[%s]信息不存在", prodOrderNo));
return results.get(0);
}
}
/**
* HPSC005公共DAO定义
......@@ -162,7 +247,7 @@ public class HPSCTools {
AssertUtils.isNull(id, "生产任务ID不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPSC005> results = DaoBase.getInstance().query("HPSC005.query", queryMap);
List<HPSC005> results = DaoBase.getInstance().query(HPSC005.QUERY, queryMap);
AssertUtils.isNull(results, String.format("生产任务ID[%s]信息不存在", id));
return results.get(0);
}
......
......@@ -128,7 +128,7 @@ public class SecurityUserStandardImpl extends ServiceEPBase implements ISecurity
} else if (!"-1".equals(userMap.get("isLocked")) && !"-1".equals(userMap.get("status"))) {
// 登录校验增加企业是否启用 modify by songx at 2024-01-16
String dbCompanyCode = (String) userMap.get("companyCode");
if (StringUtils.isBlank(dbCompanyCode) || HPPZTools.isValid(dbCompanyCode)) {
if (StringUtils.isBlank(dbCompanyCode) || HPPZTools.HpPz009.isValid(dbCompanyCode)) {
String pwdExpireDateString = (String) userMap.get("pwdExpireDate");
String accountExpireDateString = (String) userMap.get("accountExpireDate");
String nowDateString = DateUtils.curDateStr8();
......
......@@ -26,6 +26,7 @@
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="生产订单ID" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="childId" cname="生产任务ID" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partName" cname="零部件名称" enable="false" width="120" align="center"/>
......@@ -41,11 +42,10 @@
<EF:EFColumn ename="factoryName" cname="厂区名称" enable="false" width="150" align="center"/>
<EF:EFColumn ename="orgName" cname="生产组名称" enable="false" width="150" align="center"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partCode" cname="零部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="150"/>
<EF:EFColumn ename="orgNo" cname="生产组编码" enable="false" width="150"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="150" hidden="true"/>
<EF:EFColumn ename="orgNo" cname="生产组编码" enable="false" width="150" hidden="true"/>
<EF:EFColumn ename="prodTaskNo" cname="生产任务号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>
</EF:EFGrid>
......
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