From 63b7c5764a2b567a1aeaf939e0edabf98aba2378 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期二, 17 六月 2025 12:59:14 +0800
Subject: [PATCH] qx

---
 HH.WCS.QingXiNongfu/wms/TaskHelper.cs      |    2 +-
 HH.WCS.QingXiNongfu/core/TaskCore.cs       |   12 ++++++++++++
 HH.WCS.QingXiNongfu/core/Monitor.cs        |    9 ++++-----
 HH.WCS.QingXiNongfu/process/TaskProcess.cs |    7 +++++++
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/HH.WCS.QingXiNongfu/core/Monitor.cs b/HH.WCS.QingXiNongfu/core/Monitor.cs
index 8e4c336..6f2dfef 100644
--- a/HH.WCS.QingXiNongfu/core/Monitor.cs
+++ b/HH.WCS.QingXiNongfu/core/Monitor.cs
@@ -1302,8 +1302,7 @@
             {
                 try
                 {
-                    LogHelper.Info($" 鏃犺弻鍑哄簱  鏌ュ伐鍗�);
-                    var yuworders = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == "鏃犺弻鏍囩鍑哄簱" && x.WorkType == 6 && x.SQL_State == "鎵ц涓�).FindAll(x => x.OutNum > 0 && DateTime.Now.Subtract(x.SQL_Modify_TIme ?? DateTime.Now).TotalSeconds > 10).OrderBy(x => !string.IsNullOrEmpty(x.TagOver) ? 1 : 2).ThenBy(x => x.TagOverTime).ToList();
+                    var yuworders = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == "鏃犺弻鏍囩鍑哄簱" && x.WorkType == 6 && x.SQL_State == "鎵ц涓�).FindAll(x => DateTime.Now.Subtract(x.SQL_Modify_TIme ?? DateTime.Now).TotalSeconds > 10).OrderBy(x => !string.IsNullOrEmpty(x.TagOver) ? 1 : 2).ThenBy(x => x.TagOverTime).ToList();
                     if (!yuworders.Any())
                     {
                         YwlBQ_CreInwork(locsFirst, WJ_BQ.RK_BQDDQ, WJ_BQ.RK_BBHJQ);
@@ -1327,7 +1326,7 @@
                 try
                 {
                     string pline = "T2鎻愬崌鏈�鏍囩";
-                    var Syuworders = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == pline && x.WorkType == 6 && x.SQL_State == "鎵ц涓�).FindAll(x => x.OutNum > 0 && DateTime.Now.Subtract(x.SQL_Modify_TIme ?? DateTime.Now).TotalSeconds > 10).OrderBy(x => !string.IsNullOrEmpty(x.TagOver) ? 1 : 2).ThenBy(x => x.TagOverTime).ToList();
+                    var Syuworders = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == pline && x.WorkType == 6 && x.SQL_State == "鎵ц涓�).FindAll(x => DateTime.Now.Subtract(x.SQL_Modify_TIme ?? DateTime.Now).TotalSeconds > 10).OrderBy(x => !string.IsNullOrEmpty(x.TagOver) ? 1 : 2).ThenBy(x => x.TagOverTime).ToList();
                     //yuworders = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == plc.deviceName && x.WorkType == 6 && x.SQL_State == "鎵ц涓�).FindAll(x => DateTime.Now.Subtract(x.SQL_Modify_TIme ?? DateTime.Now).TotalSeconds > 10).OrderBy(x => !string.IsNullOrEmpty(x.TagOver) ? 1 : 2).ThenBy(x => x.TagOverTime).ToList();
 
                     var tklist = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == pline && x.WorkType == 1 && x.SQL_State == "鎵ц涓�);
@@ -1363,7 +1362,7 @@
                     }
                     else if (Syuworders.Any())
                     {
-                        YwlBQ_CreSXOutOrder(plc, Syuworders);
+                        YwlBQ_CreSXOutOrder(plc, Syuworders.FindAll(x => x.OutNum > 0));
                     }
                 }
                 catch (Exception ex)
@@ -2590,7 +2589,7 @@
                 }
             }
             ///绗竴娈碉細鍑哄簱 -鍒版媶鍨涙垨鑰�鎺ラ┏銆�-            var yuworders = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == "鏃犺弻鏍囩鍑哄簱" && x.WorkType == 6 && x.SQL_State == "鎵ц涓�).FindAll(x => DateTime.Now.Subtract(x.SQL_Modify_TIme ?? DateTime.Now).TotalSeconds > 10).OrderBy(x => !string.IsNullOrEmpty(x.TagOver) ? 1 : 2).ThenBy(x => x.TagOverTime).ToList();
+            var yuworders = LocationHelper.GetList<YWLWorkOrder>(x => x.SQL_PLineNo == "鏃犺弻鏍囩鍑哄簱" && x.WorkType == 6 && x.SQL_State == "鎵ц涓�).FindAll(x => x.OutNum > 0 && DateTime.Now.Subtract(x.SQL_Modify_TIme ?? DateTime.Now).TotalSeconds > 10).OrderBy(x => !string.IsNullOrEmpty(x.TagOver) ? 1 : 2).ThenBy(x => x.TagOverTime).ToList();
 
         //foreach (var order in yuworders)
         retuse:
diff --git a/HH.WCS.QingXiNongfu/core/TaskCore.cs b/HH.WCS.QingXiNongfu/core/TaskCore.cs
index aedaea0..4faf73c 100644
--- a/HH.WCS.QingXiNongfu/core/TaskCore.cs
+++ b/HH.WCS.QingXiNongfu/core/TaskCore.cs
@@ -6,6 +6,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Web.Configuration;
 using System.Xml.Schema;
 using static HH.WCS.QingXigongchang.api.ApiModel;
 
@@ -199,6 +200,17 @@
             var list = TaskHelper.GetTaskListByState("鏈墽琛�);
             if (list.Count > 0)
             {
+                foreach (var mst in list)
+                {
+                    var dinfo = Settings.GetDeviceInfoList().FindAll(x => x.deviceType == 13);
+                    if (dinfo.Find(x => x.location.Contains(mst.S_START_LOC)) != null)
+                        mst.N_PRIORITY = 99;
+                    else
+                    if (dinfo.Find(x => x.location.Contains(mst.S_END_LOC)) != null)
+                        mst.N_PRIORITY = 98;
+                }
+                list = list.OrderByDescending(x => x.N_PRIORITY).ToList();
+
                 list.ForEach(task =>
                 {
                     if (!TaskProcess.Intercept(task))
diff --git a/HH.WCS.QingXiNongfu/process/TaskProcess.cs b/HH.WCS.QingXiNongfu/process/TaskProcess.cs
index f866632..7ca0154 100644
--- a/HH.WCS.QingXiNongfu/process/TaskProcess.cs
+++ b/HH.WCS.QingXiNongfu/process/TaskProcess.cs
@@ -1523,6 +1523,13 @@
                     }
                 }
 
+                if (Settings.GetDeviceInfoList().Find(x => x.location.Contains(mst.S_END_LOC))?.deviceType == 13 && mst.S_TYPE.Contains("鏀剁缉鑶滃弶杩�))
+                {
+                    end = 7682;
+                }
+
+
+
                 LogHelper.Info("SendTask " + mst.S_TASK_NO);
                 Console.WriteLine("start=" + start.ToString());
                 Console.WriteLine("end= " + end.ToString());
diff --git a/HH.WCS.QingXiNongfu/wms/TaskHelper.cs b/HH.WCS.QingXiNongfu/wms/TaskHelper.cs
index 8a74ab1..fc7d2f0 100644
--- a/HH.WCS.QingXiNongfu/wms/TaskHelper.cs
+++ b/HH.WCS.QingXiNongfu/wms/TaskHelper.cs
@@ -329,7 +329,7 @@
         {
             var db = new SqlHelper<object>().GetInstance();
             //LogHelper.Info(DateTime.Now.ToLongTimeString() + "=====" + ShuiGaiTask.ToString());
-            return db.Queryable<WMSTask>().OrderBy(" N_PRIORITY DESC ").Where(a => a.S_B_STATE.Trim() == state).Take(10).ToList();
+            return db.Queryable<WMSTask>().OrderBy(" N_PRIORITY DESC ").Where(a => a.S_B_STATE.Trim() == state).ToList();
 
         }
 

--
Gitblit v1.9.1