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)) {