From 189fe18f9aaabc39cc4bb4cc00f531bc43fe152e Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期二, 09 六月 2026 16:20:30 +0800
Subject: [PATCH] 新增台账时增加库存类型

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

diff --git a/src/main/resources/mapper/stock/StockUninventoryMapper.xml b/src/main/resources/mapper/stock/StockUninventoryMapper.xml
index 5aa3b9a..049537b 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">
@@ -38,13 +39,17 @@
         su.type,
         COALESCE(su.locked_quantity, 0) as locked_quantity,
         su.product_model_id,
+        p.id as product_id,
+        su.batch_no,
         su.create_time,
         su.update_time,
         su.version,
         (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 +169,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 +189,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 +210,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