领胜LDS 键盘AOI检测项目
wells.liu
2020-07-02 f391747ad784f65c4f5c8f6640e094d01f3fdb79
板卡操作
3个文件已修改
95 ■■■■ 已修改文件
src/Bro.Common.Device/DeviceBase/MotionCardBase.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Device.GTSCard/GTSCardDriver.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
@@ -22,6 +22,24 @@
        public abstract ResponseMessage MoveToPoint(IOperationConfig opConfig);
        public abstract void ResetAlarm();
        public abstract ResponseMessage Run(IOperationConfig config);
        public void ExcuteMonitorInvok(DateTime dateTime, string invokeDevice, IDevice device, IMonitorSet monitorSet)
        {
            OnMonitorInvoke?.BeginInvoke(dateTime, invokeDevice, device, monitorSet, null, null);
        }
        public void ExcuteMonitorAlarm(DateTime dateTime, IDevice device, IWarningSet warningSet)
        {
            OnMonitorAlarm?.BeginInvoke(dateTime, device, warningSet, null, null);
        }
        public virtual MotionCardInitialConfigBase IConfig
        {
            get
            {
                return InitialConfig as MotionCardInitialConfigBase;
            }
        }
    }
    public class MotionCardInitialConfigBase : InitialConfigBase, IMonitorConfig
@@ -108,17 +126,20 @@
    public class MotionCardOperationConfigBase : OperationConfigBase, IComplexDisplay
    {
        [Category("IO操作配置")]
        [DisplayName("IO预检查定义集合")]
        [Description("IO预检查定义集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(IORefrenceItemCollectionEditor),typeof(UITypeEditor))]
        [Editor(typeof(IORefrenceItemCollectionEditor), typeof(UITypeEditor))]
        public List<IORefrenceItem> PreCheckIOCollection { get; set; } = new List<IORefrenceItem>();
        [Category("IO操作配置")]
        [DisplayName("IO输出定义集合")]
        [Description("IO输出定义集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
        public List<IORefrenceItem> IOOutputCollection { get; set; } = new List<IORefrenceItem>();
        [Category("IO操作配置")]
        [DisplayName("IO确认定义集合")]
        [Description("IO确认定义集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
        public List<IORefrenceItem> IOConfirmCollection { get; set; } = new List<IORefrenceItem>();
@@ -136,5 +157,4 @@
        }
    }
}
src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -18,7 +18,7 @@
namespace Bro.Device.GTSCard
{
    [Device("GTSCard", "固高板卡", EnumHelper.DeviceAttributeType.Device)]
    public class GTSCardDriver : DeviceBase, IMonitor, IMotion
    public class GTSCardDriver : MotionCardBase
    {
        // 异常事件
        public Action<Exception> OnExceptionRaised;
@@ -42,7 +42,7 @@
            _isResetting = isReset;
        }
        public List<AxisInfo> GetCurrentAxisInfo(params string[] axisName)
        public override List<AxisInfo> GetCurrentAxisInfo(params string[] axisName)
        {
            throw new NotImplementedException();
        }
@@ -74,6 +74,11 @@
            AllMoveStop();
            AllAxisOff();
        }
        public override ResponseMessage Run(IOperationConfig config)
        {
            throw new NotImplementedException();
        }
        #endregion
        #region GTSCard
@@ -93,6 +98,7 @@
                throw new Exception("板卡载入配置文件异常,错误码:" + res);
            }
        }
        public bool AllAxisOn()
        {
@@ -153,7 +159,7 @@
        /// </summary>
        /// <param name="item">运动对象</param>
        /// <returns>运动控制+停止判断</returns>
        public ResponseMessage MoveToPoint(IOperationConfig opConfig)
        public override ResponseMessage MoveToPoint(IOperationConfig opConfig)
        {
            bool resultOK = false;
            var gtsOperationConfig = opConfig as GTSCardOperationConfig;
@@ -680,8 +686,6 @@
        #endregion
        #region IMonitor
        public event Action<DateTime, string, IDevice, IMonitorSet> OnMonitorInvoke;
        public event Action<DateTime, IDevice, IWarningSet> OnMonitorAlarm;
        public List<IOItem> MonitorValues { get; set; } = new List<IOItem>();
@@ -718,7 +722,7 @@
            return result;
        }
        public async void Monitor()
        public async override void Monitor()
        {
            await Task.Run(() =>
            {
@@ -805,7 +809,7 @@
                    warningSet.TriggerTime = DateTime.Now;
                    warningSet.WarningDescription = $"警报:{warningSet.Name}-触发索引:{warningSet.TriggerIndex}-{warningSet.WarningIOModel.GetEnumDescription()}:{warningSet.WarningCode}";
                    SaveAlarmCSVAsync(DateTime.Now, this.Name, warningSet);
                    OnMonitorAlarm?.BeginInvoke(DateTime.Now, this, warningSet, null, null);
                    ExcuteMonitorAlarm(DateTime.Now, this, warningSet);
                }
            });
            #endregion
@@ -836,14 +840,14 @@
                        //    return tempNew[index].Value;
                        //}).ToList();
                        OnMonitorInvoke?.BeginInvoke(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet, OnMethodInvoked, monitorSet);
                        ExcuteMonitorInvok(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet);
                    }
                }
            });
            #endregion
        }
        public void ResetAlarm()
        public override void ResetAlarm()
        {
            int axis_sts;
            uint clk;
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardOperationBase.cs
@@ -1,9 +1,9 @@
using Bro.Common.Helper;
using Bro.Common.Base;
using Bro.Common.Helper;
using Bro.Common.Interface;
using Bro.Common.Model;
using Bro.Device.GTSCard;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Windows.Forms;
@@ -18,17 +18,23 @@
        public IDevice Device { get; set; }
        //protected CameraBase Camera
        //{
        //    get => Device as CameraBase;
        //}
        public MotionCardOperationConfigBase MotionCardOperationConfig { get; set; }
        /// <summary>
        /// 当前板卡实例
        /// </summary>
        protected MotionCardBase MotionCard
        {
            get => Device as MotionCardBase;
        }
        public CtrlMotionCardOperationBase(IDevice device)
        {
            InitializeComponent();
            Device = device;
            MotionCardOperationConfig = new MotionCardOperationConfigBase();
        }
@@ -41,43 +47,22 @@
        {
        }
        #endregion
        public void DownloadProcess(IProcess process)
        {
            throw new NotImplementedException();
        }
        public void OnProcessUpdated()
        {
            if (InvokeRequired)
            {
                Invoke(new Action(() => OnProcessUpdated()));
            }
            else
            {
                if (Process != null)
                {
                    //_avaiableMethods = Process.ProcessMethodCollection.Where(u => u.InvokeType == _invokeType).Select(u => u.MethodCode).ToList();
                    //LoadDevices();
                    //LoadProcessMethods();
                }
            }
        }
        private void RadioButton_CheckedChanged(object sender, EventArgs e)
        {
            //加载对应运动的 movingConfig
            if (radioP2P.Checked)
            {
                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal);
                movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Normal);
            }
            else if (radioJog.Checked)
            {
                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog);
                movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.Jog);
            }
            else if (radioGoHome.Checked)
            {
                movingConfig = GTSCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri);
                movingConfig = MotionCardOperationConfig.MovingOps.FirstOrDefault(u => u.MoveMode == EnumHelper.MotorMoveMode.FindOri);
            }
            propGrid.SelectedObject = movingConfig;