private void Edt_Length_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { if (_PRODUCELINE != ProduceLine.GX && _LastSuccess && e.Button.Key.EndsWith("LAST")) { if (!Edt_Length.Text.Equals(this._LastLength)) { Edt_Length.Text = this._LastLength; Edt_Length.Focus(); } else { Edt_Length.Clear(); Edt_Length.Focus(); } } }
public frmSetSpec(ProduceLine ProdLine, CodeType_XC CodeType, bool Success, string BatchNo, string OrderNo, string Spec, string Length) { InitializeComponent(); this._LastBatchNo = BatchNo; this._LastOrderNo = OrderNo; this._LastSpec = Spec; this._LastLength = Length; this._LastSuccess = Success; this._CODETYPE = CodeType; this._PRODUCELINE = ProdLine; if (_PRODUCELINE == ProduceLine.GX) { Edt_Length.Clear(); Edt_Length.Enabled = false; } }
private void btnOK_Click(object sender, EventArgs e) { try { string strSign = GetSign(); if (string.IsNullOrEmpty(strSign)) { MessageBox.Show("产线未知,无法组批!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (cbx_BatchNo.Checked) { if (string.IsNullOrEmpty(Edt_BatchNo.Text.Trim())) { MessageBox.Show("请输入轧制编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Edt_BatchNo.SelectAll(); Edt_BatchNo.Focus(); return; } if (!BatchNoCheck(Edt_BatchNo.Text.Trim())) { MessageBox.Show("轧制编号不满足编码规则(" + strSign + " + 1位年份(\\d) + 2位月份[0-1]\\d + 4位流水号\\d\\d\\d\\d、如" + strSign + "2050001)!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Edt_BatchNo.SelectAll(); Edt_BatchNo.Focus(); return; } } if (string.IsNullOrEmpty(Edt_OrderNo.Text.Trim())) { MessageBox.Show("请输入生产订单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Edt_OrderNo.SelectAll(); Edt_OrderNo.Focus(); return; } if (string.IsNullOrEmpty(Edt_Spec.Text.Trim())) { MessageBox.Show("未指定轧制规格!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Edt_Spec.SelectAll(); Edt_Spec.Focus(); return; } if (_PRODUCELINE != ProduceLine.GX) { if (string.IsNullOrEmpty(Edt_Length.Text.Trim())) { MessageBox.Show("未指定定尺长度!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Edt_Length.SelectAll(); Edt_Length.Focus(); return; } decimal dLen = 0.0M; if (!(decimal.TryParse(Edt_Length.Text.Trim(), out dLen))) { MessageBox.Show("定尺长度必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Edt_Length.SelectAll(); Edt_Length.Focus(); return; } if (dLen <= 0) { MessageBox.Show("定尺长度必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Edt_Length.SelectAll(); Edt_Length.Focus(); return; } } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }