From b9ff70814c4f8fffb7646fb0ea72a2a60b4068b0 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期三, 14 十月 2026 14:11:09 +0800
Subject: [PATCH] fix: 更新出库金额计算逻辑,确保按销售明细的含税总额折算,避免因小数位数导致的应收差异
---
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 6059825..e5b00a1 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -80,6 +80,7 @@
AND sir.record_id = slp.sales_ledger_id
AND (
(sir.batch_no IS NOT NULL AND sir.batch_no LIKE CONCAT('%-', slp.id))
+ OR (sir.batch_no IS NOT NULL AND sir.batch_no LIKE CONCAT('%-', slp.product_model_id, '-%'))
OR (sir.batch_no IS NULL AND sir.product_model_id = slp.product_model_id)
)
WHERE sir.approval_status = 1
@@ -151,8 +152,8 @@
SUM(slp.quantity) AS purchaseNum,
SUM(slp.tax_inclusive_total_price) AS purchaseAmount,
COUNT(DISTINCT slp.sales_ledger_id) AS purchaseTimes,
- <!-- 骞冲潎鍗曚环 = 鎬婚噰璐噾棰�/鎬婚噰璐暟閲忥紝淇濈暀2浣嶅皬鏁帮紝閬垮厤闄�0 -->
- ROUND(IF(SUM(slp.quantity) = 0, 0, SUM(slp.tax_inclusive_total_price) / SUM(slp.quantity)), 2) AS averagePrice,
+ <!-- 骞冲潎鍗曚环 = 鎬婚噰璐噾棰�/鎬婚噰璐暟閲忥紝淇濈暀6浣嶅皬鏁帮紝閬垮厤闄�0 -->
+ ROUND(IF(SUM(slp.quantity) = 0, 0, SUM(slp.tax_inclusive_total_price) / SUM(slp.quantity)), 6) AS averagePrice,
<!-- 璇ヤ骇鍝佸ぇ绫讳笅鏈�鍚庝竴涓綍鍏ユ棩鏈燂紙鍙栧彴璐︿富琛ㄧ殑entry_date锛� -->
MAX(sl.entry_date) AS entryDate,
COALESCE(NULLIF(SUM(t1.return_quantity), 0), 0) AS return_quantity,
--
Gitblit v1.9.3