1、替换草稿态的虚拟包
This commit is contained in:
parent
6176f3b903
commit
78b4b9ac38
|
|
@ -949,6 +949,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
//将历史已发布版-转移到正式历史表
|
//将历史已发布版-转移到正式历史表
|
||||||
eBomToFormal(bomRowIds, bomTree.stream().filter(u ->!u.getHasChangeState().equals(1) && !EBomStatusEnum.PUBLISHED.equalsValue(u.getStatus()) && u.getBomRowId() > 0).collect(Collectors.toList()) );
|
eBomToFormal(bomRowIds, bomTree.stream().filter(u ->!u.getHasChangeState().equals(1) && !EBomStatusEnum.PUBLISHED.equalsValue(u.getStatus()) && u.getBomRowId() > 0).collect(Collectors.toList()) );
|
||||||
}
|
}
|
||||||
|
//替换需覆盖的受影响的虚拟包
|
||||||
|
if(CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResultForCover())){
|
||||||
|
for (BomNewEbomUpgradeChangeEntity upgradeChangeResultForCoverEnt : eBomToPBom.getUpgradeChangeResultForCover()) {
|
||||||
|
upgradeChangeService.updateChangeImpactDo(upgradeChangeResultForCoverEnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//子级记录-bom版本
|
//子级记录-bom版本
|
||||||
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
|
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
|
||||||
bomTree.forEach(k -> {
|
bomTree.forEach(k -> {
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,6 @@ import java.util.stream.Collectors;
|
||||||
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
BomNewPbomParentService pbomParentService;
|
BomNewPbomParentService pbomParentService;
|
||||||
|
|
||||||
|
|
@ -61,12 +58,10 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
||||||
BomNewEbomParentService ebomParentService;
|
BomNewEbomParentService ebomParentService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
public void delChangeImpact(List<Long> rowIds){
|
public void delChangeImpact(List<Long> rowIds) {
|
||||||
this.getBaseMapper().deleteBatchIds(rowIds);
|
this.getBaseMapper().deleteBatchIds(rowIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,51 +72,46 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
||||||
public void updateChangeImpactVersion(List<Long> rowIds) throws ExecutionException, InterruptedException {
|
public void updateChangeImpactVersion(List<Long> rowIds) throws ExecutionException, InterruptedException {
|
||||||
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
|
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
|
||||||
//
|
//
|
||||||
for ( BomNewEbomUpgradeChangeEntity ent:upList) {
|
for (BomNewEbomUpgradeChangeEntity ent : upList) {
|
||||||
|
|
||||||
BomNewEbomParentEntity ebom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, ent.getVirtualMaterialParentMaterialNo())
|
updateChangeImpactDo(ent);
|
||||||
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).last(" order by current_version desc limit 1").one();
|
ent.setStatus(1);
|
||||||
if(Objects.nonNull(ebom)){
|
ent.setUpdatedTime(LocalDateTime.now());
|
||||||
|
this.updateById(ent);
|
||||||
|
|
||||||
List<BomNewEbomParentVO> bomTree =ebomParentService.getFormalBomTree(ebom.getRowId());
|
}
|
||||||
BomNewEbomParentVO parentBom = Convert.convert(BomNewEbomParentVO.class, ebom);
|
|
||||||
parentBom.setBomRowId(ebom.getRowId());
|
|
||||||
parentBom.setChildBomRowId(ebom.getRowId());
|
|
||||||
parentBom.setParentRowId(0L);
|
|
||||||
bomTree.add(parentBom);
|
|
||||||
ChangeImpactUpgrade updateImpact=new ChangeImpactUpgrade(parentBom, bomTree, ImmutableList.of(ent.getFacCode()),ent.getMaterialNo());
|
|
||||||
updateImpact.convert();
|
|
||||||
|
|
||||||
if(CollUtil.isNotEmpty(updateImpact.getPBomParentResult())){
|
|
||||||
pbomParentService.saveOrUpdateBatch(updateImpact.getPBomParentResult());
|
|
||||||
}
|
|
||||||
if(CollUtil.isNotEmpty(updateImpact.getPBomChildResult())){
|
|
||||||
pbomChildService.saveOrUpdateBatch(updateImpact.getPBomChildResult());
|
|
||||||
}
|
|
||||||
//旧版PBOM移动到历史表中
|
|
||||||
if(CollUtil.isNotEmpty(updateImpact.getOldPBomList())){
|
|
||||||
List<Long> oldPBomRowIds = updateImpact.getOldPBomList().stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
|
||||||
pbomParentService.getBaseMapper().insertPBomParentToFormal(oldPBomRowIds);
|
|
||||||
pbomParentService.getBaseMapper().insertPBomChildToFormal(oldPBomRowIds);
|
|
||||||
pbomParentService.getBaseMapper().delPBom(oldPBomRowIds);
|
|
||||||
}
|
|
||||||
ent.setStatus(1);
|
|
||||||
ent.setUpdatedTime(LocalDateTime.now());
|
|
||||||
this.updateById(ent);
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateChangeImpactDo(BomNewEbomUpgradeChangeEntity ent) throws ExecutionException, InterruptedException {
|
||||||
|
BomNewEbomParentEntity ebom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, ent.getVirtualMaterialParentMaterialNo())
|
||||||
|
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).last(" order by current_version desc limit 1").one();
|
||||||
|
if (Objects.nonNull(ebom)) {
|
||||||
|
|
||||||
|
List<BomNewEbomParentVO> bomTree = ebomParentService.getFormalBomTree(ebom.getRowId());
|
||||||
|
BomNewEbomParentVO parentBom = Convert.convert(BomNewEbomParentVO.class, ebom);
|
||||||
|
parentBom.setBomRowId(ebom.getRowId());
|
||||||
|
parentBom.setChildBomRowId(ebom.getRowId());
|
||||||
|
parentBom.setParentRowId(0L);
|
||||||
|
bomTree.add(parentBom);
|
||||||
|
ChangeImpactUpgrade updateImpact = new ChangeImpactUpgrade(parentBom, bomTree, ImmutableList.of(ent.getFacCode()), ent.getMaterialNo());
|
||||||
|
updateImpact.convert();
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(updateImpact.getPBomParentResult())) {
|
||||||
|
pbomParentService.saveOrUpdateBatch(updateImpact.getPBomParentResult());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(updateImpact.getPBomChildResult())) {
|
||||||
|
pbomChildService.saveOrUpdateBatch(updateImpact.getPBomChildResult());
|
||||||
|
}
|
||||||
|
//旧版PBOM移动到历史表中
|
||||||
|
if (CollUtil.isNotEmpty(updateImpact.getOldPBomList())) {
|
||||||
|
List<Long> oldPBomRowIds = updateImpact.getOldPBomList().stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||||
|
pbomParentService.getBaseMapper().insertPBomParentToFormal(oldPBomRowIds);
|
||||||
|
pbomParentService.getBaseMapper().insertPBomChildToFormal(oldPBomRowIds);
|
||||||
|
pbomParentService.getBaseMapper().delPBom(oldPBomRowIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ public class ChangeImpactUpgrade extends EBomToPbomBase {
|
||||||
//pbom 处于工作表
|
//pbom 处于工作表
|
||||||
else if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) {
|
else if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) {
|
||||||
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
||||||
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
// oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||||
oldParent.setSourceRowId(parentVo.getRowId());
|
oldParent.setSourceRowId(parentVo.getRowId());
|
||||||
oldParent.setCreatedTime(LocalDateTime.now());
|
oldParent.setCreatedTime(LocalDateTime.now());
|
||||||
this.pBomParentResult.add(oldParent);
|
this.pBomParentResult.add(oldParent);
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,10 @@ public abstract class EBomToPbomBase {
|
||||||
@Getter
|
@Getter
|
||||||
protected List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
protected List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
||||||
|
|
||||||
|
//需覆盖的虚拟包
|
||||||
|
@Getter
|
||||||
|
protected List<BomNewEbomUpgradeChangeEntity> upgradeChangeResultForCover=new ArrayList<>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
// protected List<BomNewEbomUpdateDetailEntity> upgradeChangeDetailResult = new ArrayList<>();
|
// protected List<BomNewEbomUpdateDetailEntity> upgradeChangeDetailResult = new ArrayList<>();
|
||||||
|
|
||||||
|
|
@ -485,7 +489,16 @@ public abstract class EBomToPbomBase {
|
||||||
changeEntity.setUpdatedTime(LocalDateTime.now());
|
changeEntity.setUpdatedTime(LocalDateTime.now());
|
||||||
changeEntity.setFacCode(v.getFacCode());
|
changeEntity.setFacCode(v.getFacCode());
|
||||||
changeEntity.setVirtualMaterialParentMaterialNo(v.getVirtualMaterialParentMaterialNo());
|
changeEntity.setVirtualMaterialParentMaterialNo(v.getVirtualMaterialParentMaterialNo());
|
||||||
upgradeChangeResult.add(changeEntity);
|
//虚拟包最新版PBom
|
||||||
|
BomNewPbomParentEntity lastVirtrualPbomEnt = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
||||||
|
.eq(BomNewPbomParentEntity::getMaterialNo, v.getVirtualPackageMaterialNo())
|
||||||
|
.eq(BomNewPbomParentEntity::getFacCode,v.getFacCode())
|
||||||
|
.last("order by current_version desc limit 1").one();
|
||||||
|
if(Objects.nonNull(lastVirtrualPbomEnt) && PBomStatusEnum.PUBLISH.getValue()>lastVirtrualPbomEnt.getStatus()){
|
||||||
|
upgradeChangeResultForCover.add(changeEntity);
|
||||||
|
}else {
|
||||||
|
upgradeChangeResult.add(changeEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue