From 05d7fea3fc0d280d5573d5fcb58fc75e747e8187 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期三, 01 四月 2026 14:49:36 +0800
Subject: [PATCH] feat(prod): 新增bomName字段支持
---
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 73026c8..dcbf337 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -10,10 +10,17 @@
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,
+ t3.part_send_amount
FROM
sales_ledger_product T1
LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id
+
+ LEFT JOIN (
+ SELECT sales_ledger_product_id,
+ sum(part_send_amount) as part_send_amount
+ FROM shipping_info
+ GROUP BY sales_ledger_product_id) as t3 on t3.sales_ledger_product_id = T1.id
<where>
<if test="salesLedgerProduct.salesLedgerId != null">
AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
@@ -114,10 +121,14 @@
<!-- 骞冲潎鍗曚环 = 鎬婚噰璐噾棰�/鎬婚噰璐暟閲忥紝淇濈暀2浣嶅皬鏁帮紝閬垮厤闄�0 -->
ROUND(IF(SUM(slp.quantity) = 0, 0, SUM(slp.tax_inclusive_total_price) / SUM(slp.quantity)), 2) AS averagePrice,
<!-- 璇ヤ骇鍝佸ぇ绫讳笅鏈�鍚庝竴涓綍鍏ユ棩鏈燂紙鍙栧彴璐︿富琛ㄧ殑entry_date锛� -->
- MAX(sl.entry_date) AS entryDate
+ MAX(sl.entry_date) AS entryDate,
+ COALESCE(NULLIF(SUM(t1.return_quantity), 0), 0) AS return_quantity,
+ COALESCE(SUM(t2.total_amount), 0) AS return_amount
FROM sales_ledger_product slp
<!-- 鍏宠仈鍙拌处涓昏〃锛氳幏鍙栧綍鍏ユ棩鏈焑ntry_date -->
LEFT JOIN purchase_ledger sl ON slp.sales_ledger_id = sl.id
+ left join purchase_return_order_products as t1 on t1.sales_ledger_product_id = slp.id
+ left join purchase_return_orders as t2 on t2.id = t1.purchase_return_order_id
WHERE slp.type = 2 <!-- 鍥哄畾绛涢�夛細閲囪喘鍙拌处锛坱ype=2锛� -->
<!-- 閲囪喘鏃ユ湡绛涢�夛細鍙�夋潯浠� -->
<if test="req.entryDateStart != null and req.entryDateEnd != null">
--
Gitblit v1.9.3