fix(material):修复物料计划保存前校验逻辑

This commit is contained in:
mzr 2025-11-03 18:57:35 +08:00
parent 91da40edf2
commit 4b2c7b5a66
1 changed files with 3 additions and 4 deletions

View File

@ -12,8 +12,6 @@ import nc.vo.bd.material.plan.MaterialPlanVO;
import nc.vo.org.OrgVO; import nc.vo.org.OrgVO;
import nc.vo.pub.BusinessException; import nc.vo.pub.BusinessException;
import java.util.Map;
/** /**
* 精密-物料计划信息保存前校验 * 精密-物料计划信息保存前校验
* *
@ -35,12 +33,13 @@ public class MaterialSaveBeforeCheckJMListener implements IBusinessListener {
for (Object obj : objs) { for (Object obj : objs) {
if (obj instanceof MaterialPlanVO planVO) { if (obj instanceof MaterialPlanVO planVO) {
String pkOrg = planVO.getPk_org(); String pkOrg = planVO.getPk_org();
String pkMaterialplan = planVO.getPk_materialplan();
// 组织判断精密的才需校验 // 组织判断精密的才需校验
if (MMValueCheck.isNotEmpty(orgId) && orgId.equals(pkOrg)) { if (MMValueCheck.isNotEmpty(orgId) && orgId.equals(pkOrg)) {
String def2 = planVO.getDef2();// 启源物料编码/原系统物料编码 String def2 = planVO.getDef2();// 启源物料编码/原系统物料编码
if (MMValueCheck.isNotEmpty(def2)) { if (MMValueCheck.isNotEmpty(def2)) {
String countSql = "select count(1) from bd_materialplan where pk_org = '[pk_org]' and def2 = '[def2]'"; String countSql = "select count(1) from bd_materialplan where pk_org = '[pk_org]' and pk_materialplan != '[pkMaterialplan]' and def2 = '[def2]'";
countSql = countSql.replace("[pk_org]", pkOrg).replace("[def2]", def2); countSql = countSql.replace("[pk_org]", pkOrg).replace("[def2]", def2).replace("[pkMaterialplan]", pkMaterialplan);
Integer num = (Integer) baseDAO.executeQuery(countSql, new ColumnProcessor()); Integer num = (Integer) baseDAO.executeQuery(countSql, new ColumnProcessor());
if (num > 0) { if (num > 0) {
throw new BusinessException("原系统物料编码重复,请检查!"); throw new BusinessException("原系统物料编码重复,请检查!");