From 38660ff131ba929b636048c8ee4534e09b36846f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=AD=A3=40=E7=94=A8=E5=8F=8B?= Date: Fri, 11 Apr 2025 10:10:48 +0800 Subject: [PATCH] =?UTF-8?q?uapbd=5Fbom=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8D=95=E6=8D=AE=E7=8A=B6=E6=80=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=87=AA=E5=8A=A8=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mmbd/bom/APIBomBusinessServiceImpl.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java index cd405bf..68c727b 100644 --- a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java +++ b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java @@ -110,26 +110,44 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService { AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]); BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs); - + List commitAggvoList=new ArrayList<>(); + List addAggvoList=new ArrayList<>(); for (AggBomVO agg : aggVOs) { // zhangxinah 对物料主键进行翻译 dealWithMaterial(agg); dataSupplement(agg); UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault"); + Object fBillStatusFlag = agg.getParent().getAttributeValue("fbillstatus"); + if (UFBoolean.TRUE.equals(flag)) { UFBoolean bHasOtherDefaultVersion = getIsExistDefaultVersion(agg); if (bHasOtherDefaultVersion.equals(UFBoolean.TRUE)) { - ExceptionUtils.wrappBusinessException("hasOtherDefaultVersion"); + ExceptionUtils.wrappBusinessException("有其它默认版本,请检查!!!"); } } - (new BomSavingValidation()).validate(agg); + if(fBillStatusFlag==null||"-1".equals(fBillStatusFlag.toString())){ + addAggvoList.add(agg); + } + if(fBillStatusFlag !=null && "1".equals(fBillStatusFlag.toString())){ + commitAggvoList.add(agg); + } } mapClear(); - - AggBomVO[] result = service.insertBom((AggBomVO[]) list.toArray(new AggBomVO[0])); + //请求参数状态为审批通过时,自动提交--不设审批流 start + AggBomVO[] result=null; + if(commitAggvoList.isEmpty()&&addAggvoList.isEmpty()){ + return ResultMessageUtil.exceptionToJSON("BOM保存失败,不存在单据状态不为【空/自由/审批通过】的数据","999"); + }else if(commitAggvoList.isEmpty()&&!addAggvoList.isEmpty()){ + result= service.insertBom((AggBomVO[]) list.toArray(new AggBomVO[0])); + }else if(!commitAggvoList.isEmpty()&&addAggvoList.isEmpty()){ + result = service.insertCommitBomWithParam((AggBomVO[]) list.toArray(new AggBomVO[0]),true,true); + }else{ + return ResultMessageUtil.exceptionToJSON("BOM保存失败,新增不允许单据状态自由或者空和审批通过同时存在","999"); + } + //请求参数状态为审批通过时,自动提交--不设审批流 end return ResultMessageUtil.toJSON(result, "BOM保存成功"); } catch (Exception e) { return ResultMessageUtil.exceptionToJSON(e);