From 78584911d0457ad9fc26d9dfc6f374b7ef531c0f Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期日, 22 十一月 2020 13:45:09 +0800
Subject: [PATCH] 1. 添加操作员输入和界面显示 2. 添加通过输入窗体 3. 添加webservice调用帮助类 4. M071添加MES数据检查和数据上传功能,添加相关界面显示和流程控制

---
 src/Bro.M071.Process/M071Models.cs |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/src/Bro.M071.Process/M071Models.cs b/src/Bro.M071.Process/M071Models.cs
index a56f47c..44fa305 100644
--- a/src/Bro.M071.Process/M071Models.cs
+++ b/src/Bro.M071.Process/M071Models.cs
@@ -257,7 +257,7 @@
         {
             Measurements?.ForEach(m => m?.Dispose());
             Measurements = null;
-
+            ElementList = null;
             Barcode = null;
             GC.Collect();
         }
@@ -342,6 +342,44 @@
         {
             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("KeyUnitCollection"));
         }
+
+        public MeasurementUnit Copy()
+        {
+            MeasurementUnit mUnit = new MeasurementUnit();
+
+            mUnit.Id = this.Id;
+            mUnit.Name = this.Name;
+            if (string.IsNullOrWhiteSpace(mUnit.Name))
+            {
+                mUnit.Name = string.Join("-", KeyUnitCollection.Select(u => u.GetDisplayText()));
+            }
+
+            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
@@ -391,10 +429,9 @@
 
         public void Dispose()
         {
-            SpinWait wait = new SpinWait();
             while (ImageSaveStatus != 0)
             {
-                wait.SpinOnce();
+                Thread.Sleep(10);
             }
 
             KeyImages?.ForEach(i =>
@@ -437,6 +474,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