领胜LDS 键盘AOI检测项目
xcd
2020-07-09 c0b8009ef36746c7a14606267662570e8c59c2c6
部分模型修改
10个文件已修改
200 ■■■■■ 已修改文件
src/Bro.Common.Device/DeviceBase/MotionCardBase.cs 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Model/IOItem.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Model/Model/MonitorSet.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Device.GTSCard/GTSCardDriver.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/M071Models.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/KeyIndicator.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_DataForm.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_MainForm.cs 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/MainFrm.cs 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Model.Winform/UI/DockContent/MenuFrmBase.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.Common.Device/DeviceBase/MotionCardBase.cs
@@ -237,35 +237,38 @@
    [Device("MotionOperationSet", "运动操作配置基类", EnumHelper.DeviceAttributeType.OperationConfig)]
    public class MotionCardOperationSet : IComplexDisplay
    {
        [Category("IO操作配置")]
        [DisplayName("IO预检查定义集合")]
        [Category("1.IO操作配置")]
        [DisplayName("1.IO预检查")]
        [Description("IO预检查定义集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(IORefrenceItemCollectionEditor), typeof(UITypeEditor))]
        public List<IORefrenceItem> PreCheckIOCollection { get; set; } = new List<IORefrenceItem>();
        [Category("IO操作配置")]
        [Category("1.IO操作配置")]
        [Description("超时设置,单位:ms")]
        [DisplayName("IO预检查超时")]
        [DisplayName("2.IO预检查超时")]
        public int PreCheckIOTimeout { get; set; } = 0;
        [Category("IO操作配置")]
        [DisplayName("IO输出定义集合")]
        [Category("1.IO操作配置")]
        [DisplayName("3.IO输出")]
        [Description("IO输出定义集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(IORefrenceItemCollectionEditor), typeof(UITypeEditor))]
        public List<IORefrenceItem> IOOutputCollection { get; set; } = new List<IORefrenceItem>();
        [Category("IO操作配置")]
        [DisplayName("IO确认定义集合")]
        [Category("1.IO操作配置")]
        [DisplayName("4.IO输出确认")]
        [Description("IO确认定义集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(IORefrenceItemCollectionEditor), typeof(UITypeEditor))]
        public List<IORefrenceItem> IOConfirmCollection { get; set; } = new List<IORefrenceItem>();
        [Category("IO操作配置")]
        [Category("1.IO操作配置")]
        [Description("超时设置,单位:ms")]
        [DisplayName("IO确认超时")]
        [DisplayName("5.IO输出确认超时")]
        public int IOConfirmTimeout { get; set; } = 0;
        [Category("板卡运动配置")]
        [Category("2.板卡运动配置")]
        [DisplayName("运动配置集合")]
        [Description("MovingOps:运动配置集合")]
        [TypeConverter(typeof(CollectionCountConvert))]
@@ -378,13 +381,13 @@
            if (itemType == typeof(IORefrenceItem))
            {
                IORefrenceItem item = new IORefrenceItem();
                if ((this.Context.Instance is IOperationConfig opConfig) && !string.IsNullOrWhiteSpace(opConfig.DeviceId))
                if (this.Context.Instance is MotionCardOperationSet set)
                {
                    using (var scope = GlobalVar.Container.BeginLifetimeScope())
                    {
                        List<IDevice> deviceList = scope.Resolve<List<IDevice>>();
                        var device = deviceList.FirstOrDefault(u => u.Id == opConfig.DeviceId);
                        var device = deviceList.FirstOrDefault(u => u.Id == set.MotionCardId);
                        if (device != null && (device is MotionCardBase motionCard))
                        {
@@ -411,9 +414,9 @@
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context.Instance is IOperationConfig opConfig)
            if (context.Instance is MotionCardOperationSet set)
            {
                if (string.IsNullOrWhiteSpace(opConfig.DeviceId))
                if (string.IsNullOrWhiteSpace(set.MotionCardId))
                {
                    return base.EditValue(context, provider, value);
                }
@@ -422,7 +425,7 @@
                {
                    List<IDevice> deviceList = scope.Resolve<List<IDevice>>();
                    var device = deviceList.FirstOrDefault(u => u.Id == opConfig.DeviceId);
                    var device = deviceList.FirstOrDefault(u => u.Id == set.MotionCardId);
                    if (device == null)
                    {
src/Bro.Common.Model/Model/IOItem.cs
@@ -113,7 +113,9 @@
            {
                item.IOItemSource.ForEach(i =>
                {
                    itemDict[i] = i.IODesc + "-" + i.IOType.GetEnumDescription() + "-" + i.IONum;
                    IODefinition temp = new IODefinition();
                    temp.DataFrom(i);
                    itemDict[temp] = (string.IsNullOrWhiteSpace(i.IODesc) ? i.IOPreStatement.GetEnumDescription() : i.IODesc) + "|" + i.IOType.GetEnumDescription() + "|" + i.IONum;
                });
                return new StandardValuesCollection(itemDict.Keys);
@@ -158,7 +160,7 @@
        /// <returns></returns>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var s = value.ToString().Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
            var s = value.ToString().Split(new char[] { '|' });
            if (s.Length == 3)
            {
src/Bro.Common.Model/Model/MonitorSet.cs
@@ -209,12 +209,12 @@
        /// <summary>
        /// 监听回传
        /// </summary>
        [Category("回传设置")]
        [DisplayName("监听回传")]
        [Description("监听运动板卡,并往指定的IO写入数据")]
        [TypeConverter(typeof(CollectionCountConvert))]
        [Editor(typeof(IOItem), typeof(UITypeEditor))]
        public List<IOItem> ReplyIODatas { get; set; } = new List<IOItem>();
        //[Category("回传设置")]
        //[DisplayName("监听回传")]
        //[Description("监听运动板卡,并往指定的IO写入数据")]
        //[TypeConverter(typeof(CollectionCountConvert))]
        //[Editor(typeof(ComplexCollectionEditor<IOItem>), typeof(UITypeEditor))]
        //public List<IOItem> ReplyIODatas { get; set; } = new List<IOItem>();
    }
    public class IOperationConfigEditor : UITypeEditor
src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -1027,27 +1027,27 @@
        public override void OnMethodInvoked(IAsyncResult ar)
        {
            MotionCardMonitorSet monitorSet = ar.AsyncState as MotionCardMonitorSet;
            ProcessResponse resValues = monitorSet.Response;
            if (resValues.ResultValue == (int)ReplyValue.IGNORE)
            {
                return;
            }
            //MotionCardMonitorSet monitorSet = ar.AsyncState as MotionCardMonitorSet;
            //ProcessResponse resValues = monitorSet.Response;
            //if (resValues.ResultValue == (int)ReplyValue.IGNORE)
            //{
            //    return;
            //}
            Stopwatch sw = new Stopwatch();
            sw.Start();
            // 将指定IOItem写入板卡
            foreach (var replyIOData in monitorSet.ReplyIODatas)
            {
                //写入IO输出
                if (replyIOData.IOType == IOType.OUTPUT)
                {
                    GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPI, (short)replyIOData.IONum, (short)replyIOData.Value);
                }
                // in只读不能写
            }
            sw.Stop();
            LogAsync(DateTime.Now, $"{Name}反馈完成,耗时{sw.ElapsedMilliseconds}ms", $"{resValues.GetDisplayText()}");
            //Stopwatch sw = new Stopwatch();
            //sw.Start();
            //// 将指定IOItem写入板卡
            //foreach (var replyIOData in monitorSet.ReplyIODatas)
            //{
            //    //写入IO输出
            //    if (replyIOData.IOType == IOType.OUTPUT)
            //    {
            //        GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPI, (short)replyIOData.IONum, (short)replyIOData.Value);
            //    }
            //    // in只读不能写
            //}
            //sw.Stop();
            //LogAsync(DateTime.Now, $"{Name}反馈完成,耗时{sw.ElapsedMilliseconds}ms", $"{resValues.GetDisplayText()}");
        }
        protected void MonitorCheckAndInvoke(List<IOItem> tempNew, List<IOItem> tempOld)
src/Bro.M071.Process/M071Models.cs
@@ -178,7 +178,22 @@
        public string GetDisplayText()
        {
            return $"{AliasName}";
            string snapShot = "未指定";
            using (var scope = GlobalVar.Container.BeginLifetimeScope())
            {
                var config = scope.Resolve<IProcessConfig>();
                if (config != null)
                {
                    var snapshotPoint = (config as M071Config).SnapshotPointCollection.FirstOrDefault(u => u.Id == SnapshotPointId);
                    if (snapshotPoint != null)
                    {
                        snapShot = snapshotPoint.Name;
                    }
                }
            }
            return $"{AliasName}-{snapShot}-{ImageSeq}";
        }
        public List<string> GetHalconToolPathList()
src/Bro.M071.Process/UI/KeyIndicator.cs
@@ -58,7 +58,7 @@
        protected override void SetSelectedPen()
        {
            Pen = new Pen(Color.Red, 6);
            Pen = new Pen(Color.Red, 3);
        }
        public override void Draw(Graphics g)
src/Bro.M071.Process/UI/M071_DataForm.cs
@@ -11,7 +11,7 @@
namespace Bro.M071.Process.UI
{
    [MenuNode("M071_DataForm", "数据查询界面", 1, "M071Node", true)]
    [MenuNode("M071_DataForm", "数据查询界面", 3, "M071Node", true)]
    public partial class M071_DataForm : MenuFrmBase
    {
        public M071_DataForm()
src/Bro.M071.Process/UI/M071_MainForm.cs
@@ -51,35 +51,37 @@
            if (string.IsNullOrWhiteSpace(Config.BackgroundImagePath))
                return;
            try
            this.Invoke(new Action(() =>
            {
                Bitmap image = (Bitmap)Image.FromFile(Config.BackgroundImagePath);
                cvImage.LoadImage(image);
                cvImage.SetScreenSize();
            }
            catch (Exception ex)
            {
                LogAsync(new LogMsg(DateTime.Now, "载入背景图异常", ex.Message));
                return;
            }
            cvImage.Elements.Clear();
            lvMeasures.Items.Clear();
            Config.MeasurementUnitCollection.ForEach(u =>
            {
                if (!u.IsEnabled)
                try
                {
                    Bitmap image = (Bitmap)Image.FromFile(Config.BackgroundImagePath);
                    cvImage.LoadImage(image);
                    cvImage.SetScreenSize();
                }
                catch (Exception ex)
                {
                    LogAsync(new LogMsg(DateTime.Now, "载入背景图异常", ex.Message));
                    return;
                }
                var ele = new KeyIndicator(u.Id, u.DisplayLocation);
                cvImage.Elements.Add(ele);
                cvImage.Elements.Clear();
                lvMeasures.Items.Clear();
                txtBarcode.ReadOnly = Config.IsBarcodeManulInputBlocked;
                ListViewItem item = new ListViewItem(u.GetDisplayText());
                item.Tag = u.Id;
                lvMeasures.Items.Add(item);
            });
                Config.MeasurementUnitCollection.ForEach(u =>
                {
                    if (!u.IsEnabled)
                        return;
            if (txtBarcode.IsHandleCreated)
                txtBarcode.BeginInvoke(new Action(() => txtBarcode.ReadOnly = Config.IsBarcodeManulInputBlocked));
                    var ele = new KeyIndicator(u.Id, u.DisplayLocation);
                    cvImage.Elements.Add(ele);
                    ListViewItem item = new ListViewItem(u.GetDisplayText());
                    item.Tag = u.Id;
                    lvMeasures.Items.Add(item);
                });
            }));
            Process_M071.OnClearBarcode -= M071_MainForm_OnClearBarcode;
            Process_M071.OnClearBarcode += M071_MainForm_OnClearBarcode;
src/Bro.UI.Config/MainFrm.cs
@@ -74,10 +74,10 @@
            //});
            m_deserializeMenuFrm = new DeserializeDockContent(GetMenuFromPersistString);
            LoadLayoutFromXML(m_deserializeMenuFrm);
            m_deserializeDeviceRunFrm = new DeserializeDockContent(GetAllFormPersistString);
            _allMenuLoadDoneHandle.Set();
            //LoadLayoutFromXML(m_deserializeMenuFrm);
            //_allMenuLoadDoneHandle.Set();
            Text = SettingHelper.GetProgramDescription();
            string iconPath = SettingHelper.GetProgramIcon();
@@ -254,13 +254,16 @@
        private void MainFrm_Load(object sender, EventArgs e)
        {
            LoadLayoutFromXML(m_deserializeMenuFrm);
            _allMenuLoadDoneHandle.Set();
            AdvancedPwdFrm.OnLoginOK = OnLoginOK;
            SpinWait wait = new SpinWait();
            while (_process == null)
            {
                wait.SpinOnce();
            }
            //SpinWait wait = new SpinWait();
            //while (_process == null)
            //{
            //    wait.SpinOnce();
            //}
            LoadLayoutFromXML(m_deserializeDeviceRunFrm);
        }
@@ -542,10 +545,10 @@
                dockFrm.Text = desc[2];
                if (_process != null)
                {
                    dockFrm.DownloadProcess(_process);
                }
                //if (_process != null)
                //{
                //    dockFrm.DownloadProcess(_process);
                //}
                dockFrm.SetLoginStatus(IsLogin);
@@ -580,10 +583,10 @@
                dockFrm.Text = desc[2];
                if (_process != null)
                {
                    dockFrm.DownloadProcess(_process);
                }
                //if (_process != null)
                //{
                //    dockFrm.DownloadProcess(_process);
                //}
                dockFrm.SetLoginStatus(IsLogin);
src/Bro.UI.Model.Winform/UI/DockContent/MenuFrmBase.cs
@@ -27,6 +27,7 @@
                    _constructionDoneHandle.Wait();
                    OnProcessUpdated();
                    _constructionDoneHandle.Reset();
                }
            }
        }