From f80938e8a03d9343672b4fb3179836b019f6b9d8 Mon Sep 17 00:00:00 2001
From: 海波 张 <2956280567@qq.com>
Date: 星期六, 28 六月 2025 21:38:46 +0800
Subject: [PATCH] 0628

---
 core/Monitor.cs |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/core/Monitor.cs b/core/Monitor.cs
index 5480a47..e625389 100644
--- a/core/Monitor.cs
+++ b/core/Monitor.cs
@@ -88,22 +88,33 @@
         public static void UpdateOutTaskPriority()
         {
             var db = new SqlHelper<object>().GetInstance();
-            var st = Settings.outMinutePriority;
+            //var st = Settings.outMinutePriority;
+
+            var st = TaskHelper.GetOutMinutePriority();
+
+            if (st==null)
+            {
+                return;
+            }
+
             var list = TaskHelper.GetWcsTaskListByState("鎵ц", "agv", "鍑哄簱");
 
             foreach (var item in list)
             {
-                var action = db.Queryable<WmsTaskAction>().Where(p => p.S_TASK_CODE==item.S_CODE && p.N_ACTION_CODE == 1).First();
-                if (action != null)
-                {
-                    var action3 = db.Queryable<WmsTaskAction>().Where(p => p.S_TASK_CODE == item.S_CODE && p.N_ACTION_CODE == 3).First();
-                    if (action3 == null)
+                var wcsTask = TaskHelper.GetTaskByState("瀹屾垚", "wcs", item.S_OP_CODE, "鍑哄簱");
+                if (wcsTask != null) {
+                    var action = db.Queryable<WmsTaskAction>().Where(p => p.S_TASK_CODE == item.S_CODE && p.N_ACTION_CODE == 1).First();
+                    if (action != null)
                     {
-                        if (DateTime.Now.Subtract(action.T_CREATE).TotalMinutes > st.Minute)
+                        var action3 = db.Queryable<WmsTaskAction>().Where(p => p.S_TASK_CODE == item.S_CODE && p.N_ACTION_CODE == 3).First();
+                        if (action3 == null)
                         {
-                            item.N_PRIORITY += st.Priority;
-                            db.Updateable(item).UpdateColumns(it => new { it.N_PRIORITY }).ExecuteCommand();
-                            NDCApi.ChangeOrderPri(item.S_CODE, item.N_PRIORITY);
+                            if (DateTime.Now.Subtract(action.T_CREATE).TotalMinutes > st.Minute)
+                            {
+                                item.N_PRIORITY += st.Priority;
+                                db.Updateable(item).UpdateColumns(it => new { it.N_PRIORITY }).ExecuteCommand();
+                                NDCApi.ChangeOrderPri(item.S_CODE, item.N_PRIORITY);
+                            }
                         }
                     }
                 }

--
Gitblit v1.9.1