From 642cd31f0d1586a2a5ca6f9a3b3364725f4f1ecd Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期六, 04 七月 2020 13:44:24 +0800
Subject: [PATCH] 暂存

---
 src/Bro.Device.GTSCard/GTSCardDriver.cs                             |   24 +-
 src/Bro.M071.Process/UI/M071_MainForm.cs                            |   63 ++++
 src/Bro.Common.Device/DeviceBase/MotionCardBase.cs                  |   37 ++
 src/Bro.Common.Model/Model/IOItem.cs                                |   15 
 src/Bro.M071.Process/M071Process_MotionCard.cs                      |  217 ++++++++++++++++++
 src/Bro.M071.Process/UI/M071_MainForm.Designer.cs                   |   80 ++++++
 src/Bro.UI.Config/MenuForms/FrmOperation.resx                       |    4 
 src/Bro.UI.Config/MainFrm.cs                                        |   17 
 src/Bro.Common.Model/Helper/EnumHelper.cs                           |   19 +
 /dev/null                                                           |   13 -
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs |   24 +-
 src/Bro.UI.Config/MenuForms/FrmConfig.cs                            |    2 
 src/Bro.M071.Process/M071Process.cs                                 |   56 ----
 src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs                |   39 +++
 src/Bro.M071.Process/UI/M071_ShortcutFrm.cs                         |   22 +
 src/Bro.UI.Config/MainFrm.Designer.cs                               |    1 
 src/Bro.M071.Process/Bro.M071.Process.csproj                        |    8 
 src/Bro.UI.Config/MenuForms/FrmOperation.cs                         |   15 
 src/Bro.M071.Process/M071Config.cs                                  |   21 +
 src/Bro.M071.Process/M071Models.cs                                  |    4 
 20 files changed, 550 insertions(+), 131 deletions(-)

diff --git a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
index ca5ba82..e42e318 100644
--- a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
+++ b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
@@ -12,6 +12,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using static Bro.Common.Helper.EnumHelper;
 
 namespace Bro.Common.Base
 {
@@ -26,12 +27,14 @@
         public abstract void ResetAlarm();
         public abstract ResponseMessage Run(IOperationConfig config);
 
-        public void ExcuteMonitorInvok(DateTime dateTime, string invokeDevice, IDevice device, IMonitorSet monitorSet, AsyncCallback OnMethodInvoked)
+        public virtual void ExcuteMonitorInvoke(DateTime dateTime, string invokeDevice, IDevice device, IMonitorSet monitorSet)
         {
             OnMonitorInvoke?.BeginInvoke(dateTime, invokeDevice, device, monitorSet, OnMethodInvoked, null);
         }
 
-        public void ExcuteMonitorAlarm(DateTime dateTime, IDevice device, IWarningSet warningSet)
+        public abstract void OnMethodInvoked(IAsyncResult ar);
+
+        public virtual void ExcuteMonitorAlarm(DateTime dateTime, IDevice device, IWarningSet warningSet)
         {
             OnMonitorAlarm?.BeginInvoke(dateTime, device, warningSet, null, null);
         }
@@ -43,6 +46,10 @@
                 return InitialConfig as MotionCardInitialConfigBase;
             }
         }
+
+        public List<IOItem> MonitorValues { get; set; } = new List<IOItem>();
+
+        public abstract void WriteOutput(short cardNum, short index, IOValue value);
     }
 
     public class MotionCardInitialConfigBase : InitialConfigBase, IMonitorConfig
@@ -119,14 +126,28 @@
         public List<IMonitorSet> GetAllMonitorSet()
         {
             WarningSetCollection.ForEach(m => m.Source = this.Name);
-
             MonitorSetCollection.ForEach(m => m.SourceDevice = this.Id);
             return MonitorSetCollection;
         }
         #endregion
     }
 
+    [Device("MotionCardBase", "鏉垮崱鎿嶄綔閰嶇疆鍩虹被", EnumHelper.DeviceAttributeType.OperationConfig)]
     public class MotionCardOperationConfigBase : OperationConfigBase, IComplexDisplay
+    {
+        [Category("鏉垮崱鎿嶄綔")]
+        [Description("鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎锛屼緷娆℃墽琛�")]
+        [TypeConverter(typeof(CollectionCountConvert))]
+        [Editor(typeof(ComplexCollectionEditor<MotionCardOperationConfigBase>), typeof(UITypeEditor))]
+        public List<MotionCardOperationSet> OperationCollection { get; set; } = new List<MotionCardOperationSet>();
+
+        public string GetDisplayText()
+        {
+            return string.Join(" ", OperationCollection.Select(u => u.GetDisplayText()));
+        }
+    }
+
+    public class MotionCardOperationSet : IComplexDisplay
     {
         [Category("IO鎿嶄綔閰嶇疆")]
         [DisplayName("IO棰勬鏌ュ畾涔夐泦鍚�")]
@@ -208,6 +229,16 @@
         }
     }
 
+    //[Device("MotionCardOperationConfigCollection", "鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎", EnumHelper.DeviceAttributeType.OperationConfig)]
+    //public class MotionCardOperationConfigCollection : OperationConfigBase
+    //{
+    //    [Category("澶嶄綅鎿嶄綔")]
+    //    [Description("鏉垮崱鎿嶄綔閰嶇疆鍩虹被闆嗗悎锛屼緷娆℃墽琛�")]
+    //    [TypeConverter(typeof(CollectionCountConvert))]
+    //    [Editor(typeof(ComplexCollectionEditor<MotionCardOperationConfigBase>), typeof(UITypeEditor))]
+    //    public List<MotionCardOperationConfigBase> MotionCardOpsCollection { get; set; } = new List<MotionCardOperationConfigBase>();
+    //}
+
     public class IORefrenceItemCollectionEditor : CollectionEditor
     {
         protected override CollectionForm CreateCollectionForm()
diff --git a/src/Bro.Common.Model/Helper/EnumHelper.cs b/src/Bro.Common.Model/Helper/EnumHelper.cs
index 52c5349..703be4a 100644
--- a/src/Bro.Common.Model/Helper/EnumHelper.cs
+++ b/src/Bro.Common.Model/Helper/EnumHelper.cs
@@ -577,6 +577,16 @@
             OUTPUT = 1
         }
 
+        public enum IOValue
+        {
+            [Description("鍏抽棴")]
+            FALSE = 0,
+            [Description("寮�鍚�")]
+            TRUE = 1,
+            [Description("鍙嶈浆")]
+            REVERSE = 2,
+        }
+
         /// <summary>
         /// PubSubCenter浜嬩欢涓績鐨勬秷鎭被鍨�
         /// </summary>
@@ -593,5 +603,14 @@
             //[Description("鏇存柊鏁版嵁")]
             //UpdateData,
         }
+
+        public enum MachineState
+        {
+            Unknown,
+            Ready,
+            Running,
+            Alarm,
+            Pause,
+        }
     }
 }
diff --git a/src/Bro.Common.Model/Model/IOItem.cs b/src/Bro.Common.Model/Model/IOItem.cs
index 147880e..653cdb2 100644
--- a/src/Bro.Common.Model/Model/IOItem.cs
+++ b/src/Bro.Common.Model/Model/IOItem.cs
@@ -22,8 +22,9 @@
         /// IO鐐圭殑鍊�
         /// </summary>
         [Category("IO閰嶇疆")]
-        [Description("IO鏁板��")]
-        public virtual int Value { get; set; }
+        [Description("IO鐘舵��")]
+        [TypeConverter(typeof(EnumDescriptionConverter<IOValue>))]
+        public virtual IOValue Value { get; set; }
 
         /// <summary>
         /// IO鐐规槸in杩樻槸out
@@ -44,7 +45,7 @@
 
         public virtual string GetDisplayText()
         {
-            return $"{IOType.GetEnumDescription()}-{IONum}-{Value}";
+            return $"{IOType.GetEnumDescription()}-{IONum}-{Value.GetEnumDescription()}";
         }
 
         public int GetHashCode(object obj)
@@ -70,7 +71,7 @@
 
         [Browsable(false)]
         [JsonIgnore]
-        public override int Value { get; set; }
+        public override IOValue Value { get; set; }
 
         public override string GetDisplayText()
         {
@@ -86,8 +87,8 @@
         public IODefinition IOItem { get; set; } = new IODefinition();
 
         [Category("IO鎿嶄綔閰嶇疆")]
-        [Description("闇�瑕佹搷浣滅殑IO鐨勬暟鍊�")]
-        public int CheckValue
+        [Description("闇�瑕佹搷浣滅殑IO鐨勭姸鎬�")]
+        public IOValue CheckValue
         {
             get => IOItem.Value;
             set => IOItem.Value = value;
@@ -99,7 +100,7 @@
 
         public string GetDisplayText()
         {
-            return IOItem.IODesc + "-" + CheckValue;
+            return IOItem.IODesc + "-" + CheckValue.GetEnumDescription();
         }
     }
 
diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs
index b8e668e..3368e83 100644
--- a/src/Bro.Device.GTSCard/GTSCardDriver.cs
+++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -756,16 +756,17 @@
         /// </summary>
         /// <param name="index">杈撳嚭鍙�,杩斿洖1-16</param>
         /// <param name="value">false琛ㄧず杈撳嚭锛宼rue琛ㄧず鍏抽棴</param>
-        public void WriteOut(short index, bool value)
+        public override void WriteOutput(short cardNum, short index, IOValue value)
         {
             short outNum = (short)(index % 100 + 1);
-            if (value)
+            if ((int)value <= 1)
             {
-                GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPO, outNum, 0);
+                GTSCardAPI.GT_SetDoBit(cardNum, GTSCardAPI.MC_GPO, outNum, (short)value);
             }
             else
             {
-                GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPO, outNum, 1);
+                var currentValue = (int)MonitorValues.FirstOrDefault(u => u.IONum == outNum && u.IOType == IOType.OUTPUT).Value;
+                GTSCardAPI.GT_SetDoBit(cardNum, GTSCardAPI.MC_GPO, outNum, (short)(currentValue == 1 ? 0 : 1));
             }
         }
 
@@ -791,7 +792,7 @@
 
         #region IMonitor
 
-        public List<IOItem> MonitorValues { get; set; } = new List<IOItem>();
+        //public List<IOItem> MonitorValues { get; set; } = new List<IOItem>();
 
 
         public List<IOItem> GetMonitorValues()
@@ -810,13 +811,13 @@
                 IOItem inItem = new IOItem()
                 {
                     IONum = index,
-                    Value = (inValue & (1 << index)) == 0 ? 1 : 0,
+                    Value = (inValue & (1 << index)) == 0 ? IOValue.TRUE : IOValue.FALSE,
                     IOType = IOType.INPUT
                 };
                 IOItem outItem = new IOItem()
                 {
                     IONum = index,
-                    Value = (outValue & (1 << index)) == 0 ? 1 : 0,
+                    Value = (outValue & (1 << index)) == 0 ? IOValue.TRUE : IOValue.FALSE,
                     IOType = IOType.OUTPUT
                 };
                 result.Add(inItem);
@@ -873,7 +874,7 @@
             });
         }
 
-        private void OnMethodInvoked(IAsyncResult ar)
+        public override void OnMethodInvoked(IAsyncResult ar)
         {
             MotionCardMonitorSet monitorSet = ar.AsyncState as MotionCardMonitorSet;
             ProcessResponse resValues = monitorSet.Response;
@@ -905,13 +906,12 @@
             {
                 MotionCardWarningSet warningSet = wSet as MotionCardWarningSet;
 
-                bool isOn = ((tempNew.FirstOrDefault(u => u.IONum == warningSet.TriggerIndex && u.IOType == warningSet.WarningIOModel)?.Value >> warningSet.TriggerIndex) & 1) == (warningSet.TriggerValue ? 1 : 0);
+                bool isOn = (((int)((tempNew.FirstOrDefault(u => u.IONum == warningSet.TriggerIndex && u.IOType == warningSet.WarningIOModel)?.Value)) >> warningSet.TriggerIndex) & 1) == (warningSet.TriggerValue ? 1 : 0);
 
                 if (warningSet.CurrentStatus != isOn)
                 {
                     warningSet.CurrentStatus = isOn;
                     warningSet.TriggerTime = DateTime.Now;
-                    warningSet.WarningDescription = $"璀︽姤锛歿warningSet.Name}-瑙﹀彂绱㈠紩锛歿warningSet.TriggerIndex}-{warningSet.WarningIOModel.GetEnumDescription()}:{warningSet.WarningCode}";
                     SaveAlarmCSVAsync(DateTime.Now, this.Name, warningSet);
                     ExcuteMonitorAlarm(DateTime.Now, this, warningSet);
                 }
@@ -932,7 +932,7 @@
 
                 if (newIOItem?.Value != oldIOItem?.Value)
                 {
-                    if (monitorSet.TriggerValue == -999 || newIOItem.Value == monitorSet.TriggerValue)
+                    if (monitorSet.TriggerValue == -999 || (int)newIOItem.Value == monitorSet.TriggerValue)
                     {
                         if (monitorSet.OpConfig == null)
                         {
@@ -944,7 +944,7 @@
                         //    return tempNew[index].Value;
                         //}).ToList();
 
-                        ExcuteMonitorInvok(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet, OnMethodInvoked);
+                        ExcuteMonitorInvoke(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet);
                     }
                 }
             });
diff --git a/src/Bro.M071.Process/Bro.M071.Process.csproj b/src/Bro.M071.Process/Bro.M071.Process.csproj
index ebc097e..e251945 100644
--- a/src/Bro.M071.Process/Bro.M071.Process.csproj
+++ b/src/Bro.M071.Process/Bro.M071.Process.csproj
@@ -110,7 +110,7 @@
     <Compile Include="M071Config.cs" />
     <Compile Include="M071Models.cs" />
     <Compile Include="M071Process.cs" />
-    <Compile Include="M071Process_IO.cs" />
+    <Compile Include="M071Process_MotionCard.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="UI\KeyIndicator.cs" />
     <Compile Include="UI\M071Node.cs" />
@@ -120,6 +120,12 @@
     <Compile Include="UI\M071_MainForm.Designer.cs">
       <DependentUpon>M071_MainForm.cs</DependentUpon>
     </Compile>
+    <Compile Include="UI\M071_ShortcutFrm.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="UI\M071_ShortcutFrm.Designer.cs">
+      <DependentUpon>M071_ShortcutFrm.cs</DependentUpon>
+    </Compile>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
diff --git a/src/Bro.M071.Process/M071Config.cs b/src/Bro.M071.Process/M071Config.cs
index b3ae3f3..aa06147 100644
--- a/src/Bro.M071.Process/M071Config.cs
+++ b/src/Bro.M071.Process/M071Config.cs
@@ -44,18 +44,21 @@
         [Category("鑳屾櫙鍥剧墖璁剧疆")]
         [Description("杩愯鑳屾櫙鍥剧墖璺緞")]
         [Editor(typeof(FileDialogEditor), typeof(UITypeEditor))]
+        [DisplayName("鑳屾櫙鍥剧墖")]
         public string BackgroundImagePath { get; set; }
 
         [Category("妫�娴嬭缃�")]
         [Description("鎷嶆憚鐐逛綅璁剧疆闆嗗悎")]
         [TypeConverter(typeof(CollectionCountConvert))]
         [Editor(typeof(ComplexCollectionEditor<SnapshotPoint>), typeof(UITypeEditor))]
+        [DisplayName("鎷嶆憚鐐逛綅")]
         public List<SnapshotPoint> SnapshotPointCollection { get; set; } = new List<SnapshotPoint>();
 
         [Category("妫�娴嬭缃�")]
         [Description("瑙嗚妫�娴嬪崟閿厤缃泦鍚�")]
         [TypeConverter(typeof(CollectionCountConvert))]
         [Editor(typeof(ComplexCollectionEditor<KeyUnit>), typeof(UITypeEditor))]
+        [DisplayName("鍗曢敭閰嶇疆")]
         public List<KeyUnit> KeyUnitCollection { get; set; } = new List<KeyUnit>();
 
         [Category("妫�娴嬭缃�")]
@@ -74,5 +77,23 @@
         [Description("鍗曢敭鍥剧墖淇濆瓨鐩綍璺緞")]
         [Editor(typeof(FoldDialogEditor),typeof(UITypeEditor))]
         public string ImageSaveFolder { get; set; } = "";
+
+        [Category("灞忚斀閰嶇疆")]
+        [Description("true锛氬睆钄藉畨鍏ㄩ棬 false锛氬惎鐢ㄥ畨鍏ㄩ棬")]
+        [ReadOnly(true)]
+        public bool IsSafetyDoorBlocked { get; set; } = false;
+
+        [Category("灞忚斀閰嶇疆")]
+        [Description("true锛氬睆钄藉畨鍏ㄥ厜绾� false锛氬惎鐢ㄥ畨鍏ㄥ厜绾�")]
+        [ReadOnly(true)]
+        public bool IsSafetyBeamBlocked { get; set; } = false;
+
+        [Category("灞忚斀閰嶇疆")]
+        [Description("true锛氬睆钄借渹楦e櫒 false锛氬惎鐢ㄨ渹楦e櫒")]
+        public bool IsBeepBlocked { get; set; } = false;
+
+        [Category("灞忚斀閰嶇疆")]
+        [Description("true锛氱姝㈡墜鍔ㄨ緭鍏ユ潯鐮� false锛氬厑璁告墜鍔ㄨ緭鍏ユ潯鐮�")]
+        public bool IsBarcodeManulInputBlocked { get; set; } = true;
     }
 }
diff --git a/src/Bro.M071.Process/M071Models.cs b/src/Bro.M071.Process/M071Models.cs
index 8c15fde..a5c4137 100644
--- a/src/Bro.M071.Process/M071Models.cs
+++ b/src/Bro.M071.Process/M071Models.cs
@@ -312,7 +312,7 @@
         [Category("鍗曢敭閰嶇疆")]
         [Description("鍗曢敭缁撴灉閰嶇疆")]
         [TypeConverter(typeof(KeyUnitResultConverter))]
-        public string KeyResult { get; set; } = "";
+        public string KeyResultId { get; set; } = "";
 
 
         public List<HImage> KeyImages = new List<HImage>();
@@ -342,7 +342,7 @@
         {
             string msg = Key;
 
-            msg += string.IsNullOrWhiteSpace(KeyResult) ? "" : $"-{KeyResult}";
+            msg += string.IsNullOrWhiteSpace(KeyResultId) ? "" : $"-{KeyResultId}";
 
             return msg;
         }
diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs
index 68b79c6..65f74a9 100644
--- a/src/Bro.M071.Process/M071Process.cs
+++ b/src/Bro.M071.Process/M071Process.cs
@@ -33,7 +33,7 @@
 
         #region 浜嬩欢
         public event Action OnMeasureStart;
-        public event Action<string> OnBarcodeChanged;
+        public event Action OnClearBarcode;
         public event Action<IShapeElement> OnElementUpdated;
         #endregion
 
@@ -51,7 +51,7 @@
         /// </summary>
         private void CheckMachineState()
         {
-            throw new NotImplementedException();
+            //throw new NotImplementedException();
         }
 
         private void InitialSetting()
@@ -110,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 =>
                           {
@@ -119,7 +119,7 @@
                     }
                     else
                     {
-                        b.MeasureValueDict[b.KeyResult] = null;
+                        b.MeasureValueDict[b.KeyResultId] = null;
                     }
                 });
             });
@@ -150,19 +150,7 @@
         //}
         #endregion
 
-        private string barCode = "";
-        public string BarCode
-        {
-            get => barCode;
-            set
-            {
-                if (barCode != value)
-                {
-                    barCode = value;
-                    OnBarcodeChanged?.Invoke(value);
-                }
-            }
-        }
+        public string BarCode { get; set; }
 
         List<ProductionMeasurement> productionList = new List<ProductionMeasurement>();
 
@@ -171,6 +159,7 @@
         {
             if (string.IsNullOrWhiteSpace(BarCode))
             {
+                OnClearBarcode?.Invoke();
                 throw new ProcessException("鏈緭鍏ヤ骇鍝佹潯鐮侊紝璇峰嬁寮�濮嬫祴閲�");
             }
 
@@ -236,39 +225,6 @@
             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 绉佹湁鏂规硶
diff --git a/src/Bro.M071.Process/M071Process_IO.cs b/src/Bro.M071.Process/M071Process_IO.cs
deleted file mode 100644
index 3a0dd4f..0000000
--- a/src/Bro.M071.Process/M071Process_IO.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Bro.M071.Process
-{
-    public partial class M071Process
-    {
-
-    }
-}
diff --git a/src/Bro.M071.Process/M071Process_MotionCard.cs b/src/Bro.M071.Process/M071Process_MotionCard.cs
new file mode 100644
index 0000000..514b46d
--- /dev/null
+++ b/src/Bro.M071.Process/M071Process_MotionCard.cs
@@ -0,0 +1,217 @@
+锘縰sing Bro.Common.Base;
+using Bro.Common.Helper;
+using Bro.Common.Interface;
+using Bro.Common.Model;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing.Design;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using static Bro.Common.Helper.EnumHelper;
+
+namespace Bro.M071.Process
+{
+    public partial class M071Process
+    {
+        Timer _resetTimer = null;
+        const int FULLRESETTIME = 5;
+
+        MachineState machineState = MachineState.Unknown;
+        MachineState MachineState
+        {
+            get => machineState;
+            set
+            {
+                machineState = value;
+
+                switch (machineState)
+                {
+                    case MachineState.Ready:
+                        break;
+                    case MachineState.Running:
+                        break;
+                    case MachineState.Alarm:
+                        break;
+                    case MachineState.Pause:
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+
+        [ProcessMethod("MotionCardBase", "Reset", "绠�鍗曞浣嶆搷浣�", InvokeType.TestInvoke)]
+        public ProcessResponse Reset(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            //if (opConfig == null)
+            //{
+            //    var monitorSet = Config.MonitorSetCollection.FirstOrDefault(u => u.MethodCode == "Reset");
+            //    if (monitorSet == null)
+            //        throw new ProcessException("鏈厤缃粯璁ゅ浣嶆搷浣�");
+
+            //    opConfig = monitorSet.OpConfig;
+            //    if (opConfig == null)
+            //        throw new ProcessException("鏈厤缃浣嶆搷浣滃叿浣撻厤缃姩浣�");
+
+            //    if (invokeDevice == null)
+            //    {
+            //        invokeDevice = DeviceCollection.FirstOrDefault(u => u.Id == monitorSet.InvokeDevice);
+            //        if (invokeDevice == null)
+            //            throw new ProcessException("鏈厤缃浣嶆搷浣滄墽琛岃澶�");
+            //    }
+            //}
+
+            MotionCardDefaultRun("Reset", ref opConfig, ref invokeDevice);
+
+            if (_resetTimer == null)
+            {
+                _resetTimer = new Timer(FullReset, null, -1, -1);
+            }
+
+            if (opConfig.InputPara.Count > 0)
+            {
+                //澶у浣嶄俊鍙�
+                _resetTimer.Change(-1, opConfig.InputPara[0] == 1 ? FULLRESETTIME * 1000 : -1);
+            }
+
+            //if (invokeDevice is MotionCardBase motionCard)
+            //{
+            //    motionCard.Run(opConfig);
+            //}
+
+            return new ProcessResponse(true);
+        }
+
+        private void FullReset(object state)
+        {
+            FullReset(null, null, null);
+        }
+
+        [ProcessMethod("MotionCardOperationConfigCollection", "FullReset", "澶у浣嶆搷浣�", InvokeType.TestInvoke)]
+        public ProcessResponse FullReset(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            //if (opConfig == null)
+            //{
+            //    var monitorSet = Config.MonitorSetCollection.FirstOrDefault(u => u.MethodCode == "FullReset");
+            //    if (monitorSet == null)
+            //        throw new ProcessException("鏈厤缃粯璁ゅぇ澶嶄綅鎿嶄綔");
+
+            //    opConfig = monitorSet.OpConfig;
+            //    if (opConfig == null)
+            //        throw new ProcessException("鏈厤缃ぇ澶嶄綅鎿嶄綔鍏蜂綋閰嶇疆鍔ㄤ綔");
+
+            //    if (invokeDevice == null)
+            //    {
+            //        invokeDevice = DeviceCollection.FirstOrDefault(u => u.Id == monitorSet.InvokeDevice);
+            //        if (invokeDevice == null)
+            //            throw new ProcessException("鏈厤缃ぇ澶嶄綅鎿嶄綔鎵ц璁惧");
+            //    }
+            //}
+
+            //if (invokeDevice is MotionCardBase motionCard)
+            //{
+            //    motionCard.Run(opConfig);
+            //}
+
+            //MotionCardDefaultRun("FullReset", ref opConfig, ref invokeDevice);
+
+            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);
+        }
+
+        [ProcessMethod("MotionCardBase", "SwitchLightRed", "鍒囨崲鎸囩ず鐏�-绾�", InvokeType.TestInvoke)]
+        public ProcessResponse SwitchLightRed(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            MotionCardDefaultRun("SwitchLightRed", ref opConfig, ref invokeDevice);
+            return new ProcessResponse(true);
+        }
+
+        [ProcessMethod("MotionCardBase", "SwitchLightYellow", "鍒囨崲鎸囩ず鐏�-榛�", InvokeType.TestInvoke)]
+        public ProcessResponse SwitchLightYellow(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            return new ProcessResponse(true);
+        }
+
+        [ProcessMethod("MotionCardBase", "SwitchLightGreen", "鍒囨崲鎸囩ず鐏�-缁�", InvokeType.TestInvoke)]
+        public ProcessResponse SwitchLightGreen(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            return new ProcessResponse(true);
+        }
+
+        [ProcessMethod("MotionCardBase", "SwitchBeep", "鍒囨崲铚傞福鍣�", InvokeType.TestInvoke)]
+        public ProcessResponse SwitchBeep(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            return new ProcessResponse(true);
+        }
+
+        [ProcessMethod("MotionCardBase", "SwitchNormalLight", "鍒囨崲鏃ュ厜鐏�", InvokeType.TestInvoke)]
+        public ProcessResponse SwitchNormalLight(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
+        {
+            MotionCardDefaultRun("SwitchNormalLight", ref opConfig, ref invokeDevice);
+
+            return new ProcessResponse(true);
+        }
+
+        private void MotionCardDefaultRun(string methodCode, ref IOperationConfig opConfig, ref IDevice invokeDevice)
+        {
+            IMonitorSet monitorSet = null;
+            if (opConfig == null)
+            {
+                monitorSet = Config.MonitorSetCollection.FirstOrDefault(u => u.MethodCode == methodCode);
+                if (monitorSet == null)
+                    throw new ProcessException("鏈厤缃粯璁ゆ搷浣�");
+
+                opConfig = monitorSet.OpConfig;
+                if (opConfig == null)
+                    throw new ProcessException("鏈厤缃叿浣撻厤缃姩浣�");
+            }
+
+            if (invokeDevice == null)
+            {
+                invokeDevice = DeviceCollection.FirstOrDefault(u => u.Id == monitorSet.InvokeDevice);
+                if (invokeDevice == null)
+                    throw new ProcessException("鏈厤缃搷浣滄墽琛岃澶�");
+            }
+
+            if (invokeDevice is MotionCardBase motionCard)
+            {
+                motionCard.Run(opConfig);
+            }
+        }
+    }
+}
diff --git a/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs b/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs
index 996ca15..b83b97d 100644
--- a/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs
+++ b/src/Bro.M071.Process/UI/M071_MainForm.Designer.cs
@@ -33,6 +33,11 @@
             this.tsmiShowToolBar = new System.Windows.Forms.ToolStripMenuItem();
             this.tsmiShowStatusBar = new System.Windows.Forms.ToolStripMenuItem();
             this.tsmiShowEditor = new System.Windows.Forms.ToolStripMenuItem();
+            this.lblCT = new System.Windows.Forms.Label();
+            this.txtBarcode = new System.Windows.Forms.TextBox();
+            this.lblProductionState = new System.Windows.Forms.Label();
+            this.lblMachineState = new System.Windows.Forms.Label();
+            this.plImage = new System.Windows.Forms.Panel();
             this.tscEditLocation = new System.Windows.Forms.ToolStripContainer();
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.btnConfirmEdit = new System.Windows.Forms.Button();
@@ -82,6 +87,61 @@
             this.tsmiShowEditor.Size = new System.Drawing.Size(148, 22);
             this.tsmiShowEditor.Text = "缂栬緫鏄剧ず鐐逛綅";
             this.tsmiShowEditor.CheckedChanged += new System.EventHandler(this.tsmiShowEditor_CheckedChanged);
+            // 
+            // lblCT
+            // 
+            this.lblCT.AutoSize = true;
+            this.lblCT.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134)));
+            this.lblCT.Location = new System.Drawing.Point(464, 19);
+            this.lblCT.Name = "lblCT";
+            this.lblCT.Size = new System.Drawing.Size(35, 14);
+            this.lblCT.TabIndex = 4;
+            this.lblCT.Text = "XXXX";
+            // 
+            // txtBarcode
+            // 
+            this.txtBarcode.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134)));
+            this.txtBarcode.Location = new System.Drawing.Point(138, 13);
+            this.txtBarcode.Name = "txtBarcode";
+            this.txtBarcode.Size = new System.Drawing.Size(261, 24);
+            this.txtBarcode.TabIndex = 3;
+            this.txtBarcode.Text = "BARCODE";
+            this.txtBarcode.TextChanged += new System.EventHandler(this.txtBarcode_TextChanged);
+            // 
+            // lblProductionState
+            // 
+            this.lblProductionState.AutoSize = true;
+            this.lblProductionState.BackColor = System.Drawing.Color.Lime;
+            this.lblProductionState.Font = new System.Drawing.Font("Tahoma", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World, ((byte)(134)));
+            this.lblProductionState.ForeColor = System.Drawing.Color.White;
+            this.lblProductionState.Location = new System.Drawing.Point(405, 13);
+            this.lblProductionState.Name = "lblProductionState";
+            this.lblProductionState.Size = new System.Drawing.Size(39, 24);
+            this.lblProductionState.TabIndex = 2;
+            this.lblProductionState.Text = "OK";
+            // 
+            // lblMachineState
+            // 
+            this.lblMachineState.AutoSize = true;
+            this.lblMachineState.BackColor = System.Drawing.Color.Lime;
+            this.lblMachineState.Font = new System.Drawing.Font("Tahoma", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World, ((byte)(134)));
+            this.lblMachineState.ForeColor = System.Drawing.Color.White;
+            this.lblMachineState.Location = new System.Drawing.Point(22, 12);
+            this.lblMachineState.Name = "lblMachineState";
+            this.lblMachineState.Size = new System.Drawing.Size(79, 24);
+            this.lblMachineState.TabIndex = 2;
+            this.lblMachineState.Text = "READY";
+            // 
+            // plImage
+            // 
+            this.plImage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.plImage.ContextMenuStrip = this.contextMenuStrip1;
+            this.plImage.Location = new System.Drawing.Point(1, 47);
+            this.plImage.Name = "plImage";
+            this.plImage.Size = new System.Drawing.Size(796, 304);
+            this.plImage.TabIndex = 1;
             // 
             // tscEditLocation
             // 
@@ -159,7 +219,7 @@
             // 
             this.splitContainer1.Panel2.Controls.Add(this.propGridKeyIndicator);
             this.splitContainer1.Size = new System.Drawing.Size(203, 284);
-            this.splitContainer1.SplitterDistance = 164;
+            this.splitContainer1.SplitterDistance = 163;
             this.splitContainer1.TabIndex = 1;
             // 
             // lvMeasures
@@ -171,7 +231,7 @@
             this.lvMeasures.Location = new System.Drawing.Point(0, 0);
             this.lvMeasures.MultiSelect = false;
             this.lvMeasures.Name = "lvMeasures";
-            this.lvMeasures.Size = new System.Drawing.Size(203, 164);
+            this.lvMeasures.Size = new System.Drawing.Size(203, 163);
             this.lvMeasures.TabIndex = 0;
             this.lvMeasures.UseCompatibleStateImageBehavior = false;
             this.lvMeasures.View = System.Windows.Forms.View.List;
@@ -182,7 +242,7 @@
             this.propGridKeyIndicator.Dock = System.Windows.Forms.DockStyle.Fill;
             this.propGridKeyIndicator.Location = new System.Drawing.Point(0, 0);
             this.propGridKeyIndicator.Name = "propGridKeyIndicator";
-            this.propGridKeyIndicator.Size = new System.Drawing.Size(203, 116);
+            this.propGridKeyIndicator.Size = new System.Drawing.Size(203, 117);
             this.propGridKeyIndicator.TabIndex = 0;
             this.propGridKeyIndicator.ToolbarVisible = false;
             // 
@@ -191,10 +251,16 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(800, 351);
-            this.ContextMenuStrip = this.contextMenuStrip1;
+            this.Controls.Add(this.lblCT);
+            this.Controls.Add(this.txtBarcode);
+            this.Controls.Add(this.lblProductionState);
+            this.Controls.Add(this.lblMachineState);
+            this.Controls.Add(this.plImage);
             this.Controls.Add(this.tscEditLocation);
+            this.KeyPreview = true;
             this.Name = "M071_MainForm";
             this.Text = "M071_MainForm";
+            this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.M071_MainForm_KeyUp);
             this.contextMenuStrip1.ResumeLayout(false);
             this.tscEditLocation.ContentPanel.ResumeLayout(false);
             this.tscEditLocation.ResumeLayout(false);
@@ -205,6 +271,7 @@
             ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
             this.splitContainer1.ResumeLayout(false);
             this.ResumeLayout(false);
+            this.PerformLayout();
 
         }
 
@@ -221,5 +288,10 @@
         private System.Windows.Forms.ListView lvMeasures;
         private System.Windows.Forms.ToolStripMenuItem tsmiShowToolBar;
         private System.Windows.Forms.ToolStripMenuItem tsmiShowStatusBar;
+        private System.Windows.Forms.Panel plImage;
+        private System.Windows.Forms.Label lblMachineState;
+        private System.Windows.Forms.Label lblProductionState;
+        private System.Windows.Forms.TextBox txtBarcode;
+        private System.Windows.Forms.Label lblCT;
     }
 }
\ No newline at end of file
diff --git a/src/Bro.M071.Process/UI/M071_MainForm.cs b/src/Bro.M071.Process/UI/M071_MainForm.cs
index 2ec9284..97904b6 100644
--- a/src/Bro.M071.Process/UI/M071_MainForm.cs
+++ b/src/Bro.M071.Process/UI/M071_MainForm.cs
@@ -12,7 +12,7 @@
 
 namespace Bro.M071.Process.UI
 {
-    [MenuNode("M071_MainForm", "閿洏妫�娴嬩富鐣岄潰", 3, "M071Node", true)]
+    [MenuNode("M071_MainForm", "杩愯鐣岄潰", 1, "M071Node", true)]
     public partial class M071_MainForm : MenuFrmBase
     {
         Canvas cvImage = new Canvas();
@@ -26,7 +26,7 @@
             tsmiShowStatusBar.Checked = cvImage.IsShowStatusBar = false;
             tsmiShowToolBar.Checked = cvImage.IsShowToolBar = false;
             cvImage.Dock = DockStyle.Fill;
-            this.Controls.Add(cvImage);
+            plImage.Controls.Add(cvImage);
 
             tscEditLocation.Visible = tsmiShowEditor.Checked = false;
         }
@@ -66,17 +66,14 @@
                 item.Tag = u.Id;
                 lvMeasures.Items.Add(item);
             });
-        }
-        
-        private void lvMeasures_SelectedIndexChanged(object sender, EventArgs e)
-        {
-            if (lvMeasures.SelectedItems.Count <= 0)
-                return;
 
-            var ele = cvImage.Elements.FirstOrDefault(u => u.ID == lvMeasures.SelectedItems[0].Tag.ToString());
-            propGridKeyIndicator.SelectedObject = ele;
+            txtBarcode.ReadOnly = Config.IsBarcodeManulInputBlocked;
+
+            (Process as M071Process).OnClearBarcode -= M071_MainForm_OnClearBarcode;
+            (Process as M071Process).OnClearBarcode += M071_MainForm_OnClearBarcode;
         }
 
+        #region 鍥剧墖鍖哄彸閿彍鍗�
         private void tsmiShowToolBar_CheckedChanged(object sender, EventArgs e)
         {
             cvImage.IsShowToolBar = tsmiShowToolBar.Checked;
@@ -90,6 +87,18 @@
         private void tsmiShowEditor_CheckedChanged(object sender, EventArgs e)
         {
             tscEditLocation.Visible = tsmiShowEditor.Checked;
+            tscEditLocation.BringToFront();
+        }
+        #endregion
+
+        #region 鏍囩缂栬緫鍖�
+        private void lvMeasures_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            if (lvMeasures.SelectedItems.Count <= 0)
+                return;
+
+            var ele = cvImage.Elements.FirstOrDefault(u => u.ID == lvMeasures.SelectedItems[0].Tag.ToString());
+            propGridKeyIndicator.SelectedObject = ele;
         }
 
         private void btnCancelEdit_Click(object sender, EventArgs e)
@@ -125,5 +134,39 @@
 
             MessageBox.Show("鏍囩淇敼瀹屾垚");
         }
+        #endregion
+
+        #region 涓婃柟鐘舵�佸尯
+
+        #region 鏉$爜
+        string _barcode = "";
+        private void M071_MainForm_KeyUp(object sender, KeyEventArgs e)
+        {
+            string keyStr = e.KeyCode.ToString();
+            if (keyStr.Length == 1)
+            {
+                _barcode += keyStr.ToUpper();
+            }
+
+            if (e.KeyValue == 13)
+            {
+                txtBarcode.Text = _barcode;
+                _barcode = "";
+            }
+        }
+
+        private void txtBarcode_TextChanged(object sender, EventArgs e)
+        {
+            (Process as M071Process).BarCode = txtBarcode.Text.Trim();
+        }
+
+        private void M071_MainForm_OnClearBarcode()
+        {
+            txtBarcode.BeginInvoke(new Action(() => txtBarcode.Clear()));
+        }
+        #endregion
+
+        #endregion
+
     }
 }
diff --git a/src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs b/src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs
new file mode 100644
index 0000000..6ed449b
--- /dev/null
+++ b/src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs
@@ -0,0 +1,39 @@
+锘縩amespace Bro.M071.Process.UI
+{
+    partial class M071_ShortcutFrm
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(800, 450);
+            this.Text = "M071_ShortcutFrm";
+        }
+
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/src/Bro.M071.Process/UI/M071_ShortcutFrm.cs b/src/Bro.M071.Process/UI/M071_ShortcutFrm.cs
new file mode 100644
index 0000000..245d16d
--- /dev/null
+++ b/src/Bro.M071.Process/UI/M071_ShortcutFrm.cs
@@ -0,0 +1,22 @@
+锘縰sing Bro.UI.Model.Winform;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Bro.M071.Process.UI
+{
+    [MenuNode("M071_ShortcutFrm", "蹇嵎鎿嶄綔", 2, "M071Node", true)]
+    public partial class M071_ShortcutFrm : MenuFrmBase
+    {
+        public M071_ShortcutFrm()
+        {
+            InitializeComponent();
+        }
+    }
+}
diff --git a/src/Bro.UI.Config/MainFrm.Designer.cs b/src/Bro.UI.Config/MainFrm.Designer.cs
index 86203a8..925f0ff 100644
--- a/src/Bro.UI.Config/MainFrm.Designer.cs
+++ b/src/Bro.UI.Config/MainFrm.Designer.cs
@@ -197,6 +197,7 @@
             this.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134)));
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
             this.IsMdiContainer = true;
+            this.KeyPreview = true;
             this.MainMenuStrip = this.menuMain;
             this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
             this.Name = "MainFrm";
diff --git a/src/Bro.UI.Config/MainFrm.cs b/src/Bro.UI.Config/MainFrm.cs
index a3b3e18..e7940f5 100644
--- a/src/Bro.UI.Config/MainFrm.cs
+++ b/src/Bro.UI.Config/MainFrm.cs
@@ -32,7 +32,7 @@
 
             VisualStudioToolStripExtender extender = new VisualStudioToolStripExtender();
             extender.SetStyle(menuMain, VisualStudioToolStripExtender.VsVersion.Vs2015, theme);
-            
+
             InitialMenu(MenuFormFactory.MenuFrmTypeDict, "");
 
             //MenuFormFactory.MenuFrmTypeDict.ToList().ForEach(t =>
@@ -491,15 +491,18 @@
 
         private void Device_OnDeviceStateChanged(IDevice device, EnumHelper.DeviceState currentState)
         {
-            for (int i = 1; i < ststripDevices.Items.Count; i++)
+            ststripDevices.BeginInvoke(new Action(() =>
             {
-                if ((ststripDevices.Items[i].Tag as IDevice)?.Id == device.Id)
+                for (int i = 1; i < ststripDevices.Items.Count; i++)
                 {
-                    ststripDevices.Items[i].BackColor = currentState.GetEnumSelectedColor();
-                    ststripDevices.Items[i].ForeColor = currentState.GetEnumSelectedFontColor();
-                    break;
+                    if ((ststripDevices.Items[i].Tag as IDevice)?.Id == device.Id)
+                    {
+                        ststripDevices.Items[i].BackColor = currentState.GetEnumSelectedColor();
+                        ststripDevices.Items[i].ForeColor = currentState.GetEnumSelectedFontColor();
+                        break;
+                    }
                 }
-            }
+            }));
         }
         #endregion
 
diff --git a/src/Bro.UI.Config/MenuForms/FrmConfig.cs b/src/Bro.UI.Config/MenuForms/FrmConfig.cs
index ef01a46..b58f66c 100644
--- a/src/Bro.UI.Config/MenuForms/FrmConfig.cs
+++ b/src/Bro.UI.Config/MenuForms/FrmConfig.cs
@@ -53,7 +53,7 @@
 
         private void buttonCreateConfig_Click(object sender, EventArgs e)
         {
-            string pCode = Interaction.InputBox("璇疯緭鍏ヤ骇鍝佺紪鐮�", "浜у搧缂栫爜","",0,0);
+            string pCode = Interaction.InputBox("璇疯緭鍏ヤ骇鍝佺紪鐮�", "浜у搧缂栫爜", "", 0, 0);
             if (string.IsNullOrWhiteSpace(pCode))
             {
                 MessageBox.Show("璇疯緭鍏ヤ骇鍝佺紪鐮侊紒");
diff --git a/src/Bro.UI.Config/MenuForms/FrmOperation.cs b/src/Bro.UI.Config/MenuForms/FrmOperation.cs
index 891d678..025c4fb 100644
--- a/src/Bro.UI.Config/MenuForms/FrmOperation.cs
+++ b/src/Bro.UI.Config/MenuForms/FrmOperation.cs
@@ -140,7 +140,7 @@
         }
 
         bool isStart = true;
-        private void btnStart_Click(object sender, System.EventArgs e)
+        private async void btnStart_Click(object sender, System.EventArgs e)
         {
             if (Process == null)
             {
@@ -157,11 +157,11 @@
                 //if (Process.ProcessState != EnumHelper.DeviceState.DSOpen)
                 if (isStart)
                 {
-                    ProcessOperation(true);
+                    await ProcessOperation(true);
                 }
                 else
                 {
-                    ProcessOperation(false);
+                    await ProcessOperation(false);
                 }
 
                 isStart = !isStart;
@@ -172,7 +172,8 @@
             }
             finally
             {
-                this.BeginInvoke(new Action(() => btnStart.Enabled = true));
+                //this.BeginInvoke(new Action(() => btnStart.Enabled = true));
+                btnStart.Enabled = true;
             }
             //});
         }
@@ -255,11 +256,11 @@
         //    }
         //}
 
-        private void ProcessOperation(bool isStart)
+        private async Task ProcessOperation(bool isStart)
         {
             if (isStart)
             {
-                Process.Open();
+                await Task.Run(() => Process.Open());
 
                 //this.BeginInvoke(new Action(() =>
                 //{
@@ -273,7 +274,7 @@
             }
             else
             {
-                Process.Close();
+                await Task.Run(() => Process.Close());
 
                 //this.BeginInvoke(new Action(() =>
                 //{
diff --git a/src/Bro.UI.Config/MenuForms/FrmOperation.resx b/src/Bro.UI.Config/MenuForms/FrmOperation.resx
index 28530b7..b406f47 100644
--- a/src/Bro.UI.Config/MenuForms/FrmOperation.resx
+++ b/src/Bro.UI.Config/MenuForms/FrmOperation.resx
@@ -125,7 +125,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm
-        CgAAAk1TRnQBSQFMAgEBAgEAAdgBAAHYAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
+        CgAAAk1TRnQBSQFMAgEBAgEAAeABAAHgAQABGAEAARgBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
         AwABYAMAARgDAAEBAQABCAYAAQkYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
         AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
         AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@@ -182,7 +182,7 @@
         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAD4
-        CAAAAk1TRnQBSQFMAwEBAAHYAQAB2AEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
+        CAAAAk1TRnQBSQFMAwEBAAHgAQAB4AEAARgBAAEYAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
         AWADAAEYAwABAQEAAQgGAAEJGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
         AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
         AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
index 2b8d8dd..0552bb9 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
@@ -52,18 +52,18 @@
         private void RadioButton_CheckedChanged(object sender, EventArgs e)
         {
             //鍔犺浇瀵瑰簲杩愬姩鐨� movingConfig
-            if (radioP2P.Checked)
-            {
-                movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal);
-            }
-            else if (radioJog.Checked)
-            {
-                movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog);
-            }
-            else if (radioGoHome.Checked)
-            {
-                movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri);
-            }
+            //if (radioP2P.Checked)
+            //{
+            //    movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal);
+            //}
+            //else if (radioJog.Checked)
+            //{
+            //    movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog);
+            //}
+            //else if (radioGoHome.Checked)
+            //{
+            //    movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri);
+            //}
 
             propGrid.SelectedObject = movingConfig;
         }

--
Gitblit v1.8.0