From 8fbb7182a426eac7e8112e60548b07d051b91a51 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期日, 21 十二月 2025 10:58:41 +0800
Subject: [PATCH] #库存预留

---
 src/main/java/com/zy/asrs/controller/OutController.java |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java
index f729b42..463ac10 100644
--- a/src/main/java/com/zy/asrs/controller/OutController.java
+++ b/src/main/java/com/zy/asrs/controller/OutController.java
@@ -141,20 +141,17 @@
                         .eq(!Cools.isEmpty(orderDetl.getBoxType3()), "box_type3", orderDetl.getBoxType3())
 
                 );
-                // 濡傛灉搴撳瓨棰勭暀璁板綍涓嶄负绌猴紝浣跨敤steam灏嗗簱瀛橀鐣欒褰曚腑鐨勫簱瀛樻暟閲忓叏閮ㄥ姞璧锋潵,瀛楁涓簈uantity锛岀被鍨嬩负BigDecimal
-                BigDecimal inventoryReserveQuantity = inventoryReserves.stream().map(InventoryReserve::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
-                //鑾峰彇搴撳瓨涓殑搴撳瓨鏁伴噺
                 List<LocDetl> locDetls = locDetlService.queryStockAll(null, exist, orderDetl.getMatnr(), orderDetl.getBatch(),
                         orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), orderDetl.getBoxType1(), orderDetl.getBoxType2(), orderDetl.getBoxType3());
 
-                // 浣跨敤steam灏唋ocDetls涓殑搴撳瓨鏁伴噺鍏ㄩ儴鍔犺捣鏉�,瀛楁涓簈uantity锛孌ouble绫诲瀷
-                BigDecimal locDetlQuantity = locDetls.stream().map(LocDetl::getAnfme).map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add);
+                if (!Cools.isEmpty(inventoryReserves)) {
+                    BigDecimal inventoryReserveQuantity = inventoryReserves.stream().map(InventoryReserve::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
+                    BigDecimal locDetlQuantity = locDetls.stream().map(LocDetl::getAnfme).map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add);
 
-                if (locDetlQuantity.subtract(new BigDecimal(orderDetl.getAnfme())).compareTo(inventoryReserveQuantity) < 0) {
-                    return R.parse("搴撳瓨棰勭暀鏁伴噺澶т簬搴撳瓨鏁伴噺");
+                    if (locDetlQuantity.subtract(new BigDecimal(orderDetl.getAnfme())).compareTo(inventoryReserveQuantity) < 0) {
+                        return R.parse("搴撳瓨棰勭暀鏁伴噺澶т簬搴撳瓨鏁伴噺");
+                    }
                 }
-
-
 
 
                 double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);

--
Gitblit v1.9.1