|
|
|
@ -138,19 +138,35 @@ public class BomSearch3ServiceImpl implements BomSearch3Service { |
|
|
|
|
|
|
|
// 新增数据到物料属性临时表 |
|
|
|
if (level == 0) { |
|
|
|
PartSubPropertiesValueData valueData = new PartSubPropertiesValueData(); |
|
|
|
valueData.setSite(detail.getSite()); |
|
|
|
valueData.setBuNo(detail.getBuNo()); |
|
|
|
valueData.setPartNo(detail.getPartNo()); |
|
|
|
valueData.setRecordType("IP"); |
|
|
|
List<PartSubPropertiesValueData> fromPartItems = partInformationMapper.getItemModal(valueData); |
|
|
|
if (!fromPartItems.isEmpty()) { |
|
|
|
List<PartSubPropertiesValueData> toPartItems = fromPartItems.stream().map(a -> { |
|
|
|
a.setTreeId(bom.getId()); |
|
|
|
a.setCreateBy(detail.getCreateBy()); |
|
|
|
return a; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
partInformationMapper.saveTempPartModelDetails(toPartItems); |
|
|
|
// 先查询物料的codeNo(从part_sub_properties_value_header表获取) |
|
|
|
PartInformationEntity partEntity = new PartInformationEntity(); |
|
|
|
partEntity.setSite(detail.getSite()); |
|
|
|
partEntity.setBuNo(detail.getBuNo()); |
|
|
|
partEntity.setPartNo(detail.getPartNo()); |
|
|
|
List<PartSubPropertiesValueData> codeNoList = partInformationMapper.queryCodeNo(partEntity); |
|
|
|
|
|
|
|
if (!codeNoList.isEmpty()) { |
|
|
|
// 查询物料属性值 |
|
|
|
PartSubPropertiesValueData valueData = new PartSubPropertiesValueData(); |
|
|
|
valueData.setSite(detail.getSite()); |
|
|
|
valueData.setBuNo(detail.getBuNo()); |
|
|
|
valueData.setPartNo(detail.getPartNo()); |
|
|
|
valueData.setCodeNo(codeNoList.get(0).getCodeNo()); // ✅ 设置codeNo |
|
|
|
valueData.setRecordType("IP"); |
|
|
|
|
|
|
|
List<PartSubPropertiesValueData> fromPartItems = partInformationMapper.getItemModal(valueData); |
|
|
|
if (!fromPartItems.isEmpty()) { |
|
|
|
List<PartSubPropertiesValueData> toPartItems = fromPartItems.stream().map(a -> { |
|
|
|
a.setTreeId(bom.getId()); |
|
|
|
a.setCreateBy(detail.getCreateBy()); |
|
|
|
return a; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
partInformationMapper.saveTempPartModelDetails(toPartItems); |
|
|
|
log.info("成功保存物料属性到临时表,物料: {}, codeNo: {}, 属性数量: {}", |
|
|
|
detail.getPartNo(), codeNoList.get(0).getCodeNo(), toPartItems.size()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.info("物料 {} 未配置属性模板,跳过属性复制", detail.getPartNo()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|