EBOM-初始化项目类别:跳过已发布版BOM

This commit is contained in:
大米 2024-09-09 15:14:31 +08:00
parent fc13cf3700
commit afd82d5c15
1 changed files with 17 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package com.nflg.product.bomnew.service.domain.EBom;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.nflg.product.bomnew.constant.EBomStatusEnum;
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum; import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO; import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import lombok.Getter; import lombok.Getter;
@ -42,7 +43,7 @@ public class EbomInitProjectType {
public void initProjectType() { public void initProjectType() {
for (BomNewEbomParentVO child : allChild) { for (BomNewEbomParentVO child : allChild) {
if (StrUtil.isBlank(child.getMaterialCategoryCode())) { if (StrUtil.isBlank(child.getMaterialCategoryCode()) || skipPublishedBom(child)) {
continue; continue;
} }
String materialProjectType = child.getProjectType(); String materialProjectType = child.getProjectType();
@ -126,6 +127,9 @@ public class EbomInitProjectType {
List<BomNewEbomParentVO> sameLevelChild = new ArrayList<>(); List<BomNewEbomParentVO> sameLevelChild = new ArrayList<>();
List<BomNewEbomParentVO> sResult = new ArrayList<>(); List<BomNewEbomParentVO> sResult = new ArrayList<>();
for (BomNewEbomParentVO child : list2009) { for (BomNewEbomParentVO child : list2009) {
if(skipPublishedBom(child)){
continue;
}
sameLevelChild = getChilds(child.getParentRowId()); sameLevelChild = getChilds(child.getParentRowId());
sResult = sameLevelChild.stream().filter(u -> u.getMaterialCategoryCode().startsWith("2005") || u.getMaterialCategoryCode().startsWith("2006")).collect(Collectors.toList()); sResult = sameLevelChild.stream().filter(u -> u.getMaterialCategoryCode().startsWith("2005") || u.getMaterialCategoryCode().startsWith("2006")).collect(Collectors.toList());
if (CollUtil.isNotEmpty(sResult)) { if (CollUtil.isNotEmpty(sResult)) {
@ -142,6 +146,9 @@ public class EbomInitProjectType {
List<BomNewEbomParentVO> sResult1004 = new ArrayList<>(); List<BomNewEbomParentVO> sResult1004 = new ArrayList<>();
List<BomNewEbomParentVO> sResultProjectL = new ArrayList<>(); List<BomNewEbomParentVO> sResultProjectL = new ArrayList<>();
for (BomNewEbomParentVO child : list1004) { for (BomNewEbomParentVO child : list1004) {
if(skipPublishedBom(child)){
continue;
}
//同层物料 //同层物料
sameLevelChild1004 = getChilds(child.getParentRowId()); sameLevelChild1004 = getChilds(child.getParentRowId());
//除紧固件外的其他物料 //除紧固件外的其他物料
@ -165,6 +172,15 @@ public class EbomInitProjectType {
} }
/**
* 已发布BOM-跳过初始化项目类别
* @param vo
*/
private boolean skipPublishedBom(BomNewEbomParentVO vo){
List<BomNewEbomParentVO> voParent = allChild.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
return CollUtil.isNotEmpty(voParent) && voParent.get(0).getStatus()>= EBomStatusEnum.PUBLISHED.getValue();
}
/** /**
* 判断项目类型是否一致 * 判断项目类型是否一致
* *