备料计划推送ims增加字段,生产订单增加单据类型校验

This commit is contained in:
lihao 2025-11-05 08:46:29 +08:00
parent b9dcae9677
commit 524afaeceb
2 changed files with 23 additions and 5 deletions

View File

@ -62,7 +62,7 @@ public class AfterApproveSyncImsRule implements IRule<PMOAggVO> {
"vpackbomversion", "crtversionid", "vrtversion", "tplanstarttime", "tplanendtime", "twillendtime", "tactstarttime", "tactendtime", "mocloser", "tmoclosedtime", "vsalebillcode", "vpackbomversion", "crtversionid", "vrtversion", "tplanstarttime", "tplanendtime", "twillendtime", "tactstarttime", "tactendtime", "mocloser", "tmoclosedtime", "vsalebillcode",
"cbatchid", "vbatchcode", "vnote", "cproductorid", "cprojectid", "vsrctrantypeid", "vsrctrantype", "vsrctype", "vsrcid", "vsrccode", "vsrcbid", "vsrcrowno", "crequireorg", "cbatchid", "vbatchcode", "vnote", "cproductorid", "cprojectid", "vsrctrantypeid", "vsrctrantype", "vsrctype", "vsrcid", "vsrccode", "vsrcbid", "vsrcrowno", "crequireorg",
"crequireorgvid", "trequiredate", "tsupplytime", "vfirsttrantypeid", "vfirsttrantype", "vfirsttype", "vfirstid", "vfirstcode", "vfirstbid", "vfirstrowno", "ninastnum", "ninnum", "crequireorgvid", "trequiredate", "tsupplytime", "vfirsttrantypeid", "vfirsttrantype", "vfirsttype", "vfirstid", "vfirstcode", "vfirstbid", "vfirstrowno", "ninastnum", "ninnum",
"vfirstmotype", "cfirstmoid", "vfirstmocode", "cfirstmobid", "vfirstmorowno", "cinwarehouseid", "vbdef31" "vfirstmotype", "cfirstmoid", "vfirstmocode", "cfirstmobid", "vfirstmorowno", "cinwarehouseid", "vdef31", "vdef39"
}; };
// 表头-定义数值类型字段列表 // 表头-定义数值类型字段列表
@ -81,7 +81,7 @@ public class AfterApproveSyncImsRule implements IRule<PMOAggVO> {
)); ));
// 表体-翻译字段 // 表体-翻译字段
private Set<String> bodyTransferFields = new HashSet<>(Arrays.asList( private Set<String> bodyTransferFields = new HashSet<>(Arrays.asList(
"pk_org", "cmaterialvid", "cunitid", "castunitid", "cdeptid", "mocloser", "cinwarehouseid", "vbdef31" "pk_org", "cmaterialvid", "cunitid", "castunitid", "cdeptid", "mocloser", "cinwarehouseid", "vdef31"
)); ));
@ -112,6 +112,9 @@ public class AfterApproveSyncImsRule implements IRule<PMOAggVO> {
if (checkIfOrg(orgCode, configParams)) { if (checkIfOrg(orgCode, configParams)) {
continue; continue;
} }
if (!checkIfVtrantypecode(pmoHeadVO.getVtrantypecode(), configParams)) {
continue;
}
// 获取主键值 // 获取主键值
String headPrimaryKeyValue = (String) pmoHeadVO.getAttributeValue("cpmohid"); String headPrimaryKeyValue = (String) pmoHeadVO.getAttributeValue("cpmohid");
@ -135,6 +138,20 @@ public class AfterApproveSyncImsRule implements IRule<PMOAggVO> {
} }
} }
private boolean checkIfVtrantypecode(String vtrantypecode, Map<String, String> configParams) throws BusinessException {
String targetCode = configParams.get("vtrantypecode");
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
throw new BusinessException("未配置生产订单交易类型组织参数");
}
String[] orgItem = targetCode.split(",");
for (String orgCode : orgItem) {
if (!orgCode.isEmpty() && orgCode.equals(vtrantypecode)) {
return false;
}
}
return true;
}
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException { private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
String targetCode = configParams.get("imsOrg"); String targetCode = configParams.get("imsOrg");
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) { if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
@ -423,7 +440,7 @@ public class AfterApproveSyncImsRule implements IRule<PMOAggVO> {
String sql = " select code from org_dept where nvl(dr,0) = 0 and pk_dept = '[value]' "; String sql = " select code from org_dept where nvl(dr,0) = 0 and pk_dept = '[value]' ";
sql = sql.replace("[value]", value.toString()); sql = sql.replace("[value]", value.toString());
result = (String) baseDAO.executeQuery(sql, new ColumnProcessor()); result = (String) baseDAO.executeQuery(sql, new ColumnProcessor());
} else if ("cinwarehouseid".equals(column) || "vbdef31".equals(column)) { } else if ("cinwarehouseid".equals(column) || "vdef31".equals(column)) {
String sql = " select code from bd_stordoc where nvl(dr,0) = 0 and pk_stordoc = '[value]' "; String sql = " select code from bd_stordoc where nvl(dr,0) = 0 and pk_stordoc = '[value]' ";
sql = sql.replace("[value]", value.toString()); sql = sql.replace("[value]", value.toString());
result = (String) baseDAO.executeQuery(sql, new ColumnProcessor()); result = (String) baseDAO.executeQuery(sql, new ColumnProcessor());

View File

@ -350,6 +350,7 @@ public class PMOAfterApproveRuleHighpressureIms implements IRule<PMOAggVO> {
detailJson.put("nplanoutastnum", itemVO.getNplanoutastnum() != null ? itemVO.getNplanoutastnum().doubleValue() : null); // 计划出库数量 detailJson.put("nplanoutastnum", itemVO.getNplanoutastnum() != null ? itemVO.getNplanoutastnum().doubleValue() : null); // 计划出库数量
detailJson.put("nplanoutnum", itemVO.getNplanoutnum() != null ? itemVO.getNplanoutnum().doubleValue() : null);// 计划出库主数量 detailJson.put("nplanoutnum", itemVO.getNplanoutnum() != null ? itemVO.getNplanoutnum().doubleValue() : null);// 计划出库主数量
detailJson.put("vbdef22", itemVO.getVbdef20()); // 是否备件 detailJson.put("vbdef22", itemVO.getVbdef20()); // 是否备件
detailJson.put("nunituseastnum",itemVO.getNunituseastnum() != null ? itemVO.getNunituseastnum().toString() : null);
return detailJson; return detailJson;
} }
@ -413,7 +414,7 @@ public class PMOAfterApproveRuleHighpressureIms implements IRule<PMOAggVO> {
String[] detailFields = { String[] detailFields = {
"cpickm_bid", "cpickmid", "pk_org", "vbillcode", "vrowno", "fitemtype", "cpickm_bid", "cpickmid", "pk_org", "vbillcode", "vrowno", "fitemtype",
"fitemsource", "cbmaterialvid", "cbunitid", "cbastunitid", "vbchangerate", "nquotastnum", "fitemsource", "cbmaterialvid", "cbunitid", "cbastunitid", "vbchangerate", "nquotastnum",
"nplanoutastnum", "nplanoutnum", "vbdef22" "nplanoutastnum", "nplanoutnum", "vbdef22","nunituseastnum"
}; };
String fieldStr = String.join(", ", detailFields); String fieldStr = String.join(", ", detailFields);
StringBuilder valuesSb = new StringBuilder(); StringBuilder valuesSb = new StringBuilder();
@ -494,7 +495,7 @@ public class PMOAfterApproveRuleHighpressureIms implements IRule<PMOAggVO> {
String[] detailFields = { String[] detailFields = {
"cpickmid", "pk_org", "vbillcode", "vrowno", "fitemtype", "cpickmid", "pk_org", "vbillcode", "vrowno", "fitemtype",
"fitemsource", "cbmaterialvid", "cbunitid", "cbastunitid", "vbchangerate", "nquotastnum", "fitemsource", "cbmaterialvid", "cbunitid", "cbastunitid", "vbchangerate", "nquotastnum",
"nplanoutastnum", "nplanoutnum", "vbdef22" "nplanoutastnum", "nplanoutnum", "vbdef22","nunituseastnum"
}; };
// 循环更新每条子表数据 // 循环更新每条子表数据