1
czw
2025-07-08 0d6d67bd9fe82fd477d67439cb3e5d2d853561bf
1
1个文件已修改
58 ■■■■■ 已修改文件
2025年6月12日/AuxAllWCS/Build/Project/代码/界面事件.cs 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
2025Äê6ÔÂ12ÈÕ/AuxAllWCS/Build/Project/´úÂë/½çÃæÊ¼þ.cs
@@ -763,7 +763,6 @@
                }
                ExitJudgeStack.TryPop(out int exitJudgeVal);
            });
            /// <summary>
            /// ç¨‹åºç‰‡æ®µ:Program1
            /// æè¿°:
@@ -823,6 +822,35 @@
                    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    [脚本][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>
@@ -927,6 +955,7 @@
                    Device.RGV?.Stop();
                    Device.p发那科2下线?.Stop();
                    Device.p发那科3上线?.Stop();
                    Device.p发那科4上线?.Stop();
                }
                catch (Exception ex)
                {
@@ -979,6 +1008,7 @@
                        || (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.p发那科4上线 == null ? false : Device.p发那科4上线.State != GZ.Device.PLC.PlcRunState.Stoped)
                    )
                    {
                        System.Threading.Thread.Sleep(1000);
@@ -1054,13 +1084,12 @@
        #endregion
        #region Http服务监听
        private async void HttpSvcListenerCallback(IAsyncResult ar)
        private void HttpSvcListenerCallback(IAsyncResult ar)
        {
            System.Net.HttpListenerContext context = null;
            try
            {
                HttpSvcHost.BeginGetContext(HttpSvcListenerCallback, null);
                context = HttpSvcHost.EndGetContext(ar);
                System.Net.HttpListenerContext context = HttpSvcHost.EndGetContext(ar);
                System.Net.HttpListenerRequest request = context.Request;
                System.Net.HttpListenerResponse response = context.Response;
                switch (request.LocalEndPoint.ToString())
@@ -1070,28 +1099,21 @@
                            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 respstr = HttpSvcListenerCallback_he(request.HttpMethod, request.Url.AbsolutePath, requestJson, out System.Net.HttpStatusCode 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);
                                response.Close();
                            }
                            break;
                        }
@@ -1100,10 +1122,6 @@
            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)
@@ -1172,7 +1190,7 @@
                        {
                            switch (path)
                            {
                                case var _ when System.Text.RegularExpressions.Regex.IsMatch(path, @"\.(html|ico|js|css)(\?.*)?$", System.Text.RegularExpressions.RegexOptions.IgnoreCase):
                                case "/inddddddddddddddddd":
                                    {
                                        statusCode = System.Net.HttpStatusCode.OK;
                                        // å¤åˆ¶åˆ°case ä¸Š