转pbom处理-2
This commit is contained in:
parent
1e392b6a46
commit
1462232721
|
|
@ -283,46 +283,6 @@ public abstract class FormalEBomToPbomBase {
|
||||||
return newBomChildren;
|
return newBomChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取Pbom-下一个版本(只是项目类别发生变化则生成小版本,否则大版本)
|
|
||||||
*/
|
|
||||||
private String getPBomNextVersion(BomNewPbomParentEntity oldPBomParent, List<BomNewEbomParentVO> newChildren){
|
|
||||||
//旧bom除T项之外
|
|
||||||
List<BomNewPbomParentVO> oldBomDetail = SpringUtil.getBean(BomNewPbomParentService.class).getBaseMapper().getParentChild(oldPBomParent.getRowId());
|
|
||||||
List<BomNewPbomParentVO> oldBomNoTChildren = oldBomDetail.stream().filter(u -> !EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProjectType())).collect(Collectors.toList());
|
|
||||||
//新BOM 除T项外
|
|
||||||
List<BomNewEbomParentVO> newBomNoTChildren = newChildren.stream().filter(u -> !EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProjectType())).collect(Collectors.toList());
|
|
||||||
Set<String> oldChildSet = oldBomNoTChildren.stream().map(u -> u.getMaterialNoAndNum()).collect(Collectors.toSet());
|
|
||||||
Set<String> newChildSet = newBomNoTChildren.stream().map(u -> u.getMaterialNoAndNum()).collect(Collectors.toSet());
|
|
||||||
if(oldChildSet.equals(newChildSet)){
|
|
||||||
return VersionUtil.getNextVersionForSmallVersion(oldPBomParent.getCurrentVersion());
|
|
||||||
}
|
|
||||||
return VersionUtil.getNextVersion(oldPBomParent.getCurrentVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pbom明细对比
|
|
||||||
* @param pVo
|
|
||||||
* @param newChildren
|
|
||||||
* @param facCode
|
|
||||||
* @return 一样则返回true 否则返回 false
|
|
||||||
*/
|
|
||||||
protected boolean pBomSameIs(BomNewEbomParentVO pVo, List<BomNewEbomParentVO> newChildren, String facCode){
|
|
||||||
BomNewPbomParentEntity oldParent = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
|
||||||
.eq(BomNewPbomParentEntity::getMaterialNo, pVo.getMaterialNo())
|
|
||||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
|
||||||
//正式才需对比
|
|
||||||
if(Objects.nonNull(oldParent) && PBomStatusEnum.PUBLISH.getValue()<= oldParent.getStatus()){
|
|
||||||
List<BomNewPbomChildEntity> pBomChildList = SpringUtil.getBean(BomNewPbomChildService.class).lambdaQuery().eq(BomNewPbomChildEntity::getParentRowId, oldParent.getRowId()).list();
|
|
||||||
Set<String> oldSet = pBomChildList.stream().map(u -> StrUtil.join("",u.getMaterialNo(), u.getNum(), u.getProjectType())).collect(Collectors.toSet());
|
|
||||||
Set<String> newSet = newChildren.stream().map(u -> StrUtil.join("", u.getMaterialNo(), u.getNum(), u.getProjectType())).collect(Collectors.toSet());
|
|
||||||
if(oldSet.equals(newSet)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BomNewPbomParentEntity buildParentEntity(BomNewEbomParentVO parentVo, String facCode, BomNewPbomParentEntity oldParent, String bomVersion) {
|
private BomNewPbomParentEntity buildParentEntity(BomNewEbomParentVO parentVo, String facCode, BomNewPbomParentEntity oldParent, String bomVersion) {
|
||||||
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
||||||
BeanUtil.copyProperties(parentVo, pBomParent, "sourceRowId");
|
BeanUtil.copyProperties(parentVo, pBomParent, "sourceRowId");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue