From 65faad811883efc4264e3a5ca2c4e64340c198f5 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期六, 04 七月 2020 13:02:28 +0800 Subject: [PATCH] 板卡运动 --- src/Bro.Common.Device/DeviceBase/MotionCardBase.cs | 90 ++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 81 insertions(+), 9 deletions(-) diff --git a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs index 271562e..ca5ba82 100644 --- a/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs +++ b/src/Bro.Common.Device/DeviceBase/MotionCardBase.cs @@ -26,9 +26,9 @@ public abstract void ResetAlarm(); public abstract ResponseMessage Run(IOperationConfig config); - public void ExcuteMonitorInvok(DateTime dateTime, string invokeDevice, IDevice device, IMonitorSet monitorSet) + public void ExcuteMonitorInvok(DateTime dateTime, string invokeDevice, IDevice device, IMonitorSet monitorSet, AsyncCallback OnMethodInvoked) { - OnMonitorInvoke?.BeginInvoke(dateTime, invokeDevice, device, monitorSet, null, null); + OnMonitorInvoke?.BeginInvoke(dateTime, invokeDevice, device, monitorSet, OnMethodInvoked, null); } public void ExcuteMonitorAlarm(DateTime dateTime, IDevice device, IWarningSet warningSet) @@ -134,6 +134,10 @@ [TypeConverter(typeof(CollectionCountConvert))] [Editor(typeof(IORefrenceItemCollectionEditor), typeof(UITypeEditor))] public List<IORefrenceItem> PreCheckIOCollection { get; set; } = new List<IORefrenceItem>(); + [Category("IO鎿嶄綔閰嶇疆")] + [Description("瓒呮椂璁剧疆锛屽崟浣嶏細ms")] + [DisplayName("IO棰勬鏌ヨ秴鏃�")] + public int PreCheckIOTimeout { get; set; } = 0; [Category("IO鎿嶄綔閰嶇疆")] [DisplayName("IO杈撳嚭瀹氫箟闆嗗悎")] @@ -146,6 +150,10 @@ [Description("IO纭瀹氫箟闆嗗悎")] [TypeConverter(typeof(CollectionCountConvert))] public List<IORefrenceItem> IOConfirmCollection { get; set; } = new List<IORefrenceItem>(); + [Category("IO鎿嶄綔閰嶇疆")] + [Description("瓒呮椂璁剧疆锛屽崟浣嶏細ms")] + [DisplayName("IO纭瓒呮椂")] + public int IOConfirmTimeout { get; set; } = 0; [Category("鏉垮崱杩愬姩閰嶇疆")] [DisplayName("杩愬姩閰嶇疆闆嗗悎")] @@ -154,9 +162,49 @@ [Editor(typeof(ComplexCollectionEditor<MovingOption>), typeof(UITypeEditor))] public List<MovingOption> MovingOps { get; set; } = new List<MovingOption>(); + public string GetDisplayText() { - throw new NotImplementedException(); + string preCheck = ""; + PreCheckIOCollection.ForEach(i => + { + preCheck += i.GetDisplayText() + " "; + }); + if (preCheck != "") + { + preCheck = " 棰勬锛�" + preCheck; + } + + string output = ""; + IOOutputCollection.ForEach(i => + { + output += i.GetDisplayText() + " "; + }); + if (output != "") + { + output = " 杈撳嚭锛�" + output; + } + string confirm = ""; + IOConfirmCollection.ForEach(i => + { + confirm += i.GetDisplayText() + " "; + }); + if (confirm != "") + { + confirm = " 纭锛�" + confirm; + } + + string moving = ""; + MovingOps.ForEach(i => + { + moving += i.GetDisplayText() + " "; + }); + if (moving != "") + { + moving = " 杩愬姩锛�" + moving; + } + + return (preCheck + output + confirm + moving).Trim(); } } @@ -180,10 +228,31 @@ return form; } - //protected override object CreateInstance(Type itemType) - //{ - // return base.CreateInstance(itemType); - //} + protected override object CreateInstance(Type itemType) + { + if (itemType == typeof(IORefrenceItem)) + { + IORefrenceItem item = new IORefrenceItem(); + if ((this.Context.Instance is IOperationConfig opConfig) && !string.IsNullOrWhiteSpace(opConfig.DeviceId)) + { + using (var scope = GlobalVar.Container.BeginLifetimeScope()) + { + List<IDevice> deviceList = scope.Resolve<List<IDevice>>(); + + var device = deviceList.FirstOrDefault(u => u.Id == opConfig.DeviceId); + + if (device != null && (device is MotionCardBase motionCard)) + { + item.IOItemSource = (motionCard.InitialConfig as MotionCardInitialConfigBase).IODefinitionCollection; + } + } + } + + return item; + } + + return base.CreateInstance(itemType); + } //protected override object[] GetItems(object editValue) //{ @@ -217,9 +286,12 @@ if (device is MotionCardBase motionCard) { - if (value is IORefrenceItem item) + if (value is List<IORefrenceItem> items) { - item.IOItemSource = (motionCard.InitialConfig as MotionCardInitialConfigBase).IODefinitionCollection; + items.ForEach(item => + { + item.IOItemSource = (motionCard.InitialConfig as MotionCardInitialConfigBase).IODefinitionCollection; + }); } } } -- Gitblit v1.8.0