From 901e3c96c76f168ddbeaa10562a4d2d6f4d3ba8c Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 25 五月 2026 15:07:09 +0800
Subject: [PATCH] refactor(approve): 重构审批业务状态同步逻辑

---
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index d824291..4d8aece 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -11,6 +11,7 @@
         T1.warn_num,
         T1.quantity,
         T1.single_quantity,
+        T1.total_quantity,
         T1.min_stock,
         T1.tax_rate,
         T1.tax_inclusive_unit_price,
@@ -34,10 +35,10 @@
         WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >0 THEN 1
         ELSE 0
         END as has_sufficient_stock,
-        (IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1) - IFNULL(t3.shipped_quantity, 0)) as no_quantity,
+        (IFNULL(NULLIF(T1.total_quantity, 0), IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1)) - IFNULL(t3.shipped_quantity, 0)) as no_quantity,
         CASE
          WHEN IFNULL(t3.shipped_quantity, 0) = 0 THEN '寰呭彂璐�'
-         WHEN (IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN '閮ㄥ垎鍙戣揣'
+         WHEN (IFNULL(NULLIF(T1.total_quantity, 0), IFNULL(T1.quantity, 0) * IFNULL(NULLIF(T1.single_quantity, 0), 1)) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN '閮ㄥ垎鍙戣揣'
         ELSE '宸插彂璐�'
         END as shippingStatus,
         CASE

--
Gitblit v1.9.3