Commit 591b0662 by 江和松

材料计划生成采购计划重复校验添加

parent e8f1be20
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
AUDIT_TIME as "auditTime", <!-- 审核时间 --> AUDIT_TIME as "auditTime", <!-- 审核时间 -->
AUDIT_USER_ID as "auditUserId", <!-- 审核人ID --> AUDIT_USER_ID as "auditUserId", <!-- 审核人ID -->
AUDIT_USER_NAME as "auditUserName", <!-- 审核人名称 --> AUDIT_USER_NAME as "auditUserName", <!-- 审核人名称 -->
AUDIT_REASON as "auditReason" <!-- 审核原因 --> AUDIT_REASON as "auditReason", <!-- 审核原因 -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型明细 -->
MATERIAL_PLAN_ID as "materialPlanId" <!-- 材料计划id -->
</sql> </sql>
<sql id="condition"> <sql id="condition">
...@@ -78,6 +80,12 @@ ...@@ -78,6 +80,12 @@
<isNotEmpty prepend=" AND " property="auditUserName"> <isNotEmpty prepend=" AND " property="auditUserName">
AUDIT_USER_NAME = #auditUserName# AUDIT_USER_NAME = #auditUserName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetail">
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialPlanId">
MATERIAL_PLAN_ID = #materialPlanId#
</isNotEmpty>
</sql> </sql>
<sql id="idCondition"> <sql id="idCondition">
...@@ -90,6 +98,9 @@ ...@@ -90,6 +98,9 @@
<isNotEmpty prepend=" AND " property="planNos"> <isNotEmpty prepend=" AND " property="planNos">
PLAN_NO IN <iterate open="(" close=")" conjunction="," property="planNos">#planNos[]#</iterate> PLAN_NO IN <iterate open="(" close=")" conjunction="," property="planNos">#planNos[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="materialPlanIds">
MATERIAL_PLAN_ID IN <iterate open="(" close=")" conjunction="," property="materialPlanIds">#materialPlanIds[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
...@@ -152,12 +163,14 @@ ...@@ -152,12 +163,14 @@
PLAN_QTY, <!-- 计划数量 --> PLAN_QTY, <!-- 计划数量 -->
PLAN_UNIT_WEIGHT, <!-- 计划单重 --> PLAN_UNIT_WEIGHT, <!-- 计划单重 -->
PLAN_WEIGHT, <!-- 计划重量 --> PLAN_WEIGHT, <!-- 计划重量 -->
STATUS <!-- 状态:0-未审批,1-审核通过,2-审核未通过 --> STATUS, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
INVENT_TYPE_DETAIL, <!-- 存货类型明细 -->
MATERIAL_PLAN_ID <!-- 材料计划id -->
) VALUES ( ) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#companyCode#, #companyName#, #planDate#, #planNo#, #inventCode#, #inventName#, #companyCode#, #companyName#, #planDate#, #planNo#, #inventCode#, #inventName#,
#specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#,
#planQty#, #planUnitWeight#, #planWeight#, #status# #planQty#, #planUnitWeight#, #planWeight#, #status#, #inventTypeDetail#, #materialPlanId#
) )
</insert> </insert>
......
...@@ -23,7 +23,7 @@ import java.util.stream.Collectors; ...@@ -23,7 +23,7 @@ import java.util.stream.Collectors;
* @date:2024/5/9,14:33 * @date:2024/5/9,14:33
*/ */
public class HGCGTools { public class HGCGTools {
/** /**
* HGCG001 工具类 * HGCG001 工具类
* *
...@@ -31,7 +31,7 @@ public class HGCGTools { ...@@ -31,7 +31,7 @@ public class HGCGTools {
* @date:2024/5/9,14:33 * @date:2024/5/9,14:33
*/ */
public static class HgCg001 { public static class HgCg001 {
/** /**
* 锁 * 锁
* *
...@@ -46,7 +46,7 @@ public class HGCGTools { ...@@ -46,7 +46,7 @@ public class HGCGTools {
paramMap.put("planNos", planNos); paramMap.put("planNos", planNos);
DaoBase.getInstance().update(HGSqlConstant.HgCg001.LOCK, paramMap); DaoBase.getInstance().update(HGSqlConstant.HgCg001.LOCK, paramMap);
} }
/** /**
* 查询 * 查询
* *
...@@ -69,7 +69,20 @@ public class HGCGTools { ...@@ -69,7 +69,20 @@ public class HGCGTools {
Map<String, Object> paramMap = new HashMap(); Map<String, Object> paramMap = new HashMap();
return DaoBase.getInstance().query(HGCG001.QUERY, paramMap); return DaoBase.getInstance().query(HGCG001.QUERY, paramMap);
} }
/**
* 查询
*
* @param materialPlanIds
* @return
*/
public static List<HGCG001> listByMaterialPlanIds(List<Long> materialPlanIds) {
AssertUtils.isEmpty(materialPlanIds, "材料计划id不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("materialPlanIds", materialPlanIds);
return DaoBase.getInstance().query(HGCG001.QUERY, paramMap);
}
/** /**
* 查询 * 查询
* *
...@@ -80,7 +93,7 @@ public class HGCGTools { ...@@ -80,7 +93,7 @@ public class HGCGTools {
List<HGCG001> results = list(planNos); List<HGCG001> results = list(planNos);
return results.stream().collect(Collectors.toMap(HGCG001::getPlanNo, item -> item)); return results.stream().collect(Collectors.toMap(HGCG001::getPlanNo, item -> item));
} }
/** /**
* 修改状态 * 修改状态
* *
...@@ -95,9 +108,9 @@ public class HGCGTools { ...@@ -95,9 +108,9 @@ public class HGCGTools {
paramMap.put("status", status); paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_STATUS, paramMap); DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_STATUS, paramMap);
} }
} }
/** /**
* HGCG002 工具类 * HGCG002 工具类
* *
...@@ -105,7 +118,7 @@ public class HGCGTools { ...@@ -105,7 +118,7 @@ public class HGCGTools {
* @date:2024/5/9,14:33 * @date:2024/5/9,14:33
*/ */
public static class HgCg002 { public static class HgCg002 {
/** /**
* 锁 * 锁
* *
...@@ -120,7 +133,7 @@ public class HGCGTools { ...@@ -120,7 +133,7 @@ public class HGCGTools {
paramMap.put("contractNos", contractNos); paramMap.put("contractNos", contractNos);
DaoBase.getInstance().update(HGSqlConstant.HgCg002.LOCK, paramMap); DaoBase.getInstance().update(HGSqlConstant.HgCg002.LOCK, paramMap);
} }
/** /**
* 修改状态 * 修改状态
* *
...@@ -135,7 +148,7 @@ public class HGCGTools { ...@@ -135,7 +148,7 @@ public class HGCGTools {
paramMap.put("status", status); paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_STATUS, paramMap); DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_STATUS, paramMap);
} }
/** /**
* 修改状态 * 修改状态
* *
...@@ -156,7 +169,7 @@ public class HGCGTools { ...@@ -156,7 +169,7 @@ public class HGCGTools {
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002.getPurUnitWeight())); paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002.getPurUnitWeight()));
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap); DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap);
} }
/** /**
* 查询 * 查询
* *
...@@ -169,7 +182,7 @@ public class HGCGTools { ...@@ -169,7 +182,7 @@ public class HGCGTools {
paramMap.put("contractNos", contractNos); paramMap.put("contractNos", contractNos);
return DaoBase.getInstance().query(HGCG002.QUERY, paramMap); return DaoBase.getInstance().query(HGCG002.QUERY, paramMap);
} }
/** /**
* 查询 * 查询
* *
...@@ -180,9 +193,9 @@ public class HGCGTools { ...@@ -180,9 +193,9 @@ public class HGCGTools {
List<HGCG002A> results = list(contractNos); List<HGCG002A> results = list(contractNos);
return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item)); return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item));
} }
} }
/** /**
* HGCG003 工具类 * HGCG003 工具类
* *
...@@ -190,7 +203,7 @@ public class HGCGTools { ...@@ -190,7 +203,7 @@ public class HGCGTools {
* @date:2024/5/9,14:33 * @date:2024/5/9,14:33
*/ */
public static class HgCg003 { public static class HgCg003 {
/** /**
* 锁 * 锁
* *
...@@ -205,7 +218,7 @@ public class HGCGTools { ...@@ -205,7 +218,7 @@ public class HGCGTools {
paramMap.put("receiveNos", receiveNos); paramMap.put("receiveNos", receiveNos);
DaoBase.getInstance().update(HGSqlConstant.HgCg003.LOCK, paramMap); DaoBase.getInstance().update(HGSqlConstant.HgCg003.LOCK, paramMap);
} }
/** /**
* 查询 * 查询
* *
...@@ -218,7 +231,7 @@ public class HGCGTools { ...@@ -218,7 +231,7 @@ public class HGCGTools {
paramMap.put("receiveNos", receiveNos); paramMap.put("receiveNos", receiveNos);
return DaoBase.getInstance().query(HGCG003.QUERY, paramMap); return DaoBase.getInstance().query(HGCG003.QUERY, paramMap);
} }
/** /**
* 查询 * 查询
* *
...@@ -229,7 +242,7 @@ public class HGCGTools { ...@@ -229,7 +242,7 @@ public class HGCGTools {
List<HGCG003> results = list(receiveNos); List<HGCG003> results = list(receiveNos);
return results.stream().collect(Collectors.toMap(HGCG003::getReceiveNo, item -> item)); return results.stream().collect(Collectors.toMap(HGCG003::getReceiveNo, item -> item));
} }
/** /**
* 修改状态 * 修改状态
* *
...@@ -244,7 +257,7 @@ public class HGCGTools { ...@@ -244,7 +257,7 @@ public class HGCGTools {
paramMap.put("status", status); paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_STATUS, paramMap); DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_STATUS, paramMap);
} }
/** /**
* 修改状态 * 修改状态
* *
...@@ -258,8 +271,8 @@ public class HGCGTools { ...@@ -258,8 +271,8 @@ public class HGCGTools {
paramMap.put(HGCG003.FIELD_DEPOSIT_QTY, zl001.getQualifyQty()); paramMap.put(HGCG003.FIELD_DEPOSIT_QTY, zl001.getQualifyQty());
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_CONFIRM, paramMap); DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_CONFIRM, paramMap);
} }
} }
} }
...@@ -5,6 +5,7 @@ import com.baosight.hggp.common.AssignStatusEnum; ...@@ -5,6 +5,7 @@ import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001; import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
...@@ -31,7 +32,7 @@ import java.util.stream.Collectors; ...@@ -31,7 +32,7 @@ import java.util.stream.Collectors;
* @date:2024/1/15,11:20 * @date:2024/1/15,11:20
*/ */
public class ServiceHGSC009A extends ServiceBase { public class ServiceHGSC009A extends ServiceBase {
/** /**
* 画面初始化 * 画面初始化
* *
...@@ -50,7 +51,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -50,7 +51,7 @@ public class ServiceHGSC009A extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 查询数据列表 * 查询数据列表
* *
...@@ -67,7 +68,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -67,7 +68,7 @@ public class ServiceHGSC009A extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 保存操作. * 保存操作.
* *
...@@ -107,7 +108,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -107,7 +108,7 @@ public class ServiceHGSC009A extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 校验保存的数据 * 校验保存的数据
* *
...@@ -121,7 +122,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -121,7 +122,7 @@ public class ServiceHGSC009A extends ServiceBase {
//AssertUtils.isNull(hgsc009A.s(), "是否启用不能为空"); //AssertUtils.isNull(hgsc009A.s(), "是否启用不能为空");
} }
} }
/** /**
* 新增 * 新增
* *
...@@ -133,7 +134,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -133,7 +134,7 @@ public class ServiceHGSC009A extends ServiceBase {
DaoUtils.insert(HGSC009A.INSERT, hgsc009A); DaoUtils.insert(HGSC009A.INSERT, hgsc009A);
} }
/** /**
* 修改数据 * 修改数据
* *
...@@ -142,9 +143,9 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -142,9 +143,9 @@ public class ServiceHGSC009A extends ServiceBase {
private void modify(HGSC009A hgsc009A) { private void modify(HGSC009A hgsc009A) {
DaoUtils.update(HGSC009A.UPDATE, hgsc009A); DaoUtils.update(HGSC009A.UPDATE, hgsc009A);
} }
/** /**
* 修改操作 * 修改操作
* *
...@@ -170,7 +171,7 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -170,7 +171,7 @@ public class ServiceHGSC009A extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/** /**
* 删除操作 * 删除操作
* *
...@@ -219,11 +220,14 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -219,11 +220,14 @@ public class ServiceHGSC009A extends ServiceBase {
inventUnitMap = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode,HGPZ005::getUnit,(v1,v2)->v1)); inventUnitMap = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode,HGPZ005::getUnit,(v1,v2)->v1));
} }
} }
// 数据校验
this.checkInsertcgData(hgsc009AList);
for (HGSC009A hgsc009 : hgsc009AList) { for (HGSC009A hgsc009 : hgsc009AList) {
// 写入子表数据 // 写入子表数据
HGCG001 hgcg001 = new HGCG001(); HGCG001 hgcg001 = new HGCG001();
BeanUtils.copyProperties(hgsc009,hgcg001); BeanUtils.copyProperties(hgsc009,hgcg001);
hgcg001.setMaterialPlanId(hgsc009.getId());
hgcg001.setCompanyCode(hgsc009.getCompanyCode()); hgcg001.setCompanyCode(hgsc009.getCompanyCode());
hgcg001.setCompanyName(hgsc009.getCompanyName()); hgcg001.setCompanyName(hgsc009.getCompanyName());
hgcg001.setInventCode(hgsc009.getInventCode()); hgcg001.setInventCode(hgsc009.getInventCode());
...@@ -250,5 +254,14 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -250,5 +254,14 @@ public class ServiceHGSC009A extends ServiceBase {
} }
return inInfo; return inInfo;
} }
private void checkInsertcgData(List<HGSC009A> hgsc009AList) {
List<Long> materialPlanIds = hgsc009AList.stream().map(HGSC009A::getId).collect(Collectors.toList());
List<HGCG001> hgcg001List = HGCGTools.HgCg001.listByMaterialPlanIds(materialPlanIds);
hgsc009AList.forEach(o->{
HGCG001 hgcg001 = hgcg001List.stream().filter(c -> c.getMaterialPlanId().intValue() == o.getId()).findAny().orElse(null);
AssertUtils.isTrue(Objects.nonNull(hgcg001), String.format("材料计划[%s]已生成采购计划", o.getPlanMaterialCode()));
});
}
} }
...@@ -107,7 +107,6 @@ $(function () { ...@@ -107,7 +107,6 @@ $(function () {
resultGrid.setCellValue(e.items[0],"companyName",companyCodeBox[i]['companyName']); resultGrid.setCellValue(e.items[0],"companyName",companyCodeBox[i]['companyName']);
} }
} }
loadChange(grid, e, "projCode");
} }
// 判断父级节点是否发生变化 // 判断父级节点是否发生变化
if (e.field == "projCode") { if (e.field == "projCode") {
...@@ -136,9 +135,6 @@ $(function () { ...@@ -136,9 +135,6 @@ $(function () {
} }
let query = function () {
resultGrid.dataSource.page(1);
}
let save = function (btnNode) { let save = function (btnNode) {
let rows = resultGrid.getCheckedRows(); let rows = resultGrid.getCheckedRows();
if (rows.length < 1) { if (rows.length < 1) {
...@@ -174,6 +170,9 @@ $(function () { ...@@ -174,6 +170,9 @@ $(function () {
}); });
let query = function () {
resultGrid.dataSource.page(1);
}
/** /**
* 显示附件详情 * 显示附件详情
* *
...@@ -237,8 +236,12 @@ function INSERTCG() { ...@@ -237,8 +236,12 @@ function INSERTCG() {
ok: function () { ok: function () {
EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, { EiCommunicator.send('HGSC009A', 'insertcg', inEiInfo, {
onSuccess(response) { onSuccess(response) {
NotificationUtil(response.msg); if (response.status == 1){
query(); NotificationUtil(response.msg);
query();
}else {
NotificationUtil(response.msg, "error");
}
}, },
onFail(errorMessage, status, e) { onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error"); NotificationUtil("执行失败!", "error");
......
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/> <EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="150" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="150" align="center"/>
<EF:EFComboColumn ename="companyCode" cname="公司名称" <EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=companyName#" itemTemplate="#=companyName#"
textField="textField" valueField="valueField" textField="companyName" valueField="companyCode"
maxLength="16" readonly="false" width="200" required="true" maxLength="16" readonly="false" width="100" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
<EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/> <EF:EFOptions blockId="roleCompany" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center" hidden="true" /> <EF:EFColumn ename="companyName" cname="公司名称" width="120" enable="false" readonly="true" align="center"/>
<%-- <EF:EFComboColumn ename="projCode" cname="项目编码"--%> <%-- <EF:EFComboColumn ename="projCode" cname="项目编码"--%>
<%-- columnTemplate="#=textField#" itemTemplate="#=textField#"--%> <%-- columnTemplate="#=textField#" itemTemplate="#=textField#"--%>
<%-- textField="textField" valueField="valueField"--%> <%-- textField="textField" valueField="valueField"--%>
......
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