From f06ae0e33e33f1ed5f198827b9b5a53e765b3eee Mon Sep 17 00:00:00 2001 From: patrick.xu <patrick.xu@broconcentric.com> Date: 星期一, 11 一月 2021 10:58:26 +0800 Subject: [PATCH] 1. 来料检测添加线体代码 2. 添加检测数据区间压缩配置和功能 --- src/Bro.M071.Process/UI/M071_MainForm.cs | 84 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 80 insertions(+), 4 deletions(-) diff --git a/src/Bro.M071.Process/UI/M071_MainForm.cs b/src/Bro.M071.Process/UI/M071_MainForm.cs index 0ed4652..8ef45d1 100644 --- a/src/Bro.M071.Process/UI/M071_MainForm.cs +++ b/src/Bro.M071.Process/UI/M071_MainForm.cs @@ -1,6 +1,7 @@ 锘縰sing Bro.Common.Base; using Bro.Common.Helper; using Bro.UI.Model.Winform; +using Bro.UI.Model.Winform.UI; using System; using System.Collections.Generic; using System.ComponentModel; @@ -42,6 +43,10 @@ cvImage.OnElementChangedHandle += CvImage_OnElementChangedHandle; timer1.Enabled = true; + + btnReset.Text = $"澶嶄綅锛堥暱鎸墈Config.FullResetRequiredDuration}绉掑ぇ澶嶄綅锛�"; + + lblCT.Text = tsslError.Text = ""; }; } @@ -88,6 +93,8 @@ item.Tag = u.Id; lvMeasures.Items.Add(item); }); + + lblOperator.Text = string.IsNullOrWhiteSpace(Process_M071.OperatorCode) ? "NotLogin" : Process_M071.OperatorCode; })); } catch (Exception ex) @@ -115,6 +122,9 @@ Process_M071.OnElementUpdated -= Process_M071_OnElementUpdated; Process_M071.OnElementUpdated += Process_M071_OnElementUpdated; + + Process_M071.OnCheckHintUpload = OnCheckHintUpload; + Process_M071.OnOperatorLogin = OnOperatorLogin; } private void Config_PropertyChanged(object sender, PropertyChangedEventArgs e) @@ -258,6 +268,23 @@ #region 鏍囩缁撴灉鏄剧ず private async void Process_M071_OnElementUpdated(Common.Interface.IShapeElement obj) { + //this.Invoke(new Action(() => + //{ + // if (obj is KeyIndicator keyIndicator) + // { + // var ele = cvImage.Elements.FirstOrDefault(u => u.ID == keyIndicator.ID); + + // //(ele as KeyIndicator).Text = keyIndicator.Text; + // //(ele as KeyIndicator).ResultState = keyIndicator.ResultState; + // if (ele != null) + // { + // ele = keyIndicator; + // } + + // this.Invalidate(); + // } + //})); + if (obj is KeyIndicator keyIndicator) { this.Invoke(new Action(() => @@ -290,10 +317,14 @@ { _barcode += keyStr.Substring(1).ToUpper(); } + else if (keyStr.StartsWith("NumPad")) + { + _barcode += keyStr.Replace("NumPad", ""); + } if (e.KeyValue == 13) { - txtBarcode.Text = _barcode; + Process_M071.BarCode = txtBarcode.Text = _barcode; _barcode = ""; } @@ -305,7 +336,7 @@ private void txtBarcode_TextChanged(object sender, EventArgs e) { - Process_M071.BarCode = txtBarcode.Text.Trim(); + //Process_M071.BarCode = txtBarcode.Text.Trim(); } private void M071_MainForm_OnClearBarcode() @@ -390,11 +421,17 @@ lblProductionState.ForeColor = Color.White; lblProductionState.Text = "OK"; } - else + else if (result == 0) { lblProductionState.BackColor = Color.Red; lblProductionState.ForeColor = Color.White; lblProductionState.Text = "NG"; + } + else + { + lblProductionState.BackColor = Color.White; + lblProductionState.ForeColor = Color.Red; + lblProductionState.Text = "NA"; } //btnStartMeasure.Text = "寮�濮嬫祴閲�"; @@ -472,7 +509,7 @@ Process_M071.Reset(null, null, null); } - Process_M071.ResetTimer.Change(1000 * 5, -1); + Process_M071.ResetTimer.Change(1000 * Config.FullResetRequiredDuration, -1); } private void btnReset_MouseUp(object sender, MouseEventArgs e) @@ -485,5 +522,44 @@ { cvImage.Refresh(); } + + private void lblOperator_DoubleClick(object sender, EventArgs e) + { + InputWindow inputFrm = new InputWindow("璇疯緭鍏ユ搷浣滃憳宸ュ彿"); + if (inputFrm.ShowDialog() == DialogResult.OK) + { + Process_M071.OperatorCode = inputFrm.Input; + } + } + + private void OnOperatorLogin(string operatorCode) + { + this.Invoke(new Action(() => + { + lblOperator.Text = operatorCode; + })); + } + + private async void OnCheckHintUpload(string hintMsg, bool isAlarm) + { + await Task.Run(() => + { + this.Invoke(new Action(() => + { + if (!string.IsNullOrWhiteSpace(hintMsg)) + { + stStripHint.Visible = true; + tsslError.Text = hintMsg; + + tsslError.BackColor = isAlarm ? Color.Red : Color.Green; + } + else + { + stStripHint.Visible = false; + tsslError.Text = ""; + } + })); + }); + } } } -- Gitblit v1.8.0