From 7f699a115d555d68c6b9fb658ee7db1a3e47c841 Mon Sep 17 00:00:00 2001
From: kingno <30263@KINGNO>
Date: 星期二, 17 六月 2025 13:04:32 +0800
Subject: [PATCH] Revert "双击圆点出图"

---
 src/Bro.M141.Process/M141Process_ImageCheck.cs |   46 +++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/src/Bro.M141.Process/M141Process_ImageCheck.cs b/src/Bro.M141.Process/M141Process_ImageCheck.cs
index e76e5cf..3836a93 100644
--- a/src/Bro.M141.Process/M141Process_ImageCheck.cs
+++ b/src/Bro.M141.Process/M141Process_ImageCheck.cs
@@ -3,10 +3,12 @@
 using Bro.Common.Interface;
 using Bro.Common.Model;
 using Bro.M135.Common;
+using Bro.M135.DBManager;
 using HalconDotNet;
 using Microsoft.VisualBasic;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
+using NPOI.Util;
 using Sunny.UI;
 using System.Data;
 using System.Data.SqlTypes;
@@ -28,6 +30,9 @@
         Dictionary<string, List<double>> dicdate = new Dictionary<string, List<double>>();
         ManualResetEvent set1 = new ManualResetEvent(false);
         ManualResetEvent set2 = new ManualResetEvent(false);
+
+
+        public event Action<string> StartPrinter;
 
         [ProcessMethod("ImageCheck", "ImageCheckOperation", "閫氱敤鍥剧墖妫�娴嬫搷浣�", InvokeType.TestInvoke)]
         public ResponseMessage ImageCheckOperation(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
@@ -499,6 +504,27 @@
 
 
 
+        [ProcessMethod("printer", "printer", "鎵撳嵃鏈烘墦鍗�", InvokeType.TestInvoke)]
+        public ResponseMessage Printer(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            ResponseMessage msg = new ResponseMessage();
+
+            Plc2 = invokeDevice as PLCBase;
+            string message = "";
+            StartPrinter.Invoke(message);
+            return msg;
+        }
+
+
+        public void PlcwritePrinter(int add, int value)
+        {
+            Plc2.WriteSingleAddress(add, value, out _);
+        }
+
+
+
+
+
 
         protected List<ISpec> GetSpecListFromConfigSelection(List<SpecSelector> specSelectors)
         {
@@ -508,9 +534,10 @@
                 var spec = M141Config.SpecCollection.FirstOrDefault(s => s.Code == u.SpecCode);
                 if (spec != null)
                 {
-                    var temp = spec.Copy<Spec>();
+                    var temp = spec.Copy();
                     temp.ActualValue = null;
                     temp.MeasureResult = null;
+                    temp.Source = "";
                     specList.Add(temp);
                 }
             });
@@ -556,8 +583,6 @@
                         }
                     }
 
-
-
                     LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"浜у搧{pid}妫�娴嬮」{s.Code}璧嬪�納s.GetMeasureValueStr()}锛岀粨鏋渰s.GetMeasureResultStr()}");
                 }
                 else
@@ -580,12 +605,21 @@
         {
             isOK = false;
 
+            int num = 0;
+
+            while (p.Details.Any(u => !u.IsDone) && num < 10)
+            {
+                num++;
+                Thread.Sleep(500);
+            }
+
+
             p.InitialDetailSpecs();
             var resultList = p.Details.SelectMany(u => u.ResultList).ToList();
             resultList.ForEach(u => u.SetResult());
             var defects = resultList.GetDefectDescList();
 
-            var ngSpecCodes = p.Details.SelectMany(u => u.SpecList ?? new List<Spec>()).Where(u => u.MeasureResult != true).Select(u => u.Code);
+            var ngSpecCodes = p.Details.SelectMany(u => u.SpecList ?? new List<ISpec>()).Where(u => u.MeasureResult != true).Select(u => u.Code);
             var ngDefectDescList = p.Details.SelectMany(u => u.DefectList ?? new List<string>()).ToList();
 
             defects.AddRange(ngSpecCodes);
@@ -595,6 +629,8 @@
             {
                 defects.Add("TBD");
             }
+
+
             defects = defects.Distinct().ToList();
 
             isOK = defects.Count <= 0;
@@ -604,7 +640,7 @@
             UpdateResult(DateTime.Now, p.SN, defectClass.ClassName, "");
 
             //浜у搧搴忓彿+1
-            Interlocked.Increment(ref _productIndex);
+            //Interlocked.Increment(ref _productIndex);
 
             List<ISpec> specList = new List<ISpec>();
             specList.AddRange(p.Details.SelectMany(u => u.SpecList).ToList().ConvertAll(u => (ISpec)u));

--
Gitblit v1.8.0