diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index 44078d5b..bfda9a44 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -345,9 +345,9 @@ public class EbomApi extends BaseApi { @PostMapping("intiException") @ApiOperation("初始化错误类型") - public ResultVO intiException(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException { + public ResultVO intiException(@RequestBody List bomRowIds) throws ExecutionException, InterruptedException { - bomNewEbomParentService.checkAndSaveEBomException(bomRowId ); + bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds ); return ResultVO.success(true); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index 57db3477..0a5cc70a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -3,8 +3,11 @@ package com.nflg.product.bomnew.api.user; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.nflg.product.base.core.api.BaseApi; +import com.nflg.product.bomnew.constant.EBomConstant; import com.nflg.product.bomnew.constant.PBomEditStatusEnum; +import com.nflg.product.bomnew.constant.PBomStatusEnum; import com.nflg.product.bomnew.pojo.dto.*; +import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity; import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery; import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; @@ -167,6 +170,25 @@ public class PBomApi extends BaseApi { return ResultVO.success(bomNewPbomParentService.allocationFactoryForRel(params)); } + @GetMapping("convertToMBom") + @ApiOperation("发布MBom") + public ResultVO convertToMBom(@RequestParam("bomRowId") Long bomRowId) { + BomNewPbomParentEntity parent = bomNewPbomParentService.getById(bomRowId); + VUtils.isTure(!parent.getMaterialNo().startsWith("31")).throwMessage("只有31开头的物料才可以发布"); + VUtils.isTure(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus())).throwMessage("只有已发布的BOM才能生成MBom"); + // + VUtils.isTure(!parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)).throwMessage("只有1010工厂BOM才能进行分工厂"); + + + + return ResultVO.success(bomNewPbomParentService.convertToMBom(bomRowId)); + } + + + + + + diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java index b1003ba4..b971ffc2 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java @@ -13,4 +13,10 @@ public class EBomConstant { //EBOM 获取时,初始化物料主数据信息是,忽略的字段 public static final String[] EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT = {"material", "materialTexture", "projectType", "materialUnit"}; + + //集团总部代码 + public static final String MAIN_FACTORY_CODE_1010="1010"; + + //仙桃分厂代码 + public static final String XIAN_TAO_FACTORY_CODE_1020="1020"; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 9f4c2e52..0f9c48fe 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -499,6 +499,7 @@ public class BomNewEbomParentService extends ServiceImpl list) throws ExecutionException, InterruptedException { CheckEBomException checkEBomException = new CheckEBomException(list); checkEBomException.initException(); @@ -508,6 +509,21 @@ public class BomNewEbomParentService extends ServiceImpl bomRowIds) throws ExecutionException, InterruptedException { + for (Long bomRowId : bomRowIds) { + CheckEBomException checkEBomException = new CheckEBomException(bomRowId); + checkEBomException.initException(); + + //保存异常 + saveException(checkEBomException); + } + + } + + diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java index 96514d7b..1c5b493f 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java @@ -370,7 +370,7 @@ public class BomNewOriginalParentService extends ServiceImpl childrenVO = getAllBom(params.getBomRowId() ,0); materialMainService.intiMaterialInfo(childrenVO, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); - - List relList = bomFactorySplitRuleService.lambdaQuery().eq(BomFactorySplitRuleEntity::getRuleGroupCode, params.getRuleGroupCode()).list(); StringBuilder relPattern=new StringBuilder(); - Map result=new HashMap<>(); + List result=new ArrayList<>(); Boolean match=true; for (BomNewPbomParentVO child : childrenVO) { if(StrUtil.isNotBlank(child.getProductionFactoryCode()) && ProductionFactoryCodeInputTypeEnum.MANUAL.equalsValue(child.getProductionFactoryCodeInputType()) ){ @@ -409,17 +404,30 @@ public class BomNewPbomParentService extends ServiceImpl0); } if(match){ - result.put(child.getRowId(), role.getFactoryCode()); + BomNewPbomChildEntity ent = new BomNewPbomChildEntity(); + ent.setRowId(child.getRowId()); + ent.setFacCode(role.getFactoryCode()); + + result.add(ent); + break; } - } } if(CollUtil.isNotEmpty(result)){ - + pbomChildService.saveOrUpdateBatch(result); } return true; } + /** + * 发布MBOM + */ + public Boolean convertToMBom(Long bomRowId){ + + + return true; + } + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/PBom/ConvertToMBom.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/PBom/ConvertToMBom.java new file mode 100644 index 00000000..510e6346 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/PBom/ConvertToMBom.java @@ -0,0 +1,17 @@ +package com.nflg.product.bomnew.service.domain.PBom; + +import io.swagger.annotations.ApiModelProperty; + +/** + * PBOM转MBOM + */ +public class ConvertToMBom { + + @ApiModelProperty("BOM版本行id") + private Long bomRowId; + + + public ConvertToMBom(Long inBomRowId){ + this.bomRowId=inBomRowId; + } +}