From d4afabe6cb07b4129f995c82641189b2256b15a7 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 16 三月 2026 14:50:51 +0800
Subject: [PATCH] 1.耗材模块 2.出入库磅单

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

diff --git a/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml b/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
index 2940d56..da58179 100644
--- a/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
+++ b/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
@@ -14,8 +14,11 @@
         <result column="warn_num" property="warnNum"/>
     </resultMap>
     <update id="updateAddConsumablesInventory">
-        update Consumables_inventory
+        update consumables_inventory
         <set>
+            <if test="ew.productId != null">
+                product_id = #{ew.productId},
+            </if>
             <if test="ew.qualitity != null">
                 qualitity = qualitity + #{ew.qualitity},
             </if>
@@ -37,7 +40,7 @@
         where product_model_id = #{ew.productModelId}
     </update>
     <update id="updateSubtractConsumablesInventory">
-        update Consumables_inventory
+        update consumables_inventory
         <set>
             <if test="ew.netWeight != null">
                 qualitity = qualitity - #{ew.netWeight},
@@ -71,9 +74,9 @@
         pm.unit,
         p.product_name,
         p1.product_name as parent_name,
-        p1.id as parent_id
-
-        from Consumables_inventory si
+        p1.id as parent_id,
+        si.product_id as productId
+        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 product p1 on p.parent_id = p1.id
@@ -114,7 +117,7 @@
         coalesce(si.locked_quantity, 0) as locked_quantity,
         si.remark,
         si.update_time
-        from Consumables_inventory si
+        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
         where 1 = 1
@@ -123,10 +126,10 @@
         </if>
     </select>
 
-    <select id="ConsumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto">
+    <select id="consumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto">
         select
         sir.*,
-        si.qualitity as current_Consumables,
+        si.qualitity as current_consumables,
         pm.model,
         pm.unit,
         p.product_name,
@@ -137,7 +140,7 @@
 
         from Consumables_in_record sir
 
-        left join Consumables_inventory si
+        left join consumables_inventory si
         on sir.product_model_id = si.product_model_id
 
         left join product_model pm
@@ -183,12 +186,12 @@
         </where>
     </select>
 
-    <select id="ConsumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto">
+    <select id="consumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto">
         SELECT
         pm.model,
         pm.unit,
         p.product_name,
-        MAX(current_inventory) as current_Consumables,
+        MAX(current_inventory) as current_consumables,
         SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END) as total_Consumables_in,
         SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END) as total_Consumables_out
         FROM (
@@ -197,7 +200,7 @@
         SUM(qualitity) as current_inventory,
         0 as amount,
         '' as record_type
-        FROM Consumables_inventory
+        FROM consumables_inventory
         GROUP BY product_model_id
 
         UNION ALL

--
Gitblit v1.9.3