From fccc60d8897642ef5c39176b8c872b63fe819ae2 Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期五, 20 十一月 2020 10:44:57 +0800
Subject: [PATCH] gocator添加int4类型数据,暂时注释

---
 src/Bro.M071.Process/M071Models.cs |  112 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 101 insertions(+), 11 deletions(-)

diff --git a/src/Bro.M071.Process/M071Models.cs b/src/Bro.M071.Process/M071Models.cs
index 8c15fde..2e9b2db 100644
--- a/src/Bro.M071.Process/M071Models.cs
+++ b/src/Bro.M071.Process/M071Models.cs
@@ -17,6 +17,28 @@
 
 namespace Bro.M071.Process
 {
+    public class KeyLocation : IComplexDisplay
+    {
+        [Category("閿悕閰嶇疆")]
+        [Description("鍗曢敭閿悕")]
+        [TypeConverter(typeof(KeyNameDictConverter))]
+        public string Key { get; set; }
+
+        [Category("浣嶇疆閰嶇疆")]
+        [Description("鍗曢敭鍦ㄩ敭鐩樺钩闈㈠浘涓婄殑浣嶇疆鏄剧ず")]
+        public Rectangle KeyRect { get; set; } = new Rectangle();
+
+        [Category("浣嶇疆閰嶇疆")]
+        [Description("鍗曢敭涔嬪悗闂撮殭浣嶇疆")]
+        public Rectangle IntervalRect { get; set; } = new Rectangle();
+
+        public string GetDisplayText()
+        {
+            return $"{Key}:{KeyRect.X},{KeyRect.Y},{KeyRect.Width},{KeyRect.Height}";
+        }
+    }
+
+
     public class KeyAlgorithem : IComplexDisplay
     {
         [Browsable(false)]
@@ -137,13 +159,13 @@
             get => key;
             set
             {
-                AlignName = key = value;
+                AliasName = key = value;
             }
         }
 
         [Category("閿悕閰嶇疆")]
         [Description("鍒悕")]
-        public string AlignName { get; set; }
+        public string AliasName { get; set; }
 
         [Category("鍚敤璁剧疆")]
         [Description("true锛氬惎鐢� false锛氱鐢�")]
@@ -178,7 +200,22 @@
 
         public string GetDisplayText()
         {
-            return $"{AlignName}";
+            string snapShot = "鏈寚瀹�";
+
+            using (var scope = GlobalVar.Container.BeginLifetimeScope())
+            {
+                var config = scope.Resolve<IProcessConfig>();
+                if (config != null)
+                {
+                    var snapshotPoint = (config as M071Config).SnapshotPointCollection.FirstOrDefault(u => u.Id == SnapshotPointId);
+                    if (snapshotPoint != null)
+                    {
+                        snapShot = snapshotPoint.Name;
+                    }
+                }
+            }
+
+            return $"{AliasName}-{snapShot}-{ImageSeq}";
         }
 
         public List<string> GetHalconToolPathList()
@@ -204,10 +241,15 @@
     public class ProductionMeasurement : INotifyPropertyChanged, IDisposable
     {
         public string Barcode;
+        public string PResult;
 
-        public List<MeasurementUint> Measurements = new List<MeasurementUint>();
+        public List<MeasurementUnit> Measurements = new List<MeasurementUnit>();
 
         public List<IShapeElement> ElementList = new List<IShapeElement>();
+
+        public DateTime? StartTime = null;
+
+        public DateTime? EndTime = null;
 
         public event PropertyChangedEventHandler PropertyChanged;
 
@@ -215,7 +257,7 @@
         {
             Measurements?.ForEach(m => m?.Dispose());
             Measurements = null;
-
+            ElementList = null;
             Barcode = null;
             GC.Collect();
         }
@@ -235,7 +277,7 @@
         }
     }
 
-    public class MeasurementUint : IComplexDisplay, INotifyPropertyChanged, IDisposable
+    public class MeasurementUnit : IComplexDisplay, INotifyPropertyChanged, IDisposable
     {
         public string Id = Guid.NewGuid().ToString();
 
@@ -262,7 +304,7 @@
 
         #region 鏄剧ず
         [Browsable(false)]
-        public Rectangle DisplayLocation { get; set; } = new Rectangle();
+        public Rectangle DisplayLocation { get; set; } = new Rectangle(10, 10, 100, 100);
         #endregion
 
         #region 妫�娴嬬粨鏋�
@@ -300,6 +342,39 @@
         {
             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("KeyUnitCollection"));
         }
+
+        public MeasurementUnit Copy()
+        {
+            MeasurementUnit mUnit = new MeasurementUnit();
+
+            mUnit.Id = this.Id;
+            mUnit.Name = this.Name;
+            mUnit.IsEnabled = this.IsEnabled;
+            mUnit.MeasureType = this.MeasureType;
+
+            mUnit.DisplayLocation = new Rectangle(this.DisplayLocation.Location, this.DisplayLocation.Size);
+
+            if (this.Spec == null)
+            {
+                mUnit.Spec = null;
+            }
+            else
+            {
+                mUnit.Spec = new MeasureType();
+                mUnit.Spec.Code = this.Spec.Code;
+                mUnit.Spec.AlgorithemPath = this.Spec.AlgorithemPath;
+                mUnit.Spec.StandardValue = this.Spec.StandardValue;
+                mUnit.Spec.Tolrenance_Positive = this.Spec.Tolrenance_Positive;
+                mUnit.Spec.Tolrenance_Negative = this.Spec.Tolrenance_Negative;
+            }
+
+            this.KeyUnitCollection.ForEach(k =>
+            {
+                mUnit.KeyUnitCollection.Add(k.Copy());
+            });
+
+            return mUnit;
+        }
     }
 
     public class KeyUnitBind : IComplexDisplay, INotifyPropertyChanged, IDisposable
@@ -312,7 +387,7 @@
         [Category("鍗曢敭閰嶇疆")]
         [Description("鍗曢敭缁撴灉閰嶇疆")]
         [TypeConverter(typeof(KeyUnitResultConverter))]
-        public string KeyResult { get; set; } = "";
+        public string KeyResultId { get; set; } = "";
 
 
         public List<HImage> KeyImages = new List<HImage>();
@@ -342,17 +417,16 @@
         {
             string msg = Key;
 
-            msg += string.IsNullOrWhiteSpace(KeyResult) ? "" : $"-{KeyResult}";
+            msg += string.IsNullOrWhiteSpace(KeyResultId) ? "" : $"-{KeyResultId}";
 
             return msg;
         }
 
         public void Dispose()
         {
-            SpinWait wait = new SpinWait();
             while (ImageSaveStatus != 0)
             {
-                wait.SpinOnce();
+                Thread.Sleep(10);
             }
 
             KeyImages?.ForEach(i =>
@@ -372,6 +446,8 @@
                 if (valuePairs == null || valuePairs.Count == 0)
                 {
                     IsDone = false;
+                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsDone"));
+                    return;
                 }
 
                 foreach (KeyValuePair<string, double> pair in valuePairs)
@@ -393,6 +469,20 @@
                 }
             }
         }
+
+        public KeyUnitBind Copy()
+        {
+            KeyUnitBind clone = new KeyUnitBind();
+            clone.Key = this.Key;
+            clone.KeyResultId = this.KeyResultId;
+
+            this.MeasureValueDict.Keys.ToList().ForEach(k =>
+            {
+                clone.MeasureValueDict[k] = null;
+            });
+
+            return clone;
+        }
     }
 
     //public class NoticedDictionary<T1, T2> : Dictionary<T1, T2>, INotifyPropertyChanged

--
Gitblit v1.8.0