From d907a822a940c7ec0fb7de0ca845472bda52229b Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期二, 03 二月 2026 14:33:12 +0800
Subject: [PATCH] #pda料箱组托和换码

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

diff --git a/src/main/resources/mapper/OrderDetlMapper.xml b/src/main/resources/mapper/OrderDetlMapper.xml
index b8e55d7..89caf0e 100644
--- a/src/main/resources/mapper/OrderDetlMapper.xml
+++ b/src/main/resources/mapper/OrderDetlMapper.xml
@@ -45,7 +45,6 @@
         <result column="update_by" property="updateBy" />
         <result column="update_time" property="updateTime" />
         <result column="memo" property="memo" />
-
     </resultMap>
 
     <select id="selectItem" resultMap="BaseResultMap">
@@ -53,6 +52,7 @@
         where 1=1
         and order_id = #{orderId}
         and matnr = #{matnr}
+        and status &lt; 3
         <choose>
             <when test="batch != null and batch != ''">
                 and batch = #{batch}
@@ -61,7 +61,16 @@
                 and (batch IS NULL OR batch = '')
             </otherwise>
         </choose>
+        <choose>
+            <when test="barcode != null and barcode != ''">
+                and barcode = #{barcode}
+            </when>
+            <otherwise>
+                and (barcode IS NULL OR barcode = '')
+            </otherwise>
+        </choose>
     </select>
+
 
     <select id="selectItemByOrderNo" resultMap="BaseResultMap">
         select * from man_order_detl
@@ -143,7 +152,7 @@
 
     <update id="decrease">
         update man_order_detl
-        set qty = qty - #{qty}
+        set work_qty = work_qty - #{qty}
         where 1=1
         and order_no = #{orderNo}
         and matnr = #{matnr}
@@ -168,6 +177,23 @@
         INSERT INTO man_order_detl_log SELECT * FROM man_order_detl WHERE id = #{id}
     </insert>
 
+    <update id="increaseQtyByOrderNo">
+        update man_order_detl
+        set qty = qty + #{qty}
+        where 1=1
+        and order_no = #{orderNo}
+        and matnr = #{matnr}
+        and barcode= #{barcode}
+        <choose>
+            <when test="batch != null and batch != ''">
+                and batch = #{batch}
+            </when>
+            <otherwise>
+                and (batch IS NULL OR batch = '')
+            </otherwise>
+        </choose>
+    </update>
+
     <update id="increaseWorkQty">
         update man_order_detl
         set work_qty = work_qty + #{workQty}
@@ -182,6 +208,14 @@
                 and (batch IS NULL OR batch = '')
             </otherwise>
         </choose>
+        <choose>
+            <when test="barcode != null and barcode != ''">
+                and barcode = #{barcode}
+            </when>
+            <otherwise>
+                and (barcode IS NULL OR barcode = '')
+            </otherwise>
+        </choose>
     </update>
 
 </mapper>

--
Gitblit v1.9.1