quanzhou
2025-08-22 66e0168fe68ae5641041b2bceb3f0bb9640df09f
src/Bro.M141_AOI1.Process/AOI1Process.cs
@@ -249,6 +249,25 @@
                                }
                                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} ");
@@ -547,6 +566,25 @@
                            }
                            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}");
@@ -554,6 +592,7 @@
                        }
                        catch
                        {
                            LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具  进料口空篮 获取返回值解析异常  返回数据{Msg} ");
                            Plc1.WriteSingleAddress(1590, 2, out _);
                        }
@@ -608,6 +647,25 @@
                            }
                            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 _);
                            }
@@ -658,6 +716,25 @@
                        }
                        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}");
@@ -703,7 +780,29 @@
                        {
                            ConfigAOI1.mesnum3++;
                        }
                        LogAsync(DateTime.Now, obj?.zstatus == "200" ? EnumHelper.LogLevel.Information : EnumHelper.LogLevel.Exception, $"RabbitMQ 篮具  下料口满载1 上传{(obj?.zstatus == "200" ? "成功" : "失败")}   {obj?.zstatus}");
                        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
                    {
@@ -714,8 +813,6 @@
                {
                    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;
@@ -731,6 +828,25 @@
                        }
                        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}");
@@ -753,10 +869,5 @@
            }
            return msg;
        }
    }
}