From 745d1ce73a3b27d2a3507843c8060755a0c95765 Mon Sep 17 00:00:00 2001
From: quanzhou <quan.zhou@broconcentric.com>
Date: 星期二, 21 十月 2025 19:06:36 +0800
Subject: [PATCH] 打印机条码格式修改,增添一个点检功能方法

---
 src/Bro.M141.Process/M141Process.cs |   48 ++++++++++++++++++++++--------------------------
 1 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/src/Bro.M141.Process/M141Process.cs b/src/Bro.M141.Process/M141Process.cs
index 9067fd5..fdec168 100644
--- a/src/Bro.M141.Process/M141Process.cs
+++ b/src/Bro.M141.Process/M141Process.cs
@@ -103,6 +103,7 @@
         public PLCBase Plc1;
         bool devicestate = false;
         PLCBase Plc2;
+        public PLCBase Plc3;
         public Thread ThHeartPlc;
 
         public RabbitMQHelper mqtt;
@@ -145,8 +146,12 @@
                 mqtt = new RabbitMQHelper(M141Config.zIP, M141Config.zport, M141Config.zuser, M141Config.zpassword);
                 mqtt.Connect(M141Config.MESchannel);
             }
+            else
+            {
+                LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"宸插叧闂笂浼爉es");
+            }
 
-            InitialContinuousNGAlarm();
+                InitialContinuousNGAlarm();
         }
 
 
@@ -318,7 +323,7 @@
 
                                             AlarmTypeList.Add(item2.alarmtype);
 
-                                            LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"鎶ヨ绫诲埆{item2.alarmtype}鍔犲叆闃熷垪,闃熷垪涓暟涓簕AlarmTypeList.Count}");
+                                       
                                         }
                                     }
                                 }
@@ -334,8 +339,7 @@
                                     {
 
                                         StateDIC[StateDICKey] = new List<int>();
-
-                                        LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"鎶ヨ绫诲埆{StateDICKey}鍔犲叆瀛楀吀锛歋tateDIC");
+                                       
 
                                     }
 
@@ -358,7 +362,7 @@
                                             CSVdata = csvdata,
                                         };
                                         AlarmType.Add(item.alarmtype, alarmData);
-                                        LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"鎶ヨ{item.alarmname}绫诲埆{key}浣滀负key鍔犲叆AlarmType瀛楀吀");
+
                                     }
 
                                     alarmData.CSVhead += $",{item.alarmname}";
@@ -638,6 +642,9 @@
 
                         if (measureBind.WorkPosition == "P1" && M141Config.StationCode == "S5" && detectResults.GetDefectDescList().Count == 0)
                         {
+                            var defecttem1 = detectResults.SelectMany(u => u.AllNetResults).SelectMany(m => m.DetectDetails).Select(detail => detail.ClassName).ToList();
+                            LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN}  S3S5妫�娴� 缂洪櫡鍚嶇О闆嗗悎涓簕string.Join(",", defecttem1)}");
+
                             var defecttem = detectResults.SelectMany(u => u.AllNetResults.SelectMany(m => m.DetectDetails)).Where(u => u.ClassName == M141Config.defectname).ToList();
 
                             List<Netdefectdetail> Netdefectdetails = mysqlhelper.GetNetdefectdetails(products[0].SEQUENCE);
@@ -889,7 +896,6 @@
             });
         }
 
-
         public async Task RunImageCheckAsync(List<ProductModel> products, string triggerText, string triggerSource, MeasureBind measureBind)
         {
             await Task.Run(() =>
@@ -968,7 +974,6 @@
             });
         }
 
-
         private void RunCustomizedMethod(List<ProductModel> products, string triggerText, string triggerSource, IImageSet imgSet, string methodId, List<DetectResult> resultList)
         {
             try
@@ -1015,10 +1020,6 @@
                 LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"鑷畾涔夋娴嬭繃绋嬪紓甯革紝{ex.GetExceptionMessage()}");
             }
         }
-
-
-
-
 
         #region plc
         public ResponseMessage RunImageCheck_plc(IOperationConfig config)
@@ -1097,7 +1098,6 @@
 
             CheckPositionDoneAsync_plc(measureBinds[0].WorkPosition, inputSequence, config, cameraIds);
 
-
             return msg;
 
         }
@@ -1148,8 +1148,6 @@
                     LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"鐩告満{camera.Name}妫�娴嬪墠娓呯悊缂撳瓨瀹屾垚");
                 }
             });
-
-
 
             inputSequence = triggerDatas[triggerDatas.Length - 1];
 
@@ -1241,7 +1239,6 @@
             {
                 try
                 {
-
                     string index = config.TriggerStr.Split(',')[1];
                     var positionSet = M141Config.WorkPositionCollection.FirstOrDefault(u => u.PositionName == positionName);
 
@@ -1615,7 +1612,10 @@
                             }
 
                         }
-
+                        else
+                        {
+                            LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"宸插叧闂璵es杩炴帴鎴栬�呮暟鎹笂浼犳帴鍙�");
+                        }
                     }
 
                     //ReplyPlcData(positionName, config.TriggerValue);
@@ -1890,10 +1890,6 @@
         }
 
 
-
-
-
-
         #region  鎵撳嵃鏈虹浉鍏�
         PrintDocument printDocument1 = new PrintDocument();
         string Printmessage = "";
@@ -1902,8 +1898,8 @@
         {
             try
             {
-                int ttwith = 320;
-                int ttheigh = 160;
+                int ttwith = 240;
+                int ttheigh = 80;
                 Printmessage = str;
 
                 this.printDocument1.DefaultPageSettings.PrinterSettings.PrinterName = "Honeywell PX240S (300 dpi)";
@@ -1936,14 +1932,14 @@
                 {
                     DisableECI = true,//璁剧疆鍐呭缂栫爜
                     CharacterSet = "UTF-8",  //璁剧疆浜岀淮鐮佺殑瀹藉害鍜岄珮搴�
-                    Width = 123,
-                    Height = 123,
+                    Width = 60,
+                    Height = 60,
                     Margin = 1//璁剧疆浜岀淮鐮佺殑杈硅窛,鍗曚綅涓嶆槸鍥哄畾鍍忕礌
                 };
 
                 writer.Options = options;
                 Bitmap map = writer.Write(Printmessage);
-                e.Graphics.DrawImage(map, new System.Drawing.Point(90, 10));
+                e.Graphics.DrawImage(map, new System.Drawing.Point(90, 4));
 
                 // 鍦ㄤ簩缁寸爜涓嬫柟鐢诲唴瀹规枃瀛�
                 using (Font font = new Font("Arial", 10))
@@ -1952,7 +1948,7 @@
                     // 璁╂枃瀛楀眳涓埌浜岀淮鐮佷笅鏂�
                     SizeF textSize = e.Graphics.MeasureString(Printmessage, font);
                     float textX = 90 + (map.Width - textSize.Width) / 2;
-                    float textY = 10 + map.Height;
+                    float textY = 1 + map.Height;
 
                     e.Graphics.DrawString(Printmessage, font, brush3, textX, textY);
                 }

--
Gitblit v1.8.0