From 59d43831764b1a7104266e0b453dfc9c1d1eadbf Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 1 Apr 2025 17:49:36 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E5=AF=BC=E5=85=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=89=A9=E6=96=99=E4=BD=93=E7=A7=AF=E9=87=8D=E9=87=8F?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OpenOrderServiceImpl.java | 35 ++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index 126bd274a..ddc003d52 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -1821,6 +1821,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService { dto.setOrderCode(dto.getOrderCode().trim()); dto.setOrderPackageCode(dto.getOrderPackageCode().trim()); }); + + List materialEntities = basicMaterialClient.findAllList(); + //把materialEntities转化成以productCode和productName拼接为key的Map + Map materialEntityMap = materialEntities.stream().collect(Collectors.toMap(item -> item.getProductCode() + "&&" + item.getName(), item -> item)); + + //排除pacakgeDetailExcelDTOS中的orderPackageCode为空的元素 pacakgeDetailExcelDTOS = pacakgeDetailExcelDTOS.stream().filter(item -> StringUtil.isNotBlank(item.getOrderPackageCode())).collect(Collectors.toList()); //把importStandardOuPaiDTOS中orderPackageCode相同的元素去重 @@ -2077,16 +2083,37 @@ public class OpenOrderServiceImpl implements IOpenOrderService { advanceDetailModel.setQuantity(1); advanceDetailModel.setServiceNum(pacakgeDetailExcelDTO.getServiceNum()); advanceDetailModel.setPackageStatus("0"); + + String materialName = pacakgeDetailExcelDTO.getMaterialName(); + String materialCode = pacakgeDetailExcelDTO.getMaterialCode(); + advanceDetailModel.setMaterialName(materialName); + advanceDetailModel.setMaterialCode(materialCode); + if (!Objects.isNull(pacakgeDetailExcelDTO.getVolume())) { advanceDetailModel.setVolume(new BigDecimal(pacakgeDetailExcelDTO.getVolume())); } else { advanceDetailModel.setVolume(BigDecimal.ZERO); + + BasicMaterialEntity basicMaterialEntity = materialEntityMap.get(materialCode + "&&" + materialName); + + if (!Objects.isNull(basicMaterialEntity)) { + advanceDetailModel.setMaterialId(basicMaterialEntity.getId()); + + String weight = basicMaterialEntity.getWeight(); + if (StringUtil.isBlank(weight)) { + weight = "0"; + } + String volume2 = basicMaterialEntity.getVolume(); + if (StringUtil.isBlank(volume2)) { + volume2 = "0"; + } + advanceDetailModel.setWeight(new BigDecimal(weight)); + advanceDetailModel.setVolume(new BigDecimal(volume2)); + } + } - String materialName = pacakgeDetailExcelDTO.getMaterialName(); - String materialCode = pacakgeDetailExcelDTO.getMaterialCode(); - advanceDetailModel.setMaterialName(materialName); - advanceDetailModel.setMaterialCode(materialCode); + // if (StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)) {