Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition
This commit is contained in:
commit
ba0ab67053
|
|
@ -947,6 +947,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()) );
|
||||
}
|
||||
//替换需覆盖的受影响的虚拟包
|
||||
if(CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResultForCover())){
|
||||
for (BomNewEbomUpgradeChangeEntity upgradeChangeResultForCoverEnt : eBomToPBom.getUpgradeChangeResultForCover()) {
|
||||
upgradeChangeService.updateChangeImpactDo(upgradeChangeResultForCoverEnt);
|
||||
}
|
||||
}
|
||||
|
||||
//子级记录-bom版本
|
||||
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
|
||||
bomTree.forEach(k -> {
|
||||
|
|
|
|||
|
|
@ -1,38 +1,22 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.bomnew.constant.ConvertToPBomModelEnum;
|
||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpdateDetailMapper;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.service.domain.EBom.*;
|
||||
import com.nflg.product.bomnew.util.EnumUtils;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import nonapi.io.github.classgraph.json.Id;
|
||||
import com.nflg.product.bomnew.service.domain.EBom.ChangeImpactUpgrade;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -48,9 +32,6 @@ import java.util.stream.Collectors;
|
|||
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
BomNewPbomParentService pbomParentService;
|
||||
|
||||
|
|
@ -61,8 +42,6 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
|||
BomNewEbomParentService ebomParentService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
|
@ -79,6 +58,17 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
|||
//
|
||||
for (BomNewEbomUpgradeChangeEntity ent : upList) {
|
||||
|
||||
updateChangeImpactDo(ent);
|
||||
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)) {
|
||||
|
|
@ -105,23 +95,7 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
|||
pbomParentService.getBaseMapper().insertPBomChildToFormal(oldPBomRowIds);
|
||||
pbomParentService.getBaseMapper().delPBom(oldPBomRowIds);
|
||||
}
|
||||
ent.setStatus(1);
|
||||
ent.setUpdatedTime(LocalDateTime.now());
|
||||
this.updateById(ent);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public class ChangeImpactUpgrade extends EBomToPbomBase {
|
|||
//pbom 处于工作表
|
||||
else if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) {
|
||||
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.setCreatedTime(LocalDateTime.now());
|
||||
this.pBomParentResult.add(oldParent);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ public abstract class EBomToPbomBase {
|
|||
@Getter
|
||||
protected List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
||||
|
||||
//需覆盖的虚拟包
|
||||
@Getter
|
||||
protected List<BomNewEbomUpgradeChangeEntity> upgradeChangeResultForCover=new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
// protected List<BomNewEbomUpdateDetailEntity> upgradeChangeDetailResult = new ArrayList<>();
|
||||
|
||||
|
|
@ -488,7 +492,16 @@ public abstract class EBomToPbomBase {
|
|||
changeEntity.setUpdatedTime(LocalDateTime.now());
|
||||
changeEntity.setFacCode(v.getFacCode());
|
||||
changeEntity.setVirtualMaterialParentMaterialNo(v.getVirtualMaterialParentMaterialNo());
|
||||
//虚拟包最新版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