From a383b2288dcfb90e9aa1dcf796e41d9c6be1e429 Mon Sep 17 00:00:00 2001
From: patrick.xu <patrick.xu@broconcentric.com>
Date: 星期一, 02 八月 2021 17:26:56 +0800
Subject: [PATCH] 1. 部分修改

---
 src/Bro.M071.Process/M071Process.cs                    |   42 +++++++++++++++++++++
 src/Bro.M071.Process/M071Config.cs                     |   29 ++++++++++++++
 src/Bro.M071.Process/M071Process_MES.cs                |   10 ++++-
 src/Bro.M071.Process/UI/M071_PatchInsertMeasurement.cs |    4 +-
 src/Bro.M071.Process/Properties/AssemblyInfo.cs        |    4 +-
 5 files changed, 83 insertions(+), 6 deletions(-)

diff --git a/src/Bro.M071.Process/M071Config.cs b/src/Bro.M071.Process/M071Config.cs
index 34346d5..86eab87 100644
--- a/src/Bro.M071.Process/M071Config.cs
+++ b/src/Bro.M071.Process/M071Config.cs
@@ -214,6 +214,35 @@
         public int RepeatTimes { get; set; } = 1;
     }
 
+    [Device("KeyUnitGenerate", "鍗曢敭鐢熸垚閰嶇疆", EnumHelper.DeviceAttributeType.OperationConfig)]
+    public class KeyUnitGenerateConfig : OperationConfigBase
+    {
+        [Category("閿悕閰嶇疆")]
+        [Description("寮�濮嬮敭")]
+        [TypeConverter(typeof(KeyNameDictConverter))]
+        public string StartKey { get; set; }
+
+        [Category("閿悕閰嶇疆")]
+        [Description("缁撴潫閿�")]
+        [TypeConverter(typeof(KeyNameDictConverter))]
+        public string EndKey { get; set; }
+
+        [Category("鍥惧儚鏉ユ簮")]
+        [Description("鎷嶇収鐐逛綅")]
+        [TypeConverter(typeof(SnapshotPointConverter))]
+        public string SnapshotPointId { get; set; }
+
+        [Category("绠楁硶閰嶇疆")]
+        [Description("鍗曢敭妫�娴嬮厤缃畻娉曠被鍨�")]
+        [TypeConverter(typeof(KeyAlgorithemConverter))]
+        public string KeyAlgorithemId { get; set; }
+
+        [Category("绠楁硶閰嶇疆")]
+        [Description("鍗曢敭妫�娴嬮厤缃粨鏋滅被鍨�")]
+        [TypeConverter(typeof(KeyResultConverter))]
+        public string KeyResultId { get; set; }
+    }
+
     public class OperationCombination : IComplexDisplay, IHalconToolPath
     {
         [Category("杩愬姩鏈烘瀯閰嶇疆")]
diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs
index a281648..84bb887 100644
--- a/src/Bro.M071.Process/M071Process.cs
+++ b/src/Bro.M071.Process/M071Process.cs
@@ -531,6 +531,48 @@
 
             return new ProcessResponse();
         }
+
+        [ProcessMethod("KeyUnitGenerate", "GenerateKeyUnitByKeyNames", "鐢熸垚鍗曢敭閰嶇疆", InvokeType.TestInvoke)]
+        public ProcessResponse GenerateKeyUnitByKeyNames(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            if (opConfig is KeyUnitGenerateConfig config)
+            {
+                int i = 1;
+                bool isStart = false;
+                bool isEnd = false;
+                foreach (string k in Config.KeyNameCollection)
+                {
+                    if (k == config.StartKey)
+                    {
+                        isStart = true;
+                    }
+                    else if (k == config.EndKey)
+                    {
+                        isEnd = true;
+                    }
+
+                    if (isStart)
+                    {
+                        KeyUnit unit = new KeyUnit();
+                        unit.Key = unit.AliasName = k;
+                        unit.SnapshotPointId = config.SnapshotPointId;
+                        unit.KeyAlgorithemId = config.KeyAlgorithemId;
+                        unit.KeyResultId = config.KeyResultId;
+                        unit.ImageSeq = i;
+
+                        Config.KeyUnitCollection.Add(unit);
+                        i++;
+                    }
+
+                    if (isEnd)
+                    {
+                        break;
+                    }
+                }
+            }
+
+            return new ProcessResponse(true);
+        }
         #endregion
 
         #region 绉佹湁鏂规硶
diff --git a/src/Bro.M071.Process/M071Process_MES.cs b/src/Bro.M071.Process/M071Process_MES.cs
index 28e399e..6c09537 100644
--- a/src/Bro.M071.Process/M071Process_MES.cs
+++ b/src/Bro.M071.Process/M071Process_MES.cs
@@ -9,6 +9,7 @@
 using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Windows.Forms;
 
 namespace Bro.M071.Process
 {
@@ -229,7 +230,7 @@
                 LogAsync(DateTime.Now, $"{pMeasure.Barcode}浜у搧妫�娴嬫暟鎹笂浼�", JsonConvert.SerializeObject(paras));
             }
 
-            string result = "-3";
+            string result = "-1";
 
             int repeatTime = 3;
             do
@@ -245,7 +246,7 @@
                     repeatTime--;
 
                     Thread.Sleep(100); 
-                    result = "-3";
+                    result = "-1";
                 }
             } while (repeatTime > 0);
 
@@ -254,6 +255,11 @@
             LogAsync(DateTime.Now, $"{barcode}浜у搧妫�娴嬫暟鎹笂浼狅紝{result}|{mesReturn.ToString()}", $"鑰楁椂锛歿sw.ElapsedMilliseconds}ms");
 
             OnCheckHintUpload?.Invoke("妫�娴嬫暟鎹�" + mesReturn.ToString(), mesReturn != MESUploadReturn.涓婁紶鎴愬姛);
+
+            if (mesReturn != MESUploadReturn.涓婁紶鎴愬姛)
+            {
+                MessageBox.Show($"{barcode}浜у搧鏁版嵁涓婁紶澶辫触,{mesReturn.ToString()}\r\n璇锋鏌ョ綉缁滆繛鎺ユ垨纭闂鍚庨噸鏂版娴�", "涓婁紶寮傚父", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+            }
         }
 
         private string GetMESAlignmentData(ProductionMeasurement pMeasure)
diff --git a/src/Bro.M071.Process/Properties/AssemblyInfo.cs b/src/Bro.M071.Process/Properties/AssemblyInfo.cs
index b702623..61bc53c 100644
--- a/src/Bro.M071.Process/Properties/AssemblyInfo.cs
+++ b/src/Bro.M071.Process/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
 //鍙互鎸囧畾鎵�鏈夎繖浜涘�硷紝涔熷彲浠ヤ娇鐢ㄢ�滅敓鎴愬彿鈥濆拰鈥滀慨璁㈠彿鈥濈殑榛樿鍊�
 //閫氳繃浣跨敤 "*"锛屽涓嬫墍绀�:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.6.0")]
-[assembly: AssemblyFileVersion("1.0.6.0")]
+[assembly: AssemblyVersion("1.0.7.0")]
+[assembly: AssemblyFileVersion("1.0.7.0")]
diff --git a/src/Bro.M071.Process/UI/M071_PatchInsertMeasurement.cs b/src/Bro.M071.Process/UI/M071_PatchInsertMeasurement.cs
index 5addf5d..d0ad68a 100644
--- a/src/Bro.M071.Process/UI/M071_PatchInsertMeasurement.cs
+++ b/src/Bro.M071.Process/UI/M071_PatchInsertMeasurement.cs
@@ -165,8 +165,8 @@
                              Config.MeasurementUnitCollection.Add(mUnitDown);
                          }
                          break;
-                     case "Blind":
-                     case "Blind1":
+                     case "BlindExist":
+                     case "BlindNotExist":
                          {
                              for (int i = startIndex; i <= endIndex; i++)
                              {

--
Gitblit v1.8.0