From 78584911d0457ad9fc26d9dfc6f374b7ef531c0f Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期日, 22 十一月 2020 13:45:09 +0800
Subject: [PATCH] 1. 添加操作员输入和界面显示 2. 添加通过输入窗体 3. 添加webservice调用帮助类 4. M071添加MES数据检查和数据上传功能,添加相关界面显示和流程控制

---
 src/Bro.M071.Process/UI/M071_MainForm.cs |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/src/Bro.M071.Process/UI/M071_MainForm.cs b/src/Bro.M071.Process/UI/M071_MainForm.cs
index 7035785..4893258 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;
@@ -44,6 +45,8 @@
                    timer1.Enabled = true;
 
                    btnReset.Text = $"澶嶄綅锛堥暱鎸墈Config.FullResetRequiredDuration}绉掑ぇ澶嶄綅锛�";
+
+                   lblCT.Text = tsslError.Text = "";
                };
         }
 
@@ -90,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)
@@ -117,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)
@@ -312,7 +320,7 @@
 
             if (e.KeyValue == 13)
             {
-                txtBarcode.Text = _barcode;
+                Process_M071.BarCode = txtBarcode.Text = _barcode;
                 _barcode = "";
             }
 
@@ -324,7 +332,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()
@@ -409,11 +417,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 = "寮�濮嬫祴閲�";
@@ -504,5 +518,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