From 3322022068ab818912d6f5d9e5eb31f51cc639c2 Mon Sep 17 00:00:00 2001
From: patrick.xu <patrick.xu@broconcentric.com>
Date: 星期四, 24 二月 2022 09:12:30 +0800
Subject: [PATCH] 添加配置文件的DataShift2

---
 src/Bro.M071.Process/M071Process.cs             |   42 +++++++++++++++++++++++++++++++++++++++++-
 src/Bro.M071.Process/Properties/AssemblyInfo.cs |    4 ++--
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs
index 8d8c7b7..18f263e 100644
--- a/src/Bro.M071.Process/M071Process.cs
+++ b/src/Bro.M071.Process/M071Process.cs
@@ -54,6 +54,8 @@
         string _precision = "f3";
         double _allowedShift = 0;
 
+        double _allowedShift2 = 0;
+
         public override void Open()
         {
             InitialSetting();
@@ -84,11 +86,39 @@
                 DataUploadMethod = InitialMESWebServiceMethod(DataUploadMethodName, out DataUploadObj);
             }
 
+            PrepareDataShift();
+        }
+
+        private void PrepareDataShift()
+        {
             var allowedShiftStr = ConfigurationManager.AppSettings["DataShift"];
             if (!double.TryParse(allowedShiftStr, out _allowedShift))
             {
                 _allowedShift = 0;
             }
+
+            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "dataShift");
+            if (!File.Exists(path))
+            {
+                _allowedShift2 = 0;
+            }
+            else
+            {
+                using (StreamReader reader = new StreamReader(path, System.Text.Encoding.UTF8))
+                {
+                    string data = reader.ReadToEnd();
+
+                    if (!string.IsNullOrWhiteSpace(data))
+                    {
+                        if (double.TryParse(data, out double dataValue))
+                        {
+                            _allowedShift2 = dataValue;
+                        }
+                    }
+                }
+            }
+
+            _allowedShift += _allowedShift2;
         }
 
         private void InitialMotionCardBaseAxisAlarm()
@@ -571,6 +601,16 @@
                 }
             }
 
+            return new ProcessResponse(true);
+        }
+
+        [ProcessMethod("", "SortKeyUnits", "鍗曢敭閰嶇疆鎺掑簭", InvokeType.TestInvoke)]
+        public ProcessResponse SortKeyUnits(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            if (Config.KeyUnitCollection.Count > 0)
+            {
+                Config.KeyUnitCollection = Config.KeyUnitCollection.OrderBy(u => u.SnapshotPointId).ThenBy(u => u.ImageSeq).ToList();
+            }
             return new ProcessResponse(true);
         }
         #endregion
@@ -1473,7 +1513,7 @@
                                 }
                                 else
                                 {
-                                    var results = _halconToolDict[keyToolKey].GetResultTuple("OUTPUT_Results").DArr.ToList();
+                                    var results = _halconToolDict[keyToolKey].GetResultTuple("OUTPUT_Results").HTupleToDouble();
                                     if (results.Count == 0 || results.Any(u => u < 0))
                                     {
                                         LogAsync(DateTime.Now, $"{k.AliasName}鍘熷鏁版嵁{string.Join(",", results)}寮傚父", "");
diff --git a/src/Bro.M071.Process/Properties/AssemblyInfo.cs b/src/Bro.M071.Process/Properties/AssemblyInfo.cs
index 61bc53c..195e549 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.7.0")]
-[assembly: AssemblyFileVersion("1.0.7.0")]
+[assembly: AssemblyVersion("1.0.7.1")]
+[assembly: AssemblyFileVersion("1.0.7.1")]

--
Gitblit v1.8.0