1
czw
2025-07-09 c6c6ca4fc4038aefb13ffcd8e024652c84a5b32f
2025Äê6ÔÂ12ÈÕ/AuxAllWCS/Build/Project/´úÂë/½çÃæÊ¼þ.cs
@@ -50,11 +50,12 @@
            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);
                //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);
                LogHelper.Info("<<<<<<<<<<<Runnnnnnnnnnnnninggggg>>>>>>>>>>");
            }
            catch (Exception ex)
            {
@@ -93,64 +94,6 @@
                }
                ExitJudgeStack.TryPop(out int exitJudgeVal);
            });
            //执行多次
            for (int iii = 0; iii < 1; iii++)
            {
                if (IsExitApp) { break; }
                try
                {
                    #region    [脚本][20250323151832119][业务逻辑.Program4]
                    ////Conn.默认Redis.SetValue("西门子2.Param3","300","西门子2Queue");
                    ////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" };
                    //                    LocRepository locservice = new LocRepository();
                    //                    for (int i = 0; i < locs.Count; i++)
                    //                    {
                    //                        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",
                    //                                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 = "",
                    //                            });
                    //                        }
                    //                    }
                    //                   // TaskProcess.CreateTask("", locs[6], locs[7], "test", 9, new List<string> { "test" }, 1, 1, 1);
                    //                   }
                    #endregion [脚本][20250323151832119][业务逻辑.Program4]
                }
                catch (Exception ex)
                {
                    Conn.默认日志.Error(ex.ToString());
                }
                finally
                {
                    System.Threading.Thread.Sleep(3000);
                }
            }
            /// <summary>
            /// ç¨‹åºç‰‡æ®µ:捷瞬抓臂1
            /// æè¿°:
@@ -231,21 +174,21 @@
                        //   RunafterMac(di,true);
                        /// TODO  mes ä¸‹å‘。   æ”¹æˆæœºæ¢°è‡‚监控 -  ç›‘控空的还是满的 - è”动mes ä»»åŠ¡ã€‚
                        LogHelper.Info($"设备状态:维希尔1:维希尔抓臂1.State:{Device.维希尔抓臂1.State} ");
                        Device.维希尔抓臂1.ReadPLC("维希尔抓臂1.R50", out object value);
                        LogHelper.Info($"设备状态:维希尔1:维希尔抓臂1.R50:{value?.ToString()} ");
                        //LogHelper.Info($"设备状态:维希尔1:维希尔抓臂1.State:{Device.维希尔抓臂1.State} ");
                        //Device.维希尔抓臂1.ReadPLC("维希尔抓臂1.R50", out object value);
                        //LogHelper.Info($"设备状态:维希尔1:维希尔抓臂1.R50:{value?.ToString()} ");
                        LogHelper.Info($"设备状态:维希尔2:维希尔抓臂2.State:{Device.维希尔抓臂2.State} ");
                        Device.维希尔抓臂2.ReadPLC("维希尔抓臂2.R50", out value);
                        LogHelper.Info($"设备状态:维希尔2:维希尔抓臂2.R50:{value?.ToString()} ");
                        //LogHelper.Info($"设备状态:维希尔2:维希尔抓臂2.State:{Device.维希尔抓臂2.State} ");
                        //Device.维希尔抓臂2.ReadPLC("维希尔抓臂2.R50", out value);
                        //LogHelper.Info($"设备状态:维希尔2:维希尔抓臂2.R50:{value?.ToString()} ");
                        LogHelper.Info($"设备状态:捷瞬1:Js捷顺1.State:{Device.Js捷顺1.State} ");
                        Device.Js捷顺1.ReadPLC("Js捷顺1.D1202", out value);
                        LogHelper.Info($"设备状态:捷瞬1 Js捷顺1.D1202:{value?.ToString()} ");
                        //LogHelper.Info($"设备状态:捷瞬1:Js捷顺1.State:{Device.Js捷顺1.State} ");
                        //Device.Js捷顺1.ReadPLC("Js捷顺1.D1202", out value);
                        //LogHelper.Info($"设备状态:捷瞬1 Js捷顺1.D1202:{value?.ToString()} ");
                        LogHelper.Info($"设备状态:捷瞬2:Js捷顺2.State:{Device.Js捷顺2.State} ");
                        Device.Js捷顺2.ReadPLC("Js捷顺2.D1202", out value);
                        LogHelper.Info($"设备状态:捷瞬2 Js捷顺2.D1202:{value?.ToString()} ");
                        //LogHelper.Info($"设备状态:捷瞬2:Js捷顺2.State:{Device.Js捷顺2.State} ");
                        //Device.Js捷顺2.ReadPLC("Js捷顺2.D1202", out value);
                        //LogHelper.Info($"设备状态:捷瞬2 Js捷顺2.D1202:{value?.ToString()} ");
                        #endregion [脚本][20250325085810885][业务逻辑.第三标段.自流转流程]
@@ -428,7 +371,7 @@
                    {
                        #region    [脚本][20250531163716255][业务逻辑.处理MES任务线程.ResolveMesTask]
                        //mes ä»»åŠ¡æ‹†åˆ†ã€‚ä¸€æ®µä»»åŠ¡å’Œ å¤šæ®µä»»åŠ¡ã€‚
                        ToWMSMES.ResMesTask();
                        ToWMSMES.ResMesTask(tag);
                        #endregion [脚本][20250531163716255][业务逻辑.处理MES任务线程.ResolveMesTask]
                    }
                    catch (Exception ex)
@@ -445,15 +388,7 @@
            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());
                    }
                }
                AutoThread.InvokeMethod(AutoThread.Instance, "TaskEverythingRun");
                #endregion [脚本][20250605212104026][业务逻辑.SocketServer]
            }
            catch (Exception ex)
@@ -859,6 +794,74 @@
                }
                ExitJudgeStack.TryPop(out int exitJudgeVal);
            });
            /// <summary>
            /// ç¨‹åºç‰‡æ®µ:Ipping
            /// æè¿°:检测IP地址通断
            /// </summary>
            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                System.Threading.Thread.CurrentThread.IsBackground = true;
                ExitJudgeStack.Push(0);
                //一直执行,直到满足结束条件
                while (true)
                {
                    if (IsExitApp) { break; }
                    try
                    {
                        #region    [脚本][20250323151832119][业务逻辑.Ipping]
                        //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][业务逻辑.Ipping]
                    }
                    catch (Exception ex)
                    {
                        Conn.默认日志.Error(ex.ToString());
                    }
                    finally
                    {
                        System.Threading.Thread.Sleep(3000);
                    }
                }
                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    [脚本][20250708095248653][业务逻辑.新线程总线]
                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreaTotal", new object[] { tag });
                        #endregion [脚本][20250708095248653][业务逻辑.新线程总线]
                    }
                    catch (Exception ex)
                    {
                        Conn.默认日志.Error(ex.ToString());
                    }
                    finally
                    {
                        System.Threading.Thread.Sleep(3000);
                    }
                }
                ExitJudgeStack.TryPop(out int exitJudgeVal);
            });
        }
        /// <summary>
@@ -962,7 +965,24 @@
                    Device.A2030取货交互?.Stop();
                    Device.RGV?.Stop();
                    Device.p发那科2下线?.Stop();
                    Device.p发那科3上线?.Stop();
                    Device.D定子1号机械手?.Stop();
                    Device.D定子2号机械手?.Stop();
                    Device.S2027Read?.Stop();
                    Device.S2020Read?.Stop();
                    Device.S2013Read?.Stop();
                    Device.S2027Write?.Stop();
                    Device.S2020Write?.Stop();
                    Device.S2013Write?.Stop();
                    Device.S2001Write?.Stop();
                    Device.S2008Write?.Stop();
                    Device.S3001Read?.Stop();
                    Device.S3006Read?.Stop();
                    Device.S3005Read?.Stop();
                    Device.S3010Read?.Stop();
                    Device.A3001放货交互?.Stop();
                    Device.A3005取货交互?.Stop();
                    Device.A3006放货交互?.Stop();
                    Device.A3010取货交互?.Stop();
                }
                catch (Exception ex)
                {
@@ -1014,7 +1034,24 @@
                        || (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发那科2下线 == null ? false : Device.p发那科2下线.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.p发那科3上线 == null ? false : Device.p发那科3上线.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.D定子1号机械手 == null ? false : Device.D定子1号机械手.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.D定子2号机械手 == null ? false : Device.D定子2号机械手.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2027Read == null ? false : Device.S2027Read.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2020Read == null ? false : Device.S2020Read.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2013Read == null ? false : Device.S2013Read.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2027Write == null ? false : Device.S2027Write.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2020Write == null ? false : Device.S2020Write.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2013Write == null ? false : Device.S2013Write.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2001Write == null ? false : Device.S2001Write.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S2008Write == null ? false : Device.S2008Write.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S3001Read == null ? false : Device.S3001Read.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S3006Read == null ? false : Device.S3006Read.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S3005Read == null ? false : Device.S3005Read.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.S3010Read == null ? false : Device.S3010Read.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.A3001放货交互 == null ? false : Device.A3001放货交互.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.A3005取货交互 == null ? false : Device.A3005取货交互.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.A3006放货交互 == null ? false : Device.A3006放货交互.State != GZ.Device.PLC.PlcRunState.Stoped)
                        || (Device.A3010取货交互 == null ? false : Device.A3010取货交互.State != GZ.Device.PLC.PlcRunState.Stoped)
                    )
                    {
                        System.Threading.Thread.Sleep(1000);
@@ -1045,6 +1082,38 @@
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void View1_Init(object sender, RoutedEventArgs e)
        {
        }
        #endregion
        #region View2事件
        /// <summary>
        /// View2打开事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void View2_LoadEvent(object sender, RoutedEventArgs e)
        {
        }
        /// <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
@@ -1169,7 +1238,7 @@
                                        statusCode = System.Net.HttpStatusCode.OK;
                                        // å¤åˆ¶åˆ°case ä¸Š
                                        //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));
                                        var filePath = /*Directory.GetCurrentDirectory() + "\\Static" + "\\" + path.Substring(1);*/System.IO.Path.Combine(Directory.GetCurrentDirectory() + "\\Static", path.Substring(1));
                                        return File.ReadAllText(filePath);
                                    }
                            }