Commit 9a80e53c by yukang

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

parents 3e187ec5 22269ad8
......@@ -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();
......
......@@ -15,7 +15,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-01-22 14:36:36 create
* @history 2024-02-06 15:01:45 create
*/
public class HPPZ004 extends DaoEPBase {
......@@ -34,6 +34,7 @@ public class HPPZ004 extends DaoEPBase {
public static final String FIELD_UPDATED_BY = "updatedBy"; /* 更新人*/
public static final String FIELD_UPDATED_NAME = "updatedName"; /* 更新人名称*/
public static final String FIELD_UPDATED_TIME = "updatedTime"; /* 更新时间*/
public static final String FIELD_DELETE_FLAG = "deleteFlag"; /* 是否删除0.否1.是*/
public static final String COL_ID = "ID";
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
......@@ -48,6 +49,7 @@ public class HPPZ004 extends DaoEPBase {
public static final String COL_UPDATED_BY = "UPDATED_BY"; /* 更新人*/
public static final String COL_UPDATED_NAME = "UPDATED_NAME"; /* 更新人名称*/
public static final String COL_UPDATED_TIME = "UPDATED_TIME"; /* 更新时间*/
public static final String COL_DELETE_FLAG = "DELETE_FLAG"; /* 是否删除0.否1.是*/
public static final String QUERY = "HPPZ004.query";
public static final String COUNT = "HPPZ004.count";
......@@ -55,19 +57,20 @@ public class HPPZ004 extends DaoEPBase {
public static final String UPDATE = "HPPZ004.update";
public static final String DELETE = "HPPZ004.delete";
private Long id = null;
private Long id;
private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码*/
private Integer inventType = null; /* 存货类型*/
private Integer inventType; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Integer status = 1; /* 状态 0未启用 1启用*/
private Integer status; /* 状态 0未启用 1启用*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 更新人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag; /* 是否删除0.否1.是*/
/**
* initialize the metadata.
......@@ -128,6 +131,10 @@ public class HPPZ004 extends DaoEPBase {
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DELETE_FLAG);
eiColumn.setDescName("是否删除0.否1.是");
eiMetadata.addMeta(eiColumn);
}
......@@ -347,6 +354,22 @@ public class HPPZ004 extends DaoEPBase {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 是否删除0.否1.是.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 是否删除0.否1.是.
*
* @param deleteFlag - 是否删除0.否1.是
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the value from Map.
*
* @param map - source data map
......@@ -367,6 +390,7 @@ public class HPPZ004 extends DaoEPBase {
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_BY)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_NAME)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UPDATED_TIME)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DELETE_FLAG)), deleteFlag));
}
/**
......@@ -389,6 +413,7 @@ public class HPPZ004 extends DaoEPBase {
map.put(FIELD_UPDATED_BY, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_UPDATED_BY)));
map.put(FIELD_UPDATED_NAME, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_UPDATED_NAME)));
map.put(FIELD_UPDATED_TIME, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_UPDATED_TIME)));
map.put(FIELD_DELETE_FLAG, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_DELETE_FLAG)));
return map;
}
......
......@@ -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 {
......
......@@ -15,7 +15,8 @@
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime" <!-- 更新时间 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag" <!-- 更新时间 -->
</sql>
<sql id="condition">
......@@ -54,10 +55,10 @@
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
<isNotEmpty property="order">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
<isEmpty property="order">
ID DESC
</isEmpty>
</dynamic>
......
......@@ -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,36 +53,43 @@ public class HPPZTools {
AssertUtils.isEmpty(results, String.format("厂区生产组ID[%s]不存在", id));
return results.get(0);
}
}
/**
* 查询存货
* 查询厂区信息
*
* @param inventCode
* @param factoryName
* @return
*/
public static HPPZ004 getPz004ByCode(String inventCode) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
public static HPPZ011 getByName(String factoryName) {
AssertUtils.isEmpty(factoryName, "厂区名称不能为空");
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);
queryMap.put("factoryName", factoryName);
List<HPPZ011> dbPz011s = DaoBase.getInstance().query(HPSqlConstant.HPPZ011.GET, queryMap);
return CollectionUtils.isEmpty(dbPz011s) ? null : dbPz011s.get(0);
}
}
/**
* 查询仓库
* HPPZ004 公共DAO定义
*
* @param whCode
* @author:songx
* @date:2024/2/6,13:37
*/
public static class HpPz004 {
/**
* 查询存货
*
* @param inventCode
* @return
*/
public static HPPZ007 getPz007ByCode(String whCode) {
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
public static HPPZ004 getByCode(String inventCode) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
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);
queryMap.put("inventCode", inventCode);
List<HPPZ004> pz004s = DaoBase.getInstance().query(HPPZ004.QUERY, queryMap);
AssertUtils.isNull(pz004s, String.format("存货编码[%s]不存在", inventCode));
return pz004s.get(0);
}
/**
......@@ -91,7 +98,7 @@ public class HPPZTools {
* @param inventCodes
* @return
*/
public static List<HPPZ004> listPz004(List<String> inventCodes) {
public static List<HPPZ004> list(List<String> inventCodes) {
if (CollectionUtils.isEmpty(inventCodes)) {
return null;
}
......@@ -106,13 +113,37 @@ public class HPPZTools {
* @param inventCodes
* @return
*/
public static Map<String, HPPZ004> mapPz004(List<String> inventCodes) {
List<HPPZ004> pz004s = listPz004(inventCodes);
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));
}
}
/**
* HPPZ007 公共DAO定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
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);
}
/**
* 查询仓库信息
......@@ -120,7 +151,7 @@ public class HPPZTools {
* @param whCodes
* @return
*/
public static List<HPPZ007> listPz007(List<String> whCodes) {
public static List<HPPZ007> list(List<String> whCodes) {
if (CollectionUtils.isEmpty(whCodes)) {
return null;
}
......@@ -135,21 +166,31 @@ public class HPPZTools {
* @param whCodes
* @return
*/
public static Map<String, HPPZ007> mapPz007(List<String> whCodes) {
List<HPPZ007> pz007s = listPz007(whCodes);
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定义
*
* @author:songx
* @date:2024/2/6,13:37
*/
public static class HpPz009 {
/**
* 查询企业信息
*
* @param companyCode
* @return
*/
public static HPPZ009 getPz009(String companyCode) {
public static HPPZ009 getByCode(String companyCode) {
AssertUtils.isEmpty(companyCode, "企业编码不能为空");
Map queryMap = new HashMap();
queryMap.put("companyCode", companyCode);
......@@ -158,33 +199,21 @@ public class HPPZTools {
}
/**
* 查询厂区信息
*
* @param factoryName
* @return
*/
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);
}
/**
* 企业是否启用
*
* @param companyCode
* @return
*/
public static boolean isValid(String companyCode) {
HPPZ009 pz009 = getPz009(companyCode);
HPPZ009 pz009 = getByCode(companyCode);
if (pz009 == null) {
return false;
}
return CommonConstant.YesNo.YES_1.equals(pz009.getValidFlag());
}
}
/**
* 拼接规格
* @param length
......
......@@ -87,6 +87,7 @@ public class HPSC003 extends DaoEPBase {
private String updatedTime ; /* 更新时间*/
private String depCode = " "; /* 部门编码*/
private String remark = " "; /* 备注*/
private Long matId = null; /* 物料ID*/
private String schedule = "";
......@@ -207,6 +208,10 @@ public class HPSC003 extends DaoEPBase {
eiColumn.setDescName("厚");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("matId");
eiColumn.setDescName("物料ID");
eiMetadata.addMeta(eiColumn);
}
......@@ -317,7 +322,7 @@ public class HPSC003 extends DaoEPBase {
/**
* set the prdtCode - 部件编码.
*
* @param prdtCode - 部件编码
* @param prdtType - 部件编码
*/
public void setPrdtType(Integer prdtType) {
this.prdtType = prdtType;
......@@ -561,6 +566,15 @@ public class HPSC003 extends DaoEPBase {
public void setThick(BigDecimal thick) {
this.thick = thick;
}
public Long getMatId() {
return matId;
}
public void setMatId(Long matId) {
this.matId = matId;
}
/**
* get the value from Map.
*
......@@ -592,6 +606,7 @@ public class HPSC003 extends DaoEPBase {
setLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get("length")), length));
setWidth(NumberUtils.toBigDecimal(StringUtils.toString(map.get("width")), width));
setThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get("thick")), thick));
setMatId(NumberUtils.toLong(StringUtils.toString(map.get("matId")), matId));
}
......@@ -625,6 +640,7 @@ public class HPSC003 extends DaoEPBase {
map.put("length", StringUtils.toString(length, eiMetadata.getMeta("length")));
map.put("width", StringUtils.toString(width, eiMetadata.getMeta("width")));
map.put("thick", StringUtils.toString(thick, eiMetadata.getMeta("thick")));
map.put("matId", StringUtils.toString(matId, eiMetadata.getMeta("matId")));
return map;
}
......
......@@ -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());
}
......@@ -377,6 +377,7 @@ public class ServiceHPSC002 extends ServiceBase {
HPSC003.setRemark(THPSC002.getRemark());
HPSC003.setPlanCompletionDate("");
HPSC003.setStatus(0);
HPSC003.setMatId(THPSC002.getId());
DaoUtils.insert("HPSC003.insert", HPSC003.toMap());
//生产计划详情
......
......@@ -127,6 +127,26 @@ public class ServiceHPSC003 extends ServiceBase {
Map<?, ?> map = eiBlock.getRow(i);
HPSC004.fromMap(map);
DaoUtils.update("HPSC004.updateHPSC0004", HPSC004.toMap());
List list = this.dao.query("HPSC004.query", new HashMap<String,Object>(){{
put("companyCode",HPSC004.getCompanyCode());
put("projCode",HPSC004.getProjCode());
put("parentId",HPSC004.getParentId());
put("planCommentDate"," ");
put("planCompletionDate"," ");
}});
if (list.size() == 0) {
List<HPSC004> list1 = this.dao.query("HPSC004.queryDate", new HashMap<String,Object>(){{
put("companyCode",HPSC004.getCompanyCode());
put("projCode",HPSC004.getProjCode());
put("parentId",HPSC004.getParentId());
}});
HPSC003 HPSC003 = new HPSC003();
HPSC003.setCompanyCode(HPSC004.getCompanyCode());
HPSC003.setProjCode(HPSC004.getProjCode());
HPSC003.setPlanInfoNo(HPSC004.getParentId());
HPSC003.setPlanCompletionDate(list1.get(0).getPlanCompletionDate());
DaoUtils.update("HPSC003.updateDate", HPSC003.toMap());
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
......
......@@ -57,26 +57,6 @@ public class ServiceHPSC004 extends ServiceBase {
Map<?, ?> map = eiBlock.getRow(i);
HPSC004.fromMap(map);
DaoUtils.insert("HPSC004.insert", HPSC004.toMap());
List list = this.dao.query("HPSC004.query", new HashMap<String,Object>(){{
put("companyCode",HPSC004.getCompanyCode());
put("projCode",HPSC004.getPrdtCode());
put("parentId",HPSC004.getParentId());
put("planCommentDate","");
put("planCompletionDate","");
}});
if (list == null) {
List<Map> list1 = this.dao.query("HPSC004.query", new HashMap<String,Object>(){{
put("companyCode",HPSC004.getCompanyCode());
put("projCode",HPSC004.getPrdtCode());
put("parentId",HPSC004.getParentId());
}});
HPSC003 HPSC003 = new HPSC003();
HPSC003.setCompanyCode(HPSC004.getCompanyCode());
HPSC003.setPrdtCode(HPSC004.getPrdtCode());
HPSC003.setPlanInfoNo(HPSC004.getParentId());
HPSC003.setPlanCompletionDate(list1.get(0).get("planCompletionDate").toString());
DaoUtils.update("HPSC003.updateDate", HPSC003.toMap());
}
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
......
......@@ -110,7 +110,7 @@ public class ServiceHPSC005A extends ServiceBase {
}
inInfo = this.query(inInfo);
// 刷新主订单信息
inInfo = this.refreshOrderInfo(inInfo);
inInfo = this.refreshOrderInfo(inInfo, prodOrderNo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据操作成功!");
} catch (Exception e) {
......@@ -167,6 +167,8 @@ public class ServiceHPSC005A extends ServiceBase {
*/
public EiInfo delete(EiInfo inInfo) {
try {
Map detailMap = EiInfoUtils.getFirstRow(inInfo, "detail");
String prodOrderNo = MapUtils.getString(detailMap, "productionOrderNo");
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPSC005A fSc005a = new HPSC005A();
......@@ -181,7 +183,7 @@ public class ServiceHPSC005A extends ServiceBase {
}
inInfo = this.query(inInfo);
// 刷新主订单信息
inInfo = this.refreshOrderInfo(inInfo);
inInfo = this.refreshOrderInfo(inInfo, prodOrderNo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
......@@ -196,12 +198,9 @@ public class ServiceHPSC005A extends ServiceBase {
* @param inInfo
* @return
*/
private EiInfo refreshOrderInfo(EiInfo inInfo) {
Map detailMap = EiInfoUtils.getFirstRow(inInfo, "detail");
String prodOrderNo = MapUtils.getString(detailMap, "productionOrderNo");
private EiInfo refreshOrderInfo(EiInfo inInfo, String prodOrderNo) {
HPSC005 dbSc005 = HPSCTools.HpSc005.get(prodOrderNo);
inInfo.getBlock("detail").getRows().clear();
inInfo.getBlock("detail").addRow(dbSc005);
inInfo.addBlock("detail").addRow(dbSc005);
return inInfo;
}
......
<?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">
......@@ -75,6 +54,9 @@
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
MAT_ID = #matId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -102,6 +84,7 @@
LENGTH as "length", <!-- 长 -->
WIDTH as "width", <!-- 宽 -->
THICK as "thick", <!-- 厚 -->
MAT_ID AS "matId",
CONCAT((
SELECT
format((ifnull( SUM( ACTUAL_COMPLETION_NUM ), 0 ) / ifnull( SUM( NUM ), 0 ) * 100),2)
......@@ -111,7 +94,7 @@
PARENT_ID = hpjx.T_HPSC003.PLAN_INFO_NO
),'%') AS "schedule"
FROM hpjx.T_HPSC003 WHERE 1=1
<include refid="condition" />
<include refid="condition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......@@ -128,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, <!-- 企业编码 预留 -->
......@@ -198,11 +133,13 @@
UPDATED_BY, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
DEP_CODE, <!-- 部门编码 -->
REMARK <!-- 备注 -->
REMARK, <!-- 备注 -->
MAT_ID
)
VALUES (#id#, #companyCode#, #projType#, #projCode#, #projName#, #planInfoNo#,#inventRecordId#,
#spec#, #length#, #width#, #thick#, #prdtType#, #prdtCode#, #prdtName#, #planCompletionDate#, #status#, #createdBy#,
#createdTime#, #updatedBy#, #updatedTime#, #depCode#, #remark#)
#spec#, #length#, #width#, #thick#, #prdtType#, #prdtCode#, #prdtName#, #planCompletionDate#, #status#,
#createdBy#,
#createdTime#, #updatedBy#, #updatedTime#, #depCode#, #remark#,#matId#)
</insert>
<delete id="delete">
......
......@@ -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.isEmpty(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);
}
......@@ -220,7 +305,7 @@ public class HPSCTools {
* @return
*/
public static HPSC005 get(String prodOrderNo) {
AssertUtils.isNull(prodOrderNo, "生产订单号不能为空");
AssertUtils.isEmpty(prodOrderNo, "生产订单号不能为空");
Map queryMap = new HashMap();
queryMap.put("productionOrderNo", prodOrderNo);
List<HPSC005> results = DaoBase.getInstance().query(HPSC005.QUERY, queryMap);
......
......@@ -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();
......
......@@ -42,9 +42,14 @@ let select = function () {
return;
}
for (let i = 0; i < rows.length; i++) {
let whCode = rows[i]['whCode'];
let applyNum = rows[i]['applyNum'];
let num = rows[i]['num'];
let completeNum = rows[i]['completeNum'];
if (isBlank(whCode)) {
message("第" + (i + 1) + "行请选择仓库名称");
return;
}
if (isBlank(applyNum) || !isNumber(applyNum) || !(applyNum > 0)) {
message("第" + (i + 1) + "行申请数量必须大于0");
return;
......
......@@ -42,12 +42,12 @@
<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="prodTaskNo" cname="生产任务号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>
<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:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -15,12 +15,8 @@
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput cname="部件编码" ename="inventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零部件编码" ename="subInventCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零部件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFSelect cname="是否打印" ename="isPrint" blockId="inqu_status" row="0" colWidth="3" defaultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
......@@ -29,6 +25,8 @@
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" startName="createdDateFrom" endName="createdDateTo"
blockId="inqu_status" row="0" role="date" format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8"
endRatio="4:8" readonly="true">
......@@ -61,11 +59,11 @@
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="subInventCode" cname="零部件编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="saleNo" cname="销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="oldSaleNo" cname="原销售单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="subInventCode" cname="零部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
......
......@@ -12,6 +12,7 @@ $(function() {
"result": {
columns: [{
field: "whCode",
title: "仓库名称",
template: function (dataItem) {
for (let i = 0; i < whNameGlobalData.length; i++) {
if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) {
......@@ -32,6 +33,7 @@ $(function() {
}
}, {
field: "inventName",
title: "存货名称",
template: function (dataItem) {
//let flag = false;
for (let i = 0; i < inventNameGlobalData.length; i++) {
......@@ -54,7 +56,7 @@ $(function() {
var eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
eiInfo.set("inqu_status-0-inventType", options.model["inventType"]);
eiInfo.set("inventType", options.model["inventType"]);
eiInfo.set("isSplicingSymbol",false);
//eiInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
//eiInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
......@@ -92,6 +94,7 @@ $(function() {
}*/
}, {
field: "inventRecordId",
title: "规格",
template: function (dataItem) {
for (let i = 0; i < specGlobalData.length; i++) {
if (specGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
......
......@@ -45,7 +45,7 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true" readonly="true">
......
var inventNameGlobalData = [];
var prdtNameGlobalData = [];
// 传递参数 将附件ID与当前记录ID进行绑定
// let rowId = '';
let parentId = '';
......@@ -41,7 +42,11 @@ $(function () {
select: function (e) {
var nodeData = this.dataItem(e.node);
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventTypes", [3, 4]);
if (nodeData.lv == 1){
eiInfo.set("inqu_status-0-inventTypes", [4]);
}else if (nodeData.lv == 2){
eiInfo.set("inqu_status-0-inventTypes", [3]);
}
var dataSource;
EiCommunicator.send("HPPZ006", "queryPrdtComboBox", eiInfo, {
onSuccess: function (ei) {
......@@ -56,6 +61,7 @@ $(function () {
IPLATUI.EFTree.materialTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.materialTree.selectTreeNode.prdtName = nodeData.prdtName;
IPLATUI.EFTree.materialTree.selectTreeNode.projName = nodeData.projName;
IPLATUI.EFTree.materialTree.selectTreeNode.lv = nodeData.lv;
// 重新查询EFGrid
parentId = nodeData.nodeId;
query();
......@@ -150,11 +156,18 @@ $(function () {
onAdd: function (e) {
// 动态设置默认邮箱
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
//e.items[0]['prdtType'] = selectTreeNode.lv = 4;
$.each(e.items, function (index, item) {
item['projCode'] = selectTreeNode.projCode;
item['projName'] = selectTreeNode.projName;
item['parentId'] = selectTreeNode.nodeId;
item['parentPrdtName'] = selectTreeNode.prdtName;
if (selectTreeNode.lv == 1){
item['prdtType'] = 4;
}else if (selectTreeNode.lv == 2){
item['prdtType'] = 3;
}
//item['id'] = null
});
},
/**
......@@ -198,6 +211,7 @@ $(function () {
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
console.log(item)
let auditStatus = item.status;
......@@ -205,26 +219,77 @@ $(function () {
let template = '';
// template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
// + 'onclick="openUploadFile(' + item.id + ',1)" >附件上传</a>';
if (item.id){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.id + ')" >附件清单</a>';
}
if (lv === '3') {
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="check(' + item.id + ',1)" >提交</a>';
} else {
} /*else {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="check(' + item.id + ',0)" >撤回</a>';
}
}*/
}
return template;
}
},{
field: "prdtName",
query: function (container, options) {
title: "部件名称",
/*query: function (container, options) {
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventTypes", [3, 4]);
eiInfo.set("inqu_status-0-inventType", options.model["prdtType"]);
return eiInfo;
}*/
template: function (dataItem) {
for (let i = 0; i < prdtNameGlobalData.length; i++) {
if (prdtNameGlobalData[i]['textField'] === dataItem['prdtName']) {
//dataItem["prdtCode"] = prdtNameGlobalData[i]['valueField']
resultGrid.setCellValue(0, "prdtCode", prdtNameGlobalData[i]['valueField']);
return prdtNameGlobalData[i]['textField'];
}
}
return dataItem["prdtName"];
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
if (selectTreeNode.lv == 1){
eiInfo.set("inventType", 4);
}else if (selectTreeNode.lv == 2){
eiInfo.set("inventType", 3);
}else {
eiInfo.set("inventTypes", [3,4]);
}
eiInfo.set("isSplicingSymbol",false);
var dataSource;
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
prdtNameGlobalData = dataSource;
},
onFail: function (ei) {
}
}, {async: false});
input.kendoAutoComplete({
valuePrimitive: true,
dataSource: dataSource,
dataTextField: "textField",
dataValueField: "valueField",
required: "true",
optionLabelTemplate: "#:textField#",
valueTemplate: "#:valueField#",
template: "#:textField#",
filter: "contains"
});
}
}, {
field: "parentPrdtName",
......@@ -274,22 +339,7 @@ $(function () {
// });
// }
// }
],
loadComplete: function (grid) {
// 此grid对象
// grid.dataSource.bind("change", function(e) {
// if (e.field == "inventRecordId") {
// var tr,index;
// // 获取此model元素信息
// var item = e.items[0];
// for (let i = 0; i < inventNameGlobalData.length; i++) {
// if (inventNameGlobalData[i]['valueField'] === item.inventRecordId) {
// resultGrid.setCellValue(item, 'prdtCode', inventNameGlobalData[i]['textField'])
// }
// }
// }
// });
}
]
},
};
......
......@@ -10,11 +10,11 @@
<EF:EFPage title="物料清单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect ename="inqu_status-0-prdtType" cname="部件类型" colWidth="3" filter="contains"
<%--<EF:EFSelect ename="inqu_status-0-prdtType" cname="部件类型" colWidth="3" filter="contains"
template="#=textField#" valueTemplate="#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('3','4')"/>
</EF:EFSelect>
</EF:EFSelect>--%>
<EF:EFSelect cname="部件名称" ename="inqu_status-0-prdtCode" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
......@@ -46,23 +46,33 @@
<EF:EFColumn ename="level" cname="层级" hidden="true"/>
<EF:EFColumn enable="false" ename="projCode" cname="项目编码"/>
<EF:EFColumn enable="false" ename="projName" cname="项目名称"/>
<EF:EFComboColumn cname="部件类型" ename="prdtType" width="90" align="center" required="true">
<%--<EF:EFComboColumn cname="部件类型" ename="prdtType" width="90" align="center" required="true"
columnTemplate="#=textField#"
itemTemplate="#=textField#"
textField="textField"
valueField="valueField">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('3','4')"/>
</EF:EFComboColumn>--%>
<EF:EFComboColumn ename="prdtType" cname="部件类型" align="center" required="true"
filter="contains" width="90">
<EF:EFOption label="零部件" value="3"/>
<EF:EFOption label="部件" value="4"/>
</EF:EFComboColumn>
<EF:EFPopupColumn ename="prdtName" cname="部件名称" width="200" popupType="ServiceGrid"
<%--<EF:EFPopupColumn ename="prdtName" cname="部件名称" width="200" popupType="ServiceGrid"
popupTitle="部件信息" serviceName="HPPZ006" methodName="queryPrdtComboBox" resultId="invent_prdt_name_block_id"
columnEnames="param1Field,textField"
columnCnames="部件名称,部件编码"
backFillColumnIds="param1Field,textField"
backFillFieldIds="prdtName,prdtCode"
valueField="param1Field" textField="param1Field"/>
<EF:EFColumn ename="prdtCode" cname="部件编码"/>
valueField="param1Field" textField="param1Field"/>--%>
<EF:EFColumn ename="prdtName" cname="部件名称" width="200" align="center" maxLength="50"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" hidden = 'true'/>
<EF:EFColumn ename="length" cname="长" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" />
<EF:EFColumn enable="false" ename="parentId" hidden="true" cname="上级部件名称"/>
<EF:EFColumn enable="false" ename="parentPrdtName" cname="上级部件名称"/>
<EF:EFColumn enable="false" ename="parentPrdtName" hidden="true" cname="上级部件名称"/>
<EF:EFColumn ename="num" required="true" cname="数量"/>
<EF:EFColumn ename="unitWt" required="true" format="{0:N3}" cname="单重"/>
<EF:EFColumn enable="false" format="{0:N3}" ename="totalWt" cname="总重"/>
......
......@@ -19,14 +19,18 @@ $(function () {
console.log(item)
let auditStatus = item.status;
let template = '';
if (item.matId != null){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件清单</a>';
}
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',1)" >提交</a>';
}
else {
/*else {
template += '<a hidden="hidden" style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',0)" >撤回</a>';
}
}*/
return template;
}
},
......
......@@ -41,12 +41,12 @@
<EF:EFColumn enable="false" ename="projCode" cname="项目号" readonly="true"/>
<EF:EFColumn enable="false" ename="projName" cname="项目名称" readonly="true"/>
<EF:EFColumn enable="false" ename="planInfoNo" cname="生产计划单号" readonly="true"/>
<EF:EFComboColumn ename="prdtType" cname="部件类型" width="90" align="center" enable="false">
<EF:EFComboColumn ename="prdtType" cname="部件类型" hidden = 'true' width="90" align="center" enable="false">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
</EF:EFComboColumn>
<EF:EFColumn enable="false" ename="prdtCode" cname="部件编码" readonly="true"/>
<EF:EFColumn enable="false" ename="prdtCode" cname="部件编码" readonly="true" hidden = "true"/>
<EF:EFColumn enable="false" ename="prdtName" cname="部件名称" readonly="true"/>
<EF:EFColumn hidden="true" enable="false" ename="spec" cname="规格" readonly="true"/>
<EF:EFColumn enable="false" ename="spec" cname="规格" readonly="true"/>
<EF:EFColumn enable="false" ename="remark" cname="备注" readonly="true"/>
<EF:EFColumn ename="planCompletionDate" cname="计划完成日期" editType="date" dateFormat="yyyy/MM/dd" width="150"
required='true'/>
......@@ -63,12 +63,14 @@
<EF:EFRegion id="detail" title="明细信息">
<EF:EFGrid blockId="detail" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" hidden="true"/>
<EF:EFColumn ename="parentId" cname="父ID" hidden="true"/>
<EF:EFComboColumn ename="prdtType" cname="零件类型" width="90" align="center" readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
</EF:EFComboColumn>
<EF:EFColumn enable="false" ename="prdtCode" cname="零件编码"/>
<EF:EFColumn enable="false" ename="prdtName" readonly="true" cname="零件名称"/>
<EF:EFColumn enable="false" ename="prdtCode" cname="零部件编码" hidden = "true"/>
<EF:EFColumn enable="false" ename="prdtName" readonly="true" cname="零件名称"/>
<EF:EFColumn enable="false" ename="spec" cname="规格" readonly="true"/>
<EF:EFColumn enable="false" ename="remark" cname="备注" readonly="true"/>
<%-- <EF:EFComboColumn enable="false" ename="delStatus" cname="状态">--%>
......
......@@ -39,8 +39,8 @@
<EF:EFColumn ename="orgName" cname="生产组名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>
<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="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -99,6 +99,20 @@ $(function () {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ')" >附件清单</a>';
return template
// template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
// + 'onclick="openUploadFile(' + item.id + ',1)" >附件上传</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.id + ')" >附件清单</a>';
if (lv === '3') {
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="check(' + item.id + ',1)" >提交</a>';
} /*else {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="check(' + item.id + ',0)" >撤回</a>';
}*/
}
return template;
}
},{
field: "inventName",
......
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