From 3cba54c4ee8d29d33ed21a2c749a9d2f2d03e22d Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期五, 03 七月 2020 18:33:30 +0800
Subject: [PATCH] 板卡IO定义修改。板卡预定义操作功能实现

---
 src/Bro.M071.Process/M071Process.cs |   64 ++++++++-----------------------
 1 files changed, 17 insertions(+), 47 deletions(-)

diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs
index 61f3aee..b5235b2 100644
--- a/src/Bro.M071.Process/M071Process.cs
+++ b/src/Bro.M071.Process/M071Process.cs
@@ -42,6 +42,16 @@
             InitialSetting();
 
             base.Open();
+
+            CheckMachineState();
+        }
+
+        /// <summary>
+        /// 妫�鏌ヨ澶囩姸鎬�
+        /// </summary>
+        private void CheckMachineState()
+        {
+            throw new NotImplementedException();
         }
 
         private void InitialSetting()
@@ -100,7 +110,7 @@
                     if (keyRespone.Count == 0)
                         throw new ProcessException($"{u.GetDisplayText()}瀵瑰簲鐨勫崟閿笉瀛樺湪鎴栦笉鍙敤");
 
-                    if (b.KeyResult == "All")
+                    if (b.KeyResultId == "All")
                     {
                         keyRespone.SelectMany(kr => kr.KeyResultList).ToList().ForEach(r =>
                           {
@@ -109,7 +119,7 @@
                     }
                     else
                     {
-                        b.MeasureValueDict[b.KeyResult] = null;
+                        b.MeasureValueDict[b.KeyResultId] = null;
                     }
                 });
             });
@@ -164,12 +174,6 @@
                 throw new ProcessException("鏈緭鍏ヤ骇鍝佹潯鐮侊紝璇峰嬁寮�濮嬫祴閲�");
             }
 
-            //妫�鏌ヤ骇鍝佹斁缃甇K
-
-            //姘旂几鎺ㄥ姩鍘嬫澘绉诲姩鍒颁骇鍝佷笂鏂�
-
-            //鍘嬫澘鍘嬬揣浜у搧
-
             OnMeasureStart?.BeginInvoke(null, null);
 
             var measurements = Config.MeasurementUnitCollection.Where(u => u.IsEnabled).ToList().DeepSerializeClone();
@@ -201,18 +205,19 @@
                   {
                       _pauseHandle.WaitHandle.WaitOne();
 
-                      IDevice device = DeviceCollection.FirstOrDefault(u => u.Id == s.MotionDevice);
+                      IDevice device = DeviceCollection.FirstOrDefault(u => u.Id == s.MotionOp.Device);
                       if (device == null)
                           throw new ProcessException($"{s.Name}鎷嶇収鐐逛綅鏈缃繍鍔ㄨ澶�");
 
-                      IMotion motionDevice = device as IMotion;
+                      IMotionCard motionDevice = device as IMotionCard;
 
                       if (motionDevice == null)
                           throw new ProcessException($"{s.Name}鎷嶇収鐐逛綅璁剧疆{device.Name}涓嶆槸杩愬姩璁惧");
 
-                      if (!motionDevice.MoveToPoint(null))
+                      var response = motionDevice.Run(s.MotionOp.OpConfig);
+                      if (!response.Result)
                       {
-                          throw new ProcessException("杩愬姩涓", null, ExceptionLevel.Info);
+                          throw new ProcessException($"{device.Name}寮傚父锛寋response.Message}", null, ExceptionLevel.Info);
                       }
 
                       CameraBase camera = DeviceCollection.FirstOrDefault(u => u.Id == s.CameraOp.Device) as CameraBase;
@@ -230,42 +235,7 @@
 
             BarCode = "";
 
-
-
             return new ProcessResponse(true);
-        }
-
-        /// <summary>
-        /// 鏆傚仠鏍囧織  
-        /// WaitHandle 鏆傚仠鍙ユ焺  榛樿涓洪潪闃诲 鍙墽琛�
-        /// WaitResult 鏆傚仠鏍囧織 true 姝e父鎵ц  false 鏆傚仠涓�
-        /// </summary>
-        ManualWaitConfirm _pauseHandle = new ManualWaitConfirm()
-        {
-            WaitHandle = new ManualResetEvent(true),
-            WaitResult = true,
-        };
-
-        [ProcessMethod("", "PauseJob", "鏆傚仠娴佺▼", InvokeType.TestInvoke)]
-        public ProcessResponse PauseJob(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
-        {
-            if (_pauseHandle.WaitResult)
-            {
-                #region 鏉垮崱鏆傚仠鍔ㄤ綔
-                #endregion
-
-                _pauseHandle.WaitHandle.Reset();
-            }
-            else
-            {
-                #region 鏉垮崱鎭㈠鍔ㄤ綔
-                #endregion
-
-                _pauseHandle.WaitHandle.Set();
-            }
-
-            _pauseHandle.WaitResult = !_pauseHandle.WaitResult;
-            return new ProcessResponse(_pauseHandle.WaitResult);
         }
 
         #region 绉佹湁鏂规硶

--
Gitblit v1.8.0