From 87733eb3623593da247c051593d64b8ff9e1d3a4 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 06 十一月 2026 19:00:39 +0800
Subject: [PATCH] feat(crm,mes): 扩展客户字段与重构批次号生成逻辑

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesLineController.java |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesLineController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesLineController.java
index 336da58..5967c5b 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesLineController.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productsales/MesWmProductSalesLineController.java
@@ -40,6 +40,7 @@
 @RequestMapping("/mes/wm/product-sales-line")
 @Validated
 public class MesWmProductSalesLineController {
+    @Resource private cn.iocoder.yudao.module.mes.dal.mysql.wm.transaction.MesWmTransactionMapper transactionMapper;
 
     @Resource
     private MesWmProductSalesLineService productSalesLineService;
@@ -108,6 +109,9 @@
                 .stream().collect(Collectors.toMap(MdmUnitMeasureRespDTO::getId, e -> e));
         // 2. 鏋勫缓缁撴灉
         return BeanUtils.toBean(list, MesWmProductSalesLineRespVO.class, vo -> {
+            var shipped = transactionMapper.sumSalesOutboundByLineId(vo.getId());
+            vo.setShippedQuantity(shipped == null ? java.math.BigDecimal.ZERO : shipped);
+            vo.setRemainingQuantity((vo.getQuantity() == null ? java.math.BigDecimal.ZERO : vo.getQuantity()).subtract(vo.getShippedQuantity()).max(java.math.BigDecimal.ZERO));
             MapUtils.findAndThen(itemMap, vo.getItemId(), item -> {
                 vo.setItemCode(item.getCode()).setItemName(item.getName()).setSpecification(item.getSpecification());
                 MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(),

--
Gitblit v1.9.3