From 0bf4a3d86b017fc4cadddda4182e682386dfee82 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期四, 03 七月 2025 18:08:52 +0800
Subject: [PATCH] 1

---
 2025年6月12日/AuxAllWCS/Build/Project/代码/界面事件.cs | 2817 +++++++++++++++++++++++------------------------------------
 1 files changed, 1,119 insertions(+), 1,698 deletions(-)

diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs"
index e080eb5..94a1369 100644
--- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs"
+++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/\347\225\214\351\235\242\344\272\213\344\273\266.cs"
@@ -30,1750 +30,1171 @@
 using GZ.DB.Entity.OIDATABASE;
 namespace GZ.Projects.AuxAllWCS
 {
-	/// <summary>
-	/// 浜嬩欢
-	/// </summary>
-	public partial class ViewModel : System.ComponentModel.INotifyPropertyChanged
-	{
+    /// <summary>
+    /// 浜嬩欢
+    /// </summary>
+    public partial class ViewModel : System.ComponentModel.INotifyPropertyChanged
+    {
         bool IsExitApp = false;
         ConcurrentStack<int> ExitJudgeStack = new ConcurrentStack<int>();
-		System.Net.HttpListener HttpSvcHost = null;
-	
-		#region View1浜嬩欢
-		/// <summary>
+        System.Net.HttpListener HttpSvcHost = null;
+
+        #region View1浜嬩欢
+        /// <summary>
         /// View1鎵撳紑浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-		public void View1_LoadEvent(object sender, RoutedEventArgs e)
-		{
-	
-			try
-			{
-				HttpSvcHost = new System.Net.HttpListener();
-				HttpSvcHost.AuthenticationSchemes = System.Net.AuthenticationSchemes.Anonymous;
-				HttpSvcHost.Prefixes.Add("http://10.221.55.116:8808/");
-				HttpSvcHost.Start();
-				HttpSvcHost.BeginGetContext(HttpSvcListenerCallback, null);
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			View1_Init(sender, e);
-		
-			/// <summary>
-			/// 绋嬪簭鐗囨:鍒濆鍖栭厤缃�-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝
-				 if (Tag.Global.SettingsOver == 0)
-                        {
-                            SettingInit();
-                            Tag.Global.SettingsOver = 1;
-                        }
-                        else if(Settings.deviceInfos.Count == 0)
-                        {
-                            Tag.Global.SettingsOver = 0;
-                        }
+        public void View1_LoadEvent(object sender, RoutedEventArgs e)
+        {
 
-				#endregion [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(10000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			//鎵ц澶氭
-			for(int iii=0;iii<1;iii++)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250323151832119][涓氬姟閫昏緫.Program4]
-				//Conn.榛樿Redis.SetValue("瑗块棬瀛�.Param3","300","瑗块棬瀛�Queue");
-//return;
-if(false){
-                    List<string> locs = new List<string>() { "vxr1l", "vx1r", "vxr1c1", "vxr1c2", "vxr2l", "vxr2r", "vxr2c1", "vxr2c2" };
-                    List<string> sites = new List<string>() { "196365BB283162", "193841BB283149", "198756BB287300", "198767BB286133", "206987BB282931", "204460BB282975", "209405BB287057", "209377BB285899" };
+            try
+            {
+                //HttpSvcHost = new System.Net.HttpListener();
+                //HttpSvcHost.AuthenticationSchemes = System.Net.AuthenticationSchemes.Anonymous;
+                //HttpSvcHost.Prefixes.Add("http://10.221.55.117:8808/");
+                //HttpSvcHost.Start();
+                //HttpSvcHost.BeginGetContext(HttpSvcListenerCallback, null);
+            }
+            catch (Exception ex)
+            {
+                Conn.榛樿鏃ュ織.Error(ex.ToString());
+            }
+            View1_Init(sender, e);
 
-                    LocRepository locservice = new LocRepository();
-                    for (int i = 0; i < locs.Count; i++)
+            /// <summary>
+            /// 绋嬪簭鐗囨:鍒濆鍖栭厤缃�+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
                     {
-                        string loccode = locs[i];
-                        string sitesss = sites[i];
-                        var loc = locservice.FindEntity(x => x.S_LOC_CODE == loccode);
-                        if (loc == null)
-                        {
-                            locservice.Insert(new LocEntity
-                            {
-                                S_ID = Guid.NewGuid().ToString(),
-                                S_STATE = "缂栬緫",
-                                T_CREATE = DateTime.Now,
-                                T_MODIFY = DateTime.Now,
-                                S_DEEP = "vxr",
+                        #region    [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝
 
-                                S_LOC_CODE = loccode,
-                                S_AGV_SITE = sitesss,
-
-                                S_LOCK_STATE = "鏃�,
-                                N_ROW = 1,
-                                N_COL = 1,
-                                N_AGV_CODE = 0,
-                                N_AGV_SITE_LAYER = 0,
-                                N_CAPACITY = 1,
-                                N_CURRENT_NUM = 0,
-                                S_TYPE = "",
-
-                            });
-                        }
+                        Action myDelegate = () => SettingInit();
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadSettingInit", new object[] { tag, myDelegate });
+                        #endregion [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝
                     }
-                   // TaskProcess.CreateTask("", locs[6], locs[7], "test", 9, new List<string> { "test" }, 1, 1, 1);
-                   }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(10000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:鎹风灛鎶撹噦1
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250325083325390][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦1]
 
-				#endregion [鑴氭湰][20250323151832119][涓氬姟閫昏緫.Program4]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-			/// <summary>
-			/// 绋嬪簭鐗囨:鎹风灛鎶撹噦1
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250325083325390][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦1]
-				var VERX = Settings.deviceInfos?.Find(x =>x.deviceType==2&& x.deviceName == "Js鎹烽『1");
-
- if (VERX != null)
-                        {
-                            if (tag.Js1.D1212_LAST == 0 && TcpServer.GetBitdata(tag.Js1.D1212, 2) == 1)
-                            {
-                                var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-                                {
-                                    requestType = 4,
-                                    endBit = VERX.location[0]
-                                }));
-                                LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
-                                if (str.Contains("true"))
-                                {
-                                    tag.Js1.D1212_LAST = 1;
-                                }
-                            }
-                            if(tag.Js1.D1212_LAST == 1 &&TcpServer.GetBitdata(tag.Js1.D1212, 2) == 0){
-								tag.Js1.D1212_LAST = 0;
-                            }
-							if (tag.Js1.D1213_LAST == 0 && TcpServer.GetBitdata(tag.Js1.D1212, 3) == 1)
-							{
-								var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-								{
-									requestType = 4,
-									endBit = VERX.location[1]
-								}));
-								LogHelper.Info($"{VERX.location[1]}鐢宠mes浠诲姟缁撴灉{str}");
-								if (str.Contains("true"))
-								{
-									tag.Js1.D1213_LAST = 1;
-								}
-							}if(tag.Js1.D1213_LAST == 1 &&TcpServer.GetBitdata(tag.Js1.D1212, 3) == 0){
-								tag.Js1.D1213_LAST = 0;
-                            }
-                        }
-				#endregion [鑴氭湰][20250325083325390][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦1]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:鎹风灛鎶撹噦2
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250325083326611][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦2]
-				//jsz2鎹风灛鎶撹噦2
-
-                       var VERX = Settings.deviceInfos?.Find(x =>x.deviceType==2&& x.deviceName == "Js鎹烽『2");
-
-                        if (VERX != null)
-                        {
-                            if (tag.Js2.D1212_LAST == 0 && TcpServer.GetBitdata(tag.Js2.D1212, 2) == 1)
-                            {
-                                var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-                                {
-                                    requestType = 4,
-                                    endBit = VERX.location[0]
-                                }));
-                                LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
-                                if (str.Contains("true"))
-                                {
-                                    tag.Js2.D1212_LAST = 1;
-                                }
-                            } if(tag.Js2.D1212_LAST == 1 &&TcpServer.GetBitdata(tag.Js2.D1212, 2) == 0){
-								tag.Js2.D1212_LAST = 0;
-                            }
-                            if (tag.Js2.D1213_LAST == 0 && TcpServer.GetBitdata(tag.Js2.D1212, 3) == 1)
-                            {
-                                var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-                                {
-                                    requestType = 4,
-                                    endBit = VERX.location[1]
-                                }));
-                                LogHelper.Info($"{VERX.location[1]}鐢宠mes浠诲姟缁撴灉{str}");
-                                if (str.Contains("true"))
-                                {
-                                    tag.Js2.D1213_LAST = 1;
-                                }
-                            }if(tag.Js2.D1213_LAST == 1 &&TcpServer.GetBitdata(tag.Js2.D1213, 2) == 0){
-								tag.Js2.D1213_LAST = 0;
-                            }
-                        }
-				#endregion [鑴氭湰][20250325083326611][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦2]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:鑷祦杞祦绋�-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250325085810885][涓氬姟閫昏緫.绗笁鏍囨.鑷祦杞祦绋媇
-				//foreach(var di in Settings.deviceInfos)
-//	if (di.deviceType == 2 || di.deviceType == 1)
-//	RunafterMac(di,true);
-	/// TODO  mes 涓嬪彂銆�  鏀规垚鏈烘鑷傜洃鎺�-  鐩戞帶绌虹殑杩樻槸婊$殑 - 鑱斿姩mes 浠诲姟銆�-				#endregion [鑴氭湰][20250325085810885][涓氬姟閫昏緫.绗笁鏍囨.鑷祦杞祦绋媇
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�L
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250325083149366][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
-				
-var VERX = Settings.deviceInfos?.Find(x => x.deviceType == 1 && x.deviceName.Contains("1"));
-
-                        if (VERX != null)
-                        {
-                            if (tag.wxr1.R44 && !tag.wxr1.R44_LAST && tag.wxr1.R10)
-                            {
-                                if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
-                                {
-                                    var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-                                    {
-                                        requestType = 1,
-                                        cntrCode = traycode,
-                                        startBit = VERX.location[0],
-                                        endBit = ""
-                                    }));
-                                    LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
-                                    if (str.Contains("true"))
-                                    {
-                                        tag.wxr1.R44_LAST = true; 
-                                    }
-                                }
-                                else
-                                {
-                                    TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E"));
-                                }
-                            }
-                            else
-                            {
-                               //TaskRepository ts = new TaskRepository();
-                                if (tag.wxr1.R10_LAST) //鎵樼洏鏀剧疆淇″彿銆傘�
-                                {
-                                	if (tag.wxr1.R10)
-									{
-									tag.wxr1.R10_LAST=false;
-									} else
-                                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0],out string traycode))
-                                    {
-                                        //涓婃姤鏍¢獙銆�-                                        ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
-                                        var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
-                                        {
-                                            sceneType = 1,
-                                            cntrCode = traycode,
-                                        }));
-                                        if (str.Contains("true"))
-                                        {
-                                            //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                            tag.wxr1.R10 = true;
-                                            tag.wxr1.R44_LAST = false;
-                                        }
-                                        else
-                                        {
-                                            //鎶ヨ銆�-                                        }
-                                    }
-                                    else { TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
-                                }
-                            }
-                        }
-				#endregion [鑴氭湰][20250325083149366][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�R
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250610002047005][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
-				var VERX = Settings.deviceInfos?.Find(x => x.deviceType == 1 && x.deviceName.Contains("1"));
-
-                        if (VERX != null)
-                        {
-                            if (tag.wxr1.R46 && !tag.wxr1.R46_LAST && tag.wxr1.R11)
-                            {
-                                if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
-                                {
-                                    var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-                                    {
-                                        requestType = 1,
-                                        cntrCode = traycode,
-                                        startBit = VERX.location[1],
-                                        endBit = ""
-                                    }));
-                                    LogHelper.Info($"{VERX.location[1]}鐢宠mes浠诲姟缁撴灉{str}");
-                                    if (str.Contains("true"))
-                                    {
-                                        tag.wxr1.R46_LAST = true; 
-                                    }
-                                }
-                                else
-                                {
-                                    TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E"));
-                                }
-                            }
-                            else
-                            {
-                                if (tag.wxr1.R11_LAST) //鎵樼洏鏀剧疆淇″彿銆傘�
-                                {
-                                	if (tag.wxr1.R11)
-									{
-									tag.wxr1.R11_LAST=false;
-									} else
-                                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1],out string traycode))
-                                    {
-                                        //涓婃姤鏍¢獙銆�-                                        ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
-                                        var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
-                                        {
-                                            sceneType = 1,
-                                            cntrCode = traycode,
-                                        }));
-                                        if (str.Contains("true"))
-                                        {
-                                            //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                            tag.wxr1.R11 = true;
-                                            tag.wxr1.R46_LAST = false;
-                                        }
-                                        else
-                                        {
-                                            //鎶ヨ銆�-                                        }
-                                    }
-                                    else { TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
-                                }
-                            }
-                        }
-				#endregion [鑴氭湰][20250610002047005][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�L
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250325083315503][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
-				
-var VERX = Settings.deviceInfos?.Find(x => x.deviceType == 1 && x.deviceName.Contains("2"));
-
-                        if (VERX != null)
-                        {
-                            if (tag.wxr2.R44 && !tag.wxr2.R44_LAST && tag.wxr2.R10)
-                            {
-                                if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0], out string traycode))
-                                {
-                                    var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-                                    {
-                                        requestType = 1,
-                                        cntrCode = traycode,
-                                        startBit = VERX.location[0],
-                                        endBit = ""
-                                    }));
-                                    LogHelper.Info($"{VERX.location[0]}鐢宠mes浠诲姟缁撴灉{str}");
-                                    if (str.Contains("true"))
-                                    {
-                                        tag.wxr2.R44_LAST = true; 
-                                    }
-                                }
-                                else
-                                {
-                                    TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E"));
-                                }
-                            }
-                            else
-                            {
-                                if (tag.wxr2.R10_LAST) //鎵樼洏鏀剧疆淇″彿銆傘�
-                                {
-                                	if (tag.wxr2.R10)
-									{
-										tag.wxr2.R10_LAST=false;
-									} else
-                                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[0],out string traycode))
-                                    {
-                                        //涓婃姤鏍¢獙銆�-                                        ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
-                                        var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
-                                        {
-                                            sceneType = 1,
-                                            cntrCode = traycode,
-                                        }));
-                                        if (str.Contains("true"))
-                                        {
-                                            //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                            tag.wxr2.R10 = true;
-                                            tag.wxr2.R44_LAST = false;
-                                        }
-                                        else
-                                        {
-                                            //鎶ヨ銆�-                                        }
-                                    }
-                                    else { TcpServer.TcpServerSend(VERX.deviceNo[0], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
-                                }
-                            }
-                        }
-				#endregion [鑴氭湰][20250325083315503][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�R
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250610002647095][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
-				var VERX = Settings.deviceInfos?.Find(x => x.deviceType == 1 && x.deviceName.Contains("2"));
-
-                        if (VERX != null)
-                        {
-                            if (tag.wxr2.R46 && !tag.wxr2.R46_LAST && tag.wxr2.R11)
-                            {
-                                if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1], out string traycode))
-                                {
-                                    var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", JsonConvert.SerializeObject(new
-                                    {
-                                        requestType = 1,
-                                        cntrCode = traycode,
-                                        startBit = VERX.location[1],
-                                        endBit = ""
-                                    }));
-                                    LogHelper.Info($"{VERX.location[1]}鐢宠mes浠诲姟缁撴灉{str}");
-                                    if (str.Contains("true"))
-                                    {
-                                        tag.wxr2.R46_LAST = true; 
-                                    }
-                                }
-                                else
-                                {
-                                    TcpServer.TcpServerSend(VERX.deviceNo[2], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E"));
-                                }
-                            }
-                            else
-                            {
-                               if (tag.wxr2.R11_LAST) //鎵樼洏鏀剧疆淇″彿銆傘�
-                                {
-                                	if (tag.wxr2.R11)
-									{
-										tag.wxr2.R11_LAST=false;
-									} else
-                                    if (TcpServer.TrayIps.TryGetValue(VERX.deviceNo[1],out string traycode))
-                                    {
-                                        //涓婃姤鏍¢獙銆�-                                        ///var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
-                                        var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/202", JsonConvert.SerializeObject(new
-                                        {
-                                            sceneType = 1,
-                                            cntrCode = traycode,
-                                        }));
-                                        if (str.Contains("true"))
-                                        {
-                                            //Conn.榛樿Redis.SetValue("缁村笇灏旀姄鑷�.R10", "true", "缁村笇灏旀姄鑷�Queue");
-                                            tag.wxr2.R11 = true;
-                                            tag.wxr2.R46_LAST = false;
-                                        }
-                                        else
-                                        {
-                                            //鎶ヨ銆�-                                        }
-                                    }
-                                    else { TcpServer.TcpServerSend(VERX.deviceNo[1], GZ.Device.PLC.PlcHelper.Hex2Bin("544F4E")); }
-                                }
-                            }
-                        }
-				#endregion [鑴氭湰][20250610002647095][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:浠诲姟涓嬪彂
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250325085542733][涓氬姟閫昏緫.浠诲姟涓嬪彂]
-				
-				#endregion [鑴氭湰][20250325085542733][涓氬姟閫昏緫.浠诲姟涓嬪彂]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:ResolveMesTask
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250531163716255][涓氬姟閫昏緫.澶勭悊MES浠诲姟绾跨▼.ResolveMesTask]
-				//mes 浠诲姟鎷嗗垎銆備竴娈典换鍔″拰 澶氭浠诲姟銆�-ToWMSMES.ResMesTask();
-				#endregion [鑴氭湰][20250531163716255][涓氬姟閫昏緫.澶勭悊MES浠诲姟绾跨▼.ResolveMesTask]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			try
-			{
-				#region    [鑴氭湰][20250605212104026][涓氬姟閫昏緫.SocketServer]
-				var host = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
-foreach (var ip in host.AddressList)
-{
-    if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
-    {
-        Console.WriteLine($"ip= {ip.ToString()}");
-        new TcpServer(ip.ToString());
-    }
-}
-				#endregion [鑴氭湰][20250605212104026][涓氬姟閫昏緫.SocketServer]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-			}	
-			/// <summary>
-			/// 绋嬪簭鐗囨:鍏夋爡澶勭悊
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250611223832523][涓氬姟閫昏緫.鍏夋爡澶勭悊]
-				// - 鍏夋爡浜や簰澶勭悊銆傘�
-                        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);
-                        foreach (var item in requires)
-                        {
-                            var tin = taskCOdes.IndexOf(item.S_ACTION_CODE);
-                            if (tin == -1)
-                            {
-                                item.N_CREATEMETHOD = -1;
-                                taskActRepository.Update(item);
-                                continue;
-                            }
-                            //var task = taskRepository.FindEntity(x => x.S_TASK_NO == item.S_TASK_NO);
-                            string loc = "";
-                            if (tin < 2)
-                            {
-                                loc = item.S_START_LOC;
-                            }
-                            else
-                            {
-                                loc = item.S_END_LOC;
-                            } 
-							if (loc == null) continue; else loc = loc.Trim();
-                            bool goin = tin % 2 == 0;
-                            bool continuuuuu =false;
-                            var dev = Settings.deviceInfos.Find(x => x.location.Contains(loc));
-                            if (dev != null)
-                            {
-                                var V = dev.location.ToList().FindIndex(x => x == loc) == 0;
-								//杞﹁蛋浜� 寮�厜鏍�-                                if (!goin)
-                                {
-                                    if (dev.deviceType == 1)
-                                    {
-                                        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");
-
-                                    }
-                                    else if (dev.deviceType == 2)
-                                    {
-                                        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");
-                                    }
-                                    
-	                                item.N_CREATEMETHOD = 1;
-	                                taskActRepository.Update(item);
-								}
-                                //杞﹁杩涘叆浜や簰銆�-								else
-								{
-                                    if (dev.deviceType == 1)
-                                    {
-										var tf = Conn.榛樿Redis.GetValue(dev.deviceName + "." + (V ? "R50" : "R52"));//璇诲叧闂姸鎬�-										if (tf?.ToLower() == "true")
-										{
-											LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin?"鍏抽棴":"寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
-											continuuuuu = true;
-										}
-										else
-										{
-											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");
-										}
-
-                                    }
-                                    else if (dev.deviceType == 2)
-                                    {
-                                        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)
-                                        {
-											LogHelper.Info($"{dev.deviceName}{(V ? "宸� : "鍙�)} 鍏夋爡{(goin?"鍏抽棴":"寮�惎")} 鐢宠銆�宸茬粡鍏抽棴锛�);
-                                            continuuuuu = true;
-                                        }
-                                        else
-                                        {
-                                            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");
-                                        }
-                                    }
-
-                                }
-
-                            }
-                            if (continuuuuu)
-                            {
-								LogHelper.Info($"{item.S_TASK_NO}{item.S_ACTION_CODE} 杞﹁締鍙戦�缁х画浠诲姟锛�);
-                                continueTask(new HaiKangOrderInfo
-                                {
-                                    reqCode = item.S_ID.Replace("-", ""),
-                                    taskCode = item.S_TASK_NO
-                                });
-                                item.N_CREATEMETHOD = 1;
-                                taskActRepository.Update(item);
-                            }
-                        }
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadJS1", new object[] { tag });
+                        #endregion [鑴氭湰][20250325083325390][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦1]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
                         System.Threading.Thread.Sleep(3000);
-                        //閲嶇疆淇″彿
-                        foreach (var dev in Settings.deviceInfos.FindAll(x => x.deviceType == 2))
-                        {
-                            var tf = Conn.榛樿Redis.GetValue(dev.deviceName + ".D1202");
-                            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");
-                            }
-                            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");
-                            }
-                        }
-                        
-                        // 鍙戦偅绉戜笅鏂欏厜鏍呫�
-				#endregion [鑴氭湰][20250611223832523][涓氬姟閫昏緫.鍏夋爡澶勭悊]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:1020绌烘涓嬬嚎
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250616094224396][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1020绌烘涓嬬嚎]
-				foreach (var Bssx in new string[] { "1020", "1023" })
-{
-    var RtaskState = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.RtaskState"), typeof(System.UInt16));
-    var RtaskState_LAST = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.RtaskState_LAST"), typeof(System.UInt16));
-    var R鎵樼洏鐮�= (System.String)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.R鎵樼洏鐮�), typeof(System.String));
-    Console.WriteLine($"{Bssx} 绌轰笅妫�祴锛氫换鍔$敵璇凤細{RtaskState}- 鏄惁宸插鐞嗭細{RtaskState_LAST}- 鎵樼洏鐮侊細{R鎵樼洏鐮亇");
-    if (RtaskState == 3 && RtaskState_LAST == 0)
-    {
-        try
-        {
-            foreach (var item in new string[] { "1004", "1006", "1012", "1014" })
-            {
-                var R5 = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽"), typeof(System.UInt16));
-                var R5绌洪棽_LAST = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽_LAST"), typeof(System.UInt16));
-                if (R5 == 5 && R5绌洪棽_LAST == 0)
-                {
-                    var b = TaskProcess.CreateTask("", Bssx, item, "绌轰笂RGV", 5, new List<string> { R鎵樼洏鐮�}, "RGV");
-                    if (b)
-                    {
-                        LogHelper.Debug($"杈撻�绾縍GV绌烘墭浠诲姟 from:{Bssx}>to {item}寮�鍒涘缓鎴愬姛");
-                        Modular.Redis.RedisHelper.Add($"S{Bssx}Read.RtaskState_LAST", "1", out string msg);
-                        //Conn.榛樿Redis.SetValue($"S{Bssx}Read.RtaskState_LAST", "1", $"S{Bssx}ReadQueue");
-                        Modular.Redis.RedisHelper.Add($"S{item}Read.R5绌洪棽_LAST", "1", out string msg1);
-                        //Conn.榛樿Redis.SetValue($"S{item}Read.R5绌洪棽_LAST", "1", $"S{item}ReadQueue");
-                        break;
                     }
                 }
-                else if (R5 != 5 && R5绌洪棽_LAST == 1)
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:鎹风灛鎶撹噦2
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
                 {
-                    Modular.Redis.RedisHelper.Add($"S{item}Read.R5绌洪棽_LAST", "0", out string msg);
-                    //Conn.榛樿Redis.SetValue($"S{item}Read.R5绌洪棽_LAST", "0", $"S{item}ReadQueue");
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250325083326611][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦2]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadJS2", new object[] { tag });
+                        #endregion [鑴氭湰][20250325083326611][涓氬姟閫昏緫.绗笁鏍囨.鎹风灛鎶撹噦2]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:鑷祦杞祦绋�+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250325085810885][涓氬姟閫昏緫.绗笁鏍囨.鑷祦杞祦绋媇
+                        //foreach(var di in Settings.deviceInfos)
+                        //	if (di.deviceType == 2 || di.deviceType == 1)
+                        //	RunafterMac(di,true);
+                        /// TODO  mes 涓嬪彂銆�  鏀规垚鏈烘鑷傜洃鎺�-  鐩戞帶绌虹殑杩樻槸婊$殑 - 鑱斿姩mes 浠诲姟銆�+
+                        //LogHelper.Info($"璁惧鐘舵�锛氱淮甯屽皵1锛氱淮甯屽皵鎶撹噦1.State:{Device.缁村笇灏旀姄鑷�.State} ");
+                        //Device.缁村笇灏旀姄鑷�.ReadPLC("缁村笇灏旀姄鑷�.R50", out object value);
+                        //LogHelper.Info($"璁惧鐘舵�锛氱淮甯屽皵1锛氱淮甯屽皵鎶撹噦1.R50:{value?.ToString()} ");
+
+                        //LogHelper.Info($"璁惧鐘舵�锛氱淮甯屽皵2锛氱淮甯屽皵鎶撹噦2.State:{Device.缁村笇灏旀姄鑷�.State} ");
+                        //Device.缁村笇灏旀姄鑷�.ReadPLC("缁村笇灏旀姄鑷�.R50", out value);
+                        //LogHelper.Info($"璁惧鐘舵�锛氱淮甯屽皵2锛氱淮甯屽皵鎶撹噦2.R50:{value?.ToString()} ");
+
+                        //LogHelper.Info($"璁惧鐘舵�锛氭嵎鐬�锛欽s鎹烽『1.State:{Device.Js鎹烽『1.State} ");
+                        //Device.Js鎹烽『1.ReadPLC("Js鎹烽『1.D1202", out value);
+                        //LogHelper.Info($"璁惧鐘舵�锛氭嵎鐬� Js鎹烽『1.D1202:{value?.ToString()} ");
+
+                        //LogHelper.Info($"璁惧鐘舵�锛氭嵎鐬�锛欽s鎹烽『2.State:{Device.Js鎹烽『2.State} ");
+                        //Device.Js鎹烽『2.ReadPLC("Js鎹烽『2.D1202", out value);
+                        //LogHelper.Info($"璁惧鐘舵�锛氭嵎鐬� Js鎹烽『2.D1202:{value?.ToString()} ");
+
+
+                        #endregion [鑴氭湰][20250325085810885][涓氬姟閫昏緫.绗笁鏍囨.鑷祦杞祦绋媇
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�L
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250325083149366][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Threadwxr1L", new object[] { tag });
+                        #endregion [鑴氭湰][20250325083149366][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�R
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250610002047005][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Threadwxr1R", new object[] { tag });
+                        #endregion [鑴氭湰][20250610002047005][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�L
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250325083315503][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Threadwxr2L", new object[] { tag });
+                        #endregion [鑴氭湰][20250325083315503][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�L]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:缁村笇灏旀姄鑷�R
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250610002647095][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Threadwxr2R", new object[] { tag });
+                        #endregion [鑴氭湰][20250610002647095][涓氬姟閫昏緫.绗笁鏍囨.缁寸郴灏�鍙�缁村笇灏旀姄鑷�R]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:浠诲姟涓嬪彂
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250325085542733][涓氬姟閫昏緫.浠诲姟涓嬪彂]
+
+                        Func<TaskEntity, bool> myDelegate = (t) => RunTask(t);
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadTaskRun", new object[] { tag, myDelegate });
+                        #endregion [鑴氭湰][20250325085542733][涓氬姟閫昏緫.浠诲姟涓嬪彂]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:ResolveMesTask
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250531163716255][涓氬姟閫昏緫.澶勭悊MES浠诲姟绾跨▼.ResolveMesTask]
+                        //mes 浠诲姟鎷嗗垎銆備竴娈典换鍔″拰 澶氭浠诲姟銆�+                        ToWMSMES.ResMesTask();
+                        #endregion [鑴氭湰][20250531163716255][涓氬姟閫昏緫.澶勭悊MES浠诲姟绾跨▼.ResolveMesTask]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            try
+            {
+                #region    [鑴氭湰][20250605212104026][涓氬姟閫昏緫.SocketServer]
+                AutoThread.InvokeMethod(AutoThread.Instance, "TaskEverythingRun");
+                #endregion [鑴氭湰][20250605212104026][涓氬姟閫昏緫.SocketServer]
+            }
+            catch (Exception ex)
+            {
+                Conn.榛樿鏃ュ織.Error(ex.ToString());
+            }
+            finally
+            {
+            }
+            /// <summary>
+            /// 绋嬪簭鐗囨:鍏夋爡澶勭悊
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250611223832523][涓氬姟閫昏緫.鍏夋爡澶勭悊]
+                        // - 鍏夋爡浜や簰澶勭悊銆傘�
+                        Action<HaiKangOrderInfo> myDelegate = (t) => continueTask(t);
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadGrats", new object[] { tag, myDelegate });
+
+                        // 鍙戦偅绉戜笅鏂欏厜鏍呫�
+                        #endregion [鑴氭湰][20250611223832523][涓氬姟閫昏緫.鍏夋爡澶勭悊]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:1020绌烘涓嬬嚎
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250616094224396][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1020绌烘涓嬬嚎]
+
+                        //1020  1023 绌烘涓嬬嚎
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadEdown", new object[] { tag });
+                        #endregion [鑴氭湰][20250616094224396][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1020绌烘涓嬬嚎]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:1023绌烘涓嬬嚎
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250616094226654][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1023绌烘涓嬬嚎]
+                        //1023 绌烘涓嬬嚎
+                        #endregion [鑴氭湰][20250616094226654][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1023绌烘涓嬬嚎]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:瀹氬瓙婊′笅绾�+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250616094632985][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.瀹氬瓙婊′笅绾縘
+
+                        //瀹氬瓙婊′笅绾� 1008  1016   ->  1026
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadDdown", new object[] { tag });
+                        #endregion [鑴氭湰][20250616094632985][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.瀹氬瓙婊′笅绾縘
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:杞瓙婊′笅绾�+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250616094511322][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.杞瓙婊′笅绾縘
+
+                        //杞瓙婊′笅绾� 1002  1010   - RGV2宸ヤ綅涓嶅彲鍒�1017 涓嶅彲涓嬪彂2宸ヤ綅浠诲姟銆�+                        AutoThread.InvokeMethod(AutoThread.Instance, "Thread0210Down", new object[] { tag });
+                        #endregion [鑴氭湰][20250616094511322][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.杞瓙婊′笅绾縘
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:涓嬫枡浣嶆娴�+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250616095605911][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.涓嬫枡浣嶆娴媇
+
+                        //涓嬫枡浣嶆娴嬨�  1003  鍒颁綅鏃�鍐�鏍囪瘑淇″彿 骞�缁欐満姊版墜淇″彿銆� 
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Thread涓嬫枡浣嶆娴�, new object[] { tag });
+                        #endregion [鑴氭湰][20250616095605911][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.涓嬫枡浣嶆娴媇
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:1鍙稦NK鏈烘鎵嬪畬鎴�+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250616095709155][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1鍙稦NK鏈烘鎵嬪畬鎴怾
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadFNK1Over", new object[] { tag });
+                        #endregion [鑴氭湰][20250616095709155][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1鍙稦NK鏈烘鎵嬪畬鎴怾
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:2鍙稦NK鏈烘鎵嬪畬鎴�+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250616095733680][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2鍙稦NK鏈烘鎵嬪畬鎴怾
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadFNK2Over", new object[] { tag });
+                        #endregion [鑴氭湰][20250616095733680][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2鍙稦NK鏈烘鎵嬪畬鎴怾
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:Program1
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250617085708084][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1019杞弧鍑鸿緭閫佺嚎.Program1]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Thread1019Down", new object[] { tag });
+                        #endregion [鑴氭湰][20250617085708084][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1019杞弧鍑鸿緭閫佺嚎.Program1]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:Program1
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250617085712101][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1025agv涓婄┖.Program1]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Thread1025Up", new object[] { tag });
+                        #endregion [鑴氭湰][20250617085712101][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1025agv涓婄┖.Program1]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:Program1
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250617085750712][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1022agv涓婄┖.Program1]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Thread1022Up", new object[] { tag });
+                        #endregion [鑴氭湰][20250617085750712][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1022agv涓婄┖.Program1]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            /// <summary>
+            /// 绋嬪簭鐗囨:Program1
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250617085800942][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1030涓嬫瘝鎵�Program1]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Thread1030Down", new object[] { tag });
+                        #endregion [鑴氭湰][20250617085800942][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1030涓嬫瘝鎵�Program1]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+
+            /// <summary>
+            /// 绋嬪簭鐗囨:Program1
+            /// 鎻忚堪:
+            /// </summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                System.Threading.Thread.CurrentThread.IsBackground = true;
+                ExitJudgeStack.Push(0);
+                //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+                while (true)
+                {
+                    if (IsExitApp) { break; }
+                    try
+                    {
+                        #region    [鑴氭湰][20250617085809982][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2030杈撻�绾夸笅瀹氬瓙.Program1]
+
+                        AutoThread.InvokeMethod(AutoThread.Instance, "Thread2030Down", new object[] { tag });
+                        #endregion [鑴氭湰][20250617085809982][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2030杈撻�绾夸笅瀹氬瓙.Program1]
+                    }
+                    catch (Exception ex)
+                    {
+                        Conn.榛樿鏃ュ織.Error(ex.ToString());
+                    }
+                    finally
+                    {
+                        System.Threading.Thread.Sleep(3000);
+                    }
+                }
+                ExitJudgeStack.TryPop(out int exitJudgeVal);
+            });
+            //鎵ц澶氭
+            for (int iii = 0; iii < 1; iii++)
+            {
+                if (IsExitApp) { break; }
+                try
+                {
+                    #region    [鑴氭湰][20250323151832119][涓氬姟閫昏緫.Program4]
+
+                    //LogHelper.Info($"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>");
+                    //LogHelper.Info($"<<<<<<<<<<<<<<<<<绋嬪簭路鍚姩>>>>>>>>>>>>>>");
+
+                    //// 浣跨敤鎷︽埅鍣�+                    //var interceptor = new ConsoleInterceptor();
+                    //Console.SetOut(interceptor);
+
+                    //LogHelper.Info($"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>");
+                    //AnsiConsole.Markup("[underline red]Hello[/] World!");
+                    // AnsiConsole.Markup("[underline red]Hello[/] World!");
+                    #endregion [鑴氭湰][20250323151832119][涓氬姟閫昏緫.Program4]
+                }
+                catch (Exception ex)
+                {
+                    Conn.榛樿鏃ュ織.Error(ex.ToString());
+                }
+                finally
+                {
+                    System.Threading.Thread.Sleep(3000);
                 }
             }
-            System.Threading.Thread.Sleep(1000);
-        }
-        catch (Exception ex)
-        {
-            LogHelper.Error(ex.Message, ex);
-            Console.WriteLine(ex.Message + ex.StackTrace);
-        }
-    }
-    else if (RtaskState != 3 && RtaskState_LAST == 1)
-    {
-        Modular.Redis.RedisHelper.Add($"S{Bssx}Read.RtaskState_LAST", "0", out string msg);
-        //Conn.榛樿Redis.SetValue($"S{Bssx}Read.RtaskState_LAST", "0", $"S{Bssx}ReadQueue");
-    }
-    System.Threading.Thread.Sleep(2000);
-}
-				#endregion [鑴氭湰][20250616094224396][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1020绌烘涓嬬嚎]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:1023绌烘涓嬬嚎
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250616094226654][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1023绌烘涓嬬嚎]
-				//1023 绌烘涓嬬嚎
-				#endregion [鑴氭湰][20250616094226654][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1023绌烘涓嬬嚎]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:瀹氬瓙婊′笅绾�-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250616094632985][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.瀹氬瓙婊′笅绾縘
-				foreach (var Bssx in new string[] { "1008", "1016" })
-{
-    var RtaskState = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.RtaskState"), typeof(System.UInt16));
-    var RtaskState_LAST = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.RtaskState_LAST"), typeof(System.UInt16));
-    var R鎵樼洏鐮�= (System.String)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.R鎵樼洏鐮�), typeof(System.String));
-    Console.WriteLine($"{Bssx} 婊′笅妫�祴锛氫换鍔$敵璇凤細{RtaskState}- 鏄惁宸插鐞嗭細{RtaskState_LAST}- 鎵樼洏鐮侊細{R鎵樼洏鐮亇");
-    if (RtaskState == 3 && RtaskState_LAST == 0)
-    {
-        var item = "1026";
-        var R5 = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽"), typeof(System.UInt16));
-        var R5绌洪棽_LAST = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽_LAST"), typeof(System.UInt16));
-        if (R5 == 5 && R5绌洪棽_LAST == 0)
-        {
-            var b = TaskProcess.CreateTask("", Bssx, item, "婊¤浆1026", 5, new List<string> { R鎵樼洏鐮�}, "RGV");
-            if (b)
-            {
-                Modular.Redis.RedisHelper.Add($"S{Bssx}Read.RtaskState_LAST", "1", out string msg);
-                Modular.Redis.RedisHelper.Add($"S{item}Read.R5绌洪棽_LAST", "1", out string msg2);
-                //Conn.榛樿Redis.SetValue($"S{Bssx}Read.RtaskState_LAST", "1", $"S{Bssx}ReadQueue");
-                //Conn.榛樿Redis.SetValue($"S{item}Read.R5绌洪棽_LAST", "1", $"S{item}ReadQueue");
-                break;
-            }
-        }
-        else if (R5 != 5 && R5绌洪棽_LAST == 1)
-        {
-            Modular.Redis.RedisHelper.Add($"S{item}Read.R5绌洪棽_LAST", "0", out string msg2);
-        }
-    }
-    else if (RtaskState != 3 && RtaskState_LAST == 1)
-    {
-        Modular.Redis.RedisHelper.Add($"S{Bssx}Read.RtaskState_LAST", "0", out string msg);
-        //Conn.榛樿Redis.SetValue($"S{Bssx}Read.RtaskState_LAST", "0", $"S{Bssx}ReadQueue");
-    }
-    System.Threading.Thread.Sleep(2000);
-}
-				#endregion [鑴氭湰][20250616094632985][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.瀹氬瓙婊′笅绾縘
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:杞瓙婊′笅绾�-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250616094511322][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.杞瓙婊′笅绾縘
-				//杞瓙婊′笅绾� 1002  1010   - RGV2宸ヤ綅涓嶅彲鍒�1017 涓嶅彲涓嬪彂2宸ヤ綅浠诲姟銆�-foreach (var Bssx in new string[] { "1002", "1010" })
-{
-    var RtaskState = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.RtaskState"), typeof(System.UInt16));
-    var RtaskState_LAST = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.RtaskState_LAST"), typeof(System.UInt16));
-    var R鎵樼洏鐮�= (System.String)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{Bssx}Read.R鎵樼洏鐮�), typeof(System.String));
-    Console.WriteLine($"{Bssx} 婊′笅妫�祴锛氫换鍔$敵璇凤細{RtaskState}- 鏄惁宸插鐞嗭細{RtaskState_LAST}- 鎵樼洏鐮侊細{R鎵樼洏鐮亇");
-    if (RtaskState == 3 && RtaskState_LAST == 0)
-    {
-        var item = "1017";
-        var R5 = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽"), typeof(System.UInt16));
-        var R5绌洪棽_LAST = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"S{item}Read.R5绌洪棽_LAST"), typeof(System.UInt16));
-        if (R5 == 5 && R5绌洪棽_LAST == 0)
-        {
-            var b = TaskProcess.CreateTask("", Bssx, item, "婊¤浆1017", 5, new List<string> { R鎵樼洏鐮�}, "RGV");
-            if (b)
-            {
-                Modular.Redis.RedisHelper.Add($"S{Bssx}Read.RtaskState_LAST", "1", out string msg);
-                Modular.Redis.RedisHelper.Add($"S{item}Read.R5绌洪棽_LAST", "1", out string msg1);
-                //Conn.榛樿Redis.SetValue($"S{Bssx}Read.RtaskState_LAST", "1", $"S{Bssx}ReadQueue");
-                //Conn.榛樿Redis.SetValue($"S{item}Read.R5绌洪棽_LAST", "1", $"S{item}ReadQueue");
-                break;
-            }
-        }
-        else if (R5 != 5 && R5绌洪棽_LAST == 1)
-        {
-            Modular.Redis.RedisHelper.Add($"S{item}Read.R5绌洪棽_LAST", "0", out string msg1);
-        }
-    }
-    else if (RtaskState != 3 && RtaskState_LAST == 1)
-    {
-        Modular.Redis.RedisHelper.Add($"S{Bssx}Read.RtaskState_LAST", "0", out string msg);
-    }
-    System.Threading.Thread.Sleep(2000);
-}
-				#endregion [鑴氭湰][20250616094511322][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.杞瓙婊′笅绾縘
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:涓嬫枡浣嶆娴�-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250616095605911][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.涓嬫枡浣嶆娴媇
-				//涓嬫枡浣嶆娴嬨�  1003  鍒颁綅鏃�鍐�鏍囪瘑淇″彿 骞�缁欐満姊版墜淇″彿銆� 
-foreach (var ssx in new string[] { "1003", "1005", "1011", "1013" })
-{
-    var RArrive = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"FNK1003051113.RArrive{ssx}"), typeof(System.UInt16));
-    var RArriveLast = (System.UInt16)System.Convert.ChangeType(Conn.榛樿Redis.GetValue($"FNK1003051113.RArrive{ssx}_LAST"), typeof(System.UInt16));
-    if (RArrive == 1 && RArriveLast == 0)
-    {
-        if (ssx == "1005")
-        {
-            tag.FNK1.D2210 = 1;
-            tag.SF涓嬫枡浣�RArrive1005_LAST = 1;
 
-            tag.SF涓嬫枡浣�WRelease1005 = 0;
-            tag.SF涓嬫枡浣�WSafe0305 = 0;
         }
-        else if (ssx == "1003")
-        {
-            tag.FNK2.D2215 = 1;
-            tag.SF涓嬫枡浣�RArrive1003_LAST = 1;
-
-            tag.SF涓嬫枡浣�WRelease1003 = 0;
-            tag.SF涓嬫枡浣�WSafe0305 = 0;
-        }
-        else if (ssx == "1013")
-        {
-            tag.FNK2.D2210 = 1;
-            tag.SF涓嬫枡浣�RArrive1013_LAST = 1;
-
-            tag.SF涓嬫枡浣�WRelease1013 = 0;
-            tag.SF涓嬫枡浣�WSafe1113 = 0;
-        }
-        else if (ssx == "1011")
-        {
-            tag.FNK2.D2215 = 1;
-            tag.SF涓嬫枡浣�RArrive1011_LAST = 1;
-
-            tag.SF涓嬫枡浣�WRelease1011 = 0;
-            tag.SF涓嬫枡浣�WSafe1113 = 0;
-        }
-    }
-    else if (RArrive == 0 && RArriveLast == 1)
-    {
-                                Modular.Redis.RedisHelper.Add($"FNK1003051113.RArrive{ssx}_LAST", "0", out string msg);
-    }
-}
-				#endregion [鑴氭湰][20250616095605911][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.涓嬫枡浣嶆娴媇
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:1鍙稦NK鏈烘鎵嬪畬鎴�-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250616095709155][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1鍙稦NK鏈烘鎵嬪畬鎴怾
-				if (tag.FNK1.D2212 == 1 && tag.FNK1.D2212_LAST == 0)
-{
-    tag.FNK1.D2210 = 0;
-    tag.FNK1.D2212_LAST = 1;
-
-    tag.SF涓嬫枡浣�WRelease1005 = 1;
-    tag.SF涓嬫枡浣�WSafe0305 = 1;
-}
-else if (tag.FNK1.D2212 == 0 && tag.FNK1.D2212_LAST == 1)
-{
-    tag.FNK1.D2212_LAST = 0;
-}
-if (tag.FNK1.D2217 == 1 && tag.FNK1.D2217_LAST == 0)
-{
-    tag.FNK1.D2215 = 0;
-    tag.FNK1.D2217_LAST = 1;
-
-    tag.SF涓嬫枡浣�WRelease1003 = 1;
-    tag.SF涓嬫枡浣�WSafe0305 = 1;
-}
-else if (tag.FNK1.D2217 == 0 && tag.FNK1.D2217_LAST == 1)
-    tag.FNK1.D2217_LAST = 0;
-
-				#endregion [鑴氭湰][20250616095709155][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1鍙稦NK鏈烘鎵嬪畬鎴怾
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:2鍙稦NK鏈烘鎵嬪畬鎴�-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250616095733680][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2鍙稦NK鏈烘鎵嬪畬鎴怾
-				 if (tag.FNK2.D2212 == 1 && tag.FNK2.D2212_LAST == 0)
- {
-     tag.FNK2.D2210 = 0;
-     tag.FNK2.D2212_LAST = 1;
-
-     tag.SF涓嬫枡浣�WRelease1013 = 1;
-     tag.SF涓嬫枡浣�WSafe1113 = 1;
- }
- else if (tag.FNK2.D2212 == 0 && tag.FNK2.D2212_LAST == 1)
- {
-     tag.FNK2.D2212_LAST = 0;
- }
- if (tag.FNK2.D2217 == 1 && tag.FNK2.D2217_LAST == 0)
- {
-     tag.FNK2.D2215 = 0;
-     tag.FNK2.D2217_LAST = 1;
-
-     tag.SF涓嬫枡浣�WRelease1011 = 1;
-     tag.SF涓嬫枡浣�WSafe1113 = 1;
- }
- else if (tag.FNK2.D2217 == 0 && tag.FNK2.D2217_LAST == 1)
-     tag.FNK2.D2217_LAST = 0;
-				#endregion [鑴氭湰][20250616095733680][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2鍙稦NK鏈烘鎵嬪畬鎴怾
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:Program1
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250617085708084][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1019杞弧鍑鸿緭閫佺嚎.Program1]
-				
- Console.WriteLine($"1019浠诲姟鐘舵�锛歿tag.SA1019.RtaskState}- barcode:{tag.SA1019.R鎵樼洏鐮亇- 绌洪棽{tag.SA1019.R5绌洪棽}");
-				#endregion [鑴氭湰][20250617085708084][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1019杞弧鍑鸿緭閫佺嚎.Program1]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:Program1
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250617085712101][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1025agv涓婄┖.Program1]
-				
-                        Console.WriteLine($"SA1025 浠诲姟鐘舵�锛歿tag.SA1025.RtaskState}- 绌洪棽{tag.SA1025.R5绌洪棽}");
-				#endregion [鑴氭湰][20250617085712101][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1025agv涓婄┖.Program1]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:Program1
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250617085750712][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1022agv涓婄┖.Program1]
-				
-                        Console.WriteLine($"SA1022 浠诲姟鐘舵�锛歿tag.SA1022.RtaskState}- 绌洪棽{tag.SA1022.R5绌洪棽}");
-				#endregion [鑴氭湰][20250617085750712][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1022agv涓婄┖.Program1]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:Program1
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250617085800942][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1030涓嬫瘝鎵�Program1]
-				
-                        Console.WriteLine($"SA1030 浠诲姟鐘舵�锛歿tag.SA1030.RtaskState}- 绌洪棽{tag.SA1030.R5绌洪棽}-->瀵瑰簲缁堢偣2001>绌洪棽5锛歿tag.SA2001.R5绌洪棽}");
-				#endregion [鑴氭湰][20250617085800942][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.1030涓嬫瘝鎵�Program1]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-			/// <summary>
-			/// 绋嬪簭鐗囨:Program1
-			/// 鎻忚堪:
-			/// </summary>
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-				System.Threading.Thread.CurrentThread.IsBackground = true;
-				ExitJudgeStack.Push(0);
-			//涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�-			while(true)
-			{
-				if (IsExitApp) { break; }
-			try
-			{
-				#region    [鑴氭湰][20250617085809982][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2030杈撻�绾夸笅瀹氬瓙.Program1]
-				
-                        Console.WriteLine($"SA2030 浠诲姟鐘舵�锛歿tag.SA2030.RtaskState}- 绌洪棽{tag.SA2030.R5绌洪棽} - barcode:{tag.SA2030.R鎵樼洏鐮亇");
-				#endregion [鑴氭湰][20250617085809982][涓氬姟閫昏緫.娴佺▼2鐑鐞嗙倝杩涘嚭.2030杈撻�绾夸笅瀹氬瓙.Program1]
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				System.Threading.Thread.Sleep(3000);
-			}	
-			}
-				ExitJudgeStack.TryPop(out int exitJudgeVal);
-});
-	
-		}
-		/// <summary>
+        /// <summary>
         /// View1鍏抽棴浜嬩欢
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-		public void View1_CloseEvent(object sender, System.ComponentModel.CancelEventArgs e)
-		{
-		
-			try
-			{
-                System.Threading.Tasks.Task.Factory.StartNew(() => { MessageBox.Show("绋嬪簭姝e湪鍏抽棴锛岃绛夊緟..."); });
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			try
-			{
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍏抽棴Http鏈嶅姟");
-				if(HttpSvcHost!=null)
-				{
-					HttpSvcHost.Stop();
-				}
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍏抽棴Http鏈嶅姟");
-			}
+        public void View1_CloseEvent(object sender, System.ComponentModel.CancelEventArgs e)
+        {
 
-			try
-			{
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍒ゆ柇涓氬姟澶勭悊鐘舵�");
-				IsExitApp = true;
-				//int exitCnt = 0;
-				while 
-				(
-					ExitJudgeStack.Count > 0
-				)
-				{
-					System.Threading.Thread.Sleep(100);
-					//++exitCnt;
-					//10绉掓湭缁撴潫鍒欏己鍒跺叧闂�-					//if (exitCnt >= 100)
-					//{
-					//	break;
-					//}
-				}
-			}
-			catch (Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍒ゆ柇涓氬姟澶勭悊鐘舵�");
-			}
-			
+            try
+            {
+                System.Threading.Tasks.Task.Factory.StartNew(() => { MessageBox.Show("绋嬪簭姝e湪鍏抽棴锛岃绛夊緟..."); });
+            }
+            catch (Exception ex)
+            {
+                Conn.榛樿鏃ュ織.Error(ex.ToString());
+            }
+            try
+            {
+                Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍏抽棴Http鏈嶅姟");
+                if (HttpSvcHost != null)
+                {
+                    HttpSvcHost.Stop();
+                }
+            }
+            catch (Exception ex)
+            {
+                Conn.榛樿鏃ュ織.Error(ex.ToString());
+            }
+            finally
+            {
+                Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍏抽棴Http鏈嶅姟");
+            }
+
+            try
+            {
+                Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍒ゆ柇涓氬姟澶勭悊鐘舵�");
+                IsExitApp = true;
+                //int exitCnt = 0;
+                while
+                (
+                    ExitJudgeStack.Count > 0
+                )
+                {
+                    System.Threading.Thread.Sleep(100);
+                    //++exitCnt;
+                    //10绉掓湭缁撴潫鍒欏己鍒跺叧闂�+                    //if (exitCnt >= 100)
+                    //{
+                    //	break;
+                    //}
+                }
+            }
+            catch (Exception ex)
+            {
+                Conn.榛樿鏃ュ織.Error(ex.ToString());
+            }
+            finally
+            {
+                Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍒ゆ柇涓氬姟澶勭悊鐘舵�");
+            }
+
             e.Cancel = true;
-			System.Threading.Tasks.Task.Factory.StartNew(() =>
-			{
-						try
-			{
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍏抽棴PLC");
-				Device.缁村笇灏旀姄鑷�?.Stop();
-				Device.缁村笇灏旀姄鑷�?.Stop();
-				Device.Js鎹烽『1?.Stop();
-				Device.Js鎹烽『2?.Stop();
-				Device.p鍙戦偅绉�涓嬬嚎?.Stop();
-				Device.A1025鏀捐揣浜や簰?.Stop();
-				Device.A1022鏀捐揣浜や簰?.Stop();
-				Device.A1019鍙栬揣浜や簰?.Stop();
-				Device.A1030鍙栬揣浜や簰?.Stop();
-				Device.SSXReadTemp?.Stop();
-				Device.S1019Read?.Stop();
-				Device.S1022Read?.Stop();
-				Device.S1025Read?.Stop();
-				Device.S1017Read?.Stop();
-				Device.S1023Read?.Stop();
-				Device.S1020Read?.Stop();
-				Device.S1002Read?.Stop();
-				Device.S1004Read?.Stop();
-				Device.S1006Read?.Stop();
-				Device.S1008Read?.Stop();
-				Device.S1010Read?.Stop();
-				Device.S1012Read?.Stop();
-				Device.S1014Read?.Stop();
-				Device.S1016Read?.Stop();
-				Device.FNK1003051113?.Stop();
-				Device.SSX1003051113?.Stop();
-				Device.S1026Read?.Stop();
-				Device.S1030Read?.Stop();
-				Device.S2001Read?.Stop();
-				Device.S2030Read?.Stop();
-				Device.A2001鏀捐揣浜や簰?.Stop();
-				Device.A2030鍙栬揣浜や簰?.Stop();
-				Device.RGV?.Stop();
-				Device.p鍙戦偅绉�涓嬬嚎?.Stop();
-				Device.p鍙戦偅绉�涓婄嚎?.Stop();
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍏抽棴PLC");
-			}
-			try
-			{
-			
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍒ゆ柇PLC鐘舵�");
-				//int exitCnt = 0;
-				while 
-				(
-					false
-					|| (Device.缁村笇灏旀姄鑷� == null ? false : Device.缁村笇灏旀姄鑷�.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.缁村笇灏旀姄鑷� == null ? false : Device.缁村笇灏旀姄鑷�.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.Js鎹烽『1 == null ? false : Device.Js鎹烽『1.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.Js鎹烽『2 == null ? false : Device.Js鎹烽『2.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.p鍙戦偅绉�涓嬬嚎 == null ? false : Device.p鍙戦偅绉�涓嬬嚎.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.A1025鏀捐揣浜や簰 == null ? false : Device.A1025鏀捐揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.A1022鏀捐揣浜や簰 == null ? false : Device.A1022鏀捐揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.A1019鍙栬揣浜や簰 == null ? false : Device.A1019鍙栬揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.A1030鍙栬揣浜や簰 == null ? false : Device.A1030鍙栬揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.SSXReadTemp == null ? false : Device.SSXReadTemp.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1019Read == null ? false : Device.S1019Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1022Read == null ? false : Device.S1022Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1025Read == null ? false : Device.S1025Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1017Read == null ? false : Device.S1017Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1023Read == null ? false : Device.S1023Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1020Read == null ? false : Device.S1020Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1002Read == null ? false : Device.S1002Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1004Read == null ? false : Device.S1004Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1006Read == null ? false : Device.S1006Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1008Read == null ? false : Device.S1008Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1010Read == null ? false : Device.S1010Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1012Read == null ? false : Device.S1012Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1014Read == null ? false : Device.S1014Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1016Read == null ? false : Device.S1016Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.FNK1003051113 == null ? false : Device.FNK1003051113.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.SSX1003051113 == null ? false : Device.SSX1003051113.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1026Read == null ? false : Device.S1026Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S1030Read == null ? false : Device.S1030Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S2001Read == null ? false : Device.S2001Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.S2030Read == null ? false : Device.S2030Read.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.A2001鏀捐揣浜や簰 == null ? false : Device.A2001鏀捐揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.A2030鍙栬揣浜や簰 == null ? false : Device.A2030鍙栬揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.RGV == null ? false : Device.RGV.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.p鍙戦偅绉�涓嬬嚎 == null ? false : Device.p鍙戦偅绉�涓嬬嚎.State != GZ.Device.PLC.PlcRunState.Stoped)
-					|| (Device.p鍙戦偅绉�涓婄嚎 == null ? false : Device.p鍙戦偅绉�涓婄嚎.State != GZ.Device.PLC.PlcRunState.Stoped)
-				)
-				{
-					System.Threading.Thread.Sleep(1000);
-					//++exitCnt;
-					//10绉掓湭缁撴潫鍒欏己鍒跺叧闂�-					//if (exitCnt >= 100)
-					//{
-					//	break;
-					//}
-				}
-			}
-			catch (Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-			finally
-			{
-				Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍒ゆ柇PLC鐘舵�");
-			}
-			Application.Current.Dispatcher.Invoke(() => { Environment.Exit(0); });
-			});
-	
-			//System.Windows.Application.Current.Shutdown();
-		}
-		/// <summary>
+            System.Threading.Tasks.Task.Factory.StartNew(() =>
+            {
+                try
+                {
+                    Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍏抽棴PLC");
+                    Device.缁村笇灏旀姄鑷�?.Stop();
+                    Device.缁村笇灏旀姄鑷�?.Stop();
+                    Device.Js鎹烽『1?.Stop();
+                    Device.Js鎹烽『2?.Stop();
+                    Device.p鍙戦偅绉�涓嬬嚎?.Stop();
+                    Device.A1025鏀捐揣浜や簰?.Stop();
+                    Device.A1022鏀捐揣浜や簰?.Stop();
+                    Device.A1019鍙栬揣浜や簰?.Stop();
+                    Device.A1030鍙栬揣浜や簰?.Stop();
+                    Device.SSXReadTemp?.Stop();
+                    Device.S1019Read?.Stop();
+                    Device.S1022Read?.Stop();
+                    Device.S1025Read?.Stop();
+                    Device.S1017Read?.Stop();
+                    Device.S1023Read?.Stop();
+                    Device.S1020Read?.Stop();
+                    Device.S1002Read?.Stop();
+                    Device.S1004Read?.Stop();
+                    Device.S1006Read?.Stop();
+                    Device.S1008Read?.Stop();
+                    Device.S1010Read?.Stop();
+                    Device.S1012Read?.Stop();
+                    Device.S1014Read?.Stop();
+                    Device.S1016Read?.Stop();
+                    Device.FNK1003051113?.Stop();
+                    Device.SSX1003051113?.Stop();
+                    Device.S1026Read?.Stop();
+                    Device.S1030Read?.Stop();
+                    Device.S2001Read?.Stop();
+                    Device.S2030Read?.Stop();
+                    Device.A2001鏀捐揣浜や簰?.Stop();
+                    Device.A2030鍙栬揣浜や簰?.Stop();
+                    Device.RGV?.Stop();
+                    Device.p鍙戦偅绉�涓嬬嚎?.Stop();
+                    Device.p鍙戦偅绉�涓婄嚎?.Stop();
+                }
+                catch (Exception ex)
+                {
+                    Conn.榛樿鏃ュ織.Error(ex.ToString());
+                }
+                finally
+                {
+                    Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍏抽棴PLC");
+                }
+                try
+                {
+
+                    Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][Start]鍒ゆ柇PLC鐘舵�");
+                    //int exitCnt = 0;
+                    while
+                    (
+                        false
+                        || (Device.缁村笇灏旀姄鑷� == null ? false : Device.缁村笇灏旀姄鑷�.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.缁村笇灏旀姄鑷� == null ? false : Device.缁村笇灏旀姄鑷�.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.Js鎹烽『1 == null ? false : Device.Js鎹烽『1.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.Js鎹烽『2 == null ? false : Device.Js鎹烽『2.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.p鍙戦偅绉�涓嬬嚎 == null ? false : Device.p鍙戦偅绉�涓嬬嚎.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.A1025鏀捐揣浜や簰 == null ? false : Device.A1025鏀捐揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.A1022鏀捐揣浜や簰 == null ? false : Device.A1022鏀捐揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.A1019鍙栬揣浜や簰 == null ? false : Device.A1019鍙栬揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.A1030鍙栬揣浜や簰 == null ? false : Device.A1030鍙栬揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.SSXReadTemp == null ? false : Device.SSXReadTemp.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1019Read == null ? false : Device.S1019Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1022Read == null ? false : Device.S1022Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1025Read == null ? false : Device.S1025Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1017Read == null ? false : Device.S1017Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1023Read == null ? false : Device.S1023Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1020Read == null ? false : Device.S1020Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1002Read == null ? false : Device.S1002Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1004Read == null ? false : Device.S1004Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1006Read == null ? false : Device.S1006Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1008Read == null ? false : Device.S1008Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1010Read == null ? false : Device.S1010Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1012Read == null ? false : Device.S1012Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1014Read == null ? false : Device.S1014Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1016Read == null ? false : Device.S1016Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.FNK1003051113 == null ? false : Device.FNK1003051113.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.SSX1003051113 == null ? false : Device.SSX1003051113.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1026Read == null ? false : Device.S1026Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S1030Read == null ? false : Device.S1030Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S2001Read == null ? false : Device.S2001Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.S2030Read == null ? false : Device.S2030Read.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.A2001鏀捐揣浜や簰 == null ? false : Device.A2001鏀捐揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.A2030鍙栬揣浜や簰 == null ? false : Device.A2030鍙栬揣浜や簰.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.RGV == null ? false : Device.RGV.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.p鍙戦偅绉�涓嬬嚎 == null ? false : Device.p鍙戦偅绉�涓嬬嚎.State != GZ.Device.PLC.PlcRunState.Stoped)
+                        || (Device.p鍙戦偅绉�涓婄嚎 == null ? false : Device.p鍙戦偅绉�涓婄嚎.State != GZ.Device.PLC.PlcRunState.Stoped)
+                    )
+                    {
+                        System.Threading.Thread.Sleep(1000);
+                        //++exitCnt;
+                        //10绉掓湭缁撴潫鍒欏己鍒跺叧闂�+                        //if (exitCnt >= 100)
+                        //{
+                        //	break;
+                        //}
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Conn.榛樿鏃ュ織.Error(ex.ToString());
+                }
+                finally
+                {
+                    Conn.榛樿鏃ュ織.Debug("[鍏抽棴澶勭悊][End]鍒ゆ柇PLC鐘舵�");
+                }
+                Application.Current.Dispatcher.Invoke(() => { Environment.Exit(0); });
+            });
+
+            //System.Windows.Application.Current.Shutdown();
+        }
+        /// <summary>
         /// View1鍒濆鍖�         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-		public void View1_Init(object sender, RoutedEventArgs e)
-		{
-		}
-		#endregion
-		
-		#region 鍒囨崲tab椤�-		public void tab_SelectionChanged(object sender, EventArgs e)
-		{
-			//TabItem ti = (sender as TabControl).SelectedItem as TabItem;
-			//MessageBox.Show(ti.Name);
-		}
-		#endregion
-		
-		#region Http鏈嶅姟鐩戝惉
-		private void HttpSvcListenerCallback(IAsyncResult ar)
-		{
-			try
-			{
-				HttpSvcHost.BeginGetContext(HttpSvcListenerCallback, null);
-				System.Net.HttpListenerContext context = HttpSvcHost.EndGetContext(ar);
-				System.Net.HttpListenerRequest request = context.Request;
-				System.Net.HttpListenerResponse response = context.Response;
-				switch(request.LocalEndPoint.ToString())
-				{
-					case "10.221.55.116:8808":
-					{
-						using (var reader = new System.IO.StreamReader(request.InputStream, System.Text.Encoding.UTF8))
-						{
-							string requestJson = reader.ReadToEnd();
+        public void View1_Init(object sender, RoutedEventArgs e)
+        {
+        }
+        #endregion
 
-							string respstr = HttpSvcListenerCallback_he(request.HttpMethod,request.Url.AbsolutePath,requestJson,out System.Net.HttpStatusCode statusCode);
+        #region View2浜嬩欢
+        /// <summary>
+        /// View2鎵撳紑浜嬩欢
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        public void View2_LoadEvent(object sender, RoutedEventArgs e)
+        {
 
-							string logContent="";
-							logContent += $"\r\n[{request.HttpMethod}]{request.Url.AbsolutePath}";
-							logContent += $"\r\n[request]{requestJson}";
-							logContent += $"\r\n[response]{respstr}";
-							Conn.榛樿鏃ュ織?.Info(logContent);
-							
-							byte[] bytstr = Encoding.UTF8.GetBytes(respstr);
-							response.StatusCode = (int)statusCode;
-							response.SendChunked = false;
-							response.ContentLength64 = bytstr.Length;
-							response.OutputStream.Write(bytstr, 0, bytstr.Length);
-							response.Close();
-						}
-						break;
-					}
-				}
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-			}
-		}
-		private System.String HttpSvcListenerCallback_he(System.String method,System.String path,System.String requestJson,out System.Net.HttpStatusCode statusCode)
-		{
-			try
-			{
-				switch(method)
-				{
-					case "POST":
-					{
-						switch(path)
-						{
-							case "/agv/agvCallbackService/agvCallback":
-							{
-								statusCode = System.Net.HttpStatusCode.OK;
-								
+
+
+        }
+        /// <summary>
+        /// View2鍏抽棴浜嬩欢
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        public void View2_CloseEvent(object sender, System.ComponentModel.CancelEventArgs e)
+        {
+
+
+        }
+        /// <summary>
+        /// View2鍒濆鍖�+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        public void View2_Init(object sender, RoutedEventArgs e)
+        {
+        }
+        #endregion
+
+        #region 鍒囨崲tab椤�+        public void tab_SelectionChanged(object sender, EventArgs e)
+        {
+            //TabItem ti = (sender as TabControl).SelectedItem as TabItem;
+            //MessageBox.Show(ti.Name);
+        }
+        #endregion
+
+        #region Http鏈嶅姟鐩戝惉
+        private async void HttpSvcListenerCallback(IAsyncResult ar)
+        {
+            System.Net.HttpListenerContext context = null;
+            try
+            {
+                HttpSvcHost.BeginGetContext(HttpSvcListenerCallback, null);
+                context = HttpSvcHost.EndGetContext(ar);
+                System.Net.HttpListenerRequest request = context.Request;
+                System.Net.HttpListenerResponse response = context.Response;
+                switch (request.LocalEndPoint.ToString())
+                {
+                    case "10.221.55.117:8808":
+                        {
+                            using (var reader = new System.IO.StreamReader(request.InputStream, System.Text.Encoding.UTF8))
+                            {
+                                string requestJson = reader.ReadToEnd();
+                                System.Net.HttpStatusCode statusCode = 0;
+                                string respstr = await Task.Run(() =>
+                                {
+                                    return HttpSvcListenerCallback_he(request.HttpMethod, request.Url.AbsolutePath, requestJson, out statusCode);
+                                });
+                                string logContent = "";
+                                logContent += $"\r\n[{request.HttpMethod}]{request.Url.AbsolutePath}";
+                                logContent += $"\r\n[request]{requestJson}";
+                                logContent += $"\r\n[response]{respstr}";
+                                _ = Task.Run(() =>
+                                {
+                                    Conn.榛樿鏃ュ織?.Info(logContent);
+                                });
+
+                                byte[] bytstr = Encoding.UTF8.GetBytes(respstr);
+                                response.StatusCode = (int)statusCode;
+                                response.SendChunked = false;
+                                response.ContentLength64 = bytstr.Length;
+                                response.OutputStream.Write(bytstr, 0, bytstr.Length);
+                                // 寮傛鍐欏叆鍝嶅簲
+                                await response.OutputStream.WriteAsync(bytstr, 0, bytstr.Length);
+
+                            }
+                            break;
+                        }
+                }
+            }
+            catch (Exception ex)
+            {
+                Conn.榛樿鏃ュ織.Error(ex.ToString());
+            }
+            finally
+            {
+                context?.Response.Close();
+            }
+        }
+        private System.String HttpSvcListenerCallback_he(System.String method, System.String path, System.String requestJson, out System.Net.HttpStatusCode statusCode)
+        {
+            try
+            {
+                switch (method)
+                {
+                    case "POST":
+                        {
+                            switch (path)
+                            {
+                                case "/agv/agvCallbackService/agvCallback":
+                                    {
+                                        statusCode = System.Net.HttpStatusCode.OK;
+
                                         LogHelper.Info("ExecuteState Request-haikang锛� + requestJson);
                                         var model = JsonConvert.DeserializeObject<HaiKangOrderInfo>(requestJson);
                                         OperateHKTaskStatus(model);
                                         return JsonConvert.SerializeObject(new HkReturnResult { reqCode = model.reqCode });
-							}
-							case "/api/Wcs/CreateTask":
-							{
-								statusCode = System.Net.HttpStatusCode.OK;
-								
+                                    }
+                                case "/api/Wcs/CreateTask":
+                                    {
+                                        statusCode = System.Net.HttpStatusCode.OK;
+
                                         LogHelper.Info("/api/Wcs/CreateTask锛� + requestJson);
                                         var model = JsonConvert.DeserializeObject<ToWMSMES.CreateTask>(requestJson);
                                         var res = ToWMSMES.CreateTask.CreatemesTask(model);
                                         return JsonConvert.SerializeObject(res);
-							}
-							case "/api/Wcs/TestRequestTask":
-							{
-								statusCode = System.Net.HttpStatusCode.OK;
-								LogHelper.Info("/api/Wcs/TestRequestTask锛� + requestJson);
-var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", requestJson);
-return str;
-							}
-							case "/api/Wcs/updateStatus":
-							{
-								statusCode = System.Net.HttpStatusCode.OK;
-								LogHelper.Info("/api/Wcs/updateStatus锛� + requestJson);
-var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", requestJson);
-return str;
-							}
-							case "/api/Wcs/toMes":
-							{
-								statusCode = System.Net.HttpStatusCode.OK;
-								
+                                    }
+                                case "/api/Wcs/TestRequestTask":
+                                    {
+                                        statusCode = System.Net.HttpStatusCode.OK;
+                                        LogHelper.Info("/api/Wcs/TestRequestTask锛� + requestJson);
+                                        var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/200", requestJson);
+                                        return str;
+                                    }
+                                case "/api/Wcs/updateStatus":
+                                    {
+                                        statusCode = System.Net.HttpStatusCode.OK;
+                                        LogHelper.Info("/api/Wcs/updateStatus锛� + requestJson);
+                                        var str = Settings.apiHelper.Post(Settings.WMSbaseUrl + "mom-basic/dataTransmission/json/service/201", requestJson);
+                                        return str;
+                                    }
+                                case "/api/Wcs/toMes":
+                                    {
+                                        statusCode = System.Net.HttpStatusCode.OK;
+
                                         LogHelper.Info("/api/Wcs/toMes锛� + requestJson);
                                         var str = Settings.apiHelper.Post(Settings.MESbaseUrl + "mom-basic/dataTransmission/json/service/202", requestJson);
                                         return str;
-							}
-							case "/api/Wcs/CreatePointTask":
-							{
-								statusCode = System.Net.HttpStatusCode.OK;
-								
+                                    }
+                                case "/api/Wcs/CreatePointTask":
+                                    {
+                                        statusCode = System.Net.HttpStatusCode.OK;
+
                                         LogHelper.Info("/api/Wcs/CreatepointTask锛� + requestJson);
                                         var model = JsonConvert.DeserializeObject<ToWMSMES.CreateTask>(requestJson);
                                         var res = ToWMSMES.CreateTask.CreatePointTask(model);
                                         return JsonConvert.SerializeObject(res);
-							}
-						}
-						break;
-					}
-					case "GET":
-					{
-						switch(path)
-						{
-							case "/inddddddddddddddddd":
-							{
-								statusCode = System.Net.HttpStatusCode.OK;
-								// 澶嶅埗鍒癱ase 涓�-//var _ when System.Text.RegularExpressions.Regex.IsMatch(path, @"\.(html|ico|js|css)(\?.*)?$", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
-var filePath = System.IO.Path.Combine("Static", path.Substring(1));
-return File.ReadAllText(filePath);
-							}
-						}
-						break;
-					}
-				}
-				statusCode = System.Net.HttpStatusCode.NotFound;
-				return "";
-			}
-			catch(Exception ex)
-			{
-				Conn.榛樿鏃ュ織.Error(ex.ToString());
-				statusCode = System.Net.HttpStatusCode.InternalServerError;
-				return "";
-			}
-		}
-		#endregion
-	}
+                                    }
+                            }
+                            break;
+                        }
+                    case "GET":
+                        {
+                            switch (path)
+                            {
+                                case var _ when System.Text.RegularExpressions.Regex.IsMatch(path, @"\.(html|ico|js|css)(\?.*)?$", System.Text.RegularExpressions.RegexOptions.IgnoreCase):
+                                    {
+                                        statusCode = System.Net.HttpStatusCode.OK;
+                                        // 澶嶅埗鍒癱ase 涓�+                                        //var _ when System.Text.RegularExpressions.Regex.IsMatch(path, @"\.(html|ico|js|css)(\?.*)?$", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
+                                        var filePath = /*Directory.GetCurrentDirectory() + "\\Static" + "\\" + path.Substring(1);*/System.IO.Path.Combine(Directory.GetCurrentDirectory() + "\\Static", path.Substring(1));
+                                        return File.ReadAllText(filePath);
+                                    }
+                            }
+                            break;
+                        }
+                }
+                statusCode = System.Net.HttpStatusCode.NotFound;
+                return "";
+            }
+            catch (Exception ex)
+            {
+                Conn.榛樿鏃ュ織.Error(ex.ToString());
+                statusCode = System.Net.HttpStatusCode.InternalServerError;
+                return "";
+            }
+        }
+        #endregion
+    }
 }
 

--
Gitblit v1.9.1