1、EBOM列表增加版本号说明提示

2、EBOM > 变更影响标签页增加徽章当前登录人的变更影响数量
3、BOM完整性检查接口优化
This commit is contained in:
10002327 2024-10-15 11:39:32 +08:00
parent 9bd0a9c664
commit 84bf563dfe
2 changed files with 85 additions and 7 deletions

View File

@ -20,6 +20,7 @@ import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.*; import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.pojo.dto.*; import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery; import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery; import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
@ -106,6 +107,13 @@ public class EbomApi extends BaseApi {
public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) { public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query)); return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query));
} }
@GetMapping("changeImpactCntByUser")
@ApiOperation("当前登录人的变更影响数量")
public ResultVO<Integer> changeImpactCntByUser(){
return ResultVO.success(upgradeChangeService.count(Wrappers.<BomNewEbomUpgradeChangeEntity>lambdaQuery()
.eq(BomNewEbomUpgradeChangeEntity::getStatus,0)
.eq(BomNewEbomUpgradeChangeEntity::getDeviseName,SessionUtil.getRealName())));
}
@PostMapping("delChangeImpact") @PostMapping("delChangeImpact")
@ApiOperation("变更影响-删除") @ApiOperation("变更影响-删除")

View File

@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.thread.ThreadFactoryBuilder;
import cn.hutool.core.util.*; import cn.hutool.core.util.*;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -49,9 +50,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutionException; import java.util.concurrent.*;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BinaryOperator; import java.util.function.BinaryOperator;
import java.util.function.Function; import java.util.function.Function;
@ -123,6 +122,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
@Resource @Resource
SapService sapService; SapService sapService;
/** /**
* pbom-工作列表 * pbom-工作列表
* *
@ -433,6 +433,69 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
} }
/**
* 获取pbom子表信息仅用于BOM完整性检查 by 10002327 241015
* @param parent
* @param type
* @return
*/
public List<BomNewPbomParentVO> getChildByCheckBom(BomNewPbomParentEntity parent, Integer type){
List<BomNewPbomParentVO> parentChild = this.getBaseMapper().getParentChild(parent.getRowId());
if (CollUtil.isNotEmpty(parentChild)) {
materialMainService.intiMaterialInfo(parentChild, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList());
if (CollUtil.isNotEmpty(materialNos)) {
List<BomNewPbomParentEntity> list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos)
.eq(type.equals(0), BomNewPbomParentEntity::getLastVersionIs, 1)
.ge(type.equals(1), BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.eq(BomNewPbomParentEntity::getFacCode,parent.getFacCode())
.list();
Map<String, BomNewPbomParentEntity> bomListMap= list.parallelStream()
.collect(Collectors.toMap(
BomNewPbomParentEntity::getMaterialNo, // key: DrawingNo
Function.identity(),
BinaryOperator.maxBy(Comparator.comparing(BomNewPbomParentEntity::getCurrentVersion))
));
for (BomNewPbomParentVO child : parentChild) {
if (bomListMap.containsKey(child.getMaterialNo())) {
BomNewPbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
if (parentEntity.getShouldBomExist() == 1 && parentEntity.getBomExist() == 0) {
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
} else {
child.setCurrentVersion(parentEntity.getCurrentVersion());
}
// if (parentEntity.getBomExist() == 1) {
child.setBomRowId(parentEntity.getRowId());
// }
child.setSourceRowId(parentEntity.getSourceRowId());
child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist());
if ((type == 0 || parent.getStatus() < PBomStatusEnum.PUBLISH.getValue())
&& parentEntity.getStatus() >= PBomStatusEnum.PUBLISH.getValue()) {
child.setStatus(PBomStatusEnum.BORROWED_PARTS.getValue());
}
} else { //无BOM-版本时 确定版本号
//child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue());
child.setBomRowId(0L);
// 1040506070大类以及200201小类这些不需要BOM的物料版本号显示B00 by 10002327 241012
if(MaterialshouldBomExistUtil.checkNoNeedBom(child)){
child.setCurrentVersion(OriginalConstant.NO_NEED_BOM);
}else if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
} else {
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
}
if (type == 0 && child.getStatus() >= EBomStatusEnum.PUBLISHED.getValue()) {
child.setStatus(PBomStatusEnum.BORROWED_PARTS.getValue());
}
}
}
}
}
return parentChild;
}
/** /**
* 编辑暂存 * 编辑暂存
* *
@ -2039,7 +2102,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
} }
private void checkChild(List<CheckBomVO> checkBomList ,BomNewPbomParentEntity parent, Integer type,int currLevel,String currNos){ private void checkChild(List<CheckBomVO> checkBomList ,BomNewPbomParentEntity parent, Integer type,int currLevel,String currNos){
List<BomNewPbomParentVO> cList = getChild(parent,type); List<BomNewPbomParentVO> cList = getChildByCheckBom(parent,type);
List<Long> bomRowIdList = cList.stream().filter(c -> c.getBomRowId() > 0).map(BomNewPbomParentVO::getBomRowId).distinct().collect(Collectors.toList()); List<Long> bomRowIdList = cList.stream().filter(c -> c.getBomRowId() > 0).map(BomNewPbomParentVO::getBomRowId).distinct().collect(Collectors.toList());
List<BomNewPbomParentEntity> pList = Lists.newArrayList(); List<BomNewPbomParentEntity> pList = Lists.newArrayList();
Map<Long,BomNewPbomParentEntity> pMap = Maps.newHashMap(); Map<Long,BomNewPbomParentEntity> pMap = Maps.newHashMap();
@ -2059,13 +2122,20 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
checkBomVO.setDrawingNo(c.getDrawingNo()); checkBomVO.setDrawingNo(c.getDrawingNo());
checkBomList.add(checkBomVO); checkBomList.add(checkBomVO);
} }
//不为空则进行递归 currLevel < 200 不再递归判断为死循环 //不为空则进行递归 currLevel < 400 不再递归判断为死循环
if(finalPMap.get(c.getBomRowId()) != null && currLevel < 200){ if(finalPMap.get(c.getBomRowId()) != null && currLevel < 400){
finalCurrLevel.getAndIncrement(); finalCurrLevel.getAndIncrement();
checkChild(checkBomList,finalPMap.get(c.getBomRowId()),type, finalCurrLevel.get(),currNos + " > " + finalPMap.get(c.getBomRowId()).getMaterialNo()); //checkChild(checkBomList,finalPMap.get(c.getBomRowId()),type, finalCurrLevel.get(),currNos + " > " + finalPMap.get(c.getBomRowId()).getMaterialNo());
CompletableFuture.runAsync(()-> checkChild(checkBomList,finalPMap.get(c.getBomRowId()),type, finalCurrLevel.get(),currNos + " > " + finalPMap.get(c.getBomRowId()).getMaterialNo())).join();
// try {
// CompletableFuture.runAsync(()-> checkChild(checkBomList,finalPMap.get(c.getBomRowId()),type, finalCurrLevel.get(),currNos + " > " + finalPMap.get(c.getBomRowId()).getMaterialNo())).get();
// } catch (Exception e) {
// log.error(e.getMessage());
// }
} }
}); });
} }
/** /**