From 712b1df6fdee09bd92388a60a9f5d890d711387b Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 19 三月 2026 17:34:24 +0800
Subject: [PATCH] fix:1.入库管理和耗材导出优化 2.仓储物流和耗材物流导出修改 3.首页统计仓储物流和耗材物料两边的数据

---
 src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml b/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
index da58179..3f7f8d4 100644
--- a/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
+++ b/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
@@ -110,6 +110,8 @@
 
     <select id="listConsumablesInventoryExportData" resultType="com.ruoyi.consumables.execl.ConsumablesInventoryExportData">
         select si.qualitity,
+        -- 褰撳墠鍑�閲� = 鍏ュ簱鍑�閲� - 鍑哄簱鍑�閲�
+        (COALESCE(sir.total_net_weight,0) - COALESCE(sor.total_net_weight,0)) as net_weight,
         pm.model,
         pm.unit,
         p.product_name,
@@ -120,6 +122,21 @@
         from consumables_inventory si
         left join product_model pm on si.product_model_id = pm.id
         left join product p on pm.product_id = p.id
+        left join (
+        select
+        product_model_id,
+        sum(net_weight) as total_net_weight
+        from Consumables_in_record
+        group by product_model_id
+        ) sir on si.product_model_id = sir.product_model_id
+        -- 鍑哄簱鍑�閲�
+        left join (
+        select
+        product_model_id,
+        sum(net_weight) as total_net_weight
+        from Consumables_out_record
+        group by product_model_id
+        ) sor on si.product_model_id = sor.product_model_id
         where 1 = 1
         <if test="ew.productName != null and ew.productName !=''">
             and p.product_name like concat('%',#{ew.productName},'%')

--
Gitblit v1.9.3