using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; using System.Linq; using System.Text; using System.Text.Json.Serialization; using System.Threading.Tasks; using DH.Commons.Enums; namespace DH.Devices.Motion { public class MotionBase { //[Category("板卡配置")] //[DisplayName("板卡站号")] //[Description("板卡站号")] //public virtual ushort StationNumber { get; set; } = 0; public TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning); protected Dictionary _axisAlarmRaisedFlag = new Dictionary(); protected Dictionary _axisLimitTimer = new Dictionary(); //[Category("扩展卡设置")] //[Description("扩展卡数量")] //[DisplayName("扩展卡数量")] //public ushort CardExtNum { get; set; } = 0; public List AxisStatusList { get; set; } = new List(); public virtual void Init() { } public virtual void Start() { } public virtual void Stop() { } public virtual void ResetImmediatePause(bool isResumeMoving) { } public virtual bool AllAxisOn() { return false; } public virtual void SetImmediatePause() { } public virtual bool AllAxisOff() { return false; } public virtual async Task AxisOnAsync(int axisNum){ } public virtual async Task AxisOffAsync(int axisNum) { } public virtual List GetCurrentAxisInfo(params string[] axisName) { return new List(); } public bool isconnected=false; [Category("板卡配置")] [DisplayName("板卡型号")] [Description("板卡型号")] public BoardModelEnum BoardModel { get; set; } = BoardModelEnum.EC3416; [Category("板卡配置")] [DisplayName("扩展板类型")] [Description("扩展板类型")] public ExtensionBoardEnum ExtBoard { get; set; } = ExtensionBoardEnum.None; [Category("机台配置")] [DisplayName("机台类型")] [Description("机台类型")] public MachineDiskType MachineDiskType { get; set; } = MachineDiskType.SingleDisk; [Category("轴配置")] [DisplayName("轴数量")] [Description("AxisNum:轴数量")] public int AxisNum { get; set; } = 4; [Category("轴配置")] [DisplayName("轴配置信息集合")] [Description("AxisSettings:轴配置信息集合")] public List AxisSettings { get; set; } = new List(); [Category("轴配置")] [DisplayName("轴速度比率")] [Description("AxisVelocityRatio:轴速度比率")] public double AxisVelocityRatio { get; set; } = 1; //[Category("警报配置")] //[Description("WarningSetCollection:警报配置列表")] //[DisplayName("警报配置")] //[TypeConverter(typeof(CollectionCountConvert))] //[Editor(typeof(WarningSetsEditor), typeof(UITypeEditor))] //public List WarningSetCollection { get; set; } = new List(); [Category("IO配置")] [Description("输入IO总数")] [DisplayName("输入IO总数")] public int InputNums { get; set; } = 16; [Category("IO配置")] [Description("输出IO总数")] [DisplayName("输出IO总数")] public int OutputNums { get; set; } = 16; [Category("IO配置")] [DisplayName("IO定义集合")] [Description("IO定义集合")] //[TypeConverter(typeof(CollectionCountConvert))] // [Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] public List IODefinitionCollection { get; set; } = new List(); [Category("IO配置")] [DisplayName("是否信号模式")] [Description("true:信号模式,绿色表示有信号,灰色表示无信号 false:电平模式,绿色高电平,灰色低电平,一般情况下低电平表示有信号,板卡默认是电平模式")] public bool IsSignalMode { get; set; } = false; #region IMonitorConfig //[Category("监听设置")] //[Description("MonitorSetCollection:监听操作配置集合")] //[DisplayName("监听配置")] //[TypeConverter(typeof(CollectionCountConvert))] //[Editor(typeof(ComplexCollectionEditor), typeof(UITypeEditor))] //public List MonitorSetCollection { get; set; } = new List(); [Category("监听设置")] [Description("true:启动监听 false:关闭监听")] [DisplayName("监听启用")] public bool IsEnableMonitor { get; set; } = false; [Category("监听设置")] [Description("扫描间隔时间,单位:ms")] [DisplayName("扫描间隔")] public int MonitorInterval { get; set; } = 20; [Category("监听设置")] [Description("超时设置,单位:ms")] [DisplayName("监听超时")] public int MonitorTimeout { get; set; } = 500; //public List GetAllMonitorSet() //{ // WarningSetCollection.ForEach(m => m.SourceDevice = this.Name); // MonitorSetCollection.ForEach(m => m.SourceDeviceId = this.Id); // return MonitorSetCollection; //} #endregion #region 转盘卡新增配置 [Category("筛选配置")] [DisplayName("启用转盘卡自动筛选功能")] [Description("启用转盘卡自动筛选功能")] public bool IsEnableFilter { get; set; } = true; [Category("筛选配置")] [DisplayName("启用转盘卡盘2触发取反")] [Description("启用转盘卡盘2触发取反")] public bool DiskSnaptChange { get; set; } = false; [Category("筛选配置")] [DisplayName("第二路来料检测配置")] [Description("第二路来料检测配置")] public SortingInputSetting SortingInputSetting { get; set; } = new SortingInputSetting(); [Category("筛选配置")] [DisplayName("相机配置")] [Description("相机配置")] public List SnapshotSettings { get; set; } = new List(); [Category("筛选配置")] [DisplayName("吹气口配置")] [Description("吹气口配置")] public List BlowSettings { get; set; } = new List(); [Category("筛选配置")] [DisplayName("转盘运转方向")] [Description("转盘运转方向,顺时针或逆时针")] //[TypeConverter(typeof(EnumDescriptionConverter))] public RotationDirectionEnum MotionDir { get; set; } = RotationDirectionEnum.Clockwise; [Category("筛选配置")] [DisplayName("物料尺寸最大值")] [Description("物料尺寸最大值,单位:脉冲")] public uint PieceMaxSize { get; set; } = 20000; [Category("筛选配置")] [DisplayName("物料尺寸最小值")] [Description("物料尺寸最小值,单位:脉冲")] public uint PieceMinSize { get; set; } = 10; [Category("筛选配置")] [DisplayName("物料最小间隔")] [Description("物料最小间隔,单位:脉冲")] public uint MinDistance { get; set; } = 10; [Category("筛选配置")] [DisplayName("两个物料之间触发最小间隔时间")] [Description("两个物料之间触发最小间隔时间,单位:ms")] public uint MinTimeInterval { get; set; } = 1; [Category("急停配置")] [DisplayName("启用转盘卡硬件急停")] [Description("启用转盘卡硬件急停")] public bool IsEnableEmgStop { get; set; } = false; [Category("急停配置")] [DisplayName("急停信号触发索引")] [Description("急停信号触发索引")] public ushort EmgStopSignalIoIndex { get; set; } = 4; [Category("急停配置")] [DisplayName("急停触发信号")] [Description("急停触发信号")] public EMG_Mode EmgMode { get; set; } = EMG_Mode.EMG_Trigger_High_IMD; #endregion public List CurrentIOs { get; set; } = new List(); } /// /// 吹气口配置 /// public class BlowSetting { [Category("板卡配置")] [DisplayName("板卡站号")] [Description("板卡站号")] public virtual ushort StationNumber { get; set; } = 0; [Category("吹气口配置")] [DisplayName("是否启用")] [Description("是否启用")] public bool IsEnabled { get; set; } = false; [Category("吹气口配置")] [DisplayName("转盘运转方向")] [Description("转盘运转方向")] public RotationDirectionEnum RotationDirection { get; set; } = RotationDirectionEnum.Clockwise; //[Category("吹气口配置")] //[DisplayName("吹气口名称")] //[Description("吹气口名称")] //public string Name { get; set; } = ""; [Category("吹气口配置")] [DisplayName("吹气口位置")] [Description("吹气口位置,即吹气口到入料检测传感器的相对位置,单位:脉冲")] public int BlowPosition { get; set; } = 0; [Category("吹气口配置")] [DisplayName("输出信号")] [Description("输出信号")] public ActionMode ActionMode { get; set; } = ActionMode.OutputPulse10ms; [Category("吹气口配置")] [DisplayName("吹气口IO")] [Description("吹气口IO")] public IODefinition BlowIO { get; set; } = new IODefinition() { IOType = IOType.OUTPUT }; [Category("吹气口配置")] [DisplayName("吹气口类型")] [Description("吹气口类型")] public BlowType BlowType { get; set; } //public string GetDisplayText() //{ // //return $"{BlowType.GetEnumDescription()} 距离{BlowPosition} 输出{BlowIO.GetDisplayText()}"; //} } public class SnapshotSetting : IComparable { [Category("板卡配置")] [DisplayName("板卡站号")] [Description("板卡站号")] public virtual ushort StationNumber { get; set; } = 0; [Category("取像相机设置")] [DisplayName("转盘运转方向")] [Description("转盘运转方向")] public RotationDirectionEnum RotationDirection { get; set; } = RotationDirectionEnum.Clockwise; [Category("取像相机设置")] [DisplayName("是否启用")] [Description("是否启用")] public bool IsEnabled { get; set; } = false; [Category("取像相机设置")] [Description("取像相机")] [DisplayName("取像相机")] public string CameraId { get; set; } [Category("取像相机设置")] [DisplayName("相机触发延时毫秒")] [Description("相机触发后延时显示,单位ms")] public double CameraDelayCountMS { get; set; } = 0; [Category("取像相机设置")] [DisplayName("相机位置")] [Description("相机位置,即相机到入料检测传感器的相对位置,单位:脉冲")] public int CameraPosition { get; set; } = 0; [Category("取像相机设置")] [DisplayName("相机IO")] [Description("相机IO")] public IODefinition CameraIO { get; set; } = new IODefinition() { IOType = IOType.OUTPUT }; [Category("取像相机设置")] [DisplayName("输出信号")] [Description("输出信号,取决于相机触发模式及转盘速度")] public ActionMode ActionMode { get; set; } = ActionMode.OutputPulse10ms; //[Category("获取结果")] //[Description("调用方法")] //[DisplayName("调用方法")] //[TypeConverter(typeof(ProcessMethodSelectorConverter))] //public string MethodCode { get; set; } public int CompareTo(object obj) { if (obj is SnapshotSetting setting) { // return Math.Abs(CameraPosition).CompareTo(Math.Abs(setting.CameraPosition)); return CameraPosition.CompareTo(setting.CameraPosition); } return 0; } //public string GetDisplayText() //{ // //string cameraName = ""; // //using (var scope = GlobalVar.Container.BeginLifetimeScope()) // //{ // // List devices = scope.Resolve>(); // // cameraName = devices.FirstOrDefault(u => u.Id == CameraId)?.Name ?? ""; // //} // //// return $"{cameraName} :{IOItem.GetDisplayText()};{cameraName} {DetectType.GetEnumDescription()}"; // //return $"{cameraName} 距离{CameraPosition} 输出{CameraIO.GetDisplayText()}"; //} } /// /// 轴配置 /// public class AxisSetting { [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 AxisRatio { get; set; } = 1; [Category("监听设置")] [Description("true:监听位置信息 false:不监听位置信息")] [DisplayName("位置监听")] public bool IsMonitorPosition { get; set; } = true; [Category("监听设置")] [Description("true:监听状态信息 false:不监听状态信息")] [DisplayName("状态监听")] public bool IsMonitorStatus { get; set; } = true; [Category("捕获设置")] [Description("true:启用捕获监听 false:不启用捕获监听")] [DisplayName("捕获监听")] public bool IsMonitorCapture { get; set; } = true; [Category("速度配置")] [DisplayName("默认速度参数")] [Description("VelocityPara:默认速度参数")] 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:是否使用Cmmd回馈")] //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("是否启用报警")] public bool IsUseAlarm { get; set; } = true; [Category("伺服报警")] [DisplayName("报警复位电平")] [Description("报警复位电平")] public LogicLevelEnum AlarmLogic { get; set; } = LogicLevelEnum.LowLevel; [Category("原点配置")] [DisplayName("回原点参数")] [Description("回原点参数")] public GoHomePara GoHomePara { get; set; } = new GoHomePara(); [Category("暂停配置")] [DisplayName("是否启用立即暂停")] [Description("IsImmediatePause:是否启用立即暂停")] public bool IsImmediatePause { get; set; } = false; public string GetDisplayText() { return AxisIndex + "-" + AxisName + "-" + (IsAxisEnabled ? "启用" : "禁用"); } } /// /// 速度参数对象 /// public class VelocityPara { [Category("速度配置")] [DisplayName("速度")] [Description("Velocity:速度,为0时表示不修改当前设置")] public double Velocity { get; set; } = 0; [Category("速度配置")] [DisplayName("加速度")] [Description("Acc:加速度,为0时表示不修改当前设置")] public double Acc { get; set; } = 0; [Category("速度配置")] [DisplayName("减速度")] [Description("减速度,为0时表示不修改当前设置")] public double Dec { get; set; } = 0; public string GetDisplayText() { return $"速度:{Velocity} 加速度:{Acc} 减速度:{Dec}"; } } /// /// 回原点参数对象 /// public class GoHomePara { [Category("回原点参数")] [DisplayName("回原点方式")] [Description("HomeMode:回原点方式")] public GoHomeMode HomeMode { get; set; } = GoHomeMode.Negative_Ne_Center_H_Positive_N_Index_HPoO_Offset_Po; [Category("回原点参数")] [DisplayName("正负限位触发电平")] [Description("LimitLogic:正负限位触发电平")] public LogicLevelEnum LimitLogic { get; set; } = LogicLevelEnum.LowLevel; [Category("回原点参数")] [DisplayName("原点限位触发电平")] [Description("HomeLogic:原点限位触发电平")] public LogicLevelEnum HomeLogic { get; set; } = LogicLevelEnum.LowLevel; [Category("回原点参数")] [DisplayName("Index触发电平")] [Description("IndexLogic:Index触发电平")] public LogicLevelEnum IndexLogic { get; set; } = LogicLevelEnum.LowLevel; [Category("回原点参数")] [DisplayName("捕捉位置模式")] [Description("TriggerSource:捕捉位置模式")] public PositionSourceEnum TriggerSource { get; set; } = PositionSourceEnum.CommandPosition; [Category("回原点加速时间")] [DisplayName("高速段加速时间")] [Description("高速段加速时间,单位:ms")] public ushort H_dMaxA_Time { get; set; } = 10; [Category("回原点加速时间")] [DisplayName("低速段加速时间")] [Description("低速段加速时间,单位:ms")] public ushort L_dMaxA_Time { get; set; } = 10; [Category("回原点参数")] [DisplayName("偏移位置")] [Description("偏移位置,按回零模式中的方向偏移")] public int OffsetPosition { get; set; } = 0; [Category("回原点参数")] [DisplayName("碰撞原点缓停时间")] [Description("SearchHomeStopTime:触发缓停时间,范围 0-1000ms,(默认:急停)。注意:设置碰撞原点缓停时间,需要配合回零设置的高速段速度,和低速度速度的搭配。设置大了会出现过冲的现象,设置小了停止的时候会有抖动,需要调节时间,尽量设置找到原点时候在开关中间。")] public ushort SearchHomeStopTime { get; set; } = 0; [Category("回原点速度")] [DisplayName("高速段速度")] [Description("高速段速度")] public double H_dMaxV { get; set; } = 10000; [Category("回原点速度")] [DisplayName("低速段速度")] [Description("低速段速度")] public double L_dMaxV { get; set; } = 3000; [Category("回原点超时")] [DisplayName("回原点超时")] [Description("回原点超时,单位秒")] public int GoHomeTimeOut { get; set; } = 60; } /// /// 回原点的状态 /// public class GoHomeStatus { [Category("回原点状态")] [DisplayName("回原点状态")] [Description("回原点状态,0:回零成功,31:回零错误,32:正在回零")] public ushort Status { get; set; } } /// /// 轴状态对象 /// public class AxisMovingStatus { /// /// 卡号、 核号 /// public int StationNumber { get; set; } = 0; /// /// 轴索引 /// public int AxisIndex { get; set; } /// /// 轴名称 /// public string AxisName { get; set; } /// /// 当前位置 /// public int CurPosition { get; set; } /// /// 目的地 /// public int PrfPosition { get; set; } /// /// 当前速度参数 /// public double CurVelocity { get; set; } /// /// 规划速度参数 /// public double PrfVelocity { get; set; } /// /// 轴状态 /// public int AxisStatus { get; set; } public bool Alarm { get; set; } = false; public bool Enable { get; set; } = false; public bool PositiveLimit { get; set; } = false; public bool NegativeLimit { get; set; } = false; public bool IsMonitorPosition { get; set; } public bool IsMonitorStatus { get; set; } //public string GetDisplayText() //{ // //return $"轴{AxisIndex}:{AxisName}-当前状态:{AxisStatus}-当前位置:{CurPosition}"; //} } public class AxisInfo { public string AxisName { get; set; } public double AxisLocation { get; set; } public string GetDisplayText() { return $"{AxisName}:{AxisLocation}"; } } public class IODefinition : IOItem { [Category("IO配置")] [Description("IO预定义")] public IOPrestatement IOPreStatement { get; set; } = IOPrestatement.Customized; [Category("IO配置")] [Description("IO用途描述")] public string IODesc { get; set; } [Category("IO配置")] [Description("备注说明")] public string Remark { get; set; } //[Category("IO配置")] //[Description("IO初始值,Flase为0(低电平),Ture为1(高电平)")] //public bool InitialValue { get; set; } = false; [Browsable(false)] [JsonIgnore] public override IOValue IOValue { get; set; } //public override string GetDisplayText() //{ // return $"{(IOPreStatement == IOPrestatement.Customized ? IODesc : IOPreStatement.GetEnumDescription())} {IOType.GetEnumDescription()} {IOIndex}"; //} } public class IOItem : IEqualityComparer { /// /// IO点编号 /// [Category("IO配置")] [Description("IO点索引")] public virtual int IOIndex { get; set; } /// /// IO点的值 /// [Category("IO配置")] [Description("IO状态")] public virtual IOValue IOValue { get; set; } /// /// IO点是in还是out /// [Category("IO配置")] [Description("IO类型")] public virtual IOType IOType { get; set; } public new bool Equals(object x, object y) { if (x is IOItem a && y is IOItem b) { return a.IOType == b.IOType && a.IOIndex == b.IOIndex; } return false; } //public virtual string GetDisplayText() //{ // return $"{IOType.GetEnumDescription()}-{IOIndex}-{IOValue.GetEnumDescription()}"; //} public int GetHashCode(object obj) { return obj.GetHashCode(); } } public class SortingInputSetting { [Category("入料检测配置")] [DisplayName("启用入料检测")] [Description("启用入料检测")] public bool Enable { get; set; } = false; [Category("入料检测配置")] [DisplayName("位号")] [Description("位号")] public BitInputNumberEnum BitInputNumber { get; set; } = BitInputNumberEnum.BitInput0; [Category("入料检测配置")] [DisplayName("物件检测有效电平")] [Description("物件检测有效电平")] public LogicLevelEnum InputLogic { get; set; } = LogicLevelEnum.LowLevel; [Category("入料检测配置")] [DisplayName("物件检测有效电平")] [Description("物件检测有效电平")] public ushort AxisIndex { get; set; } = 0; [Category("入料检测配置")] [DisplayName("跟随方式")] [Description("跟随方式")] public PositionSourceEnum PositionSource { get; set; } = PositionSourceEnum.EncoderPosition; [Category("入料检测配置")] [DisplayName("入料检测捕获位置")] [Description("入料检测捕获位置")] public SortingInputPositionModeEnum SortingInputPositionMode { get; set; } = SortingInputPositionModeEnum.Front; [Category("相机绑定配置")] [DisplayName("启用相机绑定")] [Description("启用相机绑定")] public bool EnableBindCamera { get; set; } = false; [Category("相机绑定配置")] [DisplayName("起始相机号")] [Description("起始相机号")] public ushort CameraStartNumber { get; set; } = 0; [Category("吹气绑定配置")] [DisplayName("启用吹气绑定")] [Description("启用吹气绑定")] public bool EnableBindBlow { get; set; } = false; [Category("吹气绑定配置")] [DisplayName("起始气阀号")] [Description("起始气阀号")] public ushort BlowStartNumber { get; set; } = 0; //public string GetDisplayText() //{ // return $"{BitInputNumber.GetEnumDescription()} 启用相机绑定{EnableBindCamera.ToString()} 启用吹气绑定{EnableBindBlow.ToString()}"; //} } #region 源程序运行调用类,未复制完,太复杂注释掉 public class ResponseMessage { public ResponseMessage() { } public int Code { get; set; } public int Result { get; set; } = 1; public string Message { get; set; } public string DataJson { get; set; } [JsonIgnore] public object DataObj { get; set; } = null; /// /// 执行结果数据集合 /// public List DataList { get; set; } = new List(); public void GetMessageFromException(Exception ex, int code = 9999) { Code = code; //Message = ex.GetExceptionMessage(); Result = -1; } public ResponseMessage(int result) { Result = result; } public ResponseMessage(bool resultFlag, List datas = null) { Result = resultFlag ? 1 : -1; if (datas != null) { DataList = new List(datas); } } public ResponseMessage(int resultFlag, List datas = null) { Result = resultFlag; if (datas != null) { DataList = new List(datas); } } public ResponseMessage(bool result, string msg) { Result = result ? 1 : -1; Message = msg; } public string GetDisplayText() { return $"{Result} | {(DataList.Count > 0 ? string.Join(" ", DataList) : "NA")}"; } } public interface IOperationConfig //: IOperationResult { /// /// 发生异常时的重新尝试次数 /// int ReTryTimes { get; set; } /// /// 输入参数 /// List InputPara { get; set; } int TriggerValue { get; set; } /// /// 当异常发生时的异常反馈值 /// int ExceptionValue { get; set; } /// /// 指示该操作的监视配置来源 /// string MonitorSetId { get; set; } /// /// 调用该操作配置的设备Id /// string ExecuteDeviceId { get; set; } /// /// 操作执行后部分输出结果,目前拟采用序列化后的字符串方式保存 /// string OutputData { get; set; } } public class SolidMotionCardOperationConfigBase : OperationConfigBase { [Category("板卡操作")] [Description("板卡操作配置基类集合,依次执行")] public List OperationCollection { get; set; } = new List(); } public class OperationConfigBase : IOperationConfig//, ISourceDevice { /// /// 输入参数 /// [JsonIgnore] [Category("输入配置")] [Description("输入参数配置")] [DisplayName("输入参数")] //[TypeConverter(typeof(SimpleCollectionConvert))] public virtual List InputPara { get; set; } = new List(); /// /// 异常反馈值 /// [Category("异常反馈设置")] [Description("异常反馈值")] [DisplayName("异常反馈值")] public virtual int ExceptionValue { get; set; } = 0; /// /// 发生异常时的重新尝试次数 /// [Category("异常反馈设置")] [Description("发生异常时的重新尝试次数")] [DisplayName("重试次数")] public virtual int ReTryTimes { get; set; } = 3; [Browsable(false)] public string MonitorSetId { get; set; } = ""; [Browsable(false)] [JsonIgnore] public virtual string ExecuteDeviceId { get; set; } = ""; //[Browsable(false)] //[JsonIgnore] //public virtual string SourceDeviceId { get; set; } = ""; [Browsable(false)] [JsonIgnore] public virtual string OutputData { get; set; } = ""; [Browsable(false)] [JsonIgnore] public virtual int TriggerValue { get; set; } } public class SolidMotionCardOperationSet : IOOperationConfigBase { #region Ignore [JsonIgnore] [Browsable(false)] public override List InputPara { get; set; } = new List(); /// /// 异常反馈值 /// [JsonIgnore] [Browsable(false)] public override int ExceptionValue { get; set; } = 0; /// /// 发生异常时的重新尝试次数 /// [JsonIgnore] [Browsable(false)] public override int ReTryTimes { get; set; } = 1; #endregion [Category("2.板卡运动配置")] [DisplayName("运动配置集合")] [Description("MovingOps:多轴并发,运动配置集合")] public List MovingOps { get; set; } = new List(); [Category("5.操作延时")] [DisplayName("操作前延时")] [Description("操作前延时,单位ms")] public override int DelayBefore { get; set; } = 0; [Category("5.操作延时")] [DisplayName("操作后延时")] [Description("操作后延时,单位ms")] public override int DelayAfter { get; set; } = 0; } public class IOOperationConfigBase : OperationConfigBase { [Category("\t\t\tIO操作配置")] [DisplayName("1.IO预检查")] [Description("IO预检查定义集合")] public List PreCheckIOCollection { get; set; } = new List(); [Category("\t\t\tIO操作配置")] [Description("超时设置,单位:ms")] [DisplayName("2.IO预检查超时")] public int PreCheckIOTimeout { get; set; } = 0; [Category("\t\t\tIO操作配置")] [DisplayName("3.IO输出")] [Description("IO输出定义集合")] public List IOOutputCollection { get; set; } = new List(); [Category("\t\t\tIO操作配置")] [DisplayName("4.IO输出确认")] [Description("IO确认定义集合")] public List IOConfirmCollection { get; set; } = new List(); [Category("\t\t\tIO操作配置")] [Description("超时设置,单位:ms")] [DisplayName("5.IO输出确认超时")] public int IOConfirmTimeout { get; set; } = 0; [Category("\t\t\tIO操作配置")] [Description("IO操作前延时,单位ms")] public virtual int DelayBefore { get; set; } = 0; [Category("\t\t\tIO操作配置")] [Description("IO操作后延时,单位ms")] public virtual int DelayAfter { get; set; } = 0; } /// /// IO操作对象 /// public class IOOperationItem { [Category("IO操作配置")] [Description("需要操作的IO")] public IODefinition IOItem { get; set; } = new IODefinition(); [Category("IO操作配置")] [Description("需要操作的IO的状态")] public IOValue CheckValue { get => IOItem.IOValue; set => IOItem.IOValue = value; } //[Browsable(false)] //[JsonIgnore] public List IOItemSource = new List(); //public string GetDisplayText() //{ // return IOItem.IODesc + "-" + CheckValue.GetEnumDescription(); //} } /// /// 运动对象 /// public class MovingOption { [Category("运动配置")] [DisplayName("运动轴索引")] [Description("AxisIndex:运动轴索引")] // [TypeConverter(typeof(AxisIndexConvert))] public int AxisIndex { get; set; } [Category("运动配置")] [DisplayName("运动模式")] [Description("MoveMode:运动模式")] public MotionMode MoveMode { get; set; } = MotionMode.P2P; [Category("运动配置")] [DisplayName("运动方向")] [Description("MoveDir:运动方向")] public PulseMode MoveDir { get; set; } = PulseMode.Pulse_Dir_H; [Category("运动配置")] [DisplayName("点位运动误差带")] [Description("点位运动误差带,单位plus")] public int ErrorBand { get; set; } = 20; [Category("运动配置")] [DisplayName("是否绝对运动")] [Description("IsAbsolute:是否绝对运动")] public bool IsAbsolute { get; set; } = true; [Category("运动配置")] [DisplayName("目的地")] [Description("Destination:目的地")] public int Destination { get; set; } [Category("运动配置")] [DisplayName("备注")] [Description("Remark:备注")] public string Remark { get; set; } [Category("运动配置")] [DisplayName("速度参数")] [Description("VelocityPara:速度参数")] public VelocityPara VelocityPara { get; set; } = new VelocityPara(); [Category("运动配置")] [Description("超时设置,单位:ms")] [DisplayName("运动超时")] public int MovingTimeout { get; set; } = 0; internal List _axisSettingList = new List(); public void SetAxisSetting(List settings) { if (settings != null) _axisSettingList = settings; } public string GetDisplayText() { //string axisName = AxisIndexStr; 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 SolidMotionOperationCollection : OperationConfigBase { [Category("运动配置")] [DisplayName("运动配置集合")] [Description("MovingOps:多轴并发,运动配置集合")] public List MovingOps { get; set; } = new List(); [Category("运动配置")] [Description("多轴并发运动超时设置,单位:s")] [DisplayName("多轴并发运动超时")] public int MovingOpsTimeout { get; set; } = 60; } #endregion }