Merge branch 'refs/heads/feature/DM/nflg-bom' into dev

This commit is contained in:
曹鹏飞 2024-04-12 08:21:49 +08:00
commit efd58784e7
2 changed files with 83 additions and 1 deletions

View File

@ -375,6 +375,88 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
/**
* 生成虚拟包时-获取子级
* @param rowId
* @return
*/
public List<BomNewEbomParentVO> getChildForVirtualPackage(Long rowId) {
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(rowId);
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
//排除项目类别的赋值
materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
if (CollUtil.isNotEmpty(parentChild)) {
List<String> materialNos = parentChild.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
if (CollUtil.isNotEmpty(materialNos)) {
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
.eq(BomNewEbomParentEntity::getLastVersionIs, 1).list();
Map<String, BomNewEbomParentEntity> bomListMap= list.parallelStream()
.collect(Collectors.toMap(
BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo
Function.identity(),
BinaryOperator.maxBy(Comparator.comparing(BomNewEbomParentEntity::getCurrentVersion))
));
// Map<String, BomNewEbomParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewEbomParentEntity::getMaterialNo);
for (BomNewEbomParentVO child : parentChild) {
if (bomListMap.containsKey(child.getMaterialNo())) {
BomNewEbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
child.setCurrentVersion(parentEntity.getCurrentVersion());
child.setStatus(parentEntity.getStatus());
child.setDeviseName(parentEntity.getDeviseName());
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
child.setCreatedTime(parentEntity.getCreatedTime());
child.setBomRowId(parentEntity.getRowId());
child.setLevelNum(parentEntity.getLevelNum());
child.setDeptName(parentEntity.getDeptName());
// child.setSource(parentEntity.getSource());
child.setSourceRowId(parentEntity.getSourceRowId());
child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist());
child.setVirtualPackageIs(parentEntity.getVirtualPackageIs());
child.setChangeDesc(parentEntity.getChangeDesc());
child.setNoticeNums(parentEntity.getNoticeNums());
child.setSuperMaterialStatus(parentEntity.getSuperMaterialStatus());
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
}
// //非本人则为借用件
// else if (!parentEntity.getCreatedBy().equals(child.getCreatedBy())) {
// child.setStatus(EBomStatusEnum.REFERENCE.getValue());
// }
} else { //无BOM-版本时 确定版本号
//child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue());
child.setDeviseUserCode(parent.getDeviseUserCode());
child.setDeviseName(parent.getDeviseName());
child.setDeptName(parent.getDeptName());
child.setStatus(parent.getStatus());
child.setEditStatus(parent.getEditStatus());
child.setVirtualPackageIs(parent.getVirtualPackageIs());
child.setSuperMaterialStatus(parent.getSuperMaterialStatus());
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
child.setStatus(parent.getStatus());
// child.setEditStatus(OriginalEditStatusEnum.HANDLER_CREATED.getValue());
}
}
}
}
}
//动态判断异常
//CheckEBomExceptoinDynamic.check(parentChild);
return parentChild;
}
public List<BomNewEbomParentVO> getChildBatch(List<Long> rowIds) { public List<BomNewEbomParentVO> getChildBatch(List<Long> rowIds) {
List<BomNewEbomParentVO> result = new ArrayList<>(); List<BomNewEbomParentVO> result = new ArrayList<>();

View File

@ -193,7 +193,7 @@ public abstract class VirtualPackageBase {
* @return * @return
*/ */
protected List<BomNewEbomParentVO> getChild(){ protected List<BomNewEbomParentVO> getChild(){
return SpringUtil.getBean(BomNewEbomParentService.class).getChild(bomRowId); return SpringUtil.getBean(BomNewEbomParentService.class).getChildForVirtualPackage(bomRowId);
} }
protected BomNewEbomParentEntity getParentZhiZuo(String inDrawingNo){ protected BomNewEbomParentEntity getParentZhiZuo(String inDrawingNo){