From d8926aee59ac8162d7266cb8cbaf1a4304440b1d Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Mon, 17 Nov 2025 17:33:54 +0800 Subject: [PATCH] =?UTF-8?q?2025-11-17=20=E9=94=80=E5=94=AE=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E8=A3=85=E7=AE=B1=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BoxForNotificationController.java | 2 +- .../service/impl/BoxForNotificationServiceImpl.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java b/src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java index 4b98d6e..dddb314 100644 --- a/src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java +++ b/src/main/java/com/gaotao/modules/boxManage/controller/BoxForNotificationController.java @@ -266,7 +266,7 @@ public class BoxForNotificationController { data.setPalletNo((String) params.get("palletNo")); data.setBoxNo((String) params.get("boxNo")); data.setReceivedBy((String) params.get("receivedBy")); - data.setBoxesQty(1); // 默认为1 + // boxesQty 在 Service 层根据箱内卷数量自动计算 srmSupplierService.scanPalletBox(data); return R.ok().put("code", 0).put("msg", "装托成功"); diff --git a/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java b/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java index c7af044..e2a3713 100644 --- a/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java +++ b/src/main/java/com/gaotao/modules/boxManage/service/impl/BoxForNotificationServiceImpl.java @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -462,6 +463,13 @@ public class BoxForNotificationServiceImpl implements BoxForNotificationService throw new RuntimeException("箱内没有卷,不允许装托!"); } + // 计算箱内所有卷的数量之和 + BigDecimal totalRollQty = boxRolls.stream() + .map(SoReceiveBoxRollsData::getRollQty) + .filter(qty -> qty != null) + .reduce(BigDecimal.ZERO, BigDecimal::add); + inData.setBoxesQty(totalRollQty.intValue()); + // 3. 添加箱到托 boxForNotificationMapper.addBoxToPallet(inData);