From 7486f6d6a93d98f96f45f0cc4846be9c8a2345df Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 09 六月 2026 15:39:20 +0800
Subject: [PATCH] 增加废品库详情接口

---
 src/main/resources/mapper/stock/StockUninventoryMapper.xml |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/stock/StockUninventoryMapper.xml b/src/main/resources/mapper/stock/StockUninventoryMapper.xml
index 5aa3b9a..fbdb322 100644
--- a/src/main/resources/mapper/stock/StockUninventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockUninventoryMapper.xml
@@ -30,6 +30,7 @@
         from stock_uninventory su
         left join product_model pm on su.product_model_id = pm.id
         left join product p on pm.product_id = p.id
+        left join manufacturer m on su.manufacturer_id = m.id
     </sql>
 
     <sql id="WastePageColumns">
@@ -44,7 +45,9 @@
         (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity,
         pm.model,
         pm.unit,
-        p.product_name
+        p.product_name,
+        m.name as manufacturer_name,
+        su.source
     </sql>
 
     <update id="updateSubtractStockUnInventory">
@@ -164,7 +167,8 @@
         su.*,
         pm.model,
         pm.unit,
-        p.product_name
+        p.product_name,
+        m.name as manufacturer_name
         <include refid="BaseWasteFromClause" />
         <where>
             <if test="ew.type != null and ew.type != ''">
@@ -183,6 +187,7 @@
         pm.model,
         pm.unit,
         p.product_name,
+        m.name as manufacturer_name,
         (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity
         <include refid="BaseWasteFromClause" />
         <where>
@@ -203,6 +208,37 @@
         order by su.update_time desc, su.id desc
     </select>
 
+    <select id="getWasteBatchNoQty" resultType="com.ruoyi.stock.dto.StockUninventoryDto">
+        select
+        su.id,
+        p.product_name,
+        pm.model,
+        m.name as manufacturer_name,
+        su.source,
+        pm.unit,
+        su.batch_no,
+        su.qualitity,
+        COALESCE(su.locked_quantity, 0) as locked_quantity,
+        (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity,
+        su.remark,
+        su.update_time,
+        su.product_model_id
+        from stock_uninventory su
+        left join product_model pm on su.product_model_id = pm.id
+        left join product p on pm.product_id = p.id
+        left join manufacturer m on su.manufacturer_id = m.id
+        <where>
+            and su.type = 'waste'
+            <if test="ew.productModelId != null and ew.productModelId > 0">
+                and su.product_model_id = #{ew.productModelId}
+            </if>
+            <if test="ew.productId != null and ew.productId > 0">
+                and p.id = #{ew.productId}
+            </if>
+        </where>
+        order by su.batch_no
+    </select>
+
     <select id="selectPendingOutQuantity" resultType="java.math.BigDecimal">
         SELECT IFNULL(SUM(sor.stock_out_num), 0)
         FROM stock_out_record sor

--
Gitblit v1.9.3