1、pbom升级
This commit is contained in:
parent
12bedbf9a2
commit
ccee79d329
|
|
@ -368,7 +368,7 @@ public abstract class EBomToPbomBase {
|
||||||
packageCompositionEntity.setFromLiftingLayerState(1);
|
packageCompositionEntity.setFromLiftingLayerState(1);
|
||||||
}
|
}
|
||||||
packageCompositionEntity.setCurrentVersion(lastVirtualPackage.getCurrentVersion());
|
packageCompositionEntity.setCurrentVersion(lastVirtualPackage.getCurrentVersion());
|
||||||
List<BomNewEbomParentVO> vParentM = allBomDetail.stream().filter(u -> lastVirtualPackage.getBomRowId().equals(u.getParentRowId())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> vParentM = allBomDetail.stream().filter(u -> lastVirtualPackage.getParentRowId().equals(u.getBomRowId())).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(vParentM)) {
|
if (CollUtil.isNotEmpty(vParentM)) {
|
||||||
packageCompositionEntity.setVirtualMaterialParentMaterialNo(vParentM.get(0).getMaterialNo());
|
packageCompositionEntity.setVirtualMaterialParentMaterialNo(vParentM.get(0).getMaterialNo());
|
||||||
}
|
}
|
||||||
|
|
@ -380,7 +380,7 @@ public abstract class EBomToPbomBase {
|
||||||
*/
|
*/
|
||||||
protected void changeImpact() {
|
protected void changeImpact() {
|
||||||
// Set<String> vmaterialNo = allBomDetail.stream().filter(u -> VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(u.getVirtualPartType()) || VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.equalsValue(u.getVirtualPartType())).map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
// Set<String> vmaterialNo = allBomDetail.stream().filter(u -> VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.equalsValue(u.getVirtualPartType()) || VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.equalsValue(u.getVirtualPartType())).map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
||||||
List<BomNewEbomParentVO> firstParent = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getRowId())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> firstParent = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getBomRowId())).collect(Collectors.toList());
|
||||||
for (BomNewEbomParentVO vo : firstParent) {
|
for (BomNewEbomParentVO vo : firstParent) {
|
||||||
changeImpactDo(vo);
|
changeImpactDo(vo);
|
||||||
}
|
}
|
||||||
|
|
@ -390,8 +390,7 @@ public abstract class EBomToPbomBase {
|
||||||
|
|
||||||
private void changeImpactDo(BomNewEbomParentVO parentVO) {
|
private void changeImpactDo(BomNewEbomParentVO parentVO) {
|
||||||
List<BomNewEbomParentVO> subVos = getAllSubInListIncludeSelf(parentVO,allBomDetail);
|
List<BomNewEbomParentVO> subVos = getAllSubInListIncludeSelf(parentVO,allBomDetail);
|
||||||
// allBomDetail.stream().filter(u -> u.getLevelNumber().compareTo(parentVO.getLevelNumber()) >= 0 && u.getLevelNumber().compareTo(NumberUtil.add(parentVO.getLevelNumber(), BigDecimal.valueOf(0.01))) < 0)
|
|
||||||
// .sorted(Comparator.comparing(BomNewEbomParentVO::getLevelNumber)).collect(Collectors.toList());
|
|
||||||
List<BomNewEbomParentVO> subVosParent = subVos.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
List<BomNewEbomParentVO> subVosParent = subVos.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
||||||
for (BomNewEbomParentVO vo : subVosParent) {
|
for (BomNewEbomParentVO vo : subVosParent) {
|
||||||
if (compareVirtualPackage(vo)) {
|
if (compareVirtualPackage(vo)) {
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,7 @@ import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.RecursiveTask;
|
import java.util.concurrent.RecursiveTask;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -59,9 +57,17 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
||||||
|
|
||||||
List<BomNewPbomParentEntity> childBomlist = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
List<BomNewPbomParentEntity> childBomlist = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
||||||
.in(BomNewPbomParentEntity::getMaterialNo, materialNos)
|
.in(BomNewPbomParentEntity::getMaterialNo, materialNos)
|
||||||
.eq(BomNewPbomParentEntity::getLastVersionIs, 1)
|
|
||||||
.eq(BomNewPbomParentEntity::getFacCode,facCode).list();
|
.eq(BomNewPbomParentEntity::getFacCode,facCode).list();
|
||||||
Map<String, BomNewPbomParentEntity> parentMap = ListCommonUtil.listToMap(childBomlist, BomNewPbomParentEntity::getMaterialNo);
|
// Map<String, BomNewPbomParentEntity> parentMap = ListCommonUtil.listToMap(childBomlist, BomNewPbomParentEntity::getMaterialNo);
|
||||||
|
Map<String, BomNewPbomParentEntity> parentMap = childBomlist.stream()
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
BomNewPbomParentEntity::getMaterialNo,
|
||||||
|
Collectors.collectingAndThen(
|
||||||
|
Collectors.maxBy(Comparator.comparing(BomNewPbomParentEntity::getCurrentVersion)),
|
||||||
|
Optional::get
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
for (BomNewPbomParentVO detailVO : bomDetail) {
|
for (BomNewPbomParentVO detailVO : bomDetail) {
|
||||||
if (parentMap.containsKey(detailVO.getMaterialNo())) {
|
if (parentMap.containsKey(detailVO.getMaterialNo())) {
|
||||||
BomNewPbomParentEntity ebomParentEntity = parentMap.get(detailVO.getMaterialNo());
|
BomNewPbomParentEntity ebomParentEntity = parentMap.get(detailVO.getMaterialNo());
|
||||||
|
|
@ -76,7 +82,7 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
||||||
detailVO.setDeviseUserCode(ebomParentEntity.getDeviseUserCode());
|
detailVO.setDeviseUserCode(ebomParentEntity.getDeviseUserCode());
|
||||||
|
|
||||||
detailVO.setCreatedTime(ebomParentEntity.getCreatedTime());
|
detailVO.setCreatedTime(ebomParentEntity.getCreatedTime());
|
||||||
|
detailVO.setCreatedBy(ebomParentEntity.getCreatedBy());
|
||||||
detailVO.setLevelNum(ebomParentEntity.getLevelNum());
|
detailVO.setLevelNum(ebomParentEntity.getLevelNum());
|
||||||
detailVO.setDeptName(ebomParentEntity.getDeptName());
|
detailVO.setDeptName(ebomParentEntity.getDeptName());
|
||||||
detailVO.setChangeDesc(ebomParentEntity.getChangeDesc());
|
detailVO.setChangeDesc(ebomParentEntity.getChangeDesc());
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,8 @@ public class PBomUpgrade {
|
||||||
private void buildParent(BomNewPbomParentVO parentVO, boolean rootIs) {
|
private void buildParent(BomNewPbomParentVO parentVO, boolean rootIs) {
|
||||||
//判断有无未发布版本-有则直接跳过
|
//判断有无未发布版本-有则直接跳过
|
||||||
List<BomNewPbomParentEntity> waitPublishBomList = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parentVO.getMaterialNo())
|
List<BomNewPbomParentEntity> waitPublishBomList = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parentVO.getMaterialNo())
|
||||||
.eq(BomNewPbomParentEntity::getStatus, PBomStatusEnum.WAIT_PUBLISH.getValue()).list();
|
.eq(BomNewPbomParentEntity::getFacCode, parentVO.getFacCode())
|
||||||
|
.lt(BomNewPbomParentEntity::getStatus, PBomStatusEnum.WAIT_PUBLISH.getValue()).list();
|
||||||
if(CollUtil.isNotEmpty(waitPublishBomList)){
|
if(CollUtil.isNotEmpty(waitPublishBomList)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue