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 eecf23d2..95b2ca91 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 @@ -432,11 +432,17 @@ public class PBomApi extends BaseApi { @GetMapping("checkBomExist") @ApiOperation("BOM完整性检查") - public ResultVO> checkBomExist(@Valid @RequestParam("bomRowId") @NotNull Long bomRowId, + public ResultVO> checkBomExist(@Valid @RequestParam("bomRowId") @NotNull Long bomRowId, @Valid @RequestParam("type") @NotNull Integer type){ return ResultVO.success(bomNewPbomParentService.checkBomExist(bomRowId,type)); } + @PostMapping("checkBomExport") + @ApiOperation("BOM完整性检查结果导出") + public void checkBomExport(@Valid @RequestBody @NotNull List messages + , HttpServletResponse response) throws IOException { + EecExcelUtil.export(response, messages, CheckBomVO.class, "缺BOM信息"); + } @PostMapping("checkException") @ApiOperation("PBOM-数据异常检查") diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/OriginalConstant.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/OriginalConstant.java index 0d338063..ca0036d6 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/OriginalConstant.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/OriginalConstant.java @@ -13,4 +13,7 @@ public class OriginalConstant { public static final String NO_BOM_VERSION="A-1"; public static final String DEFAULT_BOM_VERSION="A00"; + + //不需要有BOM的版本号 10、40、50、60、70大类以及200201小类这些不需要BOM的物料,版本号显示B00 + public static final String NO_NEED_BOM = "B00"; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CheckBomVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CheckBomVO.java new file mode 100644 index 00000000..c33774b6 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/CheckBomVO.java @@ -0,0 +1,32 @@ +package com.nflg.product.bomnew.pojo.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; +import org.ttzero.excel.annotation.ExcelColumn; + +import java.io.Serializable; + +/** + * packageName com.nflg.product.bomnew.pojo.vo + * + * @author luohj + * @className CheckBomVO + * @date 2024/10/12 0012 + * @description BOM完整性检查 + */ +@Data +@Accessors(chain = true) +public class CheckBomVO implements Serializable { + + @ApiModelProperty(value = "路径") + @ExcelColumn("路径") + private String path; + + @ApiModelProperty(value = "路径中最后一个BOM") + private String lastBom; + + @ApiModelProperty(value = "图号") + @ExcelColumn("图号") + private String drawingNo; +} \ No newline at end of file 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 1907368f..2ca0f652 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 @@ -443,7 +443,10 @@ public class BomNewEbomParentService extends ServiceImpl checkBomExist(Long bomRowId, Integer type){ - List rList = Lists.newArrayList(); + public List checkBomExist(Long bomRowId, Integer type){ + List checkBomList = Lists.newArrayList(); BomNewPbomParentEntity parent = this.getById(bomRowId); VUtils.isTure(parent == null).throwMessage("该BOM不存在:" + bomRowId); - checkChild(rList,parent,type,1,parent.getMaterialNo()); - return rList; + checkChild(checkBomList,parent,type,1,parent.getMaterialNo()); + return checkBomList; } - private void checkChild(List rList,BomNewPbomParentEntity parent, Integer type,int currLevel,String currNos){ + private void checkChild(List checkBomList ,BomNewPbomParentEntity parent, Integer type,int currLevel,String currNos){ List cList = getChild(parent,type); List bomRowIdList = cList.stream().filter(c -> c.getBomRowId() > 0).map(BomNewPbomParentVO::getBomRowId).distinct().collect(Collectors.toList()); List pList = Lists.newArrayList(); @@ -2049,12 +2052,17 @@ public class BomNewPbomParentService extends ServiceImpl { if(StrUtil.equalsIgnoreCase(OriginalConstant.NO_BOM_VERSION,c.getCurrentVersion())){ - rList.add(currNos + " > " + c.getMaterialNo()); + //rList.add(currNos + " > " + c.getMaterialNo()); + CheckBomVO checkBomVO = new CheckBomVO(); + checkBomVO.setPath(currNos + " > " + c.getMaterialNo()); + checkBomVO.setLastBom(c.getMaterialNo()); + checkBomVO.setDrawingNo(c.getDrawingNo()); + checkBomList.add(checkBomVO); } //不为空则进行递归 currLevel < 200 不再递归判断为死循环 if(finalPMap.get(c.getBomRowId()) != null && currLevel < 200){ finalCurrLevel.getAndIncrement(); - checkChild(rList,finalPMap.get(c.getBomRowId()),type, finalCurrLevel.get(),currNos + " > " + finalPMap.get(c.getBomRowId()).getMaterialNo()); + checkChild(checkBomList,finalPMap.get(c.getBomRowId()),type, finalCurrLevel.get(),currNos + " > " + finalPMap.get(c.getBomRowId()).getMaterialNo()); } }); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/MaterialshouldBomExistUtil.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/MaterialshouldBomExistUtil.java index 559cf1ab..c9171ffb 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/MaterialshouldBomExistUtil.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/util/MaterialshouldBomExistUtil.java @@ -7,6 +7,7 @@ import com.nflg.product.bomnew.constant.OriginalConstant; import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; import java.util.List; +import java.util.Objects; /** * 判断物料是否应该有BOM @@ -36,4 +37,16 @@ public class MaterialshouldBomExistUtil { (materialCategoryCode.startsWith("20") && MaterialGetEnum.developing.equalsValue(materialGetType))); } + + public static boolean checkNoNeedBom(BaseMaterialVO material){ + //10、40、50、60、70大类以及200201小类这些不需要BOM的物料,版本号显示B00 by 10002327 241012 + return material != null && StrUtil.isNotBlank(material.getMaterialCategoryCode()) + && (material.getMaterialCategoryCode().startsWith("10") || + material.getMaterialCategoryCode().startsWith("40") || + material.getMaterialCategoryCode().startsWith("50") || + material.getMaterialCategoryCode().startsWith("60") || + material.getMaterialCategoryCode().startsWith("70") || + Objects.equals("200201",material.getMaterialCategoryCode()) + ); + } }