From 8527a31907a30c1b9f15dae1e0bdcf76e7e1f123 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期四, 02 七月 2020 17:29:09 +0800 Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071 --- src/Bro.Device.GTSCard/GTSCardDriver.cs | 13 src/Bro.Common.Model/Helper/PropertyConvertHelper.cs | 79 ++ src/Bro.Common.Device/DeviceBase/MotionCardBase.cs | 140 ++++ src/Bro.Common.Model/Model/MonitorSet.cs | 2 src/Bro.Common.Model/Model/IOItem.cs | 51 + src/Bro.Common.Model/Base/DeviceConfigBase.cs | 4 src/Bro.Common.Model/Bro.Common.Model.csproj | 1 src/Bro.Common.Model/Interface/IOperationConfig.cs | 5 src/Bro.Common.Model/Helper/EnumHelper.cs | 2 src/Bro.Device.GTSCard/GTSCardConfig.cs | 990 ++++++++++++++++---------------- src/Bro.M071.Process/M071Process.cs | 2 src/Bro.Common.Device/Bro.Common.Device.csproj | 1 src/Bro.Common.Model/Model/WarningSet.cs | 2 src/Bro.Common.Model/Model/MotionCardRelated.cs | 502 ++++++++++++++++ 14 files changed, 1,284 insertions(+), 510 deletions(-) diff --git a/src/Bro.Common.Device/Bro.Common.Device.csproj b/src/Bro.Common.Device/Bro.Common.Device.csproj index bc55f15..be2d2f8 100644 --- a/src/Bro.Common.Device/Bro.Common.Device.csproj +++ b/src/Bro.Common.Device/Bro.Common.Device.csproj @@ -115,6 +115,7 @@ <Compile Include="Base\DeviceBase.cs" /> <Compile Include="DeviceBase\CameraBase.cs" /> <Compile Include="DeviceBase\HDevEngineTool.cs" /> + <Compile Include="DeviceBase\MotionCardBase.cs" /> <Compile Include="DeviceBase\PLCBase.cs" /> <Compile Include="Helper\AspectHelper.cs" /> <Compile Include="Helper\HalconHelper.cs" /> diff --git a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs new file mode 100644 index 0000000..4425373 --- /dev/null +++ b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs @@ -0,0 +1,140 @@ +锘縰sing Bro.Common.Helper; +using Bro.Common.Interface; +using Bro.Common.Model; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing.Design; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Bro.Common.Base +{ + public abstract class MotionCardBase : DeviceBase, IMonitor, IMotionCard + { + public event Action<DateTime, string, IDevice, IMonitorSet> OnMonitorInvoke; + public event Action<DateTime, IDevice, IWarningSet> OnMonitorAlarm; + + public abstract List<AxisInfo> GetCurrentAxisInfo(params string[] axisName); + public abstract void Monitor(); + public abstract ResponseMessage MoveToPoint(IOperationConfig opConfig); + public abstract void ResetAlarm(); + public abstract ResponseMessage Run(IOperationConfig config); + } + + public class MotionCardInitialConfigBase : InitialConfigBase, IMonitorConfig + { + [Category("鏉垮崱閰嶇疆")] + [DisplayName("鍗″彿")] + [Description("CardNum锛氬崱鍙�")] + public int CardNum { get; set; } + + [Category("鏉垮崱閰嶇疆")] + [DisplayName("鍒濆閰嶇疆鏂囦欢璺緞")] + [Description("InitialConfigFilePath锛氬垵濮嬮厤缃枃浠惰矾寰�")] + [Editor(typeof(FileDialogEditor), typeof(UITypeEditor))] + public string InitialConfigFilePath { get; set; } + + [Category("杞撮厤缃�")] + [DisplayName("杞存暟閲�")] + [Description("AxisNum锛氳酱鏁伴噺")] + public int AxisNum { get; set; } = 4; + + [Category("杞撮厤缃�")] + [DisplayName("杞撮厤缃俊鎭泦鍚�")] + [Description("AxisSettings锛氳酱閰嶇疆淇℃伅闆嗗悎")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<AxisSetting>), typeof(UITypeEditor))] + public List<AxisSetting> AxisSettings { get; set; } = new List<AxisSetting>(); + + [Category("杞撮厤缃�")] + [DisplayName("杞撮�熷害姣旂巼")] + [Description("AxisVelocityRatio锛氳酱閫熷害姣旂巼")] + public double AxisVelocityRatio { get; set; } = 1; + + //[Category("寤舵椂閰嶇疆")] + //[DisplayName("鍔ㄤ綔瀹屾垚鍚庡欢杩�")] + //[Description("ActionAfterDelay锛氬姩浣滃畬鎴愬悗寤惰繜")] + //public int ActionAfterDelay { get; set; } = 100; + + [Category("璀︽姤閰嶇疆")] + [Description("WarningSetCollection锛氳鎶ラ厤缃垪琛�")] + [DisplayName("璀︽姤閰嶇疆")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(WarningSetsEditor), typeof(UITypeEditor))] + public List<IWarningSet> WarningSetCollection { get; set; } = new List<IWarningSet>(); + + [Category("IO閰嶇疆")] + [Description("IO瀹氫箟闆嗗悎")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<IODefinition>), typeof(UITypeEditor))] + public List<IODefinition> IODefinitionCollection { get; set; } = new List<IODefinition>(); + + #region IMonitorConfig + [Category("鐩戝惉璁剧疆")] + [Description("MonitorSetCollection锛氱洃鍚搷浣滈厤缃泦鍚�")] + [DisplayName("鐩戝惉閰嶇疆")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<MotionCardMonitorSet>), typeof(UITypeEditor))] + public List<IMonitorSet> MonitorSetCollection { get; set; } = new List<IMonitorSet>(); + + [Category("鐩戝惉璁剧疆")] + [Description("true锛氬惎鍔ㄧ洃鍚� false锛氬叧闂洃鍚�")] + [DisplayName("鐩戝惉鍚敤")] + public bool IsEnableMonitor { get; set; } = true; + + [Category("鐩戝惉璁剧疆")] + [Description("鎵弿闂撮殧鏃堕棿锛屽崟浣嶏細ms")] + [DisplayName("鎵弿闂撮殧")] + public int MonitorInterval { get; set; } = 10; + + [Category("鐩戝惉璁剧疆")] + [Description("瓒呮椂璁剧疆锛屽崟浣嶏細ms")] + [DisplayName("鐩戝惉瓒呮椂")] + public int MonitorTimeout { get; set; } = 500; + + public List<IMonitorSet> GetAllMonitorSet() + { + WarningSetCollection.ForEach(m => m.Source = this.Name); + + MonitorSetCollection.ForEach(m => m.SourceDevice = this.Id); + return MonitorSetCollection; + } + #endregion + } + + public class MotionCardOperationConfigBase : OperationConfigBase, IComplexDisplay + { + [Category("IO鎿嶄綔閰嶇疆")] + [Description("IO棰勬鏌ュ畾涔夐泦鍚�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(IORefrenceItemCollectionEditor),typeof(UITypeEditor))] + public List<IORefrenceItem> PreCheckIOCollection { get; set; } = new List<IORefrenceItem>(); + + [Category("IO鎿嶄綔閰嶇疆")] + [Description("IO杈撳嚭瀹氫箟闆嗗悎")] + [TypeConverter(typeof(CollectionCountConvert))] + public List<IORefrenceItem> IOOutputCollection { get; set; } = new List<IORefrenceItem>(); + + [Category("IO鎿嶄綔閰嶇疆")] + [Description("IO纭瀹氫箟闆嗗悎")] + [TypeConverter(typeof(CollectionCountConvert))] + public List<IORefrenceItem> IOConfirmCollection { get; set; } = new List<IORefrenceItem>(); + + [Category("鏉垮崱杩愬姩閰嶇疆")] + [DisplayName("杩愬姩閰嶇疆闆嗗悎")] + [Description("MovingOps锛氳繍鍔ㄩ厤缃泦鍚�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<MovingOption>), typeof(UITypeEditor))] + public List<MovingOption> MovingOps { get; set; } = new List<MovingOption>(); + + public string GetDisplayText() + { + throw new NotImplementedException(); + } + } + + +} diff --git a/src/Bro.Common.Model/Base/DeviceConfigBase.cs b/src/Bro.Common.Model/Base/DeviceConfigBase.cs index ed25a43..d6c3658 100644 --- a/src/Bro.Common.Model/Base/DeviceConfigBase.cs +++ b/src/Bro.Common.Model/Base/DeviceConfigBase.cs @@ -39,6 +39,10 @@ [Browsable(false)] public string MonitorSetId { get; set; } = ""; + + [Browsable(false)] + [JsonIgnore] + public virtual string DeviceId { get; set; } = ""; } public class InitialConfigBase : IInitialConfig diff --git a/src/Bro.Common.Model/Bro.Common.Model.csproj b/src/Bro.Common.Model/Bro.Common.Model.csproj index de64a2e..a66632a 100644 --- a/src/Bro.Common.Model/Bro.Common.Model.csproj +++ b/src/Bro.Common.Model/Bro.Common.Model.csproj @@ -153,6 +153,7 @@ <Compile Include="Model\DeviceOpBind.cs" /> <Compile Include="Model\ModbusFrame.cs" /> <Compile Include="Model\MonitorSet.cs" /> + <Compile Include="Model\MotionCardRelated.cs" /> <Compile Include="Model\PageRequest.cs" /> <Compile Include="Model\IOItem.cs" /> <Compile Include="Model\PLCItem.cs" /> diff --git a/src/Bro.Common.Model/Helper/EnumHelper.cs b/src/Bro.Common.Model/Helper/EnumHelper.cs index 905013c..07c890b 100644 --- a/src/Bro.Common.Model/Helper/EnumHelper.cs +++ b/src/Bro.Common.Model/Helper/EnumHelper.cs @@ -587,7 +587,7 @@ /// <summary> /// 杩愬姩鏉垮崱 IO 绫诲瀷锛圛N OUT锛� /// </summary> - public enum IOModel + public enum IOType { [Description("In杈撳叆")] In = 0, diff --git a/src/Bro.Common.Model/Helper/PropertyConvertHelper.cs b/src/Bro.Common.Model/Helper/PropertyConvertHelper.cs index 71787f8..6dc252c 100644 --- a/src/Bro.Common.Model/Helper/PropertyConvertHelper.cs +++ b/src/Bro.Common.Model/Helper/PropertyConvertHelper.cs @@ -1,5 +1,6 @@ 锘縰sing Bro.Common.Factory; using Bro.Common.Interface; +using Bro.Common.Model; using Newtonsoft.Json; using System; using System.Collections; @@ -915,6 +916,84 @@ return base.EditValue(context, provider, value); } } + + public class IORefrenceItemCollectionEditor : CollectionEditor + { + protected override CollectionForm CreateCollectionForm() + { + var form = base.CreateCollectionForm(); + + var prop = form.GetType().GetField("propertyBrowser", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + + if (prop != null) + { + if (prop.GetValue(form) is PropertyGrid grid) + { + grid.HelpVisible = true; + grid.ToolbarVisible = false; + } + } + + return form; + } + + //protected override object CreateInstance(Type itemType) + //{ + // return base.CreateInstance(itemType); + //} + + //protected override object[] GetItems(object editValue) + //{ + // return base.GetItems(editValue); + //} + + //protected override object SetItems(object editValue, object[] value) + //{ + // return base.SetItems(editValue, value); + //} + + public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) + { + return base.EditValue(context, provider, value); + } + + public IORefrenceItemCollectionEditor(Type type) : base(type) + { + } + + /// <summary> + /// 闄愬埗涓�娆¢�変竴涓疄渚� + /// </summary> + /// <returns></returns> + protected override bool CanSelectMultipleInstances() + { + return false; + } + + /// <summary> + /// 鎸囧畾鍒涘缓鐨勫璞$被鍨� + /// </summary> + /// <returns></returns> + protected override Type CreateCollectionItemType() + { + return typeof(IORefrenceItem); + } + + protected override string GetDisplayText(object value) + { + if (value is IComplexDisplay) + { + return (value as IComplexDisplay).GetDisplayText(); + } + + return base.GetDisplayText(value); + } + + //protected override void DestroyInstance(object instance) + //{ + // base.DestroyInstance(instance);//閲嶈锛佽嚜鍔ㄥ垹闄ょ粍浠剁殑璁捐鏃朵唬鐮侊紒 + //} + } #endregion } diff --git a/src/Bro.Common.Model/Interface/IOperationConfig.cs b/src/Bro.Common.Model/Interface/IOperationConfig.cs index 4ce0c65..9a70cf6 100644 --- a/src/Bro.Common.Model/Interface/IOperationConfig.cs +++ b/src/Bro.Common.Model/Interface/IOperationConfig.cs @@ -26,5 +26,10 @@ /// 鎸囩ず璇ユ搷浣滅殑鐩戣閰嶇疆鏉ユ簮 /// </summary> string MonitorSetId { get; set; } + + /// <summary> + /// 璋冪敤璇ユ搷浣滈厤缃殑璁惧Id + /// </summary> + string DeviceId { get; set; } } } diff --git a/src/Bro.Common.Model/Model/IOItem.cs b/src/Bro.Common.Model/Model/IOItem.cs index 64a2bca..11283eb 100644 --- a/src/Bro.Common.Model/Model/IOItem.cs +++ b/src/Bro.Common.Model/Model/IOItem.cs @@ -1,6 +1,8 @@ 锘縰sing Bro.Common.Helper; +using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.ComponentModel; using static Bro.Common.Helper.EnumHelper; namespace Bro.Common.Model @@ -10,21 +12,62 @@ /// <summary> /// IO鐐圭紪鍙� /// </summary> - public int IONum { get; set; } + [Category("IO閰嶇疆")] + [Description("IO鐐圭紪鍙�")] + public virtual int IONum { get; set; } /// <summary> /// IO鐐圭殑鍊� /// </summary> - public int Value { get; set; } + [Category("IO閰嶇疆")] + [Description("IO鏁板��")] + public virtual int Value { get; set; } /// <summary> /// IO鐐规槸in杩樻槸out /// </summary> - public IOModel Model { get; set; } + [Category("IO閰嶇疆")] + [Description("IO绫诲瀷")] + public virtual IOType IOType { get; set; } public string GetDisplayText() { - return $"{Model.GetEnumDescription()},缂栧彿{IONum}锛孖O鐐圭殑鍊納Value}"; + return $"{IOType.GetEnumDescription()},缂栧彿{IONum}锛孖O鐐圭殑鍊納Value}"; } } + + public class IODefinition : IOItem + { + [Category("IO閰嶇疆")] + [Description("IO鐢ㄩ�旀弿杩�")] + public string IODesc { get; set; } + + [Category("IO閰嶇疆")] + [Description("澶囨敞璇存槑")] + public string Remark { get; set; } + + [Browsable(false)] + [JsonIgnore] + public override int Value { get; set; } + + public new string GetDisplayText() + { + return $"{IODesc} {IOType.GetEnumDescription()} {IONum}"; + } + } + + public class IORefrenceItem + { + [Category("IO鎿嶄綔閰嶇疆")] + [Description("闇�瑕佹搷浣滅殑IO")] + public IOItem IOItem { get; set; } = new IOItem(); + + [Category("IO鎿嶄綔閰嶇疆")] + [Description("闇�瑕佹搷浣滅殑IO鐨勬暟鍊�")] + public int CheckValue { get => IOItem.Value; set => IOItem.Value = value; } + + [Browsable(false)] + [JsonIgnore] + public List<IODefinition> IOItemSource { get; set; } = new List<IODefinition>(); + } } diff --git a/src/Bro.Common.Model/Model/MonitorSet.cs b/src/Bro.Common.Model/Model/MonitorSet.cs index 9635218..ce109aa 100644 --- a/src/Bro.Common.Model/Model/MonitorSet.cs +++ b/src/Bro.Common.Model/Model/MonitorSet.cs @@ -188,7 +188,7 @@ [Category("鐩戝惉璁剧疆")] [DisplayName("鐩戝惉绫诲瀷")] [Description("鐩戝惉杩愬姩鏉垮崱 IO 绫诲瀷锛圛N OUT锛�")] - public IOModel MonitorIOModel { get; set; } + public IOType MonitorIOModel { get; set; } /// <summary> /// 鐩戝惉鍦板潃绱㈠紩 diff --git a/src/Bro.Common.Model/Model/MotionCardRelated.cs b/src/Bro.Common.Model/Model/MotionCardRelated.cs new file mode 100644 index 0000000..5b4f5ac --- /dev/null +++ b/src/Bro.Common.Model/Model/MotionCardRelated.cs @@ -0,0 +1,502 @@ +锘縰sing Bro.Common.Helper; +using Newtonsoft.Json; +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.Common.Model +{ + /// <summary> + /// 杞撮厤缃� + /// </summary> + public class AxisSetting : IComplexDisplay + { + [Category("杞撮厤缃�")] + [DisplayName("杞村彿绱㈠紩")] + [Description("AxisIndex锛氳酱鍙风储寮�")] + public int AxisIndex { get; set; } + + [Category("杞撮厤缃�")] + [DisplayName("杞村悕绉�")] + [Description("AxisName锛氳酱鍚嶇О")] + public string AxisName { get; set; } + + [Category("杞撮厤缃�")] + [DisplayName("杞存槸鍚﹀惎鐢�")] + [Description("IsAxisEnabled锛氳酱鏄惁鍚敤")] + public bool IsAxisEnabled { get; set; } = false; + + [Category("鎹㈢畻閰嶇疆")] + [DisplayName("鑴夊啿鏁版崲绠楁瘮渚�")] + [Description("鑴夊啿鏁板拰鍏朵粬璁¢噺鍗曚綅鐨勬崲绠楁瘮渚嬶紝渚嬪璁剧疆涓�1000锛岃〃绀�1000涓剦鍐茬瓑浜�1uint")] + public int PulseRatio { get; set; } = 1; + + [Category("閫熷害閰嶇疆")] + [DisplayName("榛樿閫熷害鍙傛暟")] + [Description("VelocityPara锛氶粯璁ら�熷害鍙傛暟")] + [TypeConverter(typeof(ComplexObjectConvert))] + [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + public VelocityPara VelocityPara { get; set; } = new VelocityPara(); + + [Category("鍥炲師鐐硅缃�")] + [DisplayName("鍥炲師鐐规ā寮�")] + [Description("HomeMode锛氬洖鍘熺偣妯″紡銆�0锛氫竴鑸ā寮� 1锛氭瀬闄愰檺浣嶆ā寮� 2锛氬閮ㄨЕ鍙戞ā寮�")] + public int HomeMode { get; set; } = 0; + + [Category("鍥炲師鐐硅缃�")] + [DisplayName("鍥炲師鐐规柟鍚�")] + [Description("IsHomePositive锛氬洖鍘熺偣鏂瑰悜銆� true锛氭鏂瑰悜寮�濮� false锛氳礋鏂瑰悜寮�濮�")] + public bool IsHomePositive { get; set; } = true; + + [Category("鍥炲師鐐硅缃�")] + [DisplayName("鏄惁鑷姩鍥炲師鐐�")] + [Description("IsAutoGoHome锛氭槸鍚﹁嚜鍔ㄥ洖鍘熺偣銆� true锛氭槸 false锛氬惁")] + public bool IsAutoGoHome { get; set; } = false; + + [Category("瓒呮椂璁剧疆")] + [DisplayName("鍥炲師鐐硅秴鏃�")] + [Description("TimeOutHome锛氬洖鍘熺偣瓒呮椂锛屽崟浣嶆绉�")] + public int TimeOutHome { get; set; } = 30000; + + [Category("瓒呮椂璁剧疆")] + [DisplayName("杩愬姩瓒呮椂")] + [Description("TimeOutMove锛氳繍鍔ㄨ秴鏃讹紝鍗曚綅姣")] + public int TimeOutMove { get; set; } = 10000; + + [Category("寮�闂幆璁剧疆")] + [DisplayName("鏄惁浣跨敤Cmmd鍥為")] + [Description("IsUseCmmdPosition锛氭槸鍚︿娇鐢–mmd鍥為")] + public bool IsUseCmmdPosition { get; set; } = false; + + [Category("寮�闂幆璁剧疆")] + [DisplayName("鏄惁浣跨敤鏉垮崱鍙嶉鍋滄淇″彿")] + [Description("IsUseMDNStopSignal锛氭槸鍚︿娇鐢ㄦ澘鍗″弽棣堝仠姝俊鍙�")] + public bool IsUseMDNStopSignal { get; set; } = false; + + [Category("寮�闂幆璁剧疆")] + [DisplayName("鏄惁鍚敤鎶ヨ")] + [Description("IsUseWarning锛氭槸鍚﹀惎鐢ㄦ姤璀�")] + public bool IsUseWarning { get; set; } = false; + + [Category("鏆傚仠閰嶇疆")] + [DisplayName("鏄惁鍚敤绔嬪嵆鏆傚仠")] + [Description("IsImmediatePause锛氭槸鍚﹀惎鐢ㄧ珛鍗虫殏鍋�")] + public bool IsImmediatePause { get; set; } = false; + + [Category("鏆傚仠閰嶇疆")] + [DisplayName("杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] + [Description("ImmediatePauseSections锛氬綋杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<Section>), typeof(UITypeEditor))] + public List<Section> ImmediatePauseSections { get; set; } = new List<Section>(); + + public string GetDisplayText() + { + return AxisIndex + "-" + AxisName + "-" + (IsAxisEnabled ? "鍚敤" : "绂佺敤"); + } + } + + /// <summary> + /// 浣嶇疆瀵硅薄 + /// </summary> + public class Section : IComplexDisplay + { + [Category("鏆傚仠鍖洪棿")] + [DisplayName("璧峰浣嶇疆")] + [Description("StartPosition锛氳捣濮嬩綅缃�")] + public int StartPosition { get; set; } + + [Category("鏆傚仠鍖洪棿")] + [DisplayName("缁撴潫浣嶇疆")] + [Description("EndPosition锛氱粨鏉熶綅缃�")] + public int EndPosition { get; set; } + + public string GetDisplayText() + { + return $"{StartPosition}--{EndPosition}"; + } + } + + /// <summary> + /// 閫熷害鍙傛暟瀵硅薄 + /// </summary> + public class VelocityPara + { + [Category("閫熷害閰嶇疆")] + [DisplayName("閫熷害")] + [Description("Velocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double Velocity { get; set; } = 0; + + [Category("閫熷害閰嶇疆")] + [DisplayName("鍔犻�熷害")] + [Description("Acc锛氬姞閫熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double Acc { get; set; } = 1; + + [Category("閫熷害閰嶇疆")] + [DisplayName("鍑忛�熷害")] + [Description("鍑忛�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double Dec { get; set; } = 1; + } + + /// <summary> + /// 鍥炲師鐐瑰弬鏁板璞� + /// </summary> + public class GoHomePara + { + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规柟寮�")] + [Description("HomeMode锛氬洖鍘熺偣鏂瑰紡 锛圚OME_MODE_LIMIT = 10; HOME_MODE_LIMIT_HOME = 11; HOME_MODE_LIMIT_INDEX = 12; HOME_MODE_LIMIT_HOME_INDEX = 13;HOME_MODE_HOME = 20;HOME_MODE_HOME_INDEX = 22;HOME_MODE_INDEX = 30;")] + public short HomeMode { get; set; } = 11; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规柟鍚�")] + [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] + public short HomeDir { get; set; } = 1; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规柟鍚�")] + [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] + public short Edge { get; set; } = 0; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规渶浣庨�熷害")] + [Description("LowVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double LowVelocity { get; set; } = 50; + + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍥炲師鐐规渶楂橀�熷害")] + [Description("HighVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + public double HighVelocity { get; set; } = 50; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鎼滄悳璺濈")] + [Description("SearchHomeDistance锛氭悳鎼滆窛绂�")] + public int SearchHomeDistance { get; set; } = 9999999; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("鍋忕Щ璺濈")] + [Description("HomeOffset锛氬亸绉昏窛绂�")] + public int HomeOffset { get; set; } = 0; + + [Category("鍥炲師鐐瑰弬鏁�")] + [DisplayName("璺宠繃姝ラ暱")] + [Description("EscapeStep锛氳烦杩囨闀�")] + public int EscapeStep { get; set; } = 1000; + + } + + /// <summary> + /// 杩愬姩瀵硅薄 + /// </summary> + public class MovingOption : INotifyPropertyChanged, IComplexDisplay + { + private int axisIndex = 0; + [Category("杩愬姩閰嶇疆")] + [DisplayName("杩愬姩杞寸储寮�")] + [Description("AxisIndex锛氳繍鍔ㄨ酱绱㈠紩")] + [TypeConverter(typeof(AxisIndexConvert))] + public int AxisIndex + { + get => axisIndex; + set + { + if (axisIndex != value) + { + axisIndex = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("AxisIndex")); + } + axisIndex = value; + } + } + + private MotorMoveMode moveMode = MotorMoveMode.Normal; + [Category("杩愬姩閰嶇疆")] + [DisplayName("杩愬姩妯″紡")] + [Description("MoveMode锛氳繍鍔ㄦā寮�")] + public MotorMoveMode MoveMode + { + get => moveMode; + set + { + if (moveMode != value) + { + moveMode = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MoveMode")); + } + + moveMode = value; + } + } + + private bool isAbsolute = true; + [Category("杩愬姩閰嶇疆")] + [DisplayName("鏄惁缁濆杩愬姩")] + [Description("IsAbsolute锛氭槸鍚︾粷瀵硅繍鍔�")] + public bool IsAbsolute + { + get => isAbsolute; + set + { + if (isAbsolute != value) + { + isAbsolute = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsAbsolute")); + } + + isAbsolute = value; + } + } + + private int destination = 0; + [Category("杩愬姩閰嶇疆")] + [DisplayName("鐩殑鍦�")] + [Description("Destination锛氱洰鐨勫湴")] + public int Destination + { + get => destination; + set + { + if (destination != value) + { + destination = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Destination")); + } + + destination = value; + } + } + + private VelocityPara velocityPara = new VelocityPara(); + [Category("杩愬姩閰嶇疆")] + [DisplayName("閫熷害鍙傛暟")] + [Description("VelocityPara锛氶�熷害鍙傛暟")] + [TypeConverter(typeof(ComplexObjectConvert))] + [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + public VelocityPara VelocityPara + { + get => velocityPara; + set + { + velocityPara = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("VelocityPara")); + } + } + + private GoHomePara goHomePara = new GoHomePara(); + [Category("杩愬姩閰嶇疆")] + [DisplayName("鍥炲師鐐瑰弬鏁�")] + [Description("GoHomePara锛氶�熷害鍙傛暟")] + [TypeConverter(typeof(ComplexObjectConvert))] + [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + public GoHomePara GoHomePara + { + get => goHomePara; + set + { + goHomePara = value; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GoHomePara")); + } + } + + internal List<AxisSetting> _axisSettingList = new List<AxisSetting>(); + public void SetAxisSetting(List<AxisSetting> settings) + { + if (settings != null) + _axisSettingList = settings; + } + + public string GetDisplayText() + { + string axisName = AxisIndex.ToString(); + var axisSet = _axisSettingList.FirstOrDefault(a => a.AxisIndex == AxisIndex); + if (axisSet != null) + { + axisName += ("-" + axisSet.AxisName); + } + return axisName + "," + MoveMode.ToString() + "," + (IsAbsolute ? "Abs" : "Rel") + "," + Destination; + } + public event PropertyChangedEventHandler PropertyChanged; + } + + public class AxisIndexConvert : TypeConverter + { + Dictionary<int, string> _indexNameDict = new Dictionary<int, string>(); + + public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + { + return true; + } + + public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + { + MovingOption mo = context.Instance as MovingOption; + + _indexNameDict = mo._axisSettingList.ToDictionary(a => a.AxisIndex, a => a.AxisIndex + "-" + a.AxisName); + + return new StandardValuesCollection(_indexNameDict.Keys); + } + + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + return base.CanConvertFrom(context, sourceType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v) + { + if (v is string) + { + foreach (var indexName in _indexNameDict) + { + if (indexName.Value == v.ToString()) + { + return indexName.Key; + } + } + return Convert.ToInt32(v); + } + return base.ConvertFrom(context, culture, v); + } + + public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v, Type destinationType) + { + if (destinationType == typeof(string)) + { + if (_indexNameDict.ContainsKey(Convert.ToInt32(v))) + { + return _indexNameDict[Convert.ToInt32(v)]; + } + } + return base.ConvertTo(context, culture, v, destinationType); + } + + public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) + { + return false; + } + } + + public class AxisConflictSet : IComplexDisplay + { + [Category("1.杞村啿绐佹潯浠�")] + [Description("杞村啿绐佹潯浠讹紝婊¤冻鍏ㄩ儴鏉′欢鏃惰酱杩愬姩闇�瑕佹鏌ュ啿绐�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] + public List<AxisLimit> AxisOptions { get; set; } = new List<AxisLimit>(); + + [Category("1.杞村啿绐佹潯浠�")] + [Description("IO鍐茬獊鏉′欢锛屾弧瓒冲叏閮ㄦ潯浠舵椂杞磋繍鍔ㄩ渶瑕佹鏌ュ啿绐�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] + public List<IOLimit> IOOptions { get; set; } = new List<IOLimit>(); + + [Category("2.杞村啿绐侀檺鍒�")] + [Description("杞村啿绐侀檺鍒讹紝杞磋繍鍔ㄥ厑璁稿尯闂�")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] + public List<AxisLimit> AxisLimits { get; set; } = new List<AxisLimit>(); + + [Category("2.杞村啿绐侀檺鍒�")] + [Description("IO鍏佽鏉′欢锛屽厑璁歌緭鍑虹殑IO")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] + public List<IOLimit> IOOutputs { get; set; } = new List<IOLimit>(); + + [Category("3.杞村啿绐佸惎鐢�")] + [Description("true锛氬惎鐢ㄨ酱鍐茬獊闄愬埗 false锛氫笉鍚敤杞村啿绐侀檺鍒�")] + public bool IsEnabled { get; set; } = true; + + public string GetDisplayText() + { + string optionStr = "Options:" + String.Join(";", AxisOptions.Select(a => a.GetDisplayText())); + string limitStr = "Limits:" + String.Join(";", AxisLimits.Select(a => a.GetDisplayText())); + + return optionStr + "|" + limitStr; + } + } + + public class AxisLimit : IComplexDisplay + { + [Category("1.杞村彿")] + [Description("1.杞村彿")] + public int AxisIndex { get; set; } + + [Category("2.杞存渶灏忛檺鍒�")] + [Description("2.杞存渶灏忛檺鍒�")] + public int LimitMin { get; set; } + + [Category("3.杞存渶澶ч檺鍒�")] + [Description("3.杞存渶澶ч檺鍒�")] + public int LimitMax { get; set; } + + private int currentPosition = 0; + [Browsable(false)] + [JsonIgnore] + public int CurrentPosition + { + get => currentPosition; + set + { + if (currentPosition != value) + { + if (value >= LimitMin && value <= LimitMax) + { + IsInLimit = true; + } + else + { + IsInLimit = false; + } + } + + currentPosition = value; + } + } + + [Browsable(false)] + [JsonIgnore] + public bool IsInLimit { get; set; } + + public string GetDisplayText() + { + return String.Format("Index:{0},{1}->{2}", AxisIndex, LimitMin, LimitMax); + } + } + + public class IOLimit : IComplexDisplay + { + [Category("1.IO闄愬埗")] + [Description("IO绱㈠紩")] + public int IOIndex { get; set; } + + [Category("1.IO闄愬埗")] + [Description("IO闄愬埗鍊笺�傝緭鍏ュ垽鏂椂璇ュ�间綔涓哄惎鐢ㄥ垽鏂�硷紝杈撳嚭鍒ゆ柇鏃惰鍊间綔涓哄厑璁歌緭鍑哄��")] + public bool IOSignal { get; set; } + + public string GetDisplayText() + { + return IOIndex + "--" + IOSignal.ToString(); + } + } + + public class AxisMovingStay + { + public int Position { get; set; } + + public int Velocity { get; set; } + + public AutoResetEvent MoveHandle { get; set; } = new AutoResetEvent(false); + + public AutoResetEvent MoveSendHandle { get; set; } = new AutoResetEvent(false); + } +} diff --git a/src/Bro.Common.Model/Model/WarningSet.cs b/src/Bro.Common.Model/Model/WarningSet.cs index b453235..ebabb2c 100644 --- a/src/Bro.Common.Model/Model/WarningSet.cs +++ b/src/Bro.Common.Model/Model/WarningSet.cs @@ -99,7 +99,7 @@ [Category("璀︽姤璁剧疆")] [DisplayName("璀︽姤绫诲瀷")] [Description("璀︽姤璁剧疆锛氳繍鍔ㄦ澘鍗� IO 绫诲瀷锛圛N OUT锛�")] - public IOModel WarningIOModel { get; set; } + public IOType WarningIOModel { get; set; } [Category("瑙﹀彂璁剧疆")] [Description("true锛氶珮鐢靛钩瑙﹀彂鎶ヨ false锛氫綆鐢靛钩瑙﹀彂鎶ヨ")] diff --git a/src/Bro.Device.GTSCard/GTSCardConfig.cs b/src/Bro.Device.GTSCard/GTSCardConfig.cs index 9cff3c0..0cd70d6 100644 --- a/src/Bro.Device.GTSCard/GTSCardConfig.cs +++ b/src/Bro.Device.GTSCard/GTSCardConfig.cs @@ -17,105 +17,105 @@ { [Device("GTSCard", "鍥洪珮鏉垮崱", EnumHelper.DeviceAttributeType.OperationConfig)] - public class GTSCardOperationConfig : OperationConfigBase, IComplexDisplay + public class GTSCardOperationConfig : MotionCardOperationConfigBase { - [Category("鏉垮崱杩愬姩閰嶇疆")] - [DisplayName("杩愬姩閰嶇疆闆嗗悎")] - [Description("MovingOps锛氳繍鍔ㄩ厤缃泦鍚�")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<MovingOption>), typeof(UITypeEditor))] - public ObservableCollection<MovingOption> MovingOps { get; set; } = new ObservableCollection<MovingOption>(); + //[Category("鏉垮崱杩愬姩閰嶇疆")] + //[DisplayName("杩愬姩閰嶇疆闆嗗悎")] + //[Description("MovingOps锛氳繍鍔ㄩ厤缃泦鍚�")] + //[TypeConverter(typeof(CollectionCountConvert))] + //[Editor(typeof(ComplexCollectionEditor<MovingOption>), typeof(UITypeEditor))] + //public ObservableCollection<MovingOption> MovingOps { get; set; } = new ObservableCollection<MovingOption>(); - public string GetDisplayText() - { - return MovingOps.Count() == 0 ? "--" : string.Join(";", MovingOps.Select(m => m.GetDisplayText())); - } + //public string GetDisplayText() + //{ + // return MovingOps.Count() == 0 ? "--" : string.Join(";", MovingOps.Select(m => m.GetDisplayText())); + //} } - [Device("GTSCard", "鍥洪珮鏉垮崱", EnumHelper.DeviceAttributeType.OperationConfig)] - public class GTSCardInitialConfig : InitialConfigBase, IMonitorConfig + [Device("GTSCard", "鍥洪珮鏉垮崱", EnumHelper.DeviceAttributeType.InitialConfig)] + public class GTSCardInitialConfig : MotionCardInitialConfigBase { - [Category("鏉垮崱閰嶇疆")] - [DisplayName("鍗″彿")] - [Description("CardNum锛氬崱鍙�")] - public int CardNum { get; set; } + //[Category("鏉垮崱閰嶇疆")] + //[DisplayName("鍗″彿")] + //[Description("CardNum锛氬崱鍙�")] + //public int CardNum { get; set; } - [Category("鏉垮崱閰嶇疆")] - [DisplayName("鍒濆閰嶇疆鏂囦欢璺緞")] - [Description("InitialConfigFilePath锛氬垵濮嬮厤缃枃浠惰矾寰�")] - [Editor(typeof(FileDialogEditor), typeof(UITypeEditor))] - public string InitialConfigFilePath { get; set; } + //[Category("鏉垮崱閰嶇疆")] + //[DisplayName("鍒濆閰嶇疆鏂囦欢璺緞")] + //[Description("InitialConfigFilePath锛氬垵濮嬮厤缃枃浠惰矾寰�")] + //[Editor(typeof(FileDialogEditor), typeof(UITypeEditor))] + //public string InitialConfigFilePath { get; set; } - [Category("杞撮厤缃�")] - [DisplayName("杞存暟閲�")] - [Description("AxisNum锛氳酱鏁伴噺")] - public int AxisNum { get; set; } = 2; + //[Category("杞撮厤缃�")] + //[DisplayName("杞存暟閲�")] + //[Description("AxisNum锛氳酱鏁伴噺")] + //public int AxisNum { get; set; } = 2; - [Category("杞撮厤缃�")] - [DisplayName("杞撮厤缃俊鎭泦鍚�")] - [Description("AxisSettings锛氳酱閰嶇疆淇℃伅闆嗗悎")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<AxisSetting>), typeof(UITypeEditor))] - public List<AxisSetting> AxisSettings { get; set; } = new List<AxisSetting>(); + //[Category("杞撮厤缃�")] + //[DisplayName("杞撮厤缃俊鎭泦鍚�")] + //[Description("AxisSettings锛氳酱閰嶇疆淇℃伅闆嗗悎")] + //[TypeConverter(typeof(CollectionCountConvert))] + //[Editor(typeof(ComplexCollectionEditor<AxisSetting>), typeof(UITypeEditor))] + //public List<AxisSetting> AxisSettings { get; set; } = new List<AxisSetting>(); - [Category("杞撮厤缃�")] - [DisplayName("杞撮�熷害姣旂巼")] - [Description("AxisVelocityRatio锛氳酱閫熷害姣旂巼")] - public double AxisVelocityRatio { get; set; } = 1; + //[Category("杞撮厤缃�")] + //[DisplayName("杞撮�熷害姣旂巼")] + //[Description("AxisVelocityRatio锛氳酱閫熷害姣旂巼")] + //public double AxisVelocityRatio { get; set; } = 1; - [Category("寤舵椂閰嶇疆")] - [DisplayName("鍔ㄤ綔瀹屾垚鍚庡欢杩�")] - [Description("ActionAfterDelay锛氬姩浣滃畬鎴愬悗寤惰繜")] - public int ActionAfterDelay { get; set; } = 100; + //[Category("寤舵椂閰嶇疆")] + //[DisplayName("鍔ㄤ綔瀹屾垚鍚庡欢杩�")] + //[Description("ActionAfterDelay锛氬姩浣滃畬鎴愬悗寤惰繜")] + //public int ActionAfterDelay { get; set; } = 100; - [Category("璀︽姤閰嶇疆")] - [Description("WarningSetCollection锛氳鎶ラ厤缃垪琛�")] - [DisplayName("璀︽姤閰嶇疆")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(WarningSetsEditor), typeof(UITypeEditor))] - public List<IWarningSet> WarningSetCollection { get; set; } = new List<IWarningSet>(); + //[Category("璀︽姤閰嶇疆")] + //[Description("WarningSetCollection锛氳鎶ラ厤缃垪琛�")] + //[DisplayName("璀︽姤閰嶇疆")] + //[TypeConverter(typeof(CollectionCountConvert))] + //[Editor(typeof(WarningSetsEditor), typeof(UITypeEditor))] + //public List<IWarningSet> WarningSetCollection { get; set; } = new List<IWarningSet>(); - #region IMonitorConfig - [Category("鐩戝惉璁剧疆")] - [Description("MonitorSetCollection锛氱洃鍚搷浣滈厤缃泦鍚�")] - [DisplayName("鐩戝惉閰嶇疆")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<MotionCardMonitorSet>), typeof(UITypeEditor))] - public List<IMonitorSet> MonitorSetCollection { get; set; } = new List<IMonitorSet>(); + //#region IMonitorConfig + //[Category("鐩戝惉璁剧疆")] + //[Description("MonitorSetCollection锛氱洃鍚搷浣滈厤缃泦鍚�")] + //[DisplayName("鐩戝惉閰嶇疆")] + //[TypeConverter(typeof(CollectionCountConvert))] + //[Editor(typeof(ComplexCollectionEditor<MotionCardMonitorSet>), typeof(UITypeEditor))] + //public List<IMonitorSet> MonitorSetCollection { get; set; } = new List<IMonitorSet>(); - [Category("鐩戝惉璁剧疆")] - [Description("true锛氬惎鍔ㄧ洃鍚� false锛氬叧闂洃鍚�")] - [DisplayName("鐩戝惉鍚敤")] - public bool IsEnableMonitor { get; set; } = true; + //[Category("鐩戝惉璁剧疆")] + //[Description("true锛氬惎鍔ㄧ洃鍚� false锛氬叧闂洃鍚�")] + //[DisplayName("鐩戝惉鍚敤")] + //public bool IsEnableMonitor { get; set; } = true; - [Category("鐩戝惉璁剧疆")] - [Description("鎵弿闂撮殧鏃堕棿锛屽崟浣嶏細ms")] - [DisplayName("鎵弿闂撮殧")] - public int MonitorInterval { get; set; } = 10; + //[Category("鐩戝惉璁剧疆")] + //[Description("鎵弿闂撮殧鏃堕棿锛屽崟浣嶏細ms")] + //[DisplayName("鎵弿闂撮殧")] + //public int MonitorInterval { get; set; } = 10; - [Category("鐩戝惉璁剧疆")] - [Description("瓒呮椂璁剧疆锛屽崟浣嶏細ms")] - [DisplayName("鐩戝惉瓒呮椂")] - public int MonitorTimeout { get; set; } = 500; - - [Category("浜嬩欢鍦板潃璁剧疆")] - [Description("浜嬩欢寮�濮嬪湴鍧�锛孭LC鐨勫疄闄呭瘎瀛樺櫒鍦板潃銆傚崄杩涘埗锛屼笉鍖呭惈鍔熻兘鐮併��")] - [DisplayName("鐩戝惉寮�濮嬪湴鍧�")] - public int EventStartAddress { get; set; } = 8000; + //[Category("鐩戝惉璁剧疆")] + //[Description("瓒呮椂璁剧疆锛屽崟浣嶏細ms")] + //[DisplayName("鐩戝惉瓒呮椂")] + //public int MonitorTimeout { get; set; } = 500; //[Category("浜嬩欢鍦板潃璁剧疆")] - //[Description("浜嬩欢鍦板潃闀垮害锛屾渶澶ч暱搴�128")] - //[DisplayName("鐩戝惉闀垮害")] - //public int EventLength { get; set; } = 120; + //[Description("浜嬩欢寮�濮嬪湴鍧�锛孭LC鐨勫疄闄呭瘎瀛樺櫒鍦板潃銆傚崄杩涘埗锛屼笉鍖呭惈鍔熻兘鐮併��")] + //[DisplayName("鐩戝惉寮�濮嬪湴鍧�")] + //public int EventStartAddress { get; set; } = 8000; - public List<IMonitorSet> GetAllMonitorSet() - { - WarningSetCollection.ForEach(m => m.Source = this.Name); + ////[Category("浜嬩欢鍦板潃璁剧疆")] + ////[Description("浜嬩欢鍦板潃闀垮害锛屾渶澶ч暱搴�128")] + ////[DisplayName("鐩戝惉闀垮害")] + ////public int EventLength { get; set; } = 120; - MonitorSetCollection.ForEach(m => m.SourceDevice = this.Id); - return MonitorSetCollection; - } - #endregion + //public List<IMonitorSet> GetAllMonitorSet() + //{ + // WarningSetCollection.ForEach(m => m.Source = this.Name); + + // MonitorSetCollection.ForEach(m => m.SourceDevice = this.Id); + // return MonitorSetCollection; + //} + //#endregion //#region IMotion Related //[Category("杩愬姩閰嶇疆")] @@ -127,492 +127,492 @@ //#endregion } - /// <summary> - /// 杞撮厤缃� - /// </summary> - public class AxisSetting : IComplexDisplay - { - [Category("杞撮厤缃�")] - [DisplayName("杞村彿绱㈠紩")] - [Description("AxisIndex锛氳酱鍙风储寮�")] - public int AxisIndex { get; set; } + ///// <summary> + ///// 杞撮厤缃� + ///// </summary> + //public class AxisSetting : IComplexDisplay + //{ + // [Category("杞撮厤缃�")] + // [DisplayName("杞村彿绱㈠紩")] + // [Description("AxisIndex锛氳酱鍙风储寮�")] + // public int AxisIndex { get; set; } - [Category("杞撮厤缃�")] - [DisplayName("杞村悕绉�")] - [Description("AxisName锛氳酱鍚嶇О")] - public string AxisName { get; set; } + // [Category("杞撮厤缃�")] + // [DisplayName("杞村悕绉�")] + // [Description("AxisName锛氳酱鍚嶇О")] + // public string AxisName { get; set; } - [Category("杞撮厤缃�")] - [DisplayName("杞存槸鍚﹀惎鐢�")] - [Description("IsAxisEnabled锛氳酱鏄惁鍚敤")] - public bool IsAxisEnabled { get; set; } = false; + // [Category("杞撮厤缃�")] + // [DisplayName("杞存槸鍚﹀惎鐢�")] + // [Description("IsAxisEnabled锛氳酱鏄惁鍚敤")] + // public bool IsAxisEnabled { get; set; } = false; - [Category("鎹㈢畻閰嶇疆")] - [DisplayName("鑴夊啿鏁版崲绠楁瘮渚�")] - [Description("鑴夊啿鏁板拰鍏朵粬璁¢噺鍗曚綅鐨勬崲绠楁瘮渚嬶紝渚嬪璁剧疆涓�1000锛岃〃绀�1000涓剦鍐茬瓑浜�1uint")] - public int PulseRatio { get; set; } = 1; + // [Category("鎹㈢畻閰嶇疆")] + // [DisplayName("鑴夊啿鏁版崲绠楁瘮渚�")] + // [Description("鑴夊啿鏁板拰鍏朵粬璁¢噺鍗曚綅鐨勬崲绠楁瘮渚嬶紝渚嬪璁剧疆涓�1000锛岃〃绀�1000涓剦鍐茬瓑浜�1uint")] + // public int PulseRatio { get; set; } = 1; - [Category("閫熷害閰嶇疆")] - [DisplayName("榛樿閫熷害鍙傛暟")] - [Description("VelocityPara锛氶粯璁ら�熷害鍙傛暟")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public VelocityPara VelocityPara { get; set; } = new VelocityPara(); + // [Category("閫熷害閰嶇疆")] + // [DisplayName("榛樿閫熷害鍙傛暟")] + // [Description("VelocityPara锛氶粯璁ら�熷害鍙傛暟")] + // [TypeConverter(typeof(ComplexObjectConvert))] + // [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + // public VelocityPara VelocityPara { get; set; } = new VelocityPara(); - [Category("鍥炲師鐐硅缃�")] - [DisplayName("鍥炲師鐐规ā寮�")] - [Description("HomeMode锛氬洖鍘熺偣妯″紡銆�0锛氫竴鑸ā寮� 1锛氭瀬闄愰檺浣嶆ā寮� 2锛氬閮ㄨЕ鍙戞ā寮�")] - public int HomeMode { get; set; } = 0; + // [Category("鍥炲師鐐硅缃�")] + // [DisplayName("鍥炲師鐐规ā寮�")] + // [Description("HomeMode锛氬洖鍘熺偣妯″紡銆�0锛氫竴鑸ā寮� 1锛氭瀬闄愰檺浣嶆ā寮� 2锛氬閮ㄨЕ鍙戞ā寮�")] + // public int HomeMode { get; set; } = 0; - [Category("鍥炲師鐐硅缃�")] - [DisplayName("鍥炲師鐐规柟鍚�")] - [Description("IsHomePositive锛氬洖鍘熺偣鏂瑰悜銆� true锛氭鏂瑰悜寮�濮� false锛氳礋鏂瑰悜寮�濮�")] - public bool IsHomePositive { get; set; } = true; + // [Category("鍥炲師鐐硅缃�")] + // [DisplayName("鍥炲師鐐规柟鍚�")] + // [Description("IsHomePositive锛氬洖鍘熺偣鏂瑰悜銆� true锛氭鏂瑰悜寮�濮� false锛氳礋鏂瑰悜寮�濮�")] + // public bool IsHomePositive { get; set; } = true; - [Category("鍥炲師鐐硅缃�")] - [DisplayName("鏄惁鑷姩鍥炲師鐐�")] - [Description("IsAutoGoHome锛氭槸鍚﹁嚜鍔ㄥ洖鍘熺偣銆� true锛氭槸 false锛氬惁")] - public bool IsAutoGoHome { get; set; } = false; + // [Category("鍥炲師鐐硅缃�")] + // [DisplayName("鏄惁鑷姩鍥炲師鐐�")] + // [Description("IsAutoGoHome锛氭槸鍚﹁嚜鍔ㄥ洖鍘熺偣銆� true锛氭槸 false锛氬惁")] + // public bool IsAutoGoHome { get; set; } = false; - [Category("瓒呮椂璁剧疆")] - [DisplayName("鍥炲師鐐硅秴鏃�")] - [Description("TimeOutHome锛氬洖鍘熺偣瓒呮椂锛屽崟浣嶆绉�")] - public int TimeOutHome { get; set; } = 30000; + // [Category("瓒呮椂璁剧疆")] + // [DisplayName("鍥炲師鐐硅秴鏃�")] + // [Description("TimeOutHome锛氬洖鍘熺偣瓒呮椂锛屽崟浣嶆绉�")] + // public int TimeOutHome { get; set; } = 30000; - [Category("瓒呮椂璁剧疆")] - [DisplayName("杩愬姩瓒呮椂")] - [Description("TimeOutMove锛氳繍鍔ㄨ秴鏃讹紝鍗曚綅姣")] - public int TimeOutMove { get; set; } = 10000; + // [Category("瓒呮椂璁剧疆")] + // [DisplayName("杩愬姩瓒呮椂")] + // [Description("TimeOutMove锛氳繍鍔ㄨ秴鏃讹紝鍗曚綅姣")] + // public int TimeOutMove { get; set; } = 10000; - [Category("寮�闂幆璁剧疆")] - [DisplayName("鏄惁浣跨敤Cmmd鍥為")] - [Description("IsUseCmmdPosition锛氭槸鍚︿娇鐢–mmd鍥為")] - public bool IsUseCmmdPosition { get; set; } = false; + // [Category("寮�闂幆璁剧疆")] + // [DisplayName("鏄惁浣跨敤Cmmd鍥為")] + // [Description("IsUseCmmdPosition锛氭槸鍚︿娇鐢–mmd鍥為")] + // public bool IsUseCmmdPosition { get; set; } = false; - [Category("寮�闂幆璁剧疆")] - [DisplayName("鏄惁浣跨敤鏉垮崱鍙嶉鍋滄淇″彿")] - [Description("IsUseMDNStopSignal锛氭槸鍚︿娇鐢ㄦ澘鍗″弽棣堝仠姝俊鍙�")] - public bool IsUseMDNStopSignal { get; set; } = false; + // [Category("寮�闂幆璁剧疆")] + // [DisplayName("鏄惁浣跨敤鏉垮崱鍙嶉鍋滄淇″彿")] + // [Description("IsUseMDNStopSignal锛氭槸鍚︿娇鐢ㄦ澘鍗″弽棣堝仠姝俊鍙�")] + // public bool IsUseMDNStopSignal { get; set; } = false; - [Category("寮�闂幆璁剧疆")] - [DisplayName("鏄惁鍚敤鎶ヨ")] - [Description("IsUseWarning锛氭槸鍚﹀惎鐢ㄦ姤璀�")] - public bool IsUseWarning { get; set; } = false; + // [Category("寮�闂幆璁剧疆")] + // [DisplayName("鏄惁鍚敤鎶ヨ")] + // [Description("IsUseWarning锛氭槸鍚﹀惎鐢ㄦ姤璀�")] + // public bool IsUseWarning { get; set; } = false; - [Category("鏆傚仠閰嶇疆")] - [DisplayName("鏄惁鍚敤绔嬪嵆鏆傚仠")] - [Description("IsImmediatePause锛氭槸鍚﹀惎鐢ㄧ珛鍗虫殏鍋�")] - public bool IsImmediatePause { get; set; } = false; + // [Category("鏆傚仠閰嶇疆")] + // [DisplayName("鏄惁鍚敤绔嬪嵆鏆傚仠")] + // [Description("IsImmediatePause锛氭槸鍚﹀惎鐢ㄧ珛鍗虫殏鍋�")] + // public bool IsImmediatePause { get; set; } = false; - [Category("鏆傚仠閰嶇疆")] - [DisplayName("杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] - [Description("ImmediatePauseSections锛氬綋杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<Section>), typeof(UITypeEditor))] - public List<Section> ImmediatePauseSections { get; set; } = new List<Section>(); + // [Category("鏆傚仠閰嶇疆")] + // [DisplayName("杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] + // [Description("ImmediatePauseSections锛氬綋杞翠綅缃浜庡尯闂村唴鏃堕�傜敤鐨勬殏鍋滄搷浣�")] + // [TypeConverter(typeof(CollectionCountConvert))] + // [Editor(typeof(ComplexCollectionEditor<Section>), typeof(UITypeEditor))] + // public List<Section> ImmediatePauseSections { get; set; } = new List<Section>(); - public string GetDisplayText() - { - return AxisIndex + "-" + AxisName + "-" + (IsAxisEnabled ? "鍚敤" : "绂佺敤"); - } - } + // public string GetDisplayText() + // { + // return AxisIndex + "-" + AxisName + "-" + (IsAxisEnabled ? "鍚敤" : "绂佺敤"); + // } + //} - /// <summary> - /// 浣嶇疆瀵硅薄 - /// </summary> - public class Section : IComplexDisplay - { - [Category("鏆傚仠鍖洪棿")] - [DisplayName("璧峰浣嶇疆")] - [Description("StartPosition锛氳捣濮嬩綅缃�")] - public int StartPosition { get; set; } + ///// <summary> + ///// 浣嶇疆瀵硅薄 + ///// </summary> + //public class Section : IComplexDisplay + //{ + // [Category("鏆傚仠鍖洪棿")] + // [DisplayName("璧峰浣嶇疆")] + // [Description("StartPosition锛氳捣濮嬩綅缃�")] + // public int StartPosition { get; set; } - [Category("鏆傚仠鍖洪棿")] - [DisplayName("缁撴潫浣嶇疆")] - [Description("EndPosition锛氱粨鏉熶綅缃�")] - public int EndPosition { get; set; } + // [Category("鏆傚仠鍖洪棿")] + // [DisplayName("缁撴潫浣嶇疆")] + // [Description("EndPosition锛氱粨鏉熶綅缃�")] + // public int EndPosition { get; set; } - public string GetDisplayText() - { - return $"{StartPosition}--{EndPosition}"; - } - } + // public string GetDisplayText() + // { + // return $"{StartPosition}--{EndPosition}"; + // } + //} - /// <summary> - /// 閫熷害鍙傛暟瀵硅薄 - /// </summary> - public class VelocityPara - { - [Category("閫熷害閰嶇疆")] - [DisplayName("閫熷害")] - [Description("Velocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] - public double Velocity { get; set; } = 0; + ///// <summary> + ///// 閫熷害鍙傛暟瀵硅薄 + ///// </summary> + //public class VelocityPara + //{ + // [Category("閫熷害閰嶇疆")] + // [DisplayName("閫熷害")] + // [Description("Velocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + // public double Velocity { get; set; } = 0; - [Category("閫熷害閰嶇疆")] - [DisplayName("鍔犻�熷害")] - [Description("Acc锛氬姞閫熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] - public double Acc { get; set; } = 1; + // [Category("閫熷害閰嶇疆")] + // [DisplayName("鍔犻�熷害")] + // [Description("Acc锛氬姞閫熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + // public double Acc { get; set; } = 1; - [Category("閫熷害閰嶇疆")] - [DisplayName("鍑忛�熷害")] - [Description("鍑忛�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] - public double Dec { get; set; } = 1; - } + // [Category("閫熷害閰嶇疆")] + // [DisplayName("鍑忛�熷害")] + // [Description("鍑忛�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + // public double Dec { get; set; } = 1; + //} - /// <summary> - /// 鍥炲師鐐瑰弬鏁板璞� - /// </summary> - public class GoHomePara - { - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("鍥炲師鐐规柟寮�")] - [Description("HomeMode锛氬洖鍘熺偣鏂瑰紡 锛圚OME_MODE_LIMIT = 10; HOME_MODE_LIMIT_HOME = 11; HOME_MODE_LIMIT_INDEX = 12; HOME_MODE_LIMIT_HOME_INDEX = 13;HOME_MODE_HOME = 20;HOME_MODE_HOME_INDEX = 22;HOME_MODE_INDEX = 30;")] - public short HomeMode { get; set; } = 11; + ///// <summary> + ///// 鍥炲師鐐瑰弬鏁板璞� + ///// </summary> + //public class GoHomePara + //{ + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("鍥炲師鐐规柟寮�")] + // [Description("HomeMode锛氬洖鍘熺偣鏂瑰紡 锛圚OME_MODE_LIMIT = 10; HOME_MODE_LIMIT_HOME = 11; HOME_MODE_LIMIT_INDEX = 12; HOME_MODE_LIMIT_HOME_INDEX = 13;HOME_MODE_HOME = 20;HOME_MODE_HOME_INDEX = 22;HOME_MODE_INDEX = 30;")] + // public short HomeMode { get; set; } = 11; - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("鍥炲師鐐规柟鍚�")] - [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] - public short HomeDir { get; set; } = 1; + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("鍥炲師鐐规柟鍚�")] + // [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] + // public short HomeDir { get; set; } = 1; - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("鍥炲師鐐规柟鍚�")] - [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] - public short Edge { get; set; } = 0; + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("鍥炲師鐐规柟鍚�")] + // [Description("HomeDir锛�1 姝e悜锛�-1 璐熷悜")] + // public short Edge { get; set; } = 0; - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("鍥炲師鐐规渶浣庨�熷害")] - [Description("LowVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] - public double LowVelocity { get; set; } = 50; + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("鍥炲師鐐规渶浣庨�熷害")] + // [Description("LowVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + // public double LowVelocity { get; set; } = 50; - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("鍥炲師鐐规渶楂橀�熷害")] - [Description("HighVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] - public double HighVelocity { get; set; } = 50; + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("鍥炲師鐐规渶楂橀�熷害")] + // [Description("HighVelocity锛氶�熷害,涓�0鏃惰〃绀轰笉淇敼褰撳墠璁剧疆")] + // public double HighVelocity { get; set; } = 50; - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("鎼滄悳璺濈")] - [Description("SearchHomeDistance锛氭悳鎼滆窛绂�")] - public int SearchHomeDistance { get; set; } = 9999999; + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("鎼滄悳璺濈")] + // [Description("SearchHomeDistance锛氭悳鎼滆窛绂�")] + // public int SearchHomeDistance { get; set; } = 9999999; - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("鍋忕Щ璺濈")] - [Description("HomeOffset锛氬亸绉昏窛绂�")] - public int HomeOffset { get; set; } = 0; + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("鍋忕Щ璺濈")] + // [Description("HomeOffset锛氬亸绉昏窛绂�")] + // public int HomeOffset { get; set; } = 0; - [Category("鍥炲師鐐瑰弬鏁�")] - [DisplayName("璺宠繃姝ラ暱")] - [Description("EscapeStep锛氳烦杩囨闀�")] - public int EscapeStep { get; set; } = 1000; + // [Category("鍥炲師鐐瑰弬鏁�")] + // [DisplayName("璺宠繃姝ラ暱")] + // [Description("EscapeStep锛氳烦杩囨闀�")] + // public int EscapeStep { get; set; } = 1000; - } + //} - /// <summary> - /// 杩愬姩瀵硅薄 - /// </summary> - public class MovingOption : INotifyPropertyChanged, IComplexDisplay - { - private int axisIndex = 0; - [Category("杩愬姩閰嶇疆")] - [DisplayName("杩愬姩杞寸储寮�")] - [Description("AxisIndex锛氳繍鍔ㄨ酱绱㈠紩")] - [TypeConverter(typeof(AxisIndexConvert))] - public int AxisIndex - { - get => axisIndex; - set - { - if (axisIndex != value) - { - axisIndex = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("AxisIndex")); - } - axisIndex = value; - } - } + ///// <summary> + ///// 杩愬姩瀵硅薄 + ///// </summary> + //public class MovingOption : INotifyPropertyChanged, IComplexDisplay + //{ + // private int axisIndex = 0; + // [Category("杩愬姩閰嶇疆")] + // [DisplayName("杩愬姩杞寸储寮�")] + // [Description("AxisIndex锛氳繍鍔ㄨ酱绱㈠紩")] + // [TypeConverter(typeof(AxisIndexConvert))] + // public int AxisIndex + // { + // get => axisIndex; + // set + // { + // if (axisIndex != value) + // { + // axisIndex = value; + // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("AxisIndex")); + // } + // axisIndex = value; + // } + // } - private MotorMoveMode moveMode = MotorMoveMode.Normal; - [Category("杩愬姩閰嶇疆")] - [DisplayName("杩愬姩妯″紡")] - [Description("MoveMode锛氳繍鍔ㄦā寮�")] - public MotorMoveMode MoveMode - { - get => moveMode; - set - { - if (moveMode != value) - { - moveMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MoveMode")); - } + // private MotorMoveMode moveMode = MotorMoveMode.Normal; + // [Category("杩愬姩閰嶇疆")] + // [DisplayName("杩愬姩妯″紡")] + // [Description("MoveMode锛氳繍鍔ㄦā寮�")] + // public MotorMoveMode MoveMode + // { + // get => moveMode; + // set + // { + // if (moveMode != value) + // { + // moveMode = value; + // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MoveMode")); + // } - moveMode = value; - } - } + // moveMode = value; + // } + // } - private bool isAbsolute = true; - [Category("杩愬姩閰嶇疆")] - [DisplayName("鏄惁缁濆杩愬姩")] - [Description("IsAbsolute锛氭槸鍚︾粷瀵硅繍鍔�")] - public bool IsAbsolute - { - get => isAbsolute; - set - { - if (isAbsolute != value) - { - isAbsolute = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsAbsolute")); - } + // private bool isAbsolute = true; + // [Category("杩愬姩閰嶇疆")] + // [DisplayName("鏄惁缁濆杩愬姩")] + // [Description("IsAbsolute锛氭槸鍚︾粷瀵硅繍鍔�")] + // public bool IsAbsolute + // { + // get => isAbsolute; + // set + // { + // if (isAbsolute != value) + // { + // isAbsolute = value; + // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsAbsolute")); + // } - isAbsolute = value; - } - } + // isAbsolute = value; + // } + // } - private int destination = 0; - [Category("杩愬姩閰嶇疆")] - [DisplayName("鐩殑鍦�")] - [Description("Destination锛氱洰鐨勫湴")] - public int Destination - { - get => destination; - set - { - if (destination != value) - { - destination = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Destination")); - } + // private int destination = 0; + // [Category("杩愬姩閰嶇疆")] + // [DisplayName("鐩殑鍦�")] + // [Description("Destination锛氱洰鐨勫湴")] + // public int Destination + // { + // get => destination; + // set + // { + // if (destination != value) + // { + // destination = value; + // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Destination")); + // } - destination = value; - } - } + // destination = value; + // } + // } - private VelocityPara velocityPara = new VelocityPara(); - [Category("杩愬姩閰嶇疆")] - [DisplayName("閫熷害鍙傛暟")] - [Description("VelocityPara锛氶�熷害鍙傛暟")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public VelocityPara VelocityPara - { - get => velocityPara; - set - { - velocityPara = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("VelocityPara")); - } - } + // private VelocityPara velocityPara = new VelocityPara(); + // [Category("杩愬姩閰嶇疆")] + // [DisplayName("閫熷害鍙傛暟")] + // [Description("VelocityPara锛氶�熷害鍙傛暟")] + // [TypeConverter(typeof(ComplexObjectConvert))] + // [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + // public VelocityPara VelocityPara + // { + // get => velocityPara; + // set + // { + // velocityPara = value; + // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("VelocityPara")); + // } + // } - private GoHomePara goHomePara = new GoHomePara(); - [Category("杩愬姩閰嶇疆")] - [DisplayName("鍥炲師鐐瑰弬鏁�")] - [Description("GoHomePara锛氶�熷害鍙傛暟")] - [TypeConverter(typeof(ComplexObjectConvert))] - [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] - public GoHomePara GoHomePara - { - get => goHomePara; - set - { - goHomePara = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GoHomePara")); - } - } + // private GoHomePara goHomePara = new GoHomePara(); + // [Category("杩愬姩閰嶇疆")] + // [DisplayName("鍥炲師鐐瑰弬鏁�")] + // [Description("GoHomePara锛氶�熷害鍙傛暟")] + // [TypeConverter(typeof(ComplexObjectConvert))] + // [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))] + // public GoHomePara GoHomePara + // { + // get => goHomePara; + // set + // { + // goHomePara = value; + // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("GoHomePara")); + // } + // } - internal List<AxisSetting> _axisSettingList = new List<AxisSetting>(); - public void SetAxisSetting(List<AxisSetting> settings) - { - if (settings != null) - _axisSettingList = settings; - } + // internal List<AxisSetting> _axisSettingList = new List<AxisSetting>(); + // public void SetAxisSetting(List<AxisSetting> settings) + // { + // if (settings != null) + // _axisSettingList = settings; + // } - public string GetDisplayText() - { - string axisName = AxisIndex.ToString(); - var axisSet = _axisSettingList.FirstOrDefault(a => a.AxisIndex == AxisIndex); - if (axisSet != null) - { - axisName += ("-" + axisSet.AxisName); - } - return axisName + "," + MoveMode.ToString() + "," + (IsAbsolute ? "Abs" : "Rel") + "," + Destination; - } - public event PropertyChangedEventHandler PropertyChanged; - } + // public string GetDisplayText() + // { + // string axisName = AxisIndex.ToString(); + // var axisSet = _axisSettingList.FirstOrDefault(a => a.AxisIndex == AxisIndex); + // if (axisSet != null) + // { + // axisName += ("-" + axisSet.AxisName); + // } + // return axisName + "," + MoveMode.ToString() + "," + (IsAbsolute ? "Abs" : "Rel") + "," + Destination; + // } + // public event PropertyChangedEventHandler PropertyChanged; + //} - public class AxisIndexConvert : TypeConverter - { - Dictionary<int, string> _indexNameDict = new Dictionary<int, string>(); + //public class AxisIndexConvert : TypeConverter + //{ + // Dictionary<int, string> _indexNameDict = new Dictionary<int, string>(); - public override bool GetStandardValuesSupported(ITypeDescriptorContext context) - { - return true; - } + // public override bool GetStandardValuesSupported(ITypeDescriptorContext context) + // { + // return true; + // } - public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) - { - MovingOption mo = context.Instance as MovingOption; + // public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) + // { + // MovingOption mo = context.Instance as MovingOption; - _indexNameDict = mo._axisSettingList.ToDictionary(a => a.AxisIndex, a => a.AxisIndex + "-" + a.AxisName); + // _indexNameDict = mo._axisSettingList.ToDictionary(a => a.AxisIndex, a => a.AxisIndex + "-" + a.AxisName); - return new StandardValuesCollection(_indexNameDict.Keys); - } + // return new StandardValuesCollection(_indexNameDict.Keys); + // } - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - if (sourceType == typeof(string)) - { - return true; - } - return base.CanConvertFrom(context, sourceType); - } + // public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + // { + // if (sourceType == typeof(string)) + // { + // return true; + // } + // return base.CanConvertFrom(context, sourceType); + // } - public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v) - { - if (v is string) - { - foreach (var indexName in _indexNameDict) - { - if (indexName.Value == v.ToString()) - { - return indexName.Key; - } - } - return Convert.ToInt32(v); - } - return base.ConvertFrom(context, culture, v); - } + // public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v) + // { + // if (v is string) + // { + // foreach (var indexName in _indexNameDict) + // { + // if (indexName.Value == v.ToString()) + // { + // return indexName.Key; + // } + // } + // return Convert.ToInt32(v); + // } + // return base.ConvertFrom(context, culture, v); + // } - public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v, Type destinationType) - { - if (destinationType == typeof(string)) - { - if (_indexNameDict.ContainsKey(Convert.ToInt32(v))) - { - return _indexNameDict[Convert.ToInt32(v)]; - } - } - return base.ConvertTo(context, culture, v, destinationType); - } + // public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object v, Type destinationType) + // { + // if (destinationType == typeof(string)) + // { + // if (_indexNameDict.ContainsKey(Convert.ToInt32(v))) + // { + // return _indexNameDict[Convert.ToInt32(v)]; + // } + // } + // return base.ConvertTo(context, culture, v, destinationType); + // } - public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) - { - return false; - } - } + // public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) + // { + // return false; + // } + //} - public class AxisConflictSet : IComplexDisplay - { - [Category("1.杞村啿绐佹潯浠�")] - [Description("杞村啿绐佹潯浠讹紝婊¤冻鍏ㄩ儴鏉′欢鏃惰酱杩愬姩闇�瑕佹鏌ュ啿绐�")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] - public List<AxisLimit> AxisOptions { get; set; } = new List<AxisLimit>(); + //public class AxisConflictSet : IComplexDisplay + //{ + // [Category("1.杞村啿绐佹潯浠�")] + // [Description("杞村啿绐佹潯浠讹紝婊¤冻鍏ㄩ儴鏉′欢鏃惰酱杩愬姩闇�瑕佹鏌ュ啿绐�")] + // [TypeConverter(typeof(CollectionCountConvert))] + // [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] + // public List<AxisLimit> AxisOptions { get; set; } = new List<AxisLimit>(); - [Category("1.杞村啿绐佹潯浠�")] - [Description("IO鍐茬獊鏉′欢锛屾弧瓒冲叏閮ㄦ潯浠舵椂杞磋繍鍔ㄩ渶瑕佹鏌ュ啿绐�")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] - public List<IOLimit> IOOptions { get; set; } = new List<IOLimit>(); + // [Category("1.杞村啿绐佹潯浠�")] + // [Description("IO鍐茬獊鏉′欢锛屾弧瓒冲叏閮ㄦ潯浠舵椂杞磋繍鍔ㄩ渶瑕佹鏌ュ啿绐�")] + // [TypeConverter(typeof(CollectionCountConvert))] + // [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] + // public List<IOLimit> IOOptions { get; set; } = new List<IOLimit>(); - [Category("2.杞村啿绐侀檺鍒�")] - [Description("杞村啿绐侀檺鍒讹紝杞磋繍鍔ㄥ厑璁稿尯闂�")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] - public List<AxisLimit> AxisLimits { get; set; } = new List<AxisLimit>(); + // [Category("2.杞村啿绐侀檺鍒�")] + // [Description("杞村啿绐侀檺鍒讹紝杞磋繍鍔ㄥ厑璁稿尯闂�")] + // [TypeConverter(typeof(CollectionCountConvert))] + // [Editor(typeof(ComplexCollectionEditor<AxisLimit>), typeof(UITypeEditor))] + // public List<AxisLimit> AxisLimits { get; set; } = new List<AxisLimit>(); - [Category("2.杞村啿绐侀檺鍒�")] - [Description("IO鍏佽鏉′欢锛屽厑璁歌緭鍑虹殑IO")] - [TypeConverter(typeof(CollectionCountConvert))] - [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] - public List<IOLimit> IOOutputs { get; set; } = new List<IOLimit>(); + // [Category("2.杞村啿绐侀檺鍒�")] + // [Description("IO鍏佽鏉′欢锛屽厑璁歌緭鍑虹殑IO")] + // [TypeConverter(typeof(CollectionCountConvert))] + // [Editor(typeof(ComplexCollectionEditor<IOLimit>), typeof(UITypeEditor))] + // public List<IOLimit> IOOutputs { get; set; } = new List<IOLimit>(); - [Category("3.杞村啿绐佸惎鐢�")] - [Description("true锛氬惎鐢ㄨ酱鍐茬獊闄愬埗 false锛氫笉鍚敤杞村啿绐侀檺鍒�")] - public bool IsEnabled { get; set; } = true; + // [Category("3.杞村啿绐佸惎鐢�")] + // [Description("true锛氬惎鐢ㄨ酱鍐茬獊闄愬埗 false锛氫笉鍚敤杞村啿绐侀檺鍒�")] + // public bool IsEnabled { get; set; } = true; - public string GetDisplayText() - { - string optionStr = "Options:" + String.Join(";", AxisOptions.Select(a => a.GetDisplayText())); - string limitStr = "Limits:" + String.Join(";", AxisLimits.Select(a => a.GetDisplayText())); + // public string GetDisplayText() + // { + // string optionStr = "Options:" + String.Join(";", AxisOptions.Select(a => a.GetDisplayText())); + // string limitStr = "Limits:" + String.Join(";", AxisLimits.Select(a => a.GetDisplayText())); - return optionStr + "|" + limitStr; - } - } + // return optionStr + "|" + limitStr; + // } + //} - public class AxisLimit : IComplexDisplay - { - [Category("1.杞村彿")] - [Description("1.杞村彿")] - public int AxisIndex { get; set; } + //public class AxisLimit : IComplexDisplay + //{ + // [Category("1.杞村彿")] + // [Description("1.杞村彿")] + // public int AxisIndex { get; set; } - [Category("2.杞存渶灏忛檺鍒�")] - [Description("2.杞存渶灏忛檺鍒�")] - public int LimitMin { get; set; } + // [Category("2.杞存渶灏忛檺鍒�")] + // [Description("2.杞存渶灏忛檺鍒�")] + // public int LimitMin { get; set; } - [Category("3.杞存渶澶ч檺鍒�")] - [Description("3.杞存渶澶ч檺鍒�")] - public int LimitMax { get; set; } + // [Category("3.杞存渶澶ч檺鍒�")] + // [Description("3.杞存渶澶ч檺鍒�")] + // public int LimitMax { get; set; } - private int currentPosition = 0; - [Browsable(false)] - [JsonIgnore] - public int CurrentPosition - { - get => currentPosition; - set - { - if (currentPosition != value) - { - if (value >= LimitMin && value <= LimitMax) - { - IsInLimit = true; - } - else - { - IsInLimit = false; - } - } + // private int currentPosition = 0; + // [Browsable(false)] + // [JsonIgnore] + // public int CurrentPosition + // { + // get => currentPosition; + // set + // { + // if (currentPosition != value) + // { + // if (value >= LimitMin && value <= LimitMax) + // { + // IsInLimit = true; + // } + // else + // { + // IsInLimit = false; + // } + // } - currentPosition = value; - } - } + // currentPosition = value; + // } + // } - [Browsable(false)] - [JsonIgnore] - public bool IsInLimit { get; set; } + // [Browsable(false)] + // [JsonIgnore] + // public bool IsInLimit { get; set; } - public string GetDisplayText() - { - return String.Format("Index:{0},{1}->{2}", AxisIndex, LimitMin, LimitMax); - } - } + // public string GetDisplayText() + // { + // return String.Format("Index:{0},{1}->{2}", AxisIndex, LimitMin, LimitMax); + // } + //} - public class IOLimit : IComplexDisplay - { - [Category("1.IO闄愬埗")] - [Description("IO绱㈠紩")] - public int IOIndex { get; set; } + //public class IOLimit : IComplexDisplay + //{ + // [Category("1.IO闄愬埗")] + // [Description("IO绱㈠紩")] + // public int IOIndex { get; set; } - [Category("1.IO闄愬埗")] - [Description("IO闄愬埗鍊笺�傝緭鍏ュ垽鏂椂璇ュ�间綔涓哄惎鐢ㄥ垽鏂�硷紝杈撳嚭鍒ゆ柇鏃惰鍊间綔涓哄厑璁歌緭鍑哄��")] - public bool IOSignal { get; set; } + // [Category("1.IO闄愬埗")] + // [Description("IO闄愬埗鍊笺�傝緭鍏ュ垽鏂椂璇ュ�间綔涓哄惎鐢ㄥ垽鏂�硷紝杈撳嚭鍒ゆ柇鏃惰鍊间綔涓哄厑璁歌緭鍑哄��")] + // public bool IOSignal { get; set; } - public string GetDisplayText() - { - return IOIndex + "--" + IOSignal.ToString(); - } - } + // public string GetDisplayText() + // { + // return IOIndex + "--" + IOSignal.ToString(); + // } + //} - public class AxisMovingStay - { - public int Position { get; set; } + //public class AxisMovingStay + //{ + // public int Position { get; set; } - public int Velocity { get; set; } + // public int Velocity { get; set; } - public AutoResetEvent MoveHandle { get; set; } = new AutoResetEvent(false); + // public AutoResetEvent MoveHandle { get; set; } = new AutoResetEvent(false); - public AutoResetEvent MoveSendHandle { get; set; } = new AutoResetEvent(false); - } + // public AutoResetEvent MoveSendHandle { get; set; } = new AutoResetEvent(false); + //} } diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs index 5a562fe..6927c56 100644 --- a/src/Bro.Device.GTSCard/GTSCardDriver.cs +++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs @@ -153,7 +153,7 @@ /// </summary> /// <param name="item">杩愬姩瀵硅薄</param> /// <returns>杩愬姩鎺у埗+鍋滄鍒ゆ柇</returns> - public bool MoveToPoint(IOperationConfig opConfig) + public ResponseMessage MoveToPoint(IOperationConfig opConfig) { bool resultOK = false; var gtsOperationConfig = opConfig as GTSCardOperationConfig; @@ -172,7 +172,8 @@ Task.WaitAll(taskList.ToArray()); resultOK = taskList.All(u => u.GetAwaiter().GetResult()); - return resultOK; + //return resultOK; + throw new NotImplementedException(); } /// <summary> @@ -702,13 +703,13 @@ { IONum = index, Value = (inValue & (1 << index)) == 0 ? 1 : 0, - Model = IOModel.In + IOType = IOType.In }; IOItem outItem = new IOItem() { IONum = index, Value = (outValue & (1 << index)) == 0 ? 1 : 0, - Model = IOModel.Out + IOType = IOType.Out }; result.Add(inItem); result.Add(outItem); @@ -779,7 +780,7 @@ foreach (var replyIOData in monitorSet.ReplyIODatas) { //鍐欏叆IO杈撳嚭 - if (replyIOData.Model == IOModel.Out) + if (replyIOData.IOType == IOType.Out) { GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPI, (short)replyIOData.IONum, (short)replyIOData.Value); } @@ -796,7 +797,7 @@ { MotionCardWarningSet warningSet = wSet as MotionCardWarningSet; - bool isOn = ((tempNew.FirstOrDefault(u => u.IONum == warningSet.TriggerIndex && u.Model == warningSet.WarningIOModel)?.Value >> warningSet.TriggerIndex) & 1) == (warningSet.TriggerValue ? 1 : 0); + bool isOn = ((tempNew.FirstOrDefault(u => u.IONum == warningSet.TriggerIndex && u.IOType == warningSet.WarningIOModel)?.Value >> warningSet.TriggerIndex) & 1) == (warningSet.TriggerValue ? 1 : 0); if (warningSet.CurrentStatus != isOn) { diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs index dfab5fa..a6a58a3 100644 --- a/src/Bro.M071.Process/M071Process.cs +++ b/src/Bro.M071.Process/M071Process.cs @@ -231,8 +231,6 @@ BarCode = ""; - - return new ProcessResponse(true); } -- Gitblit v1.8.0