|
|
|
|
@ -284,11 +284,34 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
@Override |
|
|
|
|
public List<DsPartBomVO> sinteringPart(String bPartCode, String zPartCode) { |
|
|
|
|
if (!StringUtils.isEmpty(bPartCode) && !StringUtils.isEmpty(zPartCode)) { |
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(bPartCode, zPartCode); |
|
|
|
|
List<DsPartVersionEntity> partVersionEntityList = partVersionService.selectByPartCode(bPartCode); |
|
|
|
|
Optional<DsPartVersionEntity> maxEntity = partVersionEntityList.stream() |
|
|
|
|
.filter(entity -> entity.getPartVersion() != null) |
|
|
|
|
.max(Comparator.comparing(DsPartVersionEntity::getPartVersion)); |
|
|
|
|
|
|
|
|
|
if (maxEntity.isPresent()) { |
|
|
|
|
String bPartVersion = maxEntity.get().getPartVersion(); |
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(bPartCode, zPartCode,bPartVersion,null,null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(zPartCode)) { |
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(null, zPartCode); |
|
|
|
|
//模糊查询零件
|
|
|
|
|
List<DsPartEntity> dsPartList = dsPartMapper.selectListPartByCodeLike(zPartCode); |
|
|
|
|
//获取这些零件的最新版本号
|
|
|
|
|
List<DsPartVersionEntity> partVersionEntityList = partVersionService.selectListByPartCode(dsPartList); |
|
|
|
|
|
|
|
|
|
// 提取零件ID列表
|
|
|
|
|
List<Long> zPartIdList = partVersionEntityList.stream() |
|
|
|
|
.map(DsPartVersionEntity::getPartId) |
|
|
|
|
.filter(Objects::nonNull) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(null, null,null,null,zPartIdList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
@ -297,14 +320,21 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
@Override |
|
|
|
|
public List<DsPartTreeVO> getPartTreeList(String partCode) { |
|
|
|
|
|
|
|
|
|
// 1. 联表查询所有相关关系
|
|
|
|
|
List<DsPartBomVO> relations = dsPartMapper.selectPartRelations(partCode); |
|
|
|
|
if (relations.isEmpty()) { |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
List<DsPartVersionEntity> partVersionEntityList = partVersionService.selectByPartCode(partCode); |
|
|
|
|
Optional<DsPartVersionEntity> maxEntity = partVersionEntityList.stream() |
|
|
|
|
.filter(entity -> entity.getPartVersion() != null) |
|
|
|
|
.max(Comparator.comparing(DsPartVersionEntity::getPartVersion)); |
|
|
|
|
|
|
|
|
|
if (maxEntity.isPresent()) { |
|
|
|
|
String bPartVersion = maxEntity.get().getPartVersion(); |
|
|
|
|
List<DsPartBomVO> partBomVOList = partRelationService.selectDsPartRelationByPartCodeAndChildPartCode(partCode, null, bPartVersion, null, null); |
|
|
|
|
|
|
|
|
|
// 2. 构建树形结构
|
|
|
|
|
return buildTreeFromRelations(partBomVOList); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 2. 构建树形结构
|
|
|
|
|
return buildTreeFromRelations(relations); |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -407,7 +437,8 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
DsPartTreeVO parentNode = new DsPartTreeVO( |
|
|
|
|
parentCode, |
|
|
|
|
relation.getBPartName(), |
|
|
|
|
relation.getBDocLink() |
|
|
|
|
relation.getBDocLink(), |
|
|
|
|
null |
|
|
|
|
); |
|
|
|
|
partMap.put(parentCode, parentNode); |
|
|
|
|
} |
|
|
|
|
@ -417,7 +448,8 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
DsPartTreeVO childNode = new DsPartTreeVO( |
|
|
|
|
childCode, |
|
|
|
|
relation.getZPartName(), |
|
|
|
|
relation.getZDocLink() |
|
|
|
|
relation.getZDocLink(), |
|
|
|
|
relation.getQuota() |
|
|
|
|
); |
|
|
|
|
partMap.put(childCode, childNode); |
|
|
|
|
} |
|
|
|
|
@ -540,4 +572,9 @@ public class DsPartServiceImpl extends BaseServiceImpl<DsPartMapper, DsPartEntit |
|
|
|
|
public List<DsPartVersionVO> selectDsPartVersionByIds(List<Long> idList) { |
|
|
|
|
return dsPartMapper.selectDsPartVersionByIds(idList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean selectPartCraft(String partCode, String roamNo, String rank, String partVersion) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|