From c39b6196509ee07d5799cd2a6611700995948f5b Mon Sep 17 00:00:00 2001 From: patrick.xu <patrick.xu@broconcentric.com> Date: 星期三, 29 十二月 2021 14:23:45 +0800 Subject: [PATCH] 抽样时日期比对添加年数配置修改 --- MainForm.cs | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 42 insertions(+), 13 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index 19f79e4..3c791e3 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -137,6 +137,8 @@ this.KeyPreview = true; this.KeyPress += MainForm_KeyPress; + Trace.TraceInformation("閿洏浜嬩欢宸插姞杞�"); + hcXyView.Focus(); } @@ -144,16 +146,28 @@ CarrierBarcodeCtrl cBarcodeCtrl = null; private void MainForm_KeyPress(object sender, KeyPressEventArgs e) { - if (e.KeyChar == 27) + try { - hcXyView.Focus(); - } - else - { - if (allowBarcodeFlag) + if (e.KeyChar == 27) { - cBarcodeCtrl.AddChar(e.KeyChar); + hcXyView.Focus(); } + else + { + if (allowBarcodeFlag) + { + Trace.TraceInformation($"閿洏杈撳叆锛歿e.KeyChar}"); + cBarcodeCtrl.AddChar(e.KeyChar); + } + else + { + Trace.TraceInformation($"褰撳墠涓嶅厑璁告寜閿緭鍏ワ細{e.KeyChar}"); + } + } + } + catch (Exception ex) + { + Trace.TraceError($"閿洏浜嬩欢寮傚父锛歿ex.Message}"); } } #endregion @@ -946,7 +960,6 @@ if ((bool)item.value) { //opc.Write(OPCInputTag.UnloadTrayReady, false); - allowBarcodeFlag = false; } break; @@ -1075,18 +1088,34 @@ #region 浜嬩欢 private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { - Stop(); - SaveMeasureTTL(); - Task.Factory.StartNew(() => + try { + Stop(); + SaveMeasureTTL(); + //Task.Factory.StartNew(() => + //{ SpotCheckData data = new SpotCheckData(); data.UpdateLastBreakProductQty(measureResultTTL.ProductQuntity); DownTimeData downTimeData = new DownTimeData(); DownTime downTime = new DownTime() { BeginTime = DateTime.Now, Type = DownTimeType.Closed }; downTimeData.SaveDownTime(downTime); - }); + //}); - MessageHandler.MessageHandlerInstance.Close(); + MessageHandler.MessageHandlerInstance.Close(); + } + catch (Exception ex) + { + Trace.TraceError($"鐣岄潰鍏抽棴寮傚父锛歿ex.Message}"); + } + finally + { + lock (CommonUtil.UploadDataLock) + { + //CommonUtil.UploadDoneHandle.WaitOne(); + CommonUtil.UploadDataEnable = false; + System.Environment.Exit(0); + } + } } private void btnConfig_Click(object sender, EventArgs e) -- Gitblit v1.8.0