diff --git a/mmpac/src/public/nccloud/openapi/mmpac/wr/WrResource.java b/mmpac/src/public/nccloud/openapi/mmpac/wr/WrResource.java index 0dae270d..e451b0f1 100644 --- a/mmpac/src/public/nccloud/openapi/mmpac/wr/WrResource.java +++ b/mmpac/src/public/nccloud/openapi/mmpac/wr/WrResource.java @@ -1,22 +1,25 @@ package nccloud.openapi.mmpac.wr; - import nc.bs.dao.BaseDAO; import nc.bs.framework.common.InvocationInfoProxy; import nc.bs.framework.common.NCLocator; import nc.bs.logging.Log; import nc.bs.uif2.validation.ValidationFailure; +import nc.itf.mmpac.wr.IWrBusinessService; import nc.jdbc.framework.SQLParameter; import nc.jdbc.framework.processor.ColumnProcessor; import nc.util.mmf.framework.base.MMArrayUtil; import nc.util.mmf.framework.base.MMCollectionUtil; import nc.util.mmf.framework.base.MMNumberUtil; import nc.util.mmf.framework.base.MMValueCheck; +import nc.vo.bd.bom.bom0202.enumeration.OutputTypeEnum; +import nc.vo.mmpac.wr.consts.WrptLangConst; import nc.vo.mmpac.wr.entity.*; import nc.vo.mmpac.wr.enumeration.WrBillStatusEnum; import nc.vo.pub.BusinessException; import nc.vo.pub.VOStatus; import nc.vo.pub.billtype.BilltypeVO; +import nc.vo.pub.lang.UFBoolean; import nc.vo.pub.lang.UFDate; import nc.vo.pubapp.AppContext; import nc.vo.pubapp.pattern.exception.ExceptionUtils; @@ -24,6 +27,7 @@ import nc.ws.opm.pub.utils.result.APIErrCodeEnum; import nccloud.api.mmpac.wr.IAPIWrMaintain; import nccloud.api.rest.utils.NCCRestUtils; import nccloud.api.rest.utils.ResultMessageUtil; +import nccloud.framework.service.ServiceLocator; import nccloud.openapi.scmpub.pub.TransferCodeToPKTool; import nccloud.ws.rest.resource.AbstractNCCRestResource; import org.json.JSONString; @@ -379,7 +383,50 @@ public class WrResource extends AbstractNCCRestResource { aggWrVO.getParentVO().setVtrantypeid(collection.get(0).getPk_billtypeid()); aggWrVO.getParentVO().setDbilldate(new UFDate()); } - AggWrVO[] aggvos = server.newsave(voList.toArray(new AggWrVO[0])); + + /* + * edit by xc 2025-10-22 + * 齐套检查前置 从产品入库 前置 完工报告 + * 考虑标品接口扩展性 表头增加校验参数 isdonecheck:Y/N + */ + AggWrVO[] wrVOS = voList.toArray(new AggWrVO[0]); + if (headInfo.containsKey("isdonecheck") && "Y".equals(headInfo.get("isdonecheck").toString())) { + IWrBusinessService service = (IWrBusinessService) ServiceLocator.find(IWrBusinessService.class); + AggWrVO[] resultvos = service.setCheck(wrVOS); + if (!MMValueCheck.isEmpty(resultvos)) { + StringBuilder errorMessagesSB = new StringBuilder(); + + for (AggWrVO aggWrVO : resultvos) { + if (!WrBillStatusEnum.FREEDOM.equalsValue(aggWrVO.getParentVO().getFbillstatus())) { + StringBuilder notThroughSB = new StringBuilder(); + String billCode = aggWrVO.getParentVO().getVbillcode(); + WrItemVO[] itemVOs = (WrItemVO[]) aggWrVO.getChildren(WrItemVO.class); + if (!MMValueCheck.isEmpty(itemVOs)) { + for (WrItemVO itemVO : itemVOs) { + if (!MMValueCheck.isEmpty(itemVO.getCbmoid()) && OutputTypeEnum.MAIN_PRODUCT.equalsValue(itemVO.getFbproducttype()) && !UFBoolean.TRUE.equals(itemVO.getBbsetmark())) { + notThroughSB.append(itemVO.getVbrowno()); + notThroughSB.append(","); + } + } + if (!MMValueCheck.isEmpty(notThroughSB)) { + notThroughSB.setLength(notThroughSB.length() - 1); + String message = WrptLangConst.getSetCheckError_Msg(new String[]{billCode, notThroughSB.toString()}); + errorMessagesSB.append(message); + errorMessagesSB.append("\n"); + } + } + } + } + if (!MMValueCheck.isEmpty(errorMessagesSB)) { + ExceptionUtils.wrappBusinessException(errorMessagesSB.toString()); + } + } + } + /* + * end 齐套检查 + * edit by xc 2025-10-22 + */ + AggWrVO[] aggvos = server.newsave(wrVOS); boolean successFlag = true; StringBuilder errMsg = new StringBuilder(); if (MMArrayUtil.isNotEmpty(aggvos)) {