quanzhou
2025-10-21 745d1ce73a3b27d2a3507843c8060755a0c95765
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;
@@ -322,7 +323,7 @@
                                            AlarmTypeList.Add(item2.alarmtype);
                                            LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"报警类别{item2.alarmtype}加入队列,队列个数为{AlarmTypeList.Count}");
                                        }
                                    }
                                }
@@ -338,8 +339,7 @@
                                    {
                                        StateDIC[StateDICKey] = new List<int>();
                                        LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"报警类别{StateDICKey}加入字典:StateDIC");
                                    }
@@ -362,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}";
@@ -642,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);
@@ -893,7 +896,6 @@
            });
        }
        public async Task RunImageCheckAsync(List<ProductModel> products, string triggerText, string triggerSource, MeasureBind measureBind)
        {
            await Task.Run(() =>
@@ -972,7 +974,6 @@
            });
        }
        private void RunCustomizedMethod(List<ProductModel> products, string triggerText, string triggerSource, IImageSet imgSet, string methodId, List<DetectResult> resultList)
        {
            try
@@ -1019,10 +1020,6 @@
                LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"自定义检测过程异常,{ex.GetExceptionMessage()}");
            }
        }
        #region plc
        public ResponseMessage RunImageCheck_plc(IOperationConfig config)
@@ -1101,7 +1098,6 @@
            CheckPositionDoneAsync_plc(measureBinds[0].WorkPosition, inputSequence, config, cameraIds);
            return msg;
        }
@@ -1152,8 +1148,6 @@
                    LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"相机{camera.Name}检测前清理缓存完成");
                }
            });
            inputSequence = triggerDatas[triggerDatas.Length - 1];
@@ -1245,7 +1239,6 @@
            {
                try
                {
                    string index = config.TriggerStr.Split(',')[1];
                    var positionSet = M141Config.WorkPositionCollection.FirstOrDefault(u => u.PositionName == positionName);
@@ -1897,10 +1890,6 @@
        }
        #region  打印机相关
        PrintDocument printDocument1 = new PrintDocument();
        string Printmessage = "";
@@ -1909,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)";
@@ -1950,7 +1939,7 @@
                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))
@@ -1959,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);
                }