From 99da99b13c68c5f2b82da2764d54b92b1b598657 Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期四, 03 七月 2025 11:32:16 +0800 Subject: [PATCH] 1 --- 2025年6月12日/AuxAllWCS/Build/Project/代码/界面事件.cs | 166 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 84 insertions(+), 82 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 a128334..51d6749 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" @@ -78,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) @@ -99,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("瑗块棬瀛�.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" }; - - // 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 /// 鎻忚堪: @@ -451,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) @@ -835,6 +763,7 @@ } ExitJudgeStack.TryPop(out int exitJudgeVal); }); + /// <summary> /// 绋嬪簭鐗囨:Program1 /// 鎻忚堪: @@ -865,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> @@ -1055,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) { @@ -1064,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()) @@ -1079,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; } @@ -1102,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) @@ -1170,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; // 澶嶅埗鍒癱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)); + var filePath = /*Directory.GetCurrentDirectory() + "\\Static" + "\\" + path.Substring(1);*/System.IO.Path.Combine(Directory.GetCurrentDirectory() + "\\Static", path.Substring(1)); return File.ReadAllText(filePath); } } -- Gitblit v1.9.1