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

This commit is contained in:
lihao 2025-11-05 08:44:47 +08:00
parent 8d34f95caa
commit 5200e620b8
1 changed files with 19 additions and 4 deletions

View File

@ -116,7 +116,9 @@ public class AfterApproveRuleHighpressureIms implements IRule<AggPickmVO> {
logger.info("备料计划组织编码"+ orgCode +"非目标同步组织,跳过同步,备料单号:"+headVO.getVbillcode()+"");
continue;
}
if (!checkIfVtrantypecode(headVO.getVsourcebilltype(), configParams)) {
continue;
}
// 3. 构建主表数据JSON Map添加到列表
JSONObject mainJson = buildMainJsonObject(headVO);
List<Map<String, Object>> mainMapList = JsonUtil.jsonObjectToListMap(mainJson);
@ -143,7 +145,19 @@ public class AfterApproveRuleHighpressureIms implements IRule<AggPickmVO> {
}
}
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 void pushIms(List<Map<String, Object>> mainDataList, List<Map<String, Object>> detailDataList, String targetCpickmid) throws BusinessException {
// 1. 关键参数校验
if (targetCpickmid == null || targetCpickmid.trim().isEmpty()) {
@ -321,6 +335,7 @@ public class AfterApproveRuleHighpressureIms implements IRule<AggPickmVO> {
detailJson.put("nplanoutastnum", itemVO.getNplanoutastnum() != null ? itemVO.getNplanoutastnum().doubleValue() : null); // 计划出库数量
detailJson.put("nplanoutnum", itemVO.getNplanoutnum() != null ? itemVO.getNplanoutnum().doubleValue() : null);// 计划出库主数量
detailJson.put("vbdef22", itemVO.getVbdef20()); // 是否备件
detailJson.put("nunituseastnum",itemVO.getNunituseastnum() != null ? itemVO.getNunituseastnum().toString() : null);
return detailJson;
}
@ -384,7 +399,7 @@ public class AfterApproveRuleHighpressureIms implements IRule<AggPickmVO> {
String[] detailFields = {
"cpickm_bid", "cpickmid", "pk_org", "vbillcode", "vrowno", "fitemtype",
"fitemsource", "cbmaterialvid", "cbunitid", "cbastunitid", "vbchangerate", "nquotastnum",
"nplanoutastnum", "nplanoutnum", "vbdef22"
"nplanoutastnum", "nplanoutnum", "vbdef22","nunituseastnum"
};
String fieldStr = String.join(", ", detailFields);
StringBuilder valuesSb = new StringBuilder();
@ -465,7 +480,7 @@ public class AfterApproveRuleHighpressureIms implements IRule<AggPickmVO> {
String[] detailFields = {
"cpickmid", "pk_org", "vbillcode", "vrowno", "fitemtype",
"fitemsource", "cbmaterialvid", "cbunitid", "cbastunitid", "vbchangerate", "nquotastnum",
"nplanoutastnum", "nplanoutnum", "vbdef22"
"nplanoutastnum", "nplanoutnum", "vbdef22","nunituseastnum"
};
// 循环更新每条子表数据