Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition
This commit is contained in:
commit
a6284a7626
|
|
@ -558,6 +558,65 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步获取所有子节点(正式)
|
||||||
|
* @param rowId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<BomNewEbomParentVO> getAllEBomFormalChild(long rowId){
|
||||||
|
List<BomNewEbomParentVO> result=new ArrayList<>();
|
||||||
|
List<BomNewEbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||||
|
while (CollUtil.isNotEmpty(bomDetail)){
|
||||||
|
handlerChildBomVersionDetail(bomDetail);
|
||||||
|
result.addAll(bomDetail);
|
||||||
|
List<Long> childBowIds = bomDetail.stream().filter(u-> u.getChildBomRowId()!=null && u.getChildBomRowId() > 0).map(u->u.getChildBomRowId()).collect(Collectors.toList());
|
||||||
|
if(CollUtil.isNotEmpty(childBowIds)) {
|
||||||
|
bomDetail = this.getBaseMapper().getParentChildBatch(childBowIds);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bomDetail=Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
private void handlerChildBomVersionDetail(List<BomNewEbomParentVO> bomDetail) {
|
||||||
|
List<String> materialNos = bomDetail.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo()) ).map(BomNewEbomParentVO::getMaterialNo).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(materialNos)) {
|
||||||
|
|
||||||
|
List<BomNewEbomParentEntity> childBomlist = SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||||
|
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||||
|
Map<String, BomNewEbomParentEntity> stringBomNewOriginalParentEntityMap = childBomlist.parallelStream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo
|
||||||
|
Function.identity(),
|
||||||
|
BinaryOperator.maxBy(Comparator.comparing(BomNewEbomParentEntity::getCurrentVersion))
|
||||||
|
));
|
||||||
|
// Map<String, BomNewEbomParentEntity> stringBomNewOriginalParentEntityMap = ListCommonUtil.listToMap(childBomlist, BomNewEbomParentEntity::getMaterialNo);
|
||||||
|
for (BomNewEbomParentVO detailVO : bomDetail) {
|
||||||
|
if (stringBomNewOriginalParentEntityMap.containsKey(detailVO.getMaterialNo())) {
|
||||||
|
BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo());
|
||||||
|
detailVO.setChildBomRowId(ebomParentEntity.getRowId());
|
||||||
|
detailVO.setBomRowId(ebomParentEntity.getRowId());
|
||||||
|
detailVO.setSourceRowId(ebomParentEntity.getSourceRowId());
|
||||||
|
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
|
||||||
|
detailVO.setDeviseUserCode(ebomParentEntity.getDeviseUserCode());
|
||||||
|
detailVO.setDeptName(ebomParentEntity.getDeptName());
|
||||||
|
detailVO.setDeviseName(ebomParentEntity.getDeviseName());
|
||||||
|
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
||||||
|
detailVO.setStatus(ebomParentEntity.getStatus());
|
||||||
|
detailVO.setBatchNo(ebomParentEntity.getBatchNo());
|
||||||
|
detailVO.setCreatedBy(ebomParentEntity.getCreatedBy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取整个BOM树
|
* 获取整个BOM树
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
||||||
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).last(" order by current_version desc limit 1").one();
|
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).last(" order by current_version desc limit 1").one();
|
||||||
if (Objects.nonNull(ebom)) {
|
if (Objects.nonNull(ebom)) {
|
||||||
|
|
||||||
List<BomNewEbomParentVO> bomTree = ebomParentService.getFormalBomTree(ebom.getRowId());
|
List<BomNewEbomParentVO> bomTree = ebomParentService.getAllEBomFormalChild(ebom.getRowId());
|
||||||
BomNewEbomParentVO parentBom = Convert.convert(BomNewEbomParentVO.class, ebom);
|
BomNewEbomParentVO parentBom = Convert.convert(BomNewEbomParentVO.class, ebom);
|
||||||
parentBom.setBomRowId(ebom.getRowId());
|
parentBom.setBomRowId(ebom.getRowId());
|
||||||
parentBom.setChildBomRowId(ebom.getRowId());
|
parentBom.setChildBomRowId(ebom.getRowId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue