1、BOM完整性优化:加载中提示,表单列表展示、支持下载

2、10、40、50、60、70大类以及200201小类这些不需要BOM的物料,版本号显示B00
This commit is contained in:
10002327 2024-10-12 16:11:29 +08:00
parent d5ce236a0c
commit cc31695be9
5 changed files with 72 additions and 9 deletions

View File

@ -433,10 +433,16 @@ public class PBomApi extends BaseApi {
@GetMapping("checkBomExist") @GetMapping("checkBomExist")
@ApiOperation("BOM完整性检查") @ApiOperation("BOM完整性检查")
public ResultVO<List<String>> checkBomExist(@Valid @RequestParam("bomRowId") @NotNull Long bomRowId, public ResultVO<List<CheckBomVO>> checkBomExist(@Valid @RequestParam("bomRowId") @NotNull Long bomRowId,
@Valid @RequestParam("type") @NotNull Integer type){ @Valid @RequestParam("type") @NotNull Integer type){
return ResultVO.success(bomNewPbomParentService.checkBomExist(bomRowId,type)); return ResultVO.success(bomNewPbomParentService.checkBomExist(bomRowId,type));
} }
@PostMapping("checkBomExport")
@ApiOperation("BOM完整性检查结果导出")
public void checkBomExport(@Valid @RequestBody @NotNull List<CheckBomVO> messages
, HttpServletResponse response) throws IOException {
EecExcelUtil.export(response, messages, CheckBomVO.class, "缺BOM信息");
}
} }

View File

@ -13,4 +13,7 @@ public class OriginalConstant {
public static final String NO_BOM_VERSION="A-1"; public static final String NO_BOM_VERSION="A-1";
public static final String DEFAULT_BOM_VERSION="A00"; public static final String DEFAULT_BOM_VERSION="A00";
//不需要有BOM的版本号 1040506070大类以及200201小类这些不需要BOM的物料版本号显示B00
public static final String NO_NEED_BOM = "B00";
} }

View File

@ -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;
}

View File

@ -392,7 +392,11 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
child.setVirtualPackageIs(parent.getVirtualPackageIs()); child.setVirtualPackageIs(parent.getVirtualPackageIs());
child.setTechnologyUserCode(parent.getTechnologyUserCode()); child.setTechnologyUserCode(parent.getTechnologyUserCode());
child.setTechnologyUserName(parent.getTechnologyUserName()); child.setTechnologyUserName(parent.getTechnologyUserName());
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) { // 1040506070大类以及200201小类这些不需要BOM的物料版本号显示B00 by 10002327 241012
if(MaterialshouldBomExistUtil.checkNoNeedBom(child)){
child.setCurrentVersion(OriginalConstant.NO_NEED_BOM);
}else
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION); child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
} else { } else {
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION); child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
@ -2006,17 +2010,17 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
* @param bomRowId * @param bomRowId
* @return * @return
*/ */
public List<String> checkBomExist(Long bomRowId, Integer type){ public List<CheckBomVO> checkBomExist(Long bomRowId, Integer type){
List<String> rList = Lists.newArrayList(); List<CheckBomVO> checkBomList = Lists.newArrayList();
BomNewPbomParentEntity parent = this.getById(bomRowId); BomNewPbomParentEntity parent = this.getById(bomRowId);
VUtils.isTure(parent == null).throwMessage("该BOM不存在" + bomRowId); VUtils.isTure(parent == null).throwMessage("该BOM不存在" + bomRowId);
checkChild(rList,parent,type,1,parent.getMaterialNo()); checkChild(checkBomList,parent,type,1,parent.getMaterialNo());
return rList; return checkBomList;
} }
private void checkChild(List<String> rList,BomNewPbomParentEntity parent, Integer type,int currLevel,String currNos){ private void checkChild(List<CheckBomVO> checkBomList ,BomNewPbomParentEntity parent, Integer type,int currLevel,String currNos){
List<BomNewPbomParentVO> cList = getChild(parent,type); List<BomNewPbomParentVO> cList = getChild(parent,type);
List<Long> bomRowIdList = cList.stream().filter(c -> c.getBomRowId() > 0).map(BomNewPbomParentVO::getBomRowId).distinct().collect(Collectors.toList()); List<Long> bomRowIdList = cList.stream().filter(c -> c.getBomRowId() > 0).map(BomNewPbomParentVO::getBomRowId).distinct().collect(Collectors.toList());
List<BomNewPbomParentEntity> pList = Lists.newArrayList(); List<BomNewPbomParentEntity> pList = Lists.newArrayList();
@ -2030,12 +2034,17 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
AtomicInteger finalCurrLevel = new AtomicInteger(currLevel); AtomicInteger finalCurrLevel = new AtomicInteger(currLevel);
cList.forEach(c -> { cList.forEach(c -> {
if(StrUtil.equalsIgnoreCase(OriginalConstant.NO_BOM_VERSION,c.getCurrentVersion())){ 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 不再递归判断为死循环 //不为空则进行递归 currLevel < 200 不再递归判断为死循环
if(finalPMap.get(c.getBomRowId()) != null && currLevel < 200){ if(finalPMap.get(c.getBomRowId()) != null && currLevel < 200){
finalCurrLevel.getAndIncrement(); 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());
} }
}); });

View File

@ -7,6 +7,7 @@ import com.nflg.product.bomnew.constant.OriginalConstant;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* 判断物料是否应该有BOM * 判断物料是否应该有BOM
@ -36,4 +37,16 @@ public class MaterialshouldBomExistUtil {
(materialCategoryCode.startsWith("20") && MaterialGetEnum.developing.equalsValue(materialGetType))); (materialCategoryCode.startsWith("20") && MaterialGetEnum.developing.equalsValue(materialGetType)));
} }
public static boolean checkNoNeedBom(BaseMaterialVO material){
//1040506070大类以及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())
);
}
} }