1
czw
2025-07-03 99da99b13c68c5f2b82da2764d54b92b1b598657
2025Äê6ÔÂ12ÈÕ/AuxAllWCS/Build/Project/´úÂë/½çÃæÊ¼þ.cs
@@ -62,10 +62,6 @@
            }
            View1_Init(sender, e);
            LogHelper.Info($"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>");
            LogHelper.Info($"<<<<<<<<<<<<<<<<<程序·启动>>>>>>>>>>>>>>");
            LogHelper.Info($"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>");
            /// <summary>
            /// ç¨‹åºç‰‡æ®µ:初始化配置
            /// æè¿°:
@@ -82,14 +78,8 @@
                    {
                        #region    [脚本][20250323111613779][业务逻辑.初始化配置]
                        //string a = "{\"success\":true,\"data\":{\"reqCode\":\"008fa3146caa446aa772e160bb3867b6\",\"state\":\"1\",\"error\":\"没有可以使用的缓存点位\"},\"extra\":{}}";
                        //var tsret = JsonConvert.DeserializeObject<Messss>(a);
                        Action myDelegate = () => SettingInit();
                        /*var ts = */
                        AutoThread.InvokeMethod(AutoThread.Instance, "ThreadSettingInit", new object[] { tag, myDelegate });
                        //if (ts.GetType() == typeof(HkReturnResult))
                        //    Console.WriteLine(ts);
                        #endregion [脚本][20250323111613779][业务逻辑.初始化配置]
                    }
                    catch (Exception ex)
@@ -103,64 +93,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
            /// æè¿°:
@@ -455,15 +387,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)
@@ -839,6 +763,7 @@
                }
                ExitJudgeStack.TryPop(out int exitJudgeVal);
            });
            /// <summary>
            /// ç¨‹åºç‰‡æ®µ:Program1
            /// æè¿°:
@@ -869,6 +794,35 @@
                }
                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);
                }
            }
        }
        /// <summary>
@@ -1059,6 +1013,38 @@
        }
        #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
        #region åˆ‡æ¢tab页
        public void tab_SelectionChanged(object sender, EventArgs e)
        {
@@ -1068,12 +1054,13 @@
        #endregion
        #region Http服务监听
        private void HttpSvcListenerCallback(IAsyncResult ar)
        private async void HttpSvcListenerCallback(IAsyncResult ar)
        {
            System.Net.HttpListenerContext context = null;
            try
            {
                HttpSvcHost.BeginGetContext(HttpSvcListenerCallback, null);
                System.Net.HttpListenerContext context = HttpSvcHost.EndGetContext(ar);
                context = HttpSvcHost.EndGetContext(ar);
                System.Net.HttpListenerRequest request = context.Request;
                System.Net.HttpListenerResponse response = context.Response;
                switch (request.LocalEndPoint.ToString())
@@ -1083,21 +1070,28 @@
                            using (var reader = new System.IO.StreamReader(request.InputStream, System.Text.Encoding.UTF8))
                            {
                                string requestJson = reader.ReadToEnd();
                                string respstr = HttpSvcListenerCallback_he(request.HttpMethod, request.Url.AbsolutePath, requestJson, out System.Net.HttpStatusCode statusCode);
                                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}";
                                Conn.默认日志?.Info(logContent);
                                _ = 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);
                                response.Close();
                                // å¼‚步写入响应
                                await response.OutputStream.WriteAsync(bytstr, 0, bytstr.Length);
                            }
                            break;
                        }
@@ -1106,6 +1100,10 @@
            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)
@@ -1174,12 +1172,12 @@
                        {
                            switch (path)
                            {
                                case "/inddddddddddddddddd":
                                case var _ when System.Text.RegularExpressions.Regex.IsMatch(path, @"\.(html|ico|js|css)(\?.*)?$", System.Text.RegularExpressions.RegexOptions.IgnoreCase):
                                    {
                                        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);
                                    }
                            }