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/stock/StockInventoryMapper.xml |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index 9e0ab0e..7bc72a7 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -102,6 +102,8 @@
 
     <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
         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,
@@ -112,6 +114,16 @@
         from stock_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 stock_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 stock_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