From 836eba60214329dcf44672477dd0a0efead81a02 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 06 五月 2026 16:26:35 +0800
Subject: [PATCH] config(demo): 更新演示环境配置文件
---
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml | 34 ++++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 251cf64..49689a1 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -8,12 +8,27 @@
SELECT
T1.*,
CASE
- WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1
+ WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >0 THEN 1
ELSE 0
- END as has_sufficient_stock
+ END as has_sufficient_stock,
+ (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0)) as no_quantity,
+ CASE
+ WHEN (IFNULL(T1.quantity, 0) - IFNULL(t3.shipped_quantity, 0)) > 0 THEN '寰呭彂璐�'
+ ELSE '宸插彂璐�'
+ END as shippingStatus
FROM
sales_ledger_product T1
- LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id
+ LEFT JOIN (
+ SELECT product_model_id, SUM(qualitity) as qualitity, SUM(locked_quantity) as locked_quantity
+ FROM stock_inventory
+ GROUP BY product_model_id
+ ) t2 ON T1.product_model_id = t2.product_model_id
+ LEFT JOIN (
+ SELECT sales_ledger_product_id, IFNULL(SUM(spd.quantity), 0) as shipped_quantity
+ FROM shipping_info si
+ LEFT JOIN shipping_product_detail spd ON si.id = spd.shipping_info_id
+ GROUP BY sales_ledger_product_id
+ ) t3 ON t3.sales_ledger_product_id = T1.id
<where>
<if test="salesLedgerProduct.salesLedgerId != null">
AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
@@ -29,10 +44,17 @@
select slp.*
from quality_inspect qi
left join production_product_main ppm on qi.product_main_id = ppm.id
- left join product_work_order pwo on ppm.work_order_id = pwo.id
- left join product_order po on pwo.product_order_id = po.id
- left join sales_ledger_product slp on po.sales_ledger_product_id = slp.id and slp.type = 1
+ left join production_operation_task pot on ppm.production_operation_task_id = pot.id
+ left join production_order po on pot.production_order_id = po.id
+ left join production_plan pp_main
+ on find_in_set(pp_main.id, replace(replace(replace(po.production_plan_ids, '[', ''), ']', ''), ' ', '')) > 0
+ left join sales_ledger_product slp on slp.sales_ledger_id = pp_main.sales_ledger_id
+ and slp.product_model_id = po.product_model_id
+ and slp.type = 1
where qi.product_main_id = #{productMainId}
+ and slp.id is not null
+ order by slp.id desc
+ limit 1
</select>
--
Gitblit v1.9.3