From 31de09d1ba504cb036ae29a98a9efbb0c2d61914 Mon Sep 17 00:00:00 2001
From: quanzhou <quan.zhou@broconcentric.com>
Date: 星期四, 11 九月 2025 13:34:11 +0800
Subject: [PATCH] 增加扫码上传打印追溯条码的界面以及对mes的开关添加了日志
---
src/Bro.M141_AOI1.Process/AOI1Process.cs | 132 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 124 insertions(+), 8 deletions(-)
diff --git a/src/Bro.M141_AOI1.Process/AOI1Process.cs b/src/Bro.M141_AOI1.Process/AOI1Process.cs
index 6a88850..8f105c1 100644
--- a/src/Bro.M141_AOI1.Process/AOI1Process.cs
+++ b/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} ");
@@ -264,6 +283,7 @@
}
else
{
+ LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"宸插叧闂璵es杩炴帴");
Plc1.WriteSingleAddress(1524, 1, out _);
Plc1.WriteSingleAddress(1514, 1, out _);
}
@@ -547,6 +567,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 绡叿 杩涙枡鍙g┖绡� 涓婁紶{(obj?.zstatus == "200" ? "鎴愬姛" : "澶辫触")} {obj?.zstatus}");
@@ -554,6 +593,7 @@
}
catch
{
+
LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ 绡叿 杩涙枡鍙g┖绡� 鑾峰彇杩斿洖鍊艰В鏋愬紓甯� 杩斿洖鏁版嵁{Msg} ");
Plc1.WriteSingleAddress(1590, 2, out _);
}
@@ -567,6 +607,7 @@
}
else
{
+ LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"宸插叧闂璵es杩炴帴");
Plc1.WriteSingleAddress(1590, 1, out _);
}
@@ -608,6 +649,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 _);
}
@@ -628,6 +688,7 @@
}
else
{
+ LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"宸插叧闂璵es杩炴帴");
Plc1.WriteSingleAddress(1590, 1, out _);
}
@@ -658,6 +719,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 绡叿 涓嬫枡鍙g┖绡� 涓婁紶{(obj?.zstatus == "200" ? "鎴愬姛" : "澶辫触")} {obj?.zstatus}");
@@ -677,6 +757,7 @@
}
else
{
+ LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"宸插叧闂璵es杩炴帴");
Plc1.WriteSingleAddress(1591, 1, out _);
}
@@ -703,7 +784,29 @@
{
ConfigAOI1.mesnum3++;
}
- LogAsync(DateTime.Now, obj?.zstatus == "200" ? EnumHelper.LogLevel.Information : EnumHelper.LogLevel.Exception, $"RabbitMQ 绡叿 涓嬫枡鍙f弧杞�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 绡叿 涓嬫枡鍙f弧杞�1 涓婁紶{(obj?.zstatus == "200" ? "鎴愬姛" : "澶辫触")} {obj?.zstatus}");
}
catch
{
@@ -714,8 +817,6 @@
{
LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ 绡叿 涓嬫枡鍙f弧杞�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 +832,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 绡叿 涓嬫枡鍙f弧杞� 涓婁紶{(obj?.zstatus == "200" ? "鎴愬姛" : "澶辫触")} {obj?.zstatus}");
@@ -749,14 +869,10 @@
}
else
{
+ LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"宸插叧闂璵es杩炴帴");
Plc1.WriteSingleAddress(1591, 1, out _);
}
return msg;
}
-
-
-
-
-
}
}
--
Gitblit v1.8.0