From c0d59e233882ad489f45abc8eb0193ffa4fb8988 Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期六, 11 七月 2020 11:20:44 +0800
Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071

---
 src/Bro.Device.GTSCard/GTSCardDriver.cs                                      |   12 +
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs      |  288 ++++++++++++++++++++--------------------
 src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs                          |    4 
 src/Bro.Common.Device/DeviceBase/MotionCardBase.cs                           |    9 +
 src/Bro.M071.Process/M071Process.cs                                          |    2 
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs                |    9 -
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs |    7 +
 src/Bro.Process/ProcessControl.cs                                            |    8 
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs               |   14 +-
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs             |   28 +++
 10 files changed, 204 insertions(+), 177 deletions(-)

diff --git a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
index 4e539a0..103cc21 100644
--- a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
+++ b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
@@ -33,6 +33,13 @@
             OnAxisStatusChanged?.Invoke(axisIndex, preStatus, curStatus);
         }
 
+        protected override void Start()
+        {
+            Task.Run(() =>
+            {
+                Monitor();
+            });
+        }
         public abstract List<AxisInfo> GetCurrentAxisInfo(params string[] axisName);
         public abstract void Monitor();
         public abstract ResponseMessage MoveToPoint(IOperationConfig opConfig);
@@ -133,7 +140,7 @@
         [Category("鏉垮崱閰嶇疆")]
         [DisplayName("鍗″彿")]
         [Description("CardNum锛氬崱鍙�")]
-        public int CardNum { get; set; }
+        public int CardNum { get; set; } = 1;
 
         [Category("鏉垮崱閰嶇疆")]
         [DisplayName("鍒濆閰嶇疆鏂囦欢璺緞")]
diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs
index 6b701a8..3bf8ec1 100644
--- a/src/Bro.Device.GTSCard/GTSCardDriver.cs
+++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -96,6 +96,8 @@
         protected override void Start()
         {
             AllAxisOn();
+
+            base.Start();
         }
 
         protected override void Stop()
@@ -857,7 +859,7 @@
         /// <param name="value">false琛ㄧず杈撳嚭锛宼rue琛ㄧず鍏抽棴</param>
         public override void WriteOutput(short index, IOValue value)
         {
-            short outNum = (short)(index % 100);
+            short outNum = (short)(index % 100 + 1);
             if ((int)value <= 1)
             {
                 GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPO, outNum, (short)value);
@@ -931,10 +933,10 @@
                 AxisMovingStatus axisMovingStatus = new AxisMovingStatus();
                 axisMovingStatus.AxisIndex = axisConfig.AxisIndex;
                 axisMovingStatus.AxisName = axisConfig.AxisName;
-                axisMovingStatus.CurPosition = Convert.ToInt32(GetPosition(axisMovingStatus.AxisIndex));
+                //axisMovingStatus.CurPosition = Convert.ToInt32(GetPosition(axisMovingStatus.AxisIndex));
                 axisMovingStatus.Destination = Convert.ToInt32(GetPrfPosition(axisMovingStatus.AxisIndex));
-                axisMovingStatus.CurVelocity = GetVelocity(axisMovingStatus.AxisIndex);
-                axisMovingStatus.PrfVelocity = GetPrfVelocity(axisMovingStatus.AxisIndex);
+                //axisMovingStatus.CurVelocity = GetVelocity(axisMovingStatus.AxisIndex);
+                //axisMovingStatus.PrfVelocity = GetPrfVelocity(axisMovingStatus.AxisIndex);
                 axisMovingStatus.AxisStatus = GetAxisStatus(axisMovingStatus.AxisIndex);
 
                 axisMovingStatusesList.Add(axisMovingStatus);
@@ -956,7 +958,7 @@
             GTSCardAPI.GT_GetDo((short)IConfig.CardNum, GTSCardAPI.MC_GPO, out outValue);
 
             //瑙f瀽缁撴灉
-            for (var index = 1; index <= 16; index++)
+            for (var index = 0; index < 16; index++)
             {
                 IOItem inItem = new IOItem()
                 {
diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs
index 3305e4b..5b63bbf 100644
--- a/src/Bro.M071.Process/M071Process.cs
+++ b/src/Bro.M071.Process/M071Process.cs
@@ -79,7 +79,7 @@
         private void InitialSetting()
         {
             //鏁版嵁搴撹縼绉绘鏌�
-            DatabaseInitialize.Initialize();
+            //DatabaseInitialize.Initialize();
 
             MotionCardSettingCheck();
 
diff --git a/src/Bro.Process/ProcessControl.cs b/src/Bro.Process/ProcessControl.cs
index afbc38d..ca587d2 100644
--- a/src/Bro.Process/ProcessControl.cs
+++ b/src/Bro.Process/ProcessControl.cs
@@ -21,7 +21,7 @@
 using System.Threading.Tasks;
 using static Bro.Common.Helper.EnumHelper;
 
-namespace Bro.Process
+namespace Bro.Process  
 {
     [Process("", DeviceAttributeType.Device)]
     public partial class ProcessControl : IProcess
@@ -527,7 +527,7 @@
             object res = null;
             int reTryTimes = config.ReTryTimes;
             IDevice device = DeviceCollection.FirstOrDefault(u => u.Id == deviceId);
-            LogAsync(DateTime.Now, $"{device.Name}璋冪敤{methodCode}寮�濮�", "");
+            LogAsync(DateTime.Now, $"{device?.Name}璋冪敤{methodCode}寮�濮�", "");
 
             Stopwatch sw = new Stopwatch();
             sw.Start();
@@ -603,8 +603,8 @@
             #endregion
 
             sw.Stop();
-            LogAsync(DateTime.Now, $"{device.Name}璋冪敤{methodCode}瀹屾垚锛岃�楁椂{sw.ElapsedMilliseconds}ms", "");
-            TimeRecordCSV(DateTime.Now, device.Name, $"{methodCode}璋冪敤瀹屾垚", (int)sw.ElapsedMilliseconds);
+            LogAsync(DateTime.Now, $"{device?.Name}璋冪敤{methodCode}瀹屾垚锛岃�楁椂{sw.ElapsedMilliseconds}ms", "");
+            TimeRecordCSV(DateTime.Now, device?.Name, $"{methodCode}璋冪敤瀹屾垚", (int)sw.ElapsedMilliseconds);
         }
 
         /// <summary>
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs
index 629efc2..ed30305 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.Designer.cs
@@ -144,6 +144,7 @@
             this.textBoxP2PVel.Name = "textBoxP2PVel";
             this.textBoxP2PVel.Size = new System.Drawing.Size(116, 21);
             this.textBoxP2PVel.TabIndex = 5;
+            this.textBoxP2PVel.Text = "10";
             // 
             // textBoxP2PPrfPosition
             // 
@@ -151,6 +152,7 @@
             this.textBoxP2PPrfPosition.Name = "textBoxP2PPrfPosition";
             this.textBoxP2PPrfPosition.Size = new System.Drawing.Size(116, 21);
             this.textBoxP2PPrfPosition.TabIndex = 5;
+            this.textBoxP2PPrfPosition.Text = "20000";
             // 
             // textBoxP2PDec
             // 
@@ -158,6 +160,7 @@
             this.textBoxP2PDec.Name = "textBoxP2PDec";
             this.textBoxP2PDec.Size = new System.Drawing.Size(116, 21);
             this.textBoxP2PDec.TabIndex = 5;
+            this.textBoxP2PDec.Text = "0.5";
             // 
             // textBoxP2PAcc
             // 
@@ -165,6 +168,7 @@
             this.textBoxP2PAcc.Name = "textBoxP2PAcc";
             this.textBoxP2PAcc.Size = new System.Drawing.Size(116, 21);
             this.textBoxP2PAcc.TabIndex = 5;
+            this.textBoxP2PAcc.Text = "0.5";
             // 
             // label7
             // 
@@ -237,6 +241,7 @@
             this.textBoxJogDec.Name = "textBoxJogDec";
             this.textBoxJogDec.Size = new System.Drawing.Size(116, 21);
             this.textBoxJogDec.TabIndex = 5;
+            this.textBoxJogDec.Text = "0.1";
             // 
             // buttonPositive
             // 
@@ -256,6 +261,7 @@
             this.textBoxJogAcc.Name = "textBoxJogAcc";
             this.textBoxJogAcc.Size = new System.Drawing.Size(116, 21);
             this.textBoxJogAcc.TabIndex = 5;
+            this.textBoxJogAcc.Text = "0.1";
             // 
             // label5
             // 
@@ -272,6 +278,7 @@
             this.textBoxJogVel.Name = "textBoxJogVel";
             this.textBoxJogVel.Size = new System.Drawing.Size(116, 21);
             this.textBoxJogVel.TabIndex = 5;
+            this.textBoxJogVel.Text = "5";
             // 
             // label4
             // 
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs
index d7df378..7411bd0 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.cs
@@ -1,5 +1,8 @@
-锘縰sing Bro.Common.Model;
+锘縰sing Bro.Common.Base;
+using Bro.Common.Interface;
+using Bro.Common.Model;
 using System;
+using System.Linq;
 using System.Windows.Forms;
 
 namespace Bro.UI.Device.Winform
@@ -11,27 +14,40 @@
             InitializeComponent();
         }
 
+        public IDevice Device { get; set; }
+
+        protected MotionCardBase MotionCard
+        {
+            get => Device as MotionCardBase;
+        }
+
+        private int _axisIndex { get; set; }
+        private string _axisName { get; set; }
+
         public AxisMovingStatus _axisMovingStatus = new AxisMovingStatus();
-        public CtrlMotionCardAxisStatus(AxisMovingStatus axisMovingStatus)
+        public CtrlMotionCardAxisStatus(IDevice device,int axisIndex,string axisName)
         {
             InitializeComponent();
-            _axisMovingStatus = axisMovingStatus;
-            groupBoxAxisStatus.Text = $"杩愬姩杞达細{_axisMovingStatus.AxisIndex}-{_axisMovingStatus.AxisName}";
+            Device = device;
+            _axisIndex = axisIndex;
+            _axisName = axisName;
+            groupBoxAxisStatus.Text = $"杩愬姩杞达細{axisIndex}-{axisName}";
         }
 
         private void RefreshStatus(object sender, EventArgs e)
         {
+            _axisMovingStatus = MotionCard.AxisStatusList.FirstOrDefault(u => u.AxisIndex == _axisIndex);
             textBoxPrfPositon.Text = _axisMovingStatus.Destination.ToString();
             textBoxCurPosition.Text = _axisMovingStatus.CurPosition.ToString();
             textBoxPrfVel.Text = _axisMovingStatus.PrfVelocity.ToString();
             textBoxCurVel.Text = _axisMovingStatus.CurVelocity.ToString();
             int axis_sts = _axisMovingStatus.AxisStatus;
-      
+
             ioIndicatorCtrl1.IsOn = (axis_sts & 0x2) == 0;//椹卞姩鎶ヨ
             ioIndicatorCtrl2.IsOn = (axis_sts & 0x200) == 0;//浼烘湇浣胯兘
             ioIndicatorCtrl6.IsOn = (axis_sts & 0x20) == 0;//姝i檺浣�
             ioIndicatorCtrl8.IsOn = (axis_sts & 0x40) == 0;//璐熼檺浣�
-            ioIndicatorCtrl9.IsOn =(axis_sts & 0x400) == 0;//杩愬姩鐘舵��
+            ioIndicatorCtrl9.IsOn = (axis_sts & 0x400) == 0;//杩愬姩鐘舵��
             ioIndicatorCtrl10.IsOn = (axis_sts & 0x10) == 0;//杩愬姩鍑洪敊
 
         }
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs
index 60a09b0..69bd90d 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs
@@ -31,39 +31,39 @@
             this.components = new System.ComponentModel.Container();
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.groupBoxIOOut = new System.Windows.Forms.GroupBox();
-            this.ioOut4 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut3 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut2 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioOut16 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioOut1 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut15 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut14 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut13 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioOut9 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioOut12 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut8 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut7 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioOut12 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioOut6 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut11 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut10 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioOut6 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioOut9 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioOut5 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioOut1 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioOut4 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioOut0 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.groupBoxIOIn = new System.Windows.Forms.GroupBox();
-            this.ioIn4 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn3 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn2 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioIn16 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioIn1 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn15 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn14 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn13 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioIn9 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioIn12 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn8 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn7 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioIn12 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioIn6 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn11 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn10 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioIn6 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioIn9 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn5 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.ioIn1 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioIn4 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
+            this.ioIn0 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.timerIOStatus = new System.Windows.Forms.Timer(this.components);
             this.tableLayoutPanel1.SuspendLayout();
             this.groupBoxIOOut.SuspendLayout();
@@ -87,22 +87,22 @@
             // 
             // groupBoxIOOut
             // 
-            this.groupBoxIOOut.Controls.Add(this.ioOut4);
             this.groupBoxIOOut.Controls.Add(this.ioOut3);
             this.groupBoxIOOut.Controls.Add(this.ioOut2);
-            this.groupBoxIOOut.Controls.Add(this.ioOut16);
+            this.groupBoxIOOut.Controls.Add(this.ioOut1);
             this.groupBoxIOOut.Controls.Add(this.ioOut15);
             this.groupBoxIOOut.Controls.Add(this.ioOut14);
             this.groupBoxIOOut.Controls.Add(this.ioOut13);
-            this.groupBoxIOOut.Controls.Add(this.ioOut9);
+            this.groupBoxIOOut.Controls.Add(this.ioOut12);
             this.groupBoxIOOut.Controls.Add(this.ioOut8);
             this.groupBoxIOOut.Controls.Add(this.ioOut7);
-            this.groupBoxIOOut.Controls.Add(this.ioOut12);
+            this.groupBoxIOOut.Controls.Add(this.ioOut6);
             this.groupBoxIOOut.Controls.Add(this.ioOut11);
             this.groupBoxIOOut.Controls.Add(this.ioOut10);
-            this.groupBoxIOOut.Controls.Add(this.ioOut6);
+            this.groupBoxIOOut.Controls.Add(this.ioOut9);
             this.groupBoxIOOut.Controls.Add(this.ioOut5);
-            this.groupBoxIOOut.Controls.Add(this.ioOut1);
+            this.groupBoxIOOut.Controls.Add(this.ioOut4);
+            this.groupBoxIOOut.Controls.Add(this.ioOut0);
             this.groupBoxIOOut.Dock = System.Windows.Forms.DockStyle.Fill;
             this.groupBoxIOOut.Location = new System.Drawing.Point(3, 147);
             this.groupBoxIOOut.Name = "groupBoxIOOut";
@@ -111,20 +111,11 @@
             this.groupBoxIOOut.TabStop = false;
             this.groupBoxIOOut.Text = "鏁板瓧閲忚緭鍑�";
             // 
-            // ioOut4
-            // 
-            this.ioOut4.Desc = "OUT 4";
-            this.ioOut4.IsOn = null;
-            this.ioOut4.Location = new System.Drawing.Point(477, 18);
-            this.ioOut4.Name = "ioOut4";
-            this.ioOut4.Size = new System.Drawing.Size(90, 24);
-            this.ioOut4.TabIndex = 4;
-            // 
             // ioOut3
             // 
             this.ioOut3.Desc = "OUT 3";
             this.ioOut3.IsOn = null;
-            this.ioOut3.Location = new System.Drawing.Point(306, 18);
+            this.ioOut3.Location = new System.Drawing.Point(477, 18);
             this.ioOut3.Name = "ioOut3";
             this.ioOut3.Size = new System.Drawing.Size(90, 24);
             this.ioOut3.TabIndex = 4;
@@ -133,25 +124,25 @@
             // 
             this.ioOut2.Desc = "OUT 2";
             this.ioOut2.IsOn = null;
-            this.ioOut2.Location = new System.Drawing.Point(145, 18);
+            this.ioOut2.Location = new System.Drawing.Point(306, 18);
             this.ioOut2.Name = "ioOut2";
             this.ioOut2.Size = new System.Drawing.Size(90, 24);
             this.ioOut2.TabIndex = 4;
             // 
-            // ioOut16
+            // ioOut1
             // 
-            this.ioOut16.Desc = "OUT 16";
-            this.ioOut16.IsOn = null;
-            this.ioOut16.Location = new System.Drawing.Point(477, 107);
-            this.ioOut16.Name = "ioOut16";
-            this.ioOut16.Size = new System.Drawing.Size(90, 24);
-            this.ioOut16.TabIndex = 4;
+            this.ioOut1.Desc = "OUT 1";
+            this.ioOut1.IsOn = null;
+            this.ioOut1.Location = new System.Drawing.Point(145, 18);
+            this.ioOut1.Name = "ioOut1";
+            this.ioOut1.Size = new System.Drawing.Size(90, 24);
+            this.ioOut1.TabIndex = 4;
             // 
             // ioOut15
             // 
             this.ioOut15.Desc = "OUT 15";
             this.ioOut15.IsOn = null;
-            this.ioOut15.Location = new System.Drawing.Point(306, 107);
+            this.ioOut15.Location = new System.Drawing.Point(477, 107);
             this.ioOut15.Name = "ioOut15";
             this.ioOut15.Size = new System.Drawing.Size(90, 24);
             this.ioOut15.TabIndex = 4;
@@ -160,7 +151,7 @@
             // 
             this.ioOut14.Desc = "OUT 14";
             this.ioOut14.IsOn = null;
-            this.ioOut14.Location = new System.Drawing.Point(145, 107);
+            this.ioOut14.Location = new System.Drawing.Point(306, 107);
             this.ioOut14.Name = "ioOut14";
             this.ioOut14.Size = new System.Drawing.Size(90, 24);
             this.ioOut14.TabIndex = 4;
@@ -169,25 +160,25 @@
             // 
             this.ioOut13.Desc = "OUT 13";
             this.ioOut13.IsOn = null;
-            this.ioOut13.Location = new System.Drawing.Point(9, 106);
+            this.ioOut13.Location = new System.Drawing.Point(145, 107);
             this.ioOut13.Name = "ioOut13";
             this.ioOut13.Size = new System.Drawing.Size(90, 24);
             this.ioOut13.TabIndex = 4;
             // 
-            // ioOut9
+            // ioOut12
             // 
-            this.ioOut9.Desc = "OUT 9";
-            this.ioOut9.IsOn = null;
-            this.ioOut9.Location = new System.Drawing.Point(9, 77);
-            this.ioOut9.Name = "ioOut9";
-            this.ioOut9.Size = new System.Drawing.Size(90, 24);
-            this.ioOut9.TabIndex = 4;
+            this.ioOut12.Desc = "OUT 12";
+            this.ioOut12.IsOn = null;
+            this.ioOut12.Location = new System.Drawing.Point(9, 106);
+            this.ioOut12.Name = "ioOut12";
+            this.ioOut12.Size = new System.Drawing.Size(90, 24);
+            this.ioOut12.TabIndex = 4;
             // 
             // ioOut8
             // 
             this.ioOut8.Desc = "OUT 8";
             this.ioOut8.IsOn = null;
-            this.ioOut8.Location = new System.Drawing.Point(477, 48);
+            this.ioOut8.Location = new System.Drawing.Point(9, 77);
             this.ioOut8.Name = "ioOut8";
             this.ioOut8.Size = new System.Drawing.Size(90, 24);
             this.ioOut8.TabIndex = 4;
@@ -196,25 +187,25 @@
             // 
             this.ioOut7.Desc = "OUT 7";
             this.ioOut7.IsOn = null;
-            this.ioOut7.Location = new System.Drawing.Point(306, 48);
+            this.ioOut7.Location = new System.Drawing.Point(477, 48);
             this.ioOut7.Name = "ioOut7";
             this.ioOut7.Size = new System.Drawing.Size(90, 24);
             this.ioOut7.TabIndex = 4;
             // 
-            // ioOut12
+            // ioOut6
             // 
-            this.ioOut12.Desc = "OUT 12";
-            this.ioOut12.IsOn = null;
-            this.ioOut12.Location = new System.Drawing.Point(477, 77);
-            this.ioOut12.Name = "ioOut12";
-            this.ioOut12.Size = new System.Drawing.Size(90, 24);
-            this.ioOut12.TabIndex = 4;
+            this.ioOut6.Desc = "OUT 6";
+            this.ioOut6.IsOn = null;
+            this.ioOut6.Location = new System.Drawing.Point(306, 48);
+            this.ioOut6.Name = "ioOut6";
+            this.ioOut6.Size = new System.Drawing.Size(90, 24);
+            this.ioOut6.TabIndex = 4;
             // 
             // ioOut11
             // 
             this.ioOut11.Desc = "OUT 11";
             this.ioOut11.IsOn = null;
-            this.ioOut11.Location = new System.Drawing.Point(306, 77);
+            this.ioOut11.Location = new System.Drawing.Point(477, 77);
             this.ioOut11.Name = "ioOut11";
             this.ioOut11.Size = new System.Drawing.Size(90, 24);
             this.ioOut11.TabIndex = 4;
@@ -223,56 +214,65 @@
             // 
             this.ioOut10.Desc = "OUT 10";
             this.ioOut10.IsOn = null;
-            this.ioOut10.Location = new System.Drawing.Point(145, 77);
+            this.ioOut10.Location = new System.Drawing.Point(306, 77);
             this.ioOut10.Name = "ioOut10";
             this.ioOut10.Size = new System.Drawing.Size(90, 24);
             this.ioOut10.TabIndex = 4;
             // 
-            // ioOut6
+            // ioOut9
             // 
-            this.ioOut6.Desc = "OUT 6";
-            this.ioOut6.IsOn = null;
-            this.ioOut6.Location = new System.Drawing.Point(145, 48);
-            this.ioOut6.Name = "ioOut6";
-            this.ioOut6.Size = new System.Drawing.Size(90, 24);
-            this.ioOut6.TabIndex = 4;
+            this.ioOut9.Desc = "OUT 9";
+            this.ioOut9.IsOn = null;
+            this.ioOut9.Location = new System.Drawing.Point(145, 77);
+            this.ioOut9.Name = "ioOut9";
+            this.ioOut9.Size = new System.Drawing.Size(90, 24);
+            this.ioOut9.TabIndex = 4;
             // 
             // ioOut5
             // 
             this.ioOut5.Desc = "OUT 5";
             this.ioOut5.IsOn = null;
-            this.ioOut5.Location = new System.Drawing.Point(9, 48);
+            this.ioOut5.Location = new System.Drawing.Point(145, 48);
             this.ioOut5.Name = "ioOut5";
             this.ioOut5.Size = new System.Drawing.Size(90, 24);
             this.ioOut5.TabIndex = 4;
             // 
-            // ioOut1
+            // ioOut4
             // 
-            this.ioOut1.Desc = "OUT 1";
-            this.ioOut1.IsOn = null;
-            this.ioOut1.Location = new System.Drawing.Point(9, 18);
-            this.ioOut1.Name = "ioOut1";
-            this.ioOut1.Size = new System.Drawing.Size(90, 24);
-            this.ioOut1.TabIndex = 4;
+            this.ioOut4.Desc = "OUT 4";
+            this.ioOut4.IsOn = null;
+            this.ioOut4.Location = new System.Drawing.Point(9, 48);
+            this.ioOut4.Name = "ioOut4";
+            this.ioOut4.Size = new System.Drawing.Size(90, 24);
+            this.ioOut4.TabIndex = 4;
+            // 
+            // ioOut0
+            // 
+            this.ioOut0.Desc = "OUT 0";
+            this.ioOut0.IsOn = null;
+            this.ioOut0.Location = new System.Drawing.Point(9, 18);
+            this.ioOut0.Name = "ioOut0";
+            this.ioOut0.Size = new System.Drawing.Size(90, 24);
+            this.ioOut0.TabIndex = 4;
             // 
             // groupBoxIOIn
             // 
-            this.groupBoxIOIn.Controls.Add(this.ioIn4);
             this.groupBoxIOIn.Controls.Add(this.ioIn3);
             this.groupBoxIOIn.Controls.Add(this.ioIn2);
-            this.groupBoxIOIn.Controls.Add(this.ioIn16);
+            this.groupBoxIOIn.Controls.Add(this.ioIn1);
             this.groupBoxIOIn.Controls.Add(this.ioIn15);
             this.groupBoxIOIn.Controls.Add(this.ioIn14);
             this.groupBoxIOIn.Controls.Add(this.ioIn13);
-            this.groupBoxIOIn.Controls.Add(this.ioIn9);
+            this.groupBoxIOIn.Controls.Add(this.ioIn12);
             this.groupBoxIOIn.Controls.Add(this.ioIn8);
             this.groupBoxIOIn.Controls.Add(this.ioIn7);
-            this.groupBoxIOIn.Controls.Add(this.ioIn12);
+            this.groupBoxIOIn.Controls.Add(this.ioIn6);
             this.groupBoxIOIn.Controls.Add(this.ioIn11);
             this.groupBoxIOIn.Controls.Add(this.ioIn10);
-            this.groupBoxIOIn.Controls.Add(this.ioIn6);
+            this.groupBoxIOIn.Controls.Add(this.ioIn9);
             this.groupBoxIOIn.Controls.Add(this.ioIn5);
-            this.groupBoxIOIn.Controls.Add(this.ioIn1);
+            this.groupBoxIOIn.Controls.Add(this.ioIn4);
+            this.groupBoxIOIn.Controls.Add(this.ioIn0);
             this.groupBoxIOIn.Dock = System.Windows.Forms.DockStyle.Fill;
             this.groupBoxIOIn.Location = new System.Drawing.Point(3, 3);
             this.groupBoxIOIn.Name = "groupBoxIOIn";
@@ -281,20 +281,11 @@
             this.groupBoxIOIn.TabStop = false;
             this.groupBoxIOIn.Text = "鏁板瓧閲忚緭鍏�";
             // 
-            // ioIn4
-            // 
-            this.ioIn4.Desc = "IN 4";
-            this.ioIn4.IsOn = null;
-            this.ioIn4.Location = new System.Drawing.Point(477, 18);
-            this.ioIn4.Name = "ioIn4";
-            this.ioIn4.Size = new System.Drawing.Size(90, 24);
-            this.ioIn4.TabIndex = 4;
-            // 
             // ioIn3
             // 
             this.ioIn3.Desc = "IN 3";
             this.ioIn3.IsOn = null;
-            this.ioIn3.Location = new System.Drawing.Point(306, 18);
+            this.ioIn3.Location = new System.Drawing.Point(477, 18);
             this.ioIn3.Name = "ioIn3";
             this.ioIn3.Size = new System.Drawing.Size(90, 24);
             this.ioIn3.TabIndex = 4;
@@ -303,25 +294,25 @@
             // 
             this.ioIn2.Desc = "IN 2";
             this.ioIn2.IsOn = null;
-            this.ioIn2.Location = new System.Drawing.Point(145, 18);
+            this.ioIn2.Location = new System.Drawing.Point(306, 18);
             this.ioIn2.Name = "ioIn2";
             this.ioIn2.Size = new System.Drawing.Size(90, 24);
             this.ioIn2.TabIndex = 4;
             // 
-            // ioIn16
+            // ioIn1
             // 
-            this.ioIn16.Desc = "IN 16";
-            this.ioIn16.IsOn = null;
-            this.ioIn16.Location = new System.Drawing.Point(477, 107);
-            this.ioIn16.Name = "ioIn16";
-            this.ioIn16.Size = new System.Drawing.Size(90, 24);
-            this.ioIn16.TabIndex = 4;
+            this.ioIn1.Desc = "IN 1";
+            this.ioIn1.IsOn = null;
+            this.ioIn1.Location = new System.Drawing.Point(145, 18);
+            this.ioIn1.Name = "ioIn1";
+            this.ioIn1.Size = new System.Drawing.Size(90, 24);
+            this.ioIn1.TabIndex = 4;
             // 
             // ioIn15
             // 
             this.ioIn15.Desc = "IN 15";
             this.ioIn15.IsOn = null;
-            this.ioIn15.Location = new System.Drawing.Point(306, 107);
+            this.ioIn15.Location = new System.Drawing.Point(477, 107);
             this.ioIn15.Name = "ioIn15";
             this.ioIn15.Size = new System.Drawing.Size(90, 24);
             this.ioIn15.TabIndex = 4;
@@ -330,7 +321,7 @@
             // 
             this.ioIn14.Desc = "IN 14";
             this.ioIn14.IsOn = null;
-            this.ioIn14.Location = new System.Drawing.Point(145, 107);
+            this.ioIn14.Location = new System.Drawing.Point(306, 107);
             this.ioIn14.Name = "ioIn14";
             this.ioIn14.Size = new System.Drawing.Size(90, 24);
             this.ioIn14.TabIndex = 4;
@@ -339,25 +330,25 @@
             // 
             this.ioIn13.Desc = "IN 13";
             this.ioIn13.IsOn = null;
-            this.ioIn13.Location = new System.Drawing.Point(9, 106);
+            this.ioIn13.Location = new System.Drawing.Point(145, 107);
             this.ioIn13.Name = "ioIn13";
             this.ioIn13.Size = new System.Drawing.Size(90, 24);
             this.ioIn13.TabIndex = 4;
             // 
-            // ioIn9
+            // ioIn12
             // 
-            this.ioIn9.Desc = "IN 9";
-            this.ioIn9.IsOn = null;
-            this.ioIn9.Location = new System.Drawing.Point(9, 77);
-            this.ioIn9.Name = "ioIn9";
-            this.ioIn9.Size = new System.Drawing.Size(90, 24);
-            this.ioIn9.TabIndex = 4;
+            this.ioIn12.Desc = "IN 12";
+            this.ioIn12.IsOn = null;
+            this.ioIn12.Location = new System.Drawing.Point(9, 106);
+            this.ioIn12.Name = "ioIn12";
+            this.ioIn12.Size = new System.Drawing.Size(90, 24);
+            this.ioIn12.TabIndex = 4;
             // 
             // ioIn8
             // 
             this.ioIn8.Desc = "IN 8";
             this.ioIn8.IsOn = null;
-            this.ioIn8.Location = new System.Drawing.Point(477, 48);
+            this.ioIn8.Location = new System.Drawing.Point(9, 77);
             this.ioIn8.Name = "ioIn8";
             this.ioIn8.Size = new System.Drawing.Size(90, 24);
             this.ioIn8.TabIndex = 4;
@@ -366,25 +357,25 @@
             // 
             this.ioIn7.Desc = "IN 7";
             this.ioIn7.IsOn = null;
-            this.ioIn7.Location = new System.Drawing.Point(306, 48);
+            this.ioIn7.Location = new System.Drawing.Point(477, 48);
             this.ioIn7.Name = "ioIn7";
             this.ioIn7.Size = new System.Drawing.Size(90, 24);
             this.ioIn7.TabIndex = 4;
             // 
-            // ioIn12
+            // ioIn6
             // 
-            this.ioIn12.Desc = "IN 12";
-            this.ioIn12.IsOn = null;
-            this.ioIn12.Location = new System.Drawing.Point(477, 77);
-            this.ioIn12.Name = "ioIn12";
-            this.ioIn12.Size = new System.Drawing.Size(90, 24);
-            this.ioIn12.TabIndex = 4;
+            this.ioIn6.Desc = "IN 6";
+            this.ioIn6.IsOn = null;
+            this.ioIn6.Location = new System.Drawing.Point(306, 48);
+            this.ioIn6.Name = "ioIn6";
+            this.ioIn6.Size = new System.Drawing.Size(90, 24);
+            this.ioIn6.TabIndex = 4;
             // 
             // ioIn11
             // 
             this.ioIn11.Desc = "IN 11";
             this.ioIn11.IsOn = null;
-            this.ioIn11.Location = new System.Drawing.Point(306, 77);
+            this.ioIn11.Location = new System.Drawing.Point(477, 77);
             this.ioIn11.Name = "ioIn11";
             this.ioIn11.Size = new System.Drawing.Size(90, 24);
             this.ioIn11.TabIndex = 4;
@@ -393,37 +384,46 @@
             // 
             this.ioIn10.Desc = "IN 10";
             this.ioIn10.IsOn = null;
-            this.ioIn10.Location = new System.Drawing.Point(145, 77);
+            this.ioIn10.Location = new System.Drawing.Point(306, 77);
             this.ioIn10.Name = "ioIn10";
             this.ioIn10.Size = new System.Drawing.Size(90, 24);
             this.ioIn10.TabIndex = 4;
             // 
-            // ioIn6
+            // ioIn9
             // 
-            this.ioIn6.Desc = "IN 6";
-            this.ioIn6.IsOn = null;
-            this.ioIn6.Location = new System.Drawing.Point(145, 48);
-            this.ioIn6.Name = "ioIn6";
-            this.ioIn6.Size = new System.Drawing.Size(90, 24);
-            this.ioIn6.TabIndex = 4;
+            this.ioIn9.Desc = "IN 9";
+            this.ioIn9.IsOn = null;
+            this.ioIn9.Location = new System.Drawing.Point(145, 77);
+            this.ioIn9.Name = "ioIn9";
+            this.ioIn9.Size = new System.Drawing.Size(90, 24);
+            this.ioIn9.TabIndex = 4;
             // 
             // ioIn5
             // 
             this.ioIn5.Desc = "IN 5";
             this.ioIn5.IsOn = null;
-            this.ioIn5.Location = new System.Drawing.Point(9, 48);
+            this.ioIn5.Location = new System.Drawing.Point(145, 48);
             this.ioIn5.Name = "ioIn5";
             this.ioIn5.Size = new System.Drawing.Size(90, 24);
             this.ioIn5.TabIndex = 4;
             // 
-            // ioIn1
+            // ioIn4
             // 
-            this.ioIn1.Desc = "IN 1";
-            this.ioIn1.IsOn = null;
-            this.ioIn1.Location = new System.Drawing.Point(9, 18);
-            this.ioIn1.Name = "ioIn1";
-            this.ioIn1.Size = new System.Drawing.Size(90, 24);
-            this.ioIn1.TabIndex = 4;
+            this.ioIn4.Desc = "IN 4";
+            this.ioIn4.IsOn = null;
+            this.ioIn4.Location = new System.Drawing.Point(9, 48);
+            this.ioIn4.Name = "ioIn4";
+            this.ioIn4.Size = new System.Drawing.Size(90, 24);
+            this.ioIn4.TabIndex = 4;
+            // 
+            // ioIn0
+            // 
+            this.ioIn0.Desc = "IN 0";
+            this.ioIn0.IsOn = null;
+            this.ioIn0.Location = new System.Drawing.Point(9, 18);
+            this.ioIn0.Name = "ioIn0";
+            this.ioIn0.Size = new System.Drawing.Size(90, 24);
+            this.ioIn0.TabIndex = 4;
             // 
             // timerIOStatus
             // 
@@ -449,39 +449,39 @@
 
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
         private System.Windows.Forms.GroupBox groupBoxIOIn;
-        private Model.Winform.IOIndicatorCtrl ioIn4;
         private Model.Winform.IOIndicatorCtrl ioIn3;
         private Model.Winform.IOIndicatorCtrl ioIn2;
-        private Model.Winform.IOIndicatorCtrl ioIn16;
+        private Model.Winform.IOIndicatorCtrl ioIn1;
         private Model.Winform.IOIndicatorCtrl ioIn15;
         private Model.Winform.IOIndicatorCtrl ioIn14;
         private Model.Winform.IOIndicatorCtrl ioIn13;
-        private Model.Winform.IOIndicatorCtrl ioIn9;
+        private Model.Winform.IOIndicatorCtrl ioIn12;
         private Model.Winform.IOIndicatorCtrl ioIn8;
         private Model.Winform.IOIndicatorCtrl ioIn7;
-        private Model.Winform.IOIndicatorCtrl ioIn12;
+        private Model.Winform.IOIndicatorCtrl ioIn6;
         private Model.Winform.IOIndicatorCtrl ioIn11;
         private Model.Winform.IOIndicatorCtrl ioIn10;
-        private Model.Winform.IOIndicatorCtrl ioIn6;
+        private Model.Winform.IOIndicatorCtrl ioIn9;
         private Model.Winform.IOIndicatorCtrl ioIn5;
-        private Model.Winform.IOIndicatorCtrl ioIn1;
+        private Model.Winform.IOIndicatorCtrl ioIn4;
+        private Model.Winform.IOIndicatorCtrl ioIn0;
         private System.Windows.Forms.GroupBox groupBoxIOOut;
-        private Model.Winform.IOIndicatorCtrl ioOut4;
         private Model.Winform.IOIndicatorCtrl ioOut3;
         private Model.Winform.IOIndicatorCtrl ioOut2;
-        private Model.Winform.IOIndicatorCtrl ioOut16;
+        private Model.Winform.IOIndicatorCtrl ioOut1;
         private Model.Winform.IOIndicatorCtrl ioOut15;
         private Model.Winform.IOIndicatorCtrl ioOut14;
         private Model.Winform.IOIndicatorCtrl ioOut13;
-        private Model.Winform.IOIndicatorCtrl ioOut9;
+        private Model.Winform.IOIndicatorCtrl ioOut12;
         private Model.Winform.IOIndicatorCtrl ioOut8;
         private Model.Winform.IOIndicatorCtrl ioOut7;
-        private Model.Winform.IOIndicatorCtrl ioOut12;
+        private Model.Winform.IOIndicatorCtrl ioOut6;
         private Model.Winform.IOIndicatorCtrl ioOut11;
         private Model.Winform.IOIndicatorCtrl ioOut10;
-        private Model.Winform.IOIndicatorCtrl ioOut6;
+        private Model.Winform.IOIndicatorCtrl ioOut9;
         private Model.Winform.IOIndicatorCtrl ioOut5;
-        private Model.Winform.IOIndicatorCtrl ioOut1;
+        private Model.Winform.IOIndicatorCtrl ioOut4;
+        private Model.Winform.IOIndicatorCtrl ioOut0;
         private System.Windows.Forms.Timer timerIOStatus;
     }
 }
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs
index 103622f..528ef6b 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.cs
@@ -31,11 +31,10 @@
             get => Device as MotionCardBase;
         }
 
-        public CtrlMotionCardIOStatus(IDevice device, List<IOItem> monitorValues)
+        public CtrlMotionCardIOStatus(IDevice device)
         {
             InitializeComponent();
             Device = device;
-            _monitorValues = monitorValues;
             InitIOEvent();
         }
 
@@ -51,14 +50,15 @@
             }
         }
 
-        private void IoOut_DoubleClick(string desc, bool isOn)
+        private void IoOut_DoubleClick(string name, bool isOn)
         {
-            var index = Convert.ToInt16(desc.Substring(3));
-            MotionCard.WriteOutput(index, isOn ? IOValue.FALSE : IOValue.TRUE);
+            var index = Convert.ToInt16(name.Substring(6));
+            MotionCard.WriteOutput(index, isOn ? IOValue.TRUE : IOValue.FALSE);
         }
 
         private void RefreshIOStatus(object sender, EventArgs e)
         {
+            _monitorValues = MotionCard.MonitorValues;
             foreach (var ioItem in _monitorValues)
             {
                 if (ioItem.IOType == Common.Helper.EnumHelper.IOType.INPUT)
@@ -67,7 +67,7 @@
                     if (ioInArray != null && ioInArray.Length == 1)
                     {
                         var ioIn = ioInArray[0] as IOIndicatorCtrl;
-                        ioIn.IsOn = ioItem.Value == IOValue.TRUE;
+                        ioIn.IsOn = ioItem.Value == IOValue.FALSE;
                     }
                 }
                 else
@@ -76,7 +76,7 @@
                     if (ioOutArray != null && ioOutArray.Length == 1)
                     {
                         var ioOut = ioOutArray[0] as IOIndicatorCtrl;
-                        ioOut.IsOn = ioItem.Value == IOValue.TRUE;
+                        ioOut.IsOn = ioItem.Value == IOValue.FALSE;
                     }
                 }
             }
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs
index f497998..279648c 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs
@@ -44,16 +44,11 @@
         {
             foreach (var axisConfig in MotionCard.IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled))
             {
-                var axisMovingStatus = MotionCard.AxisStatusList.FirstOrDefault(u => u.AxisIndex == axisConfig.AxisIndex);
-                if (axisMovingStatus == null)
-                {
-                    axisMovingStatus = new AxisMovingStatus();
-                }
-                CtrlMotionCardAxisStatus ctrlMotionCardAxisStatus = new CtrlMotionCardAxisStatus(axisMovingStatus);
+                CtrlMotionCardAxisStatus ctrlMotionCardAxisStatus = new CtrlMotionCardAxisStatus(Device,axisConfig.AxisIndex, axisConfig.AxisName);
                 flowLayoutPanel1.Controls.Add(ctrlMotionCardAxisStatus);
             }
 
-            CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus(Device, MotionCard.MonitorValues);
+            CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus(Device);
             flowLayoutPanel2.Controls.Add(ctrlMotionCardIOStatus);
         }
 
diff --git a/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs b/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs
index 3713aed..bfc2bf7 100644
--- a/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs
+++ b/src/Bro.UI.Model.Winform/UI/Ctrl/IOIndicatorCtrl.cs
@@ -108,7 +108,7 @@
         {
             if (IsOn != null)
             {
-                OnIODoubleClick?.Invoke(Desc,IsOn.Value);
+                OnIODoubleClick?.Invoke(Name,IsOn.Value);
             }
         }
 
@@ -116,7 +116,7 @@
         {
             if (IsOn != null)
             {
-                OnIODoubleClick?.Invoke(Desc, IsOn.Value);
+                OnIODoubleClick?.Invoke(Name, IsOn.Value);
             }
         }
     }

--
Gitblit v1.8.0