| | |
| | | this.KeyPreview = true; |
| | | this.KeyPress += MainForm_KeyPress; |
| | | |
| | | Trace.TraceInformation("键盘事件已加载"); |
| | | |
| | | hcXyView.Focus(); |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | if ((bool)item.value) |
| | | { |
| | | //opc.Write(OPCInputTag.UnloadTrayReady, false); |
| | | |
| | | allowBarcodeFlag = false; |
| | | } |
| | | break; |
| | |
| | | #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) |
| | |
| | | |
| | | private void btnPlcOperation_Click(object sender, EventArgs e) |
| | | { |
| | | FormPlcOperation frm = new FormPlcOperation(opc); |
| | | frm.ShowDialog(); |
| | | //if (new ConfigPassword("").ShowDialog() == DialogResult.OK) |
| | | { |
| | | FormPlcOperation frm = new FormPlcOperation(opc); |
| | | frm.ShowDialog(); |
| | | } |
| | | } |
| | | |
| | | private void btnCheck_Click(object sender, EventArgs e) |