From 1b03661b32d742b2adbfc470c48d4c85eb89c328 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 18 Jul 2024 18:46:02 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=B9=B2=E7=BA=BFbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/TrunklineCarsLoadServiceImpl.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index b8092f416..87316a13a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -3988,7 +3988,24 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl parcelListEntities = trunklineCarsLoadScanService.findParceListByCarsLoadScanIds(carsLoadScanIds); //把parcelListEntities转成orderPackageCode为键值的map Map parcelListMap = parcelListEntities.stream().collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, e -> e)); - List stockArticleEntities = trunklineCarsLoadScanService.findOrderListByCarsLoadScanIds(carsLoadScanIds); + + //把loadScanEntityList中所有元素的fromWarehouseId进行分组 + Map> fromWarehouseIdMap = loadScanEntityList.stream().filter(e -> Objects.nonNull(e.getFromWarehouseId())).collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getFromWarehouseId)); + + List stockArticleEntities = new ArrayList<>(); + + fromWarehouseIdMap.keySet().forEach(fromWarehouseId -> { + List list = fromWarehouseIdMap.get(fromWarehouseId); + //把list中所有的orderCode放入一个Set集合 + Set orderCodeSet = list.stream().map(TrunklineCarsLoadScanEntity::getOrderCode).collect(Collectors.toSet()); + FindParamterDTO findParamterDTO = new FindParamterDTO(); + findParamterDTO.setOrderCodeSet(orderCodeSet); + findParamterDTO.setWarehouseId(fromWarehouseId); + List stockArticleEntityList = distributionStockArticleClient.findListByOrderCodesAndWarehouseId(findParamterDTO); + stockArticleEntities.addAll(stockArticleEntityList); + + }); + //把stockArticleEntities转成orderCode为键值的map Map stockArticleMap = stockArticleEntities.stream().collect(Collectors.toMap(DistributionStockArticleEntity::getOrderCode, e -> e)); // List waybillEntities = trunklineCarsLoadScanService.findWaybillListByCarsLoadScanIds(carsLoadScanIds);