领胜LDS 键盘AOI检测项目
xcd
2020-07-10 78994d1c8243018f6e37717e3ea0a0297d491bd8
标签显示和列表联动修改
11个文件已修改
148 ■■■■ 已修改文件
src/Bro.M071.Process/M071Config.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/M071Process.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/KeyIndicator.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_MainForm.Designer.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_MainForm.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/UI/M071_ShortcutFrm.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Config/MenuForms/FrmOperation.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Model.Winform/ElementBase.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Model.Winform/UI/Canvas.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.UI.Model.Winform/UI/CanvasImage.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Bro.M071.Process/M071Config.cs
@@ -101,5 +101,10 @@
        [Category("屏蔽配置")]
        [Description("true:禁止手动输入条码 false:允许手动输入条码")]
        public bool IsBarcodeManulInputBlocked { get; set; } = true;
        [Category("MES设置")]
        [Description("true:数据上传至MES false:数据不上传")]
        [ReadOnly(true)]
        public bool IsEnableMESUpload { get; set; } = false;
    }
}
src/Bro.M071.Process/M071Process.cs
@@ -378,6 +378,9 @@
                var measurementUnitResultAndKeyUnitDataSet = GetMeasurementUnitResultAndKeyUnitData(pMeasure);
                //MES输出 todo
                if (Config.IsEnableMESUpload)
                {
                }
                //Excel报表输出 (单个产品的excel导出)
                ExportProductionExcel(measurementUnitResultAndKeyUnitDataSet);
@@ -460,7 +463,7 @@
                    measurementUnitResult.ProductionMeasurementRecordsId = productionMeasurementRecords.ID;
                    measurementUnitResult.MeasurementName = MeasurementUnitResult.Name;
                    measurementUnitResult.MeasurementType = MeasurementUnitResult.MeasureType;
                    measurementUnitResult.MeasurementValue = "";
                    measurementUnitResult.MeasurementValue = MeasurementUnitResult.Spec.ActualValue.ToString();
                    measurementUnitResult.MeasurementResult = MeasurementUnitResult.Spec.MeasureResult.Value ? "OK" : "NG";
                    measurementUnitResults.Add(measurementUnitResult);
@@ -521,7 +524,7 @@
                excelExportDto.WorksheetDataTable[excelExportDto.Worksheets[1]] = ExcelExportHelper.ListToDataTable(measurementUnitResultAndKeyUnitDataSet.MeasurementUnitResultList, measurementUnitResultColumns); ;
                byte[] filecontent = ExcelExportHelper.ExportExcel(excelExportDto, false);
                string dir = Path.Combine(Config.ImageSaveFolder, DateTime.Now.ToString("yyyyMMdd"));
                string dir = Path.Combine(Config.ResultDataSaveFolder, DateTime.Now.ToString("yyyyMMdd"));
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
src/Bro.M071.Process/UI/KeyIndicator.cs
@@ -139,17 +139,18 @@
        public override bool IsMouseCanStretchBottom(Point p)
        {
            return Math.Abs(p.X - (DisplayRect.X + DisplayRect.Width / 2)) < 10 && Math.Abs(p.Y - DisplayRect.Y - DisplayRect.Height) < 10;
            return Math.Abs(p.X - (DisplayRect.X + DisplayRect.Width / 2)) < (DisplayRect.Width / 3) && Math.Abs(p.Y - DisplayRect.Y - DisplayRect.Height) < (DisplayRect.Height / 3);
        }
        public override bool IsMouseCanStretchRight(Point p)
        {
            return Math.Abs(p.X - (DisplayRect.X + DisplayRect.Width)) < 10 && Math.Abs(p.Y - (DisplayRect.Y + DisplayRect.Height / 2)) < 10;
            return Math.Abs(p.X - (DisplayRect.X + DisplayRect.Width)) < (DisplayRect.Width / 3) && Math.Abs(p.Y - (DisplayRect.Y + DisplayRect.Height / 2)) < (DisplayRect.Height / 3);
        }
        public override bool IsMouseCanStretchRightLowerCorner(Point p)
        {
            return Math.Abs(p.X - (DisplayRect.X + DisplayRect.Width)) < 10 && Math.Abs(p.Y - (DisplayRect.Y + DisplayRect.Height)) < 10;
            return Math.Abs(p.X - (DisplayRect.X + DisplayRect.Width)) < (DisplayRect.Width / 3) && Math.Abs(p.Y - (DisplayRect.Y + DisplayRect.Height)) < (DisplayRect.Height / 3);
        }
        int x, y = 0;
src/Bro.M071.Process/UI/M071_MainForm.Designer.cs
@@ -44,6 +44,7 @@
            this.btnCancelEdit = new System.Windows.Forms.Button();
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.lvMeasures = new System.Windows.Forms.ListView();
            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            this.propGridKeyIndicator = new System.Windows.Forms.PropertyGrid();
            this.btnStartMeasure = new System.Windows.Forms.Button();
            this.btnReset = new System.Windows.Forms.Button();
@@ -228,6 +229,9 @@
            // 
            // lvMeasures
            // 
            this.lvMeasures.BackColor = System.Drawing.SystemColors.Control;
            this.lvMeasures.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1});
            this.lvMeasures.Dock = System.Windows.Forms.DockStyle.Fill;
            this.lvMeasures.Font = new System.Drawing.Font("Tahoma", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((byte)(134)));
            this.lvMeasures.FullRowSelect = true;
@@ -241,6 +245,11 @@
            this.lvMeasures.View = System.Windows.Forms.View.List;
            this.lvMeasures.SelectedIndexChanged += new System.EventHandler(this.lvMeasures_SelectedIndexChanged);
            this.lvMeasures.DoubleClick += new System.EventHandler(this.lvMeasures_DoubleClick);
            //
            // columnHeader1
            //
            this.columnHeader1.Text = "检测标签";
            this.columnHeader1.Width = 181;
            // 
            // propGridKeyIndicator
            // 
@@ -333,5 +342,6 @@
        private System.Windows.Forms.Label lblCT;
        private System.Windows.Forms.Button btnStartMeasure;
        private System.Windows.Forms.Button btnReset;
        private System.Windows.Forms.ColumnHeader columnHeader1;
    }
}
src/Bro.M071.Process/UI/M071_MainForm.cs
@@ -38,6 +38,8 @@
                   await Task.Delay(300);
                   cvImage.SetScreenSize();
                   cvImage.OnElementChangedHandle -= CvImage_OnElementChangedHandle;
                   cvImage.OnElementChangedHandle += CvImage_OnElementChangedHandle;
               };
        }
@@ -119,10 +121,45 @@
        #endregion
        #region 标签编辑区
        private async void CvImage_OnElementChangedHandle(Common.Interface.IShapeElement ele)
        {
            this.Invoke(new Action(() =>
            {
                if (ele is KeyIndicator indicator)
                {
                    if (indicator.State == ElementState.Selected)
                    {
                        foreach (ListViewItem item in lvMeasures.Items)
                        {
                            if (item.Tag.ToString() == indicator.ID)
                            {
                                item.Selected = true;
                                lvMeasures.EnsureVisible(item.Index);
                                break;
                            }
                        }
                    }
                }
            }));
            await Task.Delay(100);
        }
        private void lvMeasures_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvMeasures.SelectedItems.Count <= 0)
                return;
            foreach (ListViewItem item in lvMeasures.Items)
            {
                item.BackColor = SystemColors.Control;
            }
            foreach (ListViewItem item in lvMeasures.SelectedItems)
            {
                item.BackColor = Color.Orange;
            }
            var ele = cvImage.Elements.FirstOrDefault(u => u.ID == lvMeasures.SelectedItems[0].Tag.ToString());
            propGridKeyIndicator.SelectedObject = ele;
@@ -167,11 +204,12 @@
            if (lvMeasures.SelectedItems.Count <= 0)
                return;
            cvImage.Elements.ToList().ForEach(u => u.State = ElementState.Normal);
            var ele = cvImage.Elements.FirstOrDefault(u => u.ID == lvMeasures.SelectedItems[0].Tag.ToString());
            if (ele != null)
            {
                ele.State = ElementState.Selected;
                cvImage.Invalidate();
                //cvImage.Invalidate();
            }
        }
        #endregion
src/Bro.M071.Process/UI/M071_ShortcutFrm.Designer.cs
@@ -34,6 +34,7 @@
            this.chkBlockBeep = new System.Windows.Forms.CheckBox();
            this.chkManualInputForbidden = new System.Windows.Forms.CheckBox();
            this.btnLightSwitch = new System.Windows.Forms.Button();
            this.chkEnableMESUpload = new System.Windows.Forms.CheckBox();
            this.flowLayoutPanel1.SuspendLayout();
            this.SuspendLayout();
            // 
@@ -43,6 +44,7 @@
            this.flowLayoutPanel1.Controls.Add(this.chkBlockSafetyBeam);
            this.flowLayoutPanel1.Controls.Add(this.chkBlockBeep);
            this.flowLayoutPanel1.Controls.Add(this.chkManualInputForbidden);
            this.flowLayoutPanel1.Controls.Add(this.chkEnableMESUpload);
            this.flowLayoutPanel1.Controls.Add(this.btnLightSwitch);
            this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
@@ -96,13 +98,24 @@
            // 
            // btnLightSwitch
            // 
            this.btnLightSwitch.Location = new System.Drawing.Point(419, 3);
            this.btnLightSwitch.Location = new System.Drawing.Point(543, 3);
            this.btnLightSwitch.Name = "btnLightSwitch";
            this.btnLightSwitch.Size = new System.Drawing.Size(75, 36);
            this.btnLightSwitch.TabIndex = 5;
            this.btnLightSwitch.Text = "日光灯开关";
            this.btnLightSwitch.UseVisualStyleBackColor = true;
            this.btnLightSwitch.Click += new System.EventHandler(this.btnLightSwitch_Click);
            //
            // chkEnableMESUpload
            //
            this.chkEnableMESUpload.AutoSize = true;
            this.chkEnableMESUpload.Location = new System.Drawing.Point(419, 3);
            this.chkEnableMESUpload.Name = "chkEnableMESUpload";
            this.chkEnableMESUpload.Size = new System.Drawing.Size(118, 17);
            this.chkEnableMESUpload.TabIndex = 6;
            this.chkEnableMESUpload.Text = "启用MES数据上传";
            this.chkEnableMESUpload.UseVisualStyleBackColor = true;
            this.chkEnableMESUpload.CheckedChanged += new System.EventHandler(this.chkEnableMESUpload_CheckedChanged);
            // 
            // M071_ShortcutFrm
            // 
@@ -126,5 +139,6 @@
        private System.Windows.Forms.CheckBox chkBlockBeep;
        private System.Windows.Forms.CheckBox chkManualInputForbidden;
        private System.Windows.Forms.Button btnLightSwitch;
        private System.Windows.Forms.CheckBox chkEnableMESUpload;
    }
}
src/Bro.M071.Process/UI/M071_ShortcutFrm.cs
@@ -29,8 +29,8 @@
        M071Config Config => Process?.IConfig as M071Config;
        M071Process Process_M071 => Process as M071Process;
        protected override bool IsLogin
        {
        protected override bool IsLogin
        {
            get => base.IsLogin;
            set
            {
@@ -42,7 +42,7 @@
                    {
                        this.Invoke(new Action(() =>
                        {
                            chkBlockSafetyBeam.Enabled = chkBlockSaftyDoor.Enabled = IsLogin;
                            chkEnableMESUpload.Enabled = chkBlockSafetyBeam.Enabled = chkBlockSaftyDoor.Enabled = IsLogin;
                        }));
                    }
                });
@@ -63,6 +63,7 @@
                        chkBlockSafetyBeam.Checked = Config.IsSafetyBeamBlocked;
                        chkBlockSaftyDoor.Checked = Config.IsSafetyDoorBlocked;
                        chkManualInputForbidden.Checked = Config.IsBarcodeManulInputBlocked;
                        chkEnableMESUpload.Checked = Config.IsEnableMESUpload;
                    }));
                }
            });
@@ -94,5 +95,10 @@
            isLightOn = !isLightOn;
            Process_M071.SwitchLight(isLightOn);
        }
        private void chkEnableMESUpload_CheckedChanged(object sender, EventArgs e)
        {
            Config.IsEnableMESUpload = chkEnableMESUpload.Checked;
        }
    }
}
src/Bro.UI.Config/MenuForms/FrmOperation.cs
@@ -28,16 +28,21 @@
            LoadProcessCode();
            LoadProductionCode();
            Task.Run(() =>
            {
                Thread.Sleep(1000);
            //Task.Run(() =>
            //{
            //    Thread.Sleep(1000);
                if ((!plProcess.Visible) && (!plProduct.Visible) && _isFirstLoad)
                {
                    LoadProcess();
                    _isFirstLoad = false;
                }
            });
            //    if ((!plProcess.Visible) && (!plProduct.Visible) && _isFirstLoad)
            //    {
            //        LoadProcess();
            //        _isFirstLoad = false;
            //    }
            //});
            //if ((!plProcess.Visible) && (!plProduct.Visible) && _isFirstLoad)
            //{
            //    LoadProcess();
            //    _isFirstLoad = false;
            //}
        }
        #region Load Codes
@@ -128,6 +133,12 @@
        private void FrmOperation_Load(object sender, System.EventArgs e)
        {
            if ((!plProcess.Visible) && (!plProduct.Visible) && _isFirstLoad)
            {
                LoadProcess();
                _isFirstLoad = false;
            }
            btnStart.Enabled = true;
        }
src/Bro.UI.Model.Winform/ElementBase.cs
@@ -190,9 +190,8 @@
                if (state != value)
                {
                    ElementState preState = state;
                    state = value;
                    Set(ref state, value);
                    EventRouter.ChangeElementsMouseState?.Invoke(this, preState, state);
                    switch (state)
                    {
                        case ElementState.MouseHover:
src/Bro.UI.Model.Winform/UI/Canvas.cs
@@ -237,7 +237,7 @@
            {
                ele.IsEnabled = e.CheckedState;
            }
            OnElementChanged();
            OnElementChanged(null);
        }
        private void dgElements_SelectionChanged(object sender, EventArgs e)
@@ -270,7 +270,7 @@
        private void Elements_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            OnElementChanged();
            OnElementChanged(null);
            foreach (IShapeElement ele in Elements)
            {
@@ -281,14 +281,17 @@
        private void Ele_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            OnElementChanged();
            OnElementChanged(sender as IShapeElement);
        }
        private void OnElementChanged()
        private void OnElementChanged(IShapeElement ele)
        {
            if (ele != null)
                OnElementChangedHandle?.Invoke(ele);
            if (InvokeRequired)
            {
                Invoke(new Action(() => OnElementChanged()));
                Invoke(new Action(() => OnElementChanged(ele)));
            }
            else
            {
@@ -543,5 +546,9 @@
            }
        }
        #endregion
        #region 事件
        public event Action<IShapeElement> OnElementChangedHandle;
        #endregion
    }
}
src/Bro.UI.Model.Winform/UI/CanvasImage.cs
@@ -358,6 +358,8 @@
                    MouseState = MouseState.Normal;
                }
            }
            this.Invalidate();
        }
        #endregion