From ff361539e3ffd6e62100e392ddda2f4ab9dfee62 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 27 五月 2026 13:15:42 +0800
Subject: [PATCH] 工序调整, 报工反改订单数量,判断是最后一道工序才修改订单完成数量

---
 src/main/resources/mapper/production/ProductOrderMapper.xml |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductOrderMapper.xml b/src/main/resources/mapper/production/ProductOrderMapper.xml
index 6b993bf..f8d10e0 100644
--- a/src/main/resources/mapper/production/ProductOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductOrderMapper.xml
@@ -110,4 +110,14 @@
         WHERE create_time &gt;= #{startDate} AND create_time &lt;= #{endDate}
           AND complete_quantity &lt; quantity
     </select>
+
+    <update id="addCompleteQtyIfNotExceed">
+        update product_order
+        set
+            complete_quantity = complete_quantity + #{delta},
+            start_time = ifnull(start_time, now()),
+            end_time = case when (complete_quantity + #{delta}) = quantity then now() else end_time end
+        where id = #{id}
+          and (complete_quantity + #{delta}) <![CDATA[ <= ]]> quantity
+    </update>
 </mapper>

--
Gitblit v1.9.3