From ef986338133c1e636fee455356f10d01e5f7b293 Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期三, 25 六月 2025 15:18:20 +0800 Subject: [PATCH] 1 --- 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs | 39 +++++++++++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 10 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 63c610a..4d71280 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" @@ -15,6 +15,7 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement; using System.Windows.Interop; using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox; +using System.Security.Cryptography; namespace GZ.Projects.AuxAllWCS { @@ -103,6 +104,12 @@ else if (Settings.deviceInfos.Count == 0) { tag.Global.SettingsOver = 0; + } + else tag.Global.SettingsOver++; + if (tag.Global.SettingsOver > 999) + { + tag.Global.SettingsOver = 1; + Console.Clear(); } } @@ -893,14 +900,15 @@ public void ThreadGrats(Tag tag, Action<HaiKangOrderInfo> continueTask) { - Console.WriteLine($"ThreadGrats 鍏夋爡澶勭悊 =================> "); - + LogHelper.Info($"ThreadGrats 鍏夋爡澶勭悊 =================> "); + var taskCOdes = new List<string> { "Sarrive", "Srelease", "Earrive", "Erelease" }; TaskActRepository taskActRepository = new TaskActRepository(); TaskRepository taskRepository = new TaskRepository(); - var requires = taskActRepository.FindList(x => taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0); + var requires = taskActRepository.FindList(x => taskCOdes.Contains(x.S_ACTION_CODE) && x.N_CREATEMETHOD == 0).OrderBy(x => x.T_CREATE); foreach (var item in requires) { + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE}鍏夋爡澶勭悊 =================> "); var tin = taskCOdes.IndexOf(item.S_ACTION_CODE); if (tin == -1) { @@ -930,20 +938,24 @@ var dev = Settings.deviceInfos.Find(x => x.location.Contains(loc)); if (dev != null) { + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏夋爡澶勭悊 =================> "); var V = dev.location.ToList().FindIndex(x => x == loc) == 0; //杞﹁蛋浜� 寮�厜鏍� if (!goin) { if (dev.deviceType == 1) { + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊 =================> "); LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "R02" : "R04"), "true", dev.deviceName + "Queue")); Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "R02" : "R04"), "true", dev.deviceName + "Queue", false); } else if (dev.deviceType == 2) { + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊 =================> "); LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "D1222" : "D1223"), "1", dev.deviceName + "Queue")); Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1222" : "D1223"), "1", dev.deviceName + "Queue"); } + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 寮�惎鍏夋爡澶勭悊瀹屾垚 =================> "); item.N_CREATEMETHOD = 1; taskActRepository.Update(item); @@ -953,7 +965,9 @@ { if (dev.deviceType == 1) { + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊 =================> "); var tf = Conn.榛樿Redis.GetValue(dev.deviceName + "." + (V ? "R50" : "R52"));//璇诲叧闂姸鎬�+ LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏夋爡鍏抽棴淇″彿{tf}"); if (tf?.ToLower() == "true") { LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�); @@ -964,13 +978,16 @@ LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "R01" : "R03"), "true", dev.deviceName + "Queue")); Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "R01" : "R03"), "true", dev.deviceName + "Queue", false); } - + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊瀹屾垚 =================> "); } else if (dev.deviceType == 2) { + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊 =================> "); var tf = Conn.榛樿Redis.GetValue(dev.deviceName + ".D1202"); int numm = int.Parse(string.IsNullOrEmpty(tf) ? "0" : tf); - if (TcpServer.GetBitdata(numm, (V ? 0 : 1)) == 1) + int close = TcpServer.GetBitdata(numm, (V ? 0 : 1)); + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏夋爡鍏抽棴淇″彿{close}"); + if (close == 1) { LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�); continuuuuu = true; @@ -980,6 +997,7 @@ LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin ? "鍏抽棴" : "寮�惎")} 鐢宠銆� + string.Format("{0}{1}{2}", dev.deviceName + "." + (V ? "D1220" : "D1221"), dev.deviceName + "Queue")); Conn.榛樿Redis.SetValue(dev.deviceName + "." + (V ? "D1220" : "D1221"), "1", dev.deviceName + "Queue"); } + LogHelper.Info($"ThreadGrats {item.S_TASK_NO} >{item.S_ACTION_CODE} 璁惧鏄瘂dev.deviceName} 鍏抽棴鍏夋爡澶勭悊瀹屾垚 =================> "); } } @@ -998,6 +1016,7 @@ } } System.Threading.Thread.Sleep(3000); + LogHelper.Info($"ThreadGrats deviceType2鍏夋爡鍐欏叆浣嶉噸缃�=================> "); //閲嶇疆淇″彿 foreach (var dev in Settings.deviceInfos.FindAll(x => x.deviceType == 2)) { @@ -1005,16 +1024,16 @@ int numm = int.Parse(string.IsNullOrEmpty(tf) ? "0" : tf); if (TcpServer.GetBitdata(numm, 0) == 0) { - Conn.榛樿Redis.SetValue(dev.deviceName + ".D1220", "0", dev.deviceName + "Queue"); - Conn.榛樿Redis.SetValue(dev.deviceName + ".D1222", "0", dev.deviceName + "Queue"); + Conn.榛樿Redis.SetValue(dev.deviceName + ".D1220", "0", dev.deviceName + "Queue", false); + Conn.榛樿Redis.SetValue(dev.deviceName + ".D1222", "0", dev.deviceName + "Queue", false); } else if (TcpServer.GetBitdata(numm, 1) == 0) { - Conn.榛樿Redis.SetValue(dev.deviceName + ".D1221", "0", dev.deviceName + "Queue"); - Conn.榛樿Redis.SetValue(dev.deviceName + ".D1223", "0", dev.deviceName + "Queue"); + Conn.榛樿Redis.SetValue(dev.deviceName + ".D1221", "0", dev.deviceName + "Queue", false); + Conn.榛樿Redis.SetValue(dev.deviceName + ".D1223", "0", dev.deviceName + "Queue", false); } } - + LogHelper.Info($"ThreadGrats deviceType2鍏夋爡鍐欏叆浣嶉噸缃畬鎴愩� =================> "); } /// <summary> /// 1020 1023绌烘涓嬬嚎 -- Gitblit v1.9.1