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 |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs
index b3c0725..84bb887 100644
--- a/src/Bro.M071.Process/M071Process.cs
+++ b/src/Bro.M071.Process/M071Process.cs
@@ -274,7 +274,7 @@
                 _isdoing = true;
             }
 
-            MachineState = MachineState.Running;
+            MeasureState = MachineState = MachineState.Running;
 
             OnCheckHintUpload?.Invoke(hint, true);
             OnMeasureStart?.Invoke();
@@ -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 绉佹湁鏂规硶
@@ -654,6 +696,7 @@
                 //if (MachineState == MachineState.Running)
                 //    MachineState = MachineState.Ready;
 
+                MeasureState = MachineState.Ready;
                 if (MachineState != MachineState.Alarm)
                 {
                     if (MachineState == MachineState.Pause)
@@ -1450,8 +1493,8 @@
                                     kb.FillKeyValues(resultDict);
                                 }
                                 else
-                                { 
-                                
+                                {
+
                                 }
                             });
                         });

--
Gitblit v1.8.0