diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OptionalEBom/PublisMaterial.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OptionalEBom/PublisMaterial.java index b47336f2..6ce4acb9 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OptionalEBom/PublisMaterial.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/OptionalEBom/PublisMaterial.java @@ -28,10 +28,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import nflg.product.common.constant.STATE; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Slf4j @@ -314,7 +311,7 @@ public class PublisMaterial { public List buildMaterialList(List optionList) throws NflgBusinessException { - if (deviceRowId == null || StrUtil.isEmpty(publishAddDTO.getGoodsDesc()) || StrUtil.isEmpty(publishAddDTO.getElectricDesc())) { + if (Objects.isNull(deviceRowId) || deviceRowId==0 || StrUtil.isEmpty(publishAddDTO.getGoodsDesc()) || StrUtil.isEmpty(publishAddDTO.getElectricDesc())) { throw new NflgBusinessException(STATE.BusinessError, "整机或电控数据不完整"); } @@ -328,10 +325,15 @@ public class PublisMaterial { OptionalMbomMaterialEntity genVirtualPackLevelMake1 = genVirtualPackLevelMake1(genVirtualPackLevelSend1.getRowId(), oaList); - //电控制作 - OptionalMbomMaterialEntity genVirtualPackElectricLevelMake2 = genVirtualPackElectricLevelMake2(genVirtualPackLevelMake1.getRowId(), oaList); + /** + * +电控发货 + * -电控制作 + * + */ //电控发货 - OptionalMbomMaterialEntity genVirtualPackElectricLevelSend2 = genVirtualPackElectricLevelSend2(genVirtualPackElectricLevelMake2.getRowId(), oaList); + OptionalMbomMaterialEntity genVirtualPackElectricLevelSend2 = genVirtualPackElectricLevelSend2(genVirtualPackLevelMake1.getRowId(), oaList); + //电控制作 + OptionalMbomMaterialEntity genVirtualPackElectricLevelMake2 = genVirtualPackElectricLevelMake2(genVirtualPackElectricLevelSend2.getRowId(), oaList); //机械 OptionalMbomMaterialEntity genVirtualPackMachineLevel2 = genVirtualPackMachineLevel2(genVirtualPackLevelMake1.getRowId(), optionList, oaList); @@ -340,7 +342,7 @@ public class PublisMaterial { //申请物料 try { mMap = SpringUtil.getBean(MaterialService.class).batchAddMaterial(oaList); - if (mMap == null) { + if (mMap == null || mMap.size()==0) { throw new Exception("申请物料编码出现异常"); } } catch (Exception e) { @@ -357,16 +359,16 @@ public class PublisMaterial { if (StrUtil.isEmpty(genVirtualPackLevelMake1.getMaterialNo())){ throw new NflgBusinessException(STATE.Error, "机型制作物料编码申请失败"); } + genVirtualPackElectricLevelSend2.setMaterialNo( mMap.get(String.valueOf(genVirtualPackElectricLevelSend2.getRowId())).getMaterialNo()) ; + if (StrUtil.isEmpty(genVirtualPackElectricLevelSend2.getMaterialNo())){ + throw new NflgBusinessException(STATE.Error, "电控发货物料编码申请失败"); + } genVirtualPackElectricLevelMake2.setMaterialNo( mMap.get(String.valueOf(genVirtualPackElectricLevelMake2.getRowId())).getMaterialNo()) ; if (StrUtil.isEmpty(genVirtualPackElectricLevelMake2.getMaterialNo())){ throw new NflgBusinessException(STATE.Error, "电控制作物料编码申请失败"); } - genVirtualPackElectricLevelSend2.setMaterialNo( mMap.get(String.valueOf(genVirtualPackElectricLevelSend2.getRowId())).getMaterialNo()) ; - if (StrUtil.isEmpty(genVirtualPackElectricLevelSend2.getMaterialNo())){ - throw new NflgBusinessException(STATE.Error, "电控发货物料编码申请失败"); - } if(StrUtil.isEmpty(genVirtualPackMachineLevel2.getMaterialNo())){