F提层后造成的空包要递归往上检查删除-先不发生产
This commit is contained in:
parent
c15239baff
commit
b23e22d9a8
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//递归 F,Z项所有父级
|
||||
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 {
|
|||
|
||||
}
|
||||
|
||||
//递归 F,Z项所有父级
|
||||
handlerFZEmptyBom();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue