Parcourir la source

修复快捷出库查询传值bug

fgd il y a 1 an
Parent
commit
ecda75f9a0

+ 12 - 13
sd-business/src/main/java/com/sd/business/service/production/impl/StockPreparationServiceImpl.java

@@ -332,13 +332,12 @@ public class StockPreparationServiceImpl implements StockPreparationService {
                 .map(OutBomVo::getBomSpecId)
                 .collect(Collectors.toList());
         if (semiFinishedProductBomSpecIdList.size() > 0) {
-            semiFinishedProductInventoryMap = inventoryService.mapKV(
-                    Inventory::getBomSpecId,
-                    item -> item.getQuantity().add(item.getLockQuantity()),
-                    q -> q.eq(Inventory::getWarehouseId, WarehouseConstant.SEMI_FINISHED_PRODUCT)
-                            .eq(Inventory::getDepartmentId, outDepartmentId)
-                            .in(Inventory::getBomSpecId, semiFinishedProductBomSpecIdList)
-            );
+            List<Inventory> tempList = inventoryService.list(q -> q.eq(Inventory::getWarehouseId, WarehouseConstant.SEMI_FINISHED_PRODUCT)
+                    .eq(Inventory::getDepartmentId, outDepartmentId)
+                    .in(Inventory::getBomSpecId, semiFinishedProductBomSpecIdList));
+            semiFinishedProductInventoryMap = tempList.stream().collect(Collectors.toMap(Inventory::getBomSpecId,
+                    item -> item.getQuantity().add(item.getLockQuantity()), (v1, v2) -> v2));
+
         }
 
         // 包材库存
@@ -348,13 +347,13 @@ public class StockPreparationServiceImpl implements StockPreparationService {
                 .map(OutBomVo::getBomSpecId)
                 .collect(Collectors.toList());
         if (packagingMaterialBomSpecIdList.size() > 0) {
-            packagingMaterialInventoryMap = inventoryService.mapKV(
-                    Inventory::getBomSpecId,
-                    item -> item.getQuantity().add(item.getLockQuantity()),
-                    q -> q.eq(Inventory::getWarehouseId, WarehouseConstant.PACKAGING_MATERIAL)
-                            .eq(Inventory::getDepartmentId, outDepartmentId)
-                            .in(Inventory::getBomSpecId, packagingMaterialBomSpecIdList)
+            List<Inventory> tempList = inventoryService.list(q -> q
+                    .eq(Inventory::getWarehouseId, WarehouseConstant.PACKAGING_MATERIAL)
+                    .eq(Inventory::getDepartmentId, outDepartmentId)
+                    .in(Inventory::getBomSpecId, packagingMaterialBomSpecIdList)
             );
+            packagingMaterialInventoryMap = tempList.stream().collect(Collectors.toMap(Inventory::getBomSpecId,
+                    item -> item.getQuantity().add(item.getLockQuantity()), (v1, v2) -> v2));
         }
 
         // 赋值库存