From 305e2990bb2161177e87ab7711f9dfb205762bcd Mon Sep 17 00:00:00 2001
From: kingno <30263@KINGNO>
Date: 星期一, 09 六月 2025 15:52:42 +0800
Subject: [PATCH] 优化数据传递

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

diff --git a/src/Bro.M141.Process/M141Process_ImageCheck.cs b/src/Bro.M141.Process/M141Process_ImageCheck.cs
index 222cddc..3836a93 100644
--- a/src/Bro.M141.Process/M141Process_ImageCheck.cs
+++ b/src/Bro.M141.Process/M141Process_ImageCheck.cs
@@ -516,9 +516,9 @@
         }
 
 
-        public void PlcwritePrinter(int add,int value)
+        public void PlcwritePrinter(int add, int value)
         {
-            Plc2.WriteSingleAddress(add,value,out _);
+            Plc2.WriteSingleAddress(add, value, out _);
         }
 
 
@@ -583,8 +583,6 @@
                         }
                     }
 
-
-
                     LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"浜у搧{pid}妫�娴嬮」{s.Code}璧嬪�納s.GetMeasureValueStr()}锛岀粨鏋渰s.GetMeasureResultStr()}");
                 }
                 else
@@ -607,6 +605,15 @@
         {
             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());
@@ -622,6 +629,8 @@
             {
                 defects.Add("TBD");
             }
+
+
             defects = defects.Distinct().ToList();
 
             isOK = defects.Count <= 0;
@@ -631,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