| | |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if (zwordstr.Contains("version错误")) |
| | | { |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | { |
| | | ConfigAOI1.mesnum2 = int.Parse(matches[0].Value)+1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum2 = 0; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | Plc1.WriteSingleAddress(1524, 2, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ zwoid获取失败 {zwordstr} "); |
| | |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if (Msg.Contains("version错误")) |
| | | { |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | { |
| | | ConfigAOI1.mesnum1 = int.Parse(matches[0].Value)+ 1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum1 = 0; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | Plc1.WriteSingleAddress(1590, 2, out _); |
| | | } |
| | | LogAsync(DateTime.Now, obj?.zstatus == "200" ? EnumHelper.LogLevel.Information : EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具 进料口空篮 上传{(obj?.zstatus == "200" ? "成功" : "失败")} {obj?.zstatus}"); |
| | |
| | | } |
| | | catch |
| | | { |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具 进料口空篮 获取返回值解析异常 返回数据{Msg} "); |
| | | Plc1.WriteSingleAddress(1590, 2, out _); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if (Msg.Contains("version错误")) |
| | | { |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | { |
| | | ConfigAOI1.mesnum1 = int.Parse(matches[0].Value) + 1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum1 = 0; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | Plc1.WriteSingleAddress(1590, 2, out _); |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if (Msg.Contains("version错误")) |
| | | { |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | { |
| | | ConfigAOI1.mesnum3 = int.Parse(matches[0].Value)+1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum3 = 0; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | Plc1.WriteSingleAddress(1591, 2, out _); |
| | | } |
| | | LogAsync(DateTime.Now, obj?.zstatus == "200" ? EnumHelper.LogLevel.Information : EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具 下料口空篮 上传{(obj?.zstatus == "200" ? "成功" : "失败")} {obj?.zstatus}"); |
| | |
| | | { |
| | | ConfigAOI1.mesnum3++; |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if (Msg.Contains("version错误")) |
| | | { |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | { |
| | | ConfigAOI1.mesnum3 = int.Parse(matches[0].Value) + 1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum3 = 0; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | } |
| | | LogAsync(DateTime.Now, obj?.zstatus == "200" ? EnumHelper.LogLevel.Information : EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具 下料口满载1 上传{(obj?.zstatus == "200" ? "成功" : "失败")} {obj?.zstatus}"); |
| | | } |
| | | catch |
| | |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具 下料口满载1 获取返回值解析异常 返回数据null "); |
| | | } |
| | | |
| | | |
| | | Thread.Sleep(1000); |
| | | //mqtt.Send("4", "DS02217", ConfigAOI1.Dicbasketcode.ContainsKey(num) ? ConfigAOI1.Dicbasketcode[num] : ConfigAOI1.basketcode, "1", num.ToString()); |
| | | Msg = Task.Run(() => mqtt.MESForBasketAsync("4", "DS02217", ConfigAOI1.PlcAndBasketcodes.Any(u => u.id == num) ? ConfigAOI1.PlcAndBasketcodes.FirstOrDefault(u => u.id == num).code : "NoRead", "1", ConfigAOI1.mesnum4.ToString())).Result; |
| | |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | if (Msg.Contains("version错误")) |
| | | { |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | { |
| | | ConfigAOI1.mesnum4 = int.Parse(matches[0].Value) + 1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum4 = 0; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | Plc1.WriteSingleAddress(1591, 2, out _); |
| | | } |
| | | LogAsync(DateTime.Now, obj?.zstatus == "200" ? EnumHelper.LogLevel.Information : EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具 下料口满载 上传{(obj?.zstatus == "200" ? "成功" : "失败")} {obj?.zstatus}"); |
| | |
| | | } |
| | | return msg; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |