From af3ab9c10ab913ada060e4b545209105223e7923 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期三, 23 七月 2025 13:48:33 +0800
Subject: [PATCH] 1

---
 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs"
index c2d5e15..6a2d2b8 100644
--- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs"
+++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs"
@@ -33,6 +33,29 @@
 
 namespace GZ.Projects.AuxAllWCS
 {
+    public static class ExtendClass
+    {
+        public static void Disnull(this TaskRepository repository)
+        {
+            repository.dbcontext.Dispose();
+            repository = null;
+        }
+        public static void Disnull(this LocRepository repository)
+        {
+            repository.dbcontext.Dispose();
+            repository = null;
+        }
+        public static void Disnull(this TaskActRepository repository)
+        {
+            repository.dbcontext.Dispose();
+            repository = null;
+        }
+        public static void Disnull(this SYSRepository repository)
+        {
+            repository.dbcontext.Dispose();
+            repository = null;
+        }
+    }
     public partial class AutoThread
     {
 
@@ -155,6 +178,7 @@
         public void ThreaTotal(Tag tag, Device device)
         {
             List<Task> tasks = new List<Task>();
+            LogHelper.Info("ThreaTotal 绾跨▼鎬荤嚎鍚姩");
             tasks.Add(GetTask(delegate (Tag tag1, Device device1)
             {
                 try
@@ -217,7 +241,9 @@
             tasks.Add(GetTask(ThreadMXC5, tag, 3000));
             tasks.Add(GetTask(ThreadMXC6, tag, 3000));
 
+            LogHelper.Info("ThreaTotal 绾跨▼鎬荤嚎runing");
             Task.WaitAll(tasks.ToArray());
+            LogHelper.Info("ThreaTotal 绾跨▼鎬荤嚎over");
         }
         void taskssss1(Tag tag)
         {
@@ -1213,6 +1239,8 @@
                         }
                     }
                 }
+                task1 = null;
+                task2 = null;
                 LogHelper.Info($"rgv 澶勭悊瀹屾垚銆倀askend 125");
                 #endregion
             }
@@ -1236,7 +1264,6 @@
             TaskRepository taskRepository = new TaskRepository();
             try
             {
-
                 var requires1 = taskActRepository.FindList(x => taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0).OrderBy(x => x.T_CREATE).ToList();
                 var timeMorhours = requires1.FindAll(x => DateTime.Now.Subtract(x.T_CREATE).TotalHours > 1);
                 if (timeMorhours.Any())
@@ -1629,9 +1656,10 @@
                                 else if (dev.deviceType == 6)
                                 {
                                     var close = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue(dev.deviceName + "." + (V ? "RD1203" : "RD1204")), typeof(System.UInt16));
-                                    LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆�鍏抽棴鐘舵�锛歿close}锛�);
+
                                     var canDo = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue(dev.deviceName + "." + (locindex == 0 ? "RD1200" : locindex == 1 ? "RD1201" : "RD1202")), typeof(System.UInt16));
-                                    if (close == 0)
+                                    LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆傚畞姹�鍏抽棴鐘舵�锛歿close}锛�鍏佽鎿嶄綔鐘舵�锛歿canDo}");
+                                    if (close == 0 && canDo == 1)
                                     {
                                         continuuuuu = true;
                                     }
@@ -1680,6 +1708,8 @@
                     }
 
                 }
+                requires1 = null;
+                timeMorhours = null;
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.1