From e0f2b2a83684fba1b15e90226f5ae78c9680165f Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 23 十二月 2025 11:18:18 +0800
Subject: [PATCH] yys 修改仓储物流bug
---
src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
index 177e1c3..c432bf8 100644
--- a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
@@ -51,7 +51,7 @@
t1.update_time,
t1.create_by,
t2.warn_num,
- SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock
+ (t1.inbound_num - COALESCE(SUM(t4.inbound_num), 0)) / count(1) AS availableStock
from procurement_record_storage t1
left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
@@ -141,19 +141,19 @@
t1.inbound_batches,
t1.unit_price as unitPrice,
sum(t1.total_price) as totalPrice,
- sum(t1.inbound_num) as inboundNum,
- sum(t1.inbound_num) as inboundNum0,
+ sum(t1.inbound_num) / COALESCE(count(1), 1) as inboundNum,
+ sum(t1.inbound_num) / COALESCE(count(1), 1) as inboundNum0,
t1.create_time,
t1.update_time,
t1.create_by,
t2.warn_num,
- SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock
+ (SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0)) / COALESCE(count(1), 1) AS availableStock
from procurement_record_storage t1
left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
left join procurement_record_out t4 on t1.id = t4.procurement_record_storage_id and t4.type = 1
<where>
- t1.type = 1
+ t1.type = 1 and t4.type = 1
<if test="req.supplierName != null and req.supplierName != ''">
and t3.supplier_name like concat('%',#{req.supplierName},'%')
</if>
@@ -264,7 +264,7 @@
t1.update_time,
t1.create_by,
t2.warn_num,
- SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock
+ (t1.inbound_num - COALESCE(SUM(t4.inbound_num), 0)) / count(1) AS availableStock
from procurement_record_storage t1
left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1
left join sales_ledger t3 on t3.id = t2.sales_ledger_id
@@ -312,13 +312,13 @@
t1.update_time,
t1.create_by,
t2.warn_num,
- SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) AS availableStock
+ SUM(t1.inbound_num) - COALESCE(SUM(t4.inbound_num), 0) / COALESCE(count(1), 1) AS availableStock
from procurement_record_storage t1
left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1
left join sales_ledger t3 on t3.id = t2.sales_ledger_id
left join procurement_record_out t4 on t1.id = t4.procurement_record_storage_id and t4.type = 2
<where>
- t1.type = 2
+ t4.type = 2 and t1.type = 2
<if test="req.customerName != null and req.customerName != ''">
and t3.customer_name like concat('%',#{req.customerName},'%')
</if>
--
Gitblit v1.9.3