Commit 591b0662 by 江和松

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

parent e8f1be20
...@@ -58,6 +58,9 @@ public class HGCG001 extends DaoEPBase { ...@@ -58,6 +58,9 @@ public class HGCG001 extends DaoEPBase {
public static final String FIELD_AUDIT_USER_NAME = "auditUserName"; /* 审核人名称*/ public static final String FIELD_AUDIT_USER_NAME = "auditUserName"; /* 审核人名称*/
public static final String FIELD_AUDIT_REASON = "auditReason"; /* 审核原因*/ public static final String FIELD_AUDIT_REASON = "auditReason"; /* 审核原因*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String FIELD_MATERIAL_PLAN_ID = "materialPlanId"; /*材料计划id*/
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/ public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码*/
...@@ -135,6 +138,8 @@ public class HGCG001 extends DaoEPBase { ...@@ -135,6 +138,8 @@ public class HGCG001 extends DaoEPBase {
private String auditUserId = " "; /* 审核人ID*/ private String auditUserId = " "; /* 审核人ID*/
private String auditUserName = " "; /* 审核人名称*/ private String auditUserName = " "; /* 审核人名称*/
private String auditReason = " "; /* 审核原因*/ private String auditReason = " "; /* 审核原因*/
private Integer inventTypeDetail; /*存货类型明细 1:构建 2:零件*/
private Long materialPlanId = new Long(0); /*材料计划id*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -310,7 +315,13 @@ public class HGCG001 extends DaoEPBase { ...@@ -310,7 +315,13 @@ public class HGCG001 extends DaoEPBase {
eiColumn.setDescName("审核原因"); eiColumn.setDescName("审核原因");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_TYPE_DETAIL);
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_MATERIAL_PLAN_ID);
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -880,6 +891,23 @@ public class HGCG001 extends DaoEPBase { ...@@ -880,6 +891,23 @@ public class HGCG001 extends DaoEPBase {
public void setAuditReason(String auditReason) { public void setAuditReason(String auditReason) {
this.auditReason = auditReason; this.auditReason = auditReason;
} }
public Integer getInventTypeDetail() {
return inventTypeDetail;
}
public void setInventTypeDetail(Integer inventTypeDetail) {
this.inventTypeDetail = inventTypeDetail;
}
public Long getMaterialPlanId() {
return materialPlanId;
}
public void setMaterialPlanId(Long materialPlanId) {
this.materialPlanId = materialPlanId;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -923,6 +951,8 @@ public class HGCG001 extends DaoEPBase { ...@@ -923,6 +951,8 @@ public class HGCG001 extends DaoEPBase {
setAuditUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_USER_ID)), auditUserId)); setAuditUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_USER_ID)), auditUserId));
setAuditUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_USER_NAME)), auditUserName)); setAuditUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_USER_NAME)), auditUserName));
setAuditReason(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_REASON)), auditReason)); setAuditReason(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_AUDIT_REASON)), auditReason));
setMaterialPlanId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_MATERIAL_PLAN_ID)), materialPlanId));
setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
} }
/** /**
...@@ -967,7 +997,8 @@ public class HGCG001 extends DaoEPBase { ...@@ -967,7 +997,8 @@ public class HGCG001 extends DaoEPBase {
map.put(FIELD_AUDIT_USER_ID, StringUtils.toString(auditUserId, eiMetadata.getMeta(FIELD_AUDIT_USER_ID))); map.put(FIELD_AUDIT_USER_ID, StringUtils.toString(auditUserId, eiMetadata.getMeta(FIELD_AUDIT_USER_ID)));
map.put(FIELD_AUDIT_USER_NAME, StringUtils.toString(auditUserName, eiMetadata.getMeta(FIELD_AUDIT_USER_NAME))); map.put(FIELD_AUDIT_USER_NAME, StringUtils.toString(auditUserName, eiMetadata.getMeta(FIELD_AUDIT_USER_NAME)));
map.put(FIELD_AUDIT_REASON, StringUtils.toString(auditReason, eiMetadata.getMeta(FIELD_AUDIT_REASON))); map.put(FIELD_AUDIT_REASON, StringUtils.toString(auditReason, eiMetadata.getMeta(FIELD_AUDIT_REASON)));
map.put(FIELD_MATERIAL_PLAN_ID,StringUtils.toString(materialPlanId, eiMetadata.getMeta(FIELD_MATERIAL_PLAN_ID)));
map.put(FIELD_INVENT_TYPE_DETAIL,StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
return map; return map;
} }
} }
...@@ -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>
......
...@@ -73,6 +73,19 @@ public class HGCGTools { ...@@ -73,6 +73,19 @@ public class HGCGTools {
/** /**
* 查询 * 查询
* *
* @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);
}
/**
* 查询
*
* @param planNos * @param planNos
* @return * @return
*/ */
......
...@@ -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;
...@@ -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());
...@@ -251,4 +255,13 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -251,4 +255,13 @@ 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) {
if (response.status == 1){
NotificationUtil(response.msg); NotificationUtil(response.msg);
query(); 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