From b9df2fc5c64a1d989991655a9e42e4d1f2ec4075 Mon Sep 17 00:00:00 2001
From: hdy <1105738590@qq.com>
Date: 星期四, 06 三月 2025 18:18:11 +0800
Subject: [PATCH] 修改

---
 billion-main/src/main/resources/mapper/om/OmProductionOrderInfoMapper.xml |  101 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 66 insertions(+), 35 deletions(-)

diff --git a/billion-main/src/main/resources/mapper/om/OmProductionOrderInfoMapper.xml b/billion-main/src/main/resources/mapper/om/OmProductionOrderInfoMapper.xml
index 25c5522..6dd5de1 100644
--- a/billion-main/src/main/resources/mapper/om/OmProductionOrderInfoMapper.xml
+++ b/billion-main/src/main/resources/mapper/om/OmProductionOrderInfoMapper.xml
@@ -23,62 +23,93 @@
     </resultMap>
 
     <sql id="selectOmProductionOrderInfoVo">
-        select id, work_order_no, sales_order_code, product_code, line_code, plan_qty, plan_start_time, plan_end_time, order_status, create_time, update_time, create_by, update_by, remarks, del_flag from om_production_order_info
+        select id,body_status,head_status,pre_status,body_qty,head_qty,pre_qty,work_order_no, sales_order_code, product_code, line_code, plan_qty, plan_start_time, plan_end_time, order_status, create_time, update_time, create_by, update_by, remarks, del_flag from om_production_order_info
     </sql>
 
     <!-- 鏌ヨ order_status 涓� 1 涓� plan_start_time 鏈�鏃╃殑涓�鏉¤褰� -->
-    <select id="selectEarliestOrder" resultType="OmProductionOrderInfo">
+    <select id="getBodyOrder" resultType="OmProductionOrderInfo">
             SELECT TOP 1 *
             FROM om_production_order_info
-            WHERE order_status IN (1, 2)
+            WHERE body_status IN (0,1)
             ORDER BY plan_start_time ASC
     </select>
-
-    <select id="selectEarliestOrder2" resultType="OmProductionOrderInfo">
+    <select id="updateBodyStatus1" resultType="OmProductionOrderInfo">
+        UPDATE o
+        SET body_status = 1, body_qty = body_qty + 1
+            FROM om_production_order_info AS o
+            INNER JOIN (
+            SELECT TOP 1 id
+            FROM om_production_order_info
+        WHERE body_status IN (0, 1)
+        ORDER BY plan_start_time ASC
+        ) AS sub ON o.id = sub.id;
+    </select>
+    <select id="updateBodyStatus2" resultType="OmProductionOrderInfo">
+        UPDATE om_production_order_info
+        SET body_status = 2
+        WHERE id = (
+            SELECT TOP 1 id
+            FROM om_production_order_info
+            WHERE body_status IN (0, 1)
+            ORDER BY plan_start_time ASC
+        );
+    </select>
+    <select id="getHeadOrder" resultType="OmProductionOrderInfo">
         SELECT TOP 1 *
         FROM om_production_order_info
-        WHERE order_status IN (5)
+        WHERE head_status IN (0,1)
         ORDER BY plan_start_time ASC
     </select>
-
-    <select id="updateOrderStatus" resultType="OmProductionOrderInfo">
+    <select id="updateHeadStatus1" resultType="OmProductionOrderInfo">
+        UPDATE o
+        SET head_status = 1, head_qty = head_qty + 1
+            FROM om_production_order_info AS o
+            INNER JOIN (
+            SELECT TOP 1 id
+            FROM om_production_order_info
+        WHERE head_status IN (0, 1)
+        ORDER BY plan_start_time ASC
+        ) AS sub ON o.id = sub.id;
+    </select>
+    <select id="updateHeadStatus2" resultType="OmProductionOrderInfo">
         UPDATE om_production_order_info
-        SET order_status = 5
+        SET head_status = 2
         WHERE id = (
             SELECT TOP 1 id
             FROM om_production_order_info
-            WHERE order_status IN (1, 2)
+            WHERE head_status IN (0, 1)
             ORDER BY plan_start_time ASC
         );
     </select>
-    <select id="updateOrderStatus2" resultType="OmProductionOrderInfo">
-        UPDATE om_production_order_info
-        SET order_status = 2
-        WHERE id = (
-            SELECT TOP 1 id
-            FROM om_production_order_info
-            WHERE order_status IN (1, 2)
-            ORDER BY plan_start_time ASC
-        );
-    </select>
-
-    <select id="getSerialNumber" resultType="OmProductionOrderInfo">
-        SELECT  *
+    <select id="getPreOrder" resultType="OmProductionOrderInfo">
+        SELECT TOP 1 *
         FROM om_production_order_info
-        WHERE id = 1
+        WHERE pre_status IN (0,1)
+        ORDER BY plan_start_time ASC
+    </select>
+    <select id="updatePreStatus1" resultType="OmProductionOrderInfo">
+        UPDATE o
+        SET pre_status = 1, pre_qty = pre_qty + 1
+            FROM om_production_order_info AS o
+            INNER JOIN (
+            SELECT TOP 1 id
+            FROM om_production_order_info
+        WHERE pre_status IN (0, 1)
+        ORDER BY plan_start_time ASC
+        ) AS sub ON o.id = sub.id;
+    </select>
+    <select id="updatePreStatus2" resultType="OmProductionOrderInfo">
+        UPDATE om_production_order_info
+        SET pre_status = 2
+        WHERE id = (
+            SELECT TOP 1 id
+            FROM om_production_order_info
+            WHERE pre_status IN (0, 1)
+            ORDER BY plan_start_time ASC
+        );
     </select>
 
-    <select id="updateSerialNumber" resultType="OmProductionOrderInfo">
-        UPDATE om_production_order_info
-        SET plan_qty = plan_qty + 1
-        WHERE id = 1;
-    </select>
-    <select id="updateYear" resultType="OmProductionOrderInfo">
-        UPDATE om_production_order_info
-        SET remarks = remarks + 1,
-            qty = 1
-        WHERE id = 1;
-    </select>
+
 
 
     <select id="selectOmProductionOrderInfoList" parameterType="OmProductionOrderInfo" resultMap="OmProductionOrderInfoResult">

--
Gitblit v1.9.3