From e129685f5503ab36dc7cad39bda8842c0d20c9c9 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Fri, 28 Nov 2025 09:31:21 +0800 Subject: [PATCH] =?UTF-8?q?BOM=E5=A4=8D=E5=88=B6=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BomSearch3ServiceImpl.java | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/xujie/sys/modules/part/service/impl/BomSearch3ServiceImpl.java b/src/main/java/com/xujie/sys/modules/part/service/impl/BomSearch3ServiceImpl.java index 1e968692..d8bf779e 100644 --- a/src/main/java/com/xujie/sys/modules/part/service/impl/BomSearch3ServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/part/service/impl/BomSearch3ServiceImpl.java @@ -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 fromPartItems = partInformationMapper.getItemModal(valueData); - if (!fromPartItems.isEmpty()) { - List 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 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 fromPartItems = partInformationMapper.getItemModal(valueData); + if (!fromPartItems.isEmpty()) { + List 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()); } }