Commit 591b0662 by 江和松

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

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