转pbom处理
This commit is contained in:
parent
a0337e5a41
commit
57aa6603ce
|
|
@ -16,4 +16,7 @@ public class BomConstant {
|
||||||
|
|
||||||
public static final Integer YES=1;
|
public static final Integer YES=1;
|
||||||
public static final Integer NO=0;
|
public static final Integer NO=0;
|
||||||
|
|
||||||
|
//工艺包物料类别编码
|
||||||
|
public static final String ART_PACKAGE_MATERIAL_CATEGORY_CODE="201201";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ public abstract class EBomToPbomBase {
|
||||||
|
|
||||||
//当子级为F项或Z项时-无需转的父级物料
|
//当子级为F项或Z项时-无需转的父级物料
|
||||||
protected Set<String> childDelMaterialNos = new HashSet<>();
|
protected Set<String> childDelMaterialNos = new HashSet<>();
|
||||||
|
private BomNewPbomParentEntity ;
|
||||||
|
|
||||||
public abstract void convert();
|
public abstract void convert();
|
||||||
|
|
||||||
|
|
@ -213,6 +214,77 @@ public abstract class EBomToPbomBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理PBOM-正式包含工艺包时:
|
||||||
|
* 1、将工艺包迁移过来。
|
||||||
|
* 2、建BOM中新增物料-迁移过来
|
||||||
|
* 3、将修改过的物料编码,项目类别,数量 复制过来。
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void handlerPBom(BomNewPbomParentEntity oldParent , List<BomNewEbomParentVO> newBomChildren){
|
||||||
|
|
||||||
|
List<BomNewPbomParentVO> oldChildren = SpringUtil.getBean(BomNewPbomParentService.class).getChild(oldParent.getRowId(), 1);
|
||||||
|
//PBOM手动添加的迁移过来
|
||||||
|
List<BomNewPbomParentVO> pBomCreateChildren = oldChildren.stream().filter(u -> PbomSourceStatusEnum.PBOM.equalsValue(u.getSourceStatus())).collect(Collectors.toList());
|
||||||
|
//Pbom新增的工艺包
|
||||||
|
List<BomNewPbomParentVO> pBomCreateArtPackage = pBomCreateChildren.stream().filter(u -> BomConstant.ART_PACKAGE_MATERIAL_CATEGORY_CODE.equals(u.getMaterialCategoryCode())).collect(Collectors.toList());
|
||||||
|
for (BomNewPbomParentVO pBomCreateArtPackageItem : pBomCreateArtPackage) {
|
||||||
|
if()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理PBOM新增物料
|
||||||
|
*/
|
||||||
|
private void handlerArtPackage(List<BomNewPbomParentVO> oldChildren , List<BomNewEbomParentVO> newBomChildren ,String facCode ,List<BomNewEbomParentVO> parentList){
|
||||||
|
List<BomNewEbomParentVO> resultAdd=new ArrayList<>();
|
||||||
|
//pbom 新增物料
|
||||||
|
List<BomNewPbomParentVO> oldPBomCreateChildren = oldChildren.stream().filter(u -> StrUtil.isBlank(u.getOriginalMaterialNo())).collect(Collectors.toList());
|
||||||
|
Map<String, BomNewEbomParentVO> newBomChildrenMap = newBomChildren.stream().collect(Collectors.toMap(BomNewEbomParentVO::getMaterialNo, u -> u));
|
||||||
|
//Pbom新增的工艺包
|
||||||
|
for (BomNewPbomParentVO oldPBomCreateArtPackageItem : oldPBomCreateChildren) {
|
||||||
|
//新的不包含虚拟包:1、将该虚拟包加在该物料下,
|
||||||
|
// 2、将虚拟包中的物料从该BOM中移除
|
||||||
|
if(!newBomChildrenMap.containsKey(oldPBomCreateArtPackageItem.getMaterialNo())){
|
||||||
|
BomNewEbomParentVO artChild=new BomNewEbomParentVO();
|
||||||
|
BeanUtil.copyProperties(oldPBomCreateArtPackageItem,artChild);
|
||||||
|
|
||||||
|
BomNewPbomParentEntity artParent = buildPBomParent(artChild, facCode, parentList);
|
||||||
|
//old 工艺包子级
|
||||||
|
List<BomNewPbomParentVO> oldArtChildren = SpringUtil.getBean(BomNewPbomParentService.class).getChild(oldPBomCreateArtPackageItem.getBomRowId(), 1);
|
||||||
|
if()
|
||||||
|
|
||||||
|
resultAdd.add(artChild);
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* T项外-是否一致
|
||||||
|
* @param oldChildren
|
||||||
|
* @param newChildren
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean pBomSameIs(List<BomNewPbomParentVO> oldChildren ,List<BomNewPbomParentVO> newChildren){
|
||||||
|
//旧bom除T项之外
|
||||||
|
List<BomNewPbomParentVO> oldBomNoTChildren = oldChildren.stream().filter(u -> !EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProjectType())).collect(Collectors.toList());
|
||||||
|
//新BOM 除T项外
|
||||||
|
List<BomNewPbomParentVO> newBomNoTChildren = newChildren.stream().filter(u -> !EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProjectType())).collect(Collectors.toList());
|
||||||
|
if(oldBomNoTChildren.size()!=newBomNoTChildren.size()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<String> oldSet = oldBomNoTChildren.stream().map(u -> u.getMaterialNoAndNumAndProjectType()).collect(Collectors.toSet());
|
||||||
|
Set<String> newSet = newChildren.stream().map(u -> u.getMaterialNoAndNumAndProjectType()).collect(Collectors.toSet());
|
||||||
|
if(oldSet.equals(newSet)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pbom明细对比
|
* Pbom明细对比
|
||||||
* @param pVo
|
* @param pVo
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||||
|
import com.nflg.product.bomnew.constant.PbomSourceStatusEnum;
|
||||||
import com.nflg.product.bomnew.pojo.dto.TechnologyPackageParam;
|
import com.nflg.product.bomnew.pojo.dto.TechnologyPackageParam;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||||
|
|
@ -232,6 +233,7 @@ public class TechnologyPackageParamBuilder {
|
||||||
child.setCreatedTime(LocalDateTime.now());
|
child.setCreatedTime(LocalDateTime.now());
|
||||||
child.setModifyTime(LocalDateTime.now());
|
child.setModifyTime(LocalDateTime.now());
|
||||||
child.setSourceRowId(0L);
|
child.setSourceRowId(0L);
|
||||||
|
child.setSourceStatus(PbomSourceStatusEnum.PBOM.getValue());
|
||||||
this.packageChildren.add(child);
|
this.packageChildren.add(child);
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue