自动化立体仓库 - WMS系统
zhou zhou
2025-12-21 8fbb7182a426eac7e8112e60548b07d051b91a51
src/main/java/com/zy/asrs/controller/OutController.java
@@ -141,20 +141,17 @@
                        .eq(!Cools.isEmpty(orderDetl.getBoxType3()), "box_type3", orderDetl.getBoxType3())
                );
                // 如果库存预留记录不为空,使用steam将库存预留记录中的库存数量全部加起来,字段为quantity,类型为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将locDetls中的库存数量全部加起来,字段为quantity,Double类型
                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);