Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
This commit is contained in:
commit
a0409d15e5
|
|
@ -40,6 +40,7 @@ import java.util.*;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ForkJoinTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -425,8 +426,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
*/
|
||||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail,countLevelNum);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail,countLevelNum,levelNum);
|
||||
ForkJoinTask<List<BomNewPbomParentVO>> submit = bomDetailPool.submit(detailTask);
|
||||
|
||||
List<BomNewPbomParentVO> result = submit.join();
|
||||
|
|
@ -561,7 +562,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
//将PBOM改为已发布
|
||||
List<Long> bomRowIds = allChild.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||
rootParent.setOrderNo("订单号");
|
||||
|
||||
rootParent.setStatus(PBomStatusEnum.PUBLISH.getValue());
|
||||
this.updateById(rootParent);
|
||||
if(CollUtil.isNotEmpty(bomRowIds)){
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ public class VirtualPackageFor31 extends VirtualPackageBase {
|
|||
buildChild(makingPackage, deliveryPackage.getRowId(), "001", VirtualPackageTypeEnum.MAKING_PACKAGE);
|
||||
buildChild(directDeliveryPackage, deliveryPackage.getRowId(), "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
|
||||
|
||||
|
||||
BomNewEbomChildEntity itemUp = new BomNewEbomChildEntity();
|
||||
itemUp.setRowId(item.getRowId());
|
||||
itemUp.setParentRowId(makingPackage.getRowId());
|
||||
|
|
@ -72,16 +70,24 @@ public class VirtualPackageFor31 extends VirtualPackageBase {
|
|||
}
|
||||
buildChild(preAssemblyPackage, makingPackage.getRowId(), "001", VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
parent.setVirtrualPackageEnum(VirtualPackageTypeEnum.getAll());
|
||||
parent.setVirtrualPackageEnum(getVPackageNum(parent));
|
||||
this.parentResult.add(parent);
|
||||
|
||||
}catch (Exception ex) {
|
||||
throw new NflgBusinessException(STATE.BusinessError, ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private Integer getVPackageNum(BomNewEbomParentEntity parent){
|
||||
Integer vNum= parent.getVirtrualPackageEnum();
|
||||
for ( Integer i: virtualPackageValue) {
|
||||
vNum=vNum|i;
|
||||
}
|
||||
return vNum;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
BigDecimal numResult = BigDecimal.ZERO;
|
||||
BigDecimal totalWeightResult = BigDecimal.ZERO;
|
||||
for (BomOriginalListVO item : list1) {
|
||||
numResult = Objects.nonNull(item.getNum()) ? item.getNum() : BigDecimal.ZERO;
|
||||
numResult = NumberUtil.add(numResult, Objects.nonNull(item.getNum()) ? item.getNum() : BigDecimal.ZERO);
|
||||
totalWeightResult = NumberUtil.add(totalWeightResult, item.getTotalWeight());
|
||||
}
|
||||
one.setNum(numResult);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.RecursiveTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -34,17 +35,16 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
|
||||
List<BomNewPbomParentVO> result = new ArrayList<>();
|
||||
|
||||
public static Integer levelNum=1;
|
||||
public AtomicInteger levelNum = new AtomicInteger(1);
|
||||
|
||||
//是否统计层级数
|
||||
private Integer countLevelState;
|
||||
|
||||
|
||||
|
||||
|
||||
public PBomDetailTask(List<BomNewPbomParentVO> inBomDetail ,Integer inCountLevelState) {
|
||||
public PBomDetailTask(List<BomNewPbomParentVO> inBomDetail, Integer inCountLevelState, AtomicInteger inLevelNum) {
|
||||
bomDetail = inBomDetail;
|
||||
countLevelState=inCountLevelState;
|
||||
levelNum=inLevelNum;
|
||||
countLevelState = inCountLevelState;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
* 处理BOM明细中未选择Bom版本的明细;使用最新版
|
||||
*/
|
||||
public void handlerChildBomVersionDetail() {
|
||||
List<String> materialNos = bomDetail.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo()) ).map(BomNewPbomParentVO::getMaterialNo).collect(Collectors.toList());
|
||||
List<String> materialNos = bomDetail.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomNewPbomParentVO::getMaterialNo).collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
|
||||
|
|
@ -82,15 +82,14 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
||||
detailVO.setShouldBomExist(ebomParentEntity.getShouldBomExist());
|
||||
detailVO.setVirtualPackageIs(ebomParentEntity.getVirtualPackageIs());
|
||||
}
|
||||
else {
|
||||
BomNewPbomParentEntity parent= SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getRowId, detailVO.getParentRowId()).one();
|
||||
} else {
|
||||
BomNewPbomParentEntity parent = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getRowId, detailVO.getParentRowId()).one();
|
||||
detailVO.setDeviseUserCode(parent.getDeviseUserCode());
|
||||
detailVO.setDeviseName(parent.getDeviseName());
|
||||
detailVO.setDeptName(parent.getDeptName());
|
||||
detailVO.setStatus(parent.getStatus());
|
||||
detailVO.setEditStatus(parent.getEditStatus());
|
||||
detailVO.setVirtualPackageIs(parent.getVirtualPackageIs()) ;
|
||||
detailVO.setVirtualPackageIs(parent.getVirtualPackageIs());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,19 +112,19 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
|
||||
result.addAll(bomDetail);
|
||||
//标记层级
|
||||
if(countLevelState.equals(1)){
|
||||
|
||||
bomDetail.forEach(k->k.setLevelNum(levelNum));
|
||||
levelNumAdd();
|
||||
if (countLevelState.equals(1)) {
|
||||
// Integer levelNumd=levelNum.getAndAdd(1);
|
||||
// bomDetail.forEach(k->k.setLevelNum(levelNumd));
|
||||
levelNumSet(bomDetail);
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(bomDetail)) {
|
||||
List<Long> childBowIds = bomDetail.stream().filter(u-> u.getBomRowId() > 0).map(u->u.getBomRowId()).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(childBowIds)) {
|
||||
List<Long> childBowIds = bomDetail.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(childBowIds)) {
|
||||
List<BomNewPbomChildEntity> children = SpringUtil.getBean(BomNewPbomChildService.class).lambdaQuery().in(BomNewPbomChildEntity::getParentRowId, childBowIds).list();
|
||||
List<BomNewPbomParentVO> bom = Convert.toList(BomNewPbomParentVO.class,children);
|
||||
List<BomNewPbomParentVO> bom = Convert.toList(BomNewPbomParentVO.class, children);
|
||||
|
||||
PBomDetailTask task = new PBomDetailTask(bom,countLevelState);
|
||||
PBomDetailTask task = new PBomDetailTask(bom, countLevelState,levelNum);
|
||||
task.fork();
|
||||
bomDetail.addAll(task.join());
|
||||
return bomDetail;
|
||||
|
|
@ -135,10 +134,16 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
return result;
|
||||
}
|
||||
|
||||
private synchronized void levelNumSet(List<BomNewPbomParentVO> dt) {
|
||||
Integer levelNumd = levelNum.getAndIncrement();
|
||||
dt.forEach(k -> k.setLevelNum(levelNumd));
|
||||
|
||||
public synchronized void levelNumAdd(){
|
||||
levelNum++;
|
||||
}
|
||||
|
||||
|
||||
// public synchronized void levelNumAdd(){
|
||||
// levelNum.add;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue