From 0beb4e197c13ccce94a943e158993c503700f4da Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 20 八月 2026 17:57:23 +0800
Subject: [PATCH] feat(sales): 实现发货模块部分发货与批量发货功能
---
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 3109bce..e8f7241 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -10,7 +10,19 @@
CASE
WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1
ELSE 0
- END as has_sufficient_stock
+ END as has_sufficient_stock,
+ CASE
+ WHEN t2.id IS NOT NULL THEN 1
+ ELSE 0
+ END as has_stock_inventory,
+ (SELECT IFNULL(SUM(si.quantity), 0)
+ FROM shipping_info si
+ WHERE si.sales_ledger_product_id = T1.id
+ AND si.status IN ('瀹℃牳閫氳繃', '宸插彂璐�')) AS already_shipped_quantity,
+ (IFNULL(T1.quantity, 0) - (SELECT IFNULL(SUM(si.quantity), 0)
+ FROM shipping_info si
+ WHERE si.sales_ledger_product_id = T1.id
+ AND si.status IN ('瀹℃牳閫氳繃', '宸插彂璐�'))) AS unshipped_quantity
FROM
sales_ledger_product T1
LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id
@@ -227,4 +239,4 @@
FROM product_tree);
</select>
-</mapper>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3