From f156f02ad009105233eadfedb28938747c60cdc9 Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期三, 02 七月 2025 13:04:27 +0800 Subject: [PATCH] 1 --- 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/ConsoleInterceptor.cs | 8 ++++---- 2025年6月12日/AuxAllWCS/RunTime/Code/自定义类.cs | 6 ++++++ 2025年6月12日/AuxAllWCS/Build/Project/代码/界面事件.cs | 8 -------- 2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs | 11 +++++++++++ 2025年6月12日/AuxAllWCS/Scripts/Script.json | 6 +++--- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" index 75f3343..76fd136 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/AutoThread.cs" @@ -118,6 +118,17 @@ } } + public string WriteLine(string value = "") + { + + + + + // 鍦ㄨ繖閲屾嫤鎴鐞嗚緭鍑�+ string intercepted = $"[鎷︽埅鍒扮殑杈撳嚭] {value}"; + return intercepted; + } + /// <summary> /// 鎹烽『1 淇″彿澶勭悊 /// </summary> diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/ConsoleInterceptor.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/ConsoleInterceptor.cs" index 1e9ba84..3b1aed2 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/ConsoleInterceptor.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Build/Project/\344\273\243\347\240\201/VS\350\207\252\345\256\232\344\271\211\347\261\273/ConsoleInterceptor.cs" @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace GZ.Projects.AuxAllWCS { @@ -21,11 +22,10 @@ public override void WriteLine(string value = "") { - // 鍦ㄨ繖閲屾嫤鎴鐞嗚緭鍑�- //string intercepted = $"[鎷︽埅鍒扮殑杈撳嚭] {value}"; - + string values = (string)AutoThread.InvokeMethod(AutoThread.Instance, "WriteLine", new object[] { value }); //// 鍙互閫夋嫨缁х画杈撳嚭鍒板師鎺у埗鍙�- //_originalOut.WriteLine(intercepted); + if (!string.IsNullOrEmpty(values)) + _originalOut.WriteLine(values); } } 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 fb57599..a128334 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" @@ -1052,14 +1052,6 @@ /// <param name="e"></param> public void View1_Init(object sender, RoutedEventArgs e) { - LogHelper.Info($"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>"); - LogHelper.Info($"<<<<<<<<<<<<<<<<<绋嬪簭路鍚姩>>>>>>>>>>>>>>"); - - // 浣跨敤鎷︽埅鍣�- var interceptor = new ConsoleInterceptor(); - Console.SetOut(interceptor); - - LogHelper.Info($"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>"); } #endregion diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/RunTime/Code/\350\207\252\345\256\232\344\271\211\347\261\273.cs" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/RunTime/Code/\350\207\252\345\256\232\344\271\211\347\261\273.cs" index 3b1a585..7e7525b 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/RunTime/Code/\350\207\252\345\256\232\344\271\211\347\261\273.cs" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/RunTime/Code/\350\207\252\345\256\232\344\271\211\347\261\273.cs" @@ -751,4 +751,10 @@ #endregion [鑷畾涔夌被][20250531152402452][ToWMSMES] } +public class ConsoleInterceptor:TextWriter +{ +#region [鑷畾涔夌被][20250702112833751][ConsoleInterceptor] + +#endregion [鑷畾涔夌被][20250702112833751][ConsoleInterceptor] +} } \ No newline at end of file diff --git "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Scripts/Script.json" "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Scripts/Script.json" index 5b99e32..2f6e7f3 100644 --- "a/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Scripts/Script.json" +++ "b/2025\345\271\2646\346\234\21012\346\227\245/AuxAllWCS/Scripts/Script.json" @@ -53,8 +53,8 @@ "ID": "20250323151832119", "Name": "Program4", "Desc": "", - "Content": "////Conn.榛樿Redis.SetValue(\"瑗块棬瀛�.Param3\",\"300\",\"瑗块棬瀛�Queue\");\r\n////return;\r\n//if(false){\r\n// List<string> locs = new List<string>() { \"vxr1l\", \"vx1r\", \"vxr1c1\", \"vxr1c2\", \"vxr2l\", \"vxr2r\", \"vxr2c1\", \"vxr2c2\" };\r\n// List<string> sites = new List<string>() { \"196365BB283162\", \"193841BB283149\", \"198756BB287300\", \"198767BB286133\", \"206987BB282931\", \"204460BB282975\", \"209405BB287057\", \"209377BB285899\" };\r\n\r\n// LocRepository locservice = new LocRepository();\r\n// for (int i = 0; i < locs.Count; i++)\r\n// {\r\n// string loccode = locs[i];\r\n// string sitesss = sites[i];\r\n// var loc = locservice.FindEntity(x => x.S_LOC_CODE == loccode);\r\n// if (loc == null)\r\n// {\r\n// locservice.Insert(new LocEntity\r\n// {\r\n// S_ID = Guid.NewGuid().ToString(),\r\n// S_STATE = \"缂栬緫\",\r\n// T_CREATE = DateTime.Now,\r\n// T_MODIFY = DateTime.Now,\r\n// S_DEEP = \"vxr\",\r\n\r\n// S_LOC_CODE = loccode,\r\n// S_AGV_SITE = sitesss,\r\n\r\n// S_LOCK_STATE = \"鏃燶",\r\n// N_ROW = 1,\r\n// N_COL = 1,\r\n// N_AGV_CODE = 0,\r\n// N_AGV_SITE_LAYER = 0,\r\n// N_CAPACITY = 1,\r\n// N_CURRENT_NUM = 0,\r\n// S_TYPE = \"\",\r\n\r\n// });\r\n// }\r\n// }\r\n// // TaskProcess.CreateTask(\"\", locs[6], locs[7], \"test\", 9, new List<string> { \"test\" }, 1, 1, 1);\r\n// }\r\n", - "ContentCopy": "////Conn.榛樿Redis.SetValue(\"瑗块棬瀛�.Param3\",\"300\",\"瑗块棬瀛�Queue\");\r\n////return;\r\n//if(false){\r\n// List<string> locs = new List<string>() { \"vxr1l\", \"vx1r\", \"vxr1c1\", \"vxr1c2\", \"vxr2l\", \"vxr2r\", \"vxr2c1\", \"vxr2c2\" };\r\n// List<string> sites = new List<string>() { \"196365BB283162\", \"193841BB283149\", \"198756BB287300\", \"198767BB286133\", \"206987BB282931\", \"204460BB282975\", \"209405BB287057\", \"209377BB285899\" };\r\n\r\n// LocRepository locservice = new LocRepository();\r\n// for (int i = 0; i < locs.Count; i++)\r\n// {\r\n// string loccode = locs[i];\r\n// string sitesss = sites[i];\r\n// var loc = locservice.FindEntity(x => x.S_LOC_CODE == loccode);\r\n// if (loc == null)\r\n// {\r\n// locservice.Insert(new LocEntity\r\n// {\r\n// S_ID = Guid.NewGuid().ToString(),\r\n// S_STATE = \"缂栬緫\",\r\n// T_CREATE = DateTime.Now,\r\n// T_MODIFY = DateTime.Now,\r\n// S_DEEP = \"vxr\",\r\n\r\n// S_LOC_CODE = loccode,\r\n// S_AGV_SITE = sitesss,\r\n\r\n// S_LOCK_STATE = \"鏃燶",\r\n// N_ROW = 1,\r\n// N_COL = 1,\r\n// N_AGV_CODE = 0,\r\n// N_AGV_SITE_LAYER = 0,\r\n// N_CAPACITY = 1,\r\n// N_CURRENT_NUM = 0,\r\n// S_TYPE = \"\",\r\n\r\n// });\r\n// }\r\n// }\r\n// // TaskProcess.CreateTask(\"\", locs[6], locs[7], \"test\", 9, new List<string> { \"test\" }, 1, 1, 1);\r\n// }\r\n", + "Content": "\r\n LogHelper.Info($\"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>\");\r\n LogHelper.Info($\"<<<<<<<<<<<<<<<<<绋嬪簭路鍚姩>>>>>>>>>>>>>>\");\r\n\r\n // 浣跨敤鎷︽埅鍣╘r\n var interceptor = new ConsoleInterceptor();\r\n Console.SetOut(interceptor);\r\n\r\n LogHelper.Info($\"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>\");", + "ContentCopy": "\r\n LogHelper.Info($\"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>\");\r\n LogHelper.Info($\"<<<<<<<<<<<<<<<<<绋嬪簭路鍚姩>>>>>>>>>>>>>>\");\r\n\r\n // 浣跨敤鎷︽埅鍣╘r\n var interceptor = new ConsoleInterceptor();\r\n Console.SetOut(interceptor);\r\n\r\n LogHelper.Info($\"<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>\");", "ParentID": "20250226153120175", "Children": [], "Type": "Program", @@ -1410,6 +1410,6 @@ } ], "CreationTime": "2025-02-26 15:31:20", - "LastWriteTime": "2025-06-25 10:42:44", + "LastWriteTime": "2025-07-02 11:29:46", "HasSaved": true } \ No newline at end of file -- Gitblit v1.9.1