| | |
| | | using GZ.DB.Repository.OIDATABASE; |
| | | using GZ.DB.IRepository.OIDATABASE; |
| | | 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> |
| | |
| | | } |
| | | 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)) |
| | | //{ |
| | | |
| | | //foreach (var configPath in Directory.EnumerateFiles(@"G:\1AGIT\HH-0167_WuHuAoKeSi\2025å¹´6æ12æ¥\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) |
| | | { |
| | | if (IsExitApp) { break; } |
| | | try |
| | | System.Threading.Thread.CurrentThread.IsBackground = true; |
| | | ExitJudgeStack.Push(0); |
| | | //ä¸ç´æ§è¡ï¼ç´å°æ»¡è¶³ç»ææ¡ä»¶ |
| | | while (true) |
| | | { |
| | | #region [èæ¬][20250323111613779][ä¸å¡é»è¾.åå§åé
ç½®] |
| | | if (IsExitApp) { break; } |
| | | try |
| | | { |
| | | #region [èæ¬][20250323111613779][ä¸å¡é»è¾.åå§åé
ç½®] |
| | | |
| | | Action myDelegate = () => SettingInit(); |
| | | AutoThread.InvokeMethod(AutoThread.Instance, "ThreadSettingInit", new object[] { tag, myDelegate }); |
| | | #endregion [èæ¬][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); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Conn.é»è®¤æ¥å¿.Error(ex.ToString()); |
| | | } |
| | | finally |
| | | { |
| | | System.Threading.Thread.Sleep(10000); |
| | | } |
| | | } |
| | | ExitJudgeStack.TryPop(out int exitJudgeVal); |
| | | }); |
| | | ExitJudgeStack.TryPop(out int exitJudgeVal); |
| | | }); |
| | | /// <summary> |
| | | /// ç¨åºç段:æ·ç¬æè1 |
| | | /// æè¿°: |
| | |
| | | { |
| | | #region [èæ¬][20250323151832119][ä¸å¡é»è¾.Ipping] |
| | | |
| | | //var hkr = AutoThread.InvokeMethod(AutoThread.Instance, "IsMachineOnline", new object[] { "192.168.1.103", 1000 }); |
| | | //Console.WriteLine("192.168.1.103 > " + hkr.ToString()); |
| | | //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][ä¸å¡é»è¾.Ipping] |
| | | } |
| | | catch (Exception ex) |
| | |
| | | Device.A3005å货交äº?.Stop(); |
| | | Device.A3006æ¾è´§äº¤äº?.Stop(); |
| | | Device.A3010å货交äº?.Stop(); |
| | | Device.S2008Read?.Stop(); |
| | | Device.Z转å1å·æºæ¢°æ?.Stop(); |
| | | Device.Z转å2å·æºæ¢°æ?.Stop(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | || (Device.A3005åè´§äº¤äº == null ? false : Device.A3005å货交äº.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.A3006æ¾è´§äº¤äº == null ? false : Device.A3006æ¾è´§äº¤äº.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.A3010åè´§äº¤äº == null ? false : Device.A3010å货交äº.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.S2008Read == null ? false : Device.S2008Read.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.Z转å1å·æºæ¢°æ == null ? false : Device.Z转å1å·æºæ¢°æ.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | || (Device.Z转å2å·æºæ¢°æ == null ? false : Device.Z转å2å·æºæ¢°æ.State != GZ.Device.PLC.PlcRunState.Stoped) |
| | | ) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | |
| | | var model = JsonConvert.DeserializeObject<ToWMSMES.CreateTask>(requestJson); |
| | | var res = ToWMSMES.CreateTask.CreatePointTask(model); |
| | | return JsonConvert.SerializeObject(res); |
| | | } |
| | | case "/api/Wcs/initZZCache": |
| | | { |
| | | statusCode = System.Net.HttpStatusCode.OK; |
| | | |
| | | var rturn = new ReturnMsg |
| | | { |
| | | resultCode = 0, |
| | | resultMsg = "" |
| | | }; |
| | | try |
| | | { |
| | | LocRepository locRepository = new LocRepository(); |
| | | foreach (var item in Settings.deviceInfos.FindAll(x => x.deviceType == 2)) |
| | | { |
| | | foreach (var ssloc in item.deviceNo) |
| | | { |
| | | var ssl = locRepository.FindEntity(x => x.S_LOC_CODE == ssloc); |
| | | if (ssl != null && (ssl.N_CURRENT_NUM > 0 || ssl.S_LOCK_STATE != "æ ")) |
| | | { |
| | | ssl.N_CURRENT_NUM = 0; |
| | | ssl.S_LOCK_STATE = "æ "; |
| | | locRepository.Update(ssl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Error("/api/Wcs/initZZCache" + requestJson + ex.Message, ex); |
| | | return JsonConvert.SerializeObject(new ReturnMsg |
| | | { |
| | | resultCode = -1, |
| | | resultMsg = ex.Message |
| | | }); |
| | | } |
| | | return JsonConvert.SerializeObject(rturn); |
| | | } |
| | | } |
| | | break; |