From dc9fb292e8b057dbd0d45c60a1538d2d95727d67 Mon Sep 17 00:00:00 2001 From: czw <selecti@yeah.net> Date: 星期三, 23 七月 2025 17:07:18 +0800 Subject: [PATCH] 1 --- 2025年6月12日/AuxAllWCS/Build/Project/代码/界面事件.cs | 79 +++++++++++++++++++++++++-------------- 1 files changed, 51 insertions(+), 28 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 b14d39f..401458c 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" @@ -30,6 +30,8 @@ using GZ.DB.Entity.OIDATABASE; using static GZ.Projects.AuxAllWCS.ToWMSMES.CreateTask; using GZ.Device.PLC; +using System.Text.RegularExpressions; +using ServiceStack.Text; namespace GZ.Projects.AuxAllWCS { /// <summary> @@ -66,44 +68,65 @@ View1_Init(sender, e); var path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs"); - string text = File.ReadAllText(configPath); - PlcConfig plcConfig = JsonConvert.DeserializeObject<PlcConfig>(text); - if (plcConfig != null && FactoryMap.ContainsKey((int)plcConfig.Brand) && FactoryMap[(int)plcConfig.Brand].Contains((int)plcConfig.Comm)) - { + //string text = File.ReadAllText(configPath); + //PlcConfig plcConfig = JsonConvert.DeserializeObject<PlcConfig>(text); + //if (plcConfig != null && FactoryMap.ContainsKey((int)plcConfig.Brand) && FactoryMap[(int)plcConfig.Brand].Contains((int)plcConfig.Comm)) + //{ - } - Console.Write(path); + //foreach (var configPath in Directory.EnumerateFiles(@"G:\1AGIT\HH-0167_WuHuAoKeSi\2025骞�鏈�2鏃AuxAllWCS\Build\auxwcs\bin\Debug\Configs", "* - 鍓湰", SearchOption.TopDirectoryOnly)) + //{ + // string text = File.ReadAllText(configPath); + // PlcConfig plcConfig = JsonConvert.DeserializeObject<PlcConfig>(text); + // if (plcConfig.Brand == DeviceBrand.Siemens) + // { + // string pattern = "^(?<ip>((?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d))\r\n:(?<port>0|[1-9]\\d{0,4}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])\r\n(?:(?::(?<number>\\d+)|\\[(?<rack>\\d+),(?<slot>\\d+)\\]|\\[v(?<ver>\\d+\\.\\d+)\\])){0,3}$"; + // Match match = Regex.Match(plcConfig.IP, pattern, RegexOptions.IgnorePatternWhitespace); + // if (match.Success) + // { + + // string value = match.Groups["ip"].Value; + // int.TryParse(match.Groups["port"].Value, out var result3); + // int.TryParse(match.Groups["number"].Value, out var result4); + // short.TryParse(match.Groups["rack"].Value, out var result5); + // short.TryParse(match.Groups["slot"].Value, out var result6); + // string value2 = match.Groups["ver"].Value; + // var result = new Comm_S7Net(Comm_S7Net. CpuType., value, result3, result5, result6, result4, value2); + // } + // } + //} + //} + //Console.Write(path); /// <summary> /// 绋嬪簭鐗囨:鍒濆鍖栭厤缃� /// 鎻忚堪: /// </summary> System.Threading.Tasks.Task.Factory.StartNew(() => + { + System.Threading.Thread.CurrentThread.IsBackground = true; + ExitJudgeStack.Push(0); + //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�+ while (true) { - System.Threading.Thread.CurrentThread.IsBackground = true; - ExitJudgeStack.Push(0); - //涓�洿鎵ц锛岀洿鍒版弧瓒崇粨鏉熸潯浠�- while (true) + if (IsExitApp) { break; } + try { - if (IsExitApp) { break; } - try - { - #region [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝 + #region [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝 - Action myDelegate = () => SettingInit(); - AutoThread.InvokeMethod(AutoThread.Instance, "ThreadSettingInit", new object[] { tag, myDelegate }); - #endregion [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝 - } - catch (Exception ex) - { - Conn.榛樿鏃ュ織.Error(ex.ToString()); - } - finally - { - System.Threading.Thread.Sleep(10000); - } + Action myDelegate = () => SettingInit(); + AutoThread.InvokeMethod(AutoThread.Instance, "ThreadSettingInit", new object[] { tag, myDelegate }); + #endregion [鑴氭湰][20250323111613779][涓氬姟閫昏緫.鍒濆鍖栭厤缃甝 } - ExitJudgeStack.TryPop(out int exitJudgeVal); - }); + catch (Exception ex) + { + Conn.榛樿鏃ュ織.Error(ex.ToString()); + } + finally + { + System.Threading.Thread.Sleep(10000); + } + } + ExitJudgeStack.TryPop(out int exitJudgeVal); + }); /// <summary> /// 绋嬪簭鐗囨:鎹风灛鎶撹噦1 /// 鎻忚堪: -- Gitblit v1.9.1