Merge branch 'feature/DM/nflg-bom-transition' of http://192.168.0.40:3000/root/nflg_project into feature/DM/nflg-bom-transition

This commit is contained in:
曹鹏飞 2024-08-15 10:12:38 +08:00
commit 553e9f699d
3 changed files with 46 additions and 0 deletions

View File

@ -12,4 +12,8 @@ public class BomConstant {
public static final String PROJECT_TYPE_TEMPORARY = "T";
public static final String PROJECT_TYPE_TEMPORARY_MATERIAL_NO = "9000000000";
public static final Integer YES=1;
public static final Integer NO=0;
}

View File

@ -357,6 +357,10 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
@ApiModelProperty("父级物料RowId")
private List<Long> parentRowIds=new ArrayList<>();
@ApiModelProperty("因子级都为F or Z 项而不转")
private Integer notToPBomForFZ=0;
private static final long serialVersionUID = 1L;
@Override

View File

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.excel.enums.BooleanEnum;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@ -745,14 +746,47 @@ public abstract class EBomToPbomBase {
if (!VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey().equals(parentBom.getVirtualPartType()) && !VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey().equals(parentBom.getVirtualPartType()) &&
(ImmutableSet.of("F").equals(projectSet) || ImmutableSet.of("F", "Z").equals(projectSet) || ImmutableSet.of("Z").equals(projectSet))) {
parentBom.setNoConvertToPBomIs(1);
parentBom.setNotToPBomForFZ(BomConstant.YES);
childDelMaterialNos.add(parentBom.getMaterialNo());
}
}
}
}
//递归 FZ项所有父级
handlerFZEmptyBom();
}
/**
* 处理子级都是F项的空BOM
*/
private void handlerFZEmptyBom() {
List<BomNewEbomParentVO> parentBoms = getParentForAllSubNodeIsNotToPBomForFZ();
while (CollUtil.isNotEmpty(parentBoms)){
parentBoms.forEach(u->{
u.setNoConvertToPBomIs(1);
u.setNotToPBomForFZ(BomConstant.YES);
childDelMaterialNos.add(u.getMaterialNo());
});
parentBoms = getParentForAllSubNodeIsNotToPBomForFZ();
}
}
private List<BomNewEbomParentVO> getParentForAllSubNodeIsNotToPBomForFZ(){
Map<Long, List<BomNewEbomParentVO>> parentMp = allBomDetail.stream().filter(u->u.getParentRowId()>0).collect(Collectors.groupingBy(BomNewEbomParentVO::getParentRowId));
List<BomNewEbomParentVO> result=new ArrayList<>();
parentMp.forEach((k,v)->{
List<BomNewEbomParentVO> parent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(k)).collect(Collectors.toList());
if(Objects.nonNull(parent) && CollUtil.isNotEmpty(parent) && BomConstant.NO.equals(parent.get(0).getNotToPBomForFZ()) ) {
Optional<BomNewEbomParentVO> min = v.stream().min(Comparator.comparingInt(BomNewEbomParentVO::getNotToPBomForFZ));
if (min.isPresent() && BomConstant.YES.equals(min.get().getNotToPBomForFZ())) {
result.add(parent.get(0));
}
}
});
return result;
}
/**
@ -770,6 +804,7 @@ public abstract class EBomToPbomBase {
if (!VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey().equals(parentBom.getVirtualPartType()) && !VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey().equals(parentBom.getVirtualPartType()) &&
(ImmutableSet.of("F").equals(projectSet) || ImmutableSet.of("F", "Z").equals(projectSet) || ImmutableSet.of("Z").equals(projectSet))) {
parentBom.setNoConvertToPBomIs(1);
parentBom.setNotToPBomForFZ(BomConstant.YES);
childDelMaterialNos.add(parentBom.getMaterialNo());
}
}
@ -777,6 +812,9 @@ public abstract class EBomToPbomBase {
}
//递归 FZ项所有父级
handlerFZEmptyBom();
}
/**