예제 #1
0
        private void cbx_BatchNo_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                Edt_BatchNo.Enabled = cbx_BatchNo.Checked;

                if (!cbx_BatchNo.Checked)
                {
                    Edt_BatchNo.Tag  = Edt_BatchNo.Text;
                    Edt_BatchNo.Text = "自动";

                    Edt_OrderNo.SelectAll();
                    Edt_OrderNo.Focus();
                }
                else
                {
                    if (Edt_BatchNo.Tag != null)
                    {
                        Edt_BatchNo.Text = Convert.ToString(Edt_BatchNo.Tag);
                    }

                    if (Edt_BatchNo.Text.Contains("自动"))
                    {
                        Edt_BatchNo.Clear();
                    }

                    Edt_BatchNo.SelectAll();
                    Edt_BatchNo.Focus();
                }
            }
            catch { }
        }
예제 #2
0
 private void Edt_BatchNo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
 {
     if (e.Button.Key.EndsWith("INIT"))
     {
         Edt_BatchNo.Text = GetSign() + DateTime.Today.ToString("yyMM").Substring(1);
         Edt_BatchNo.Select(Edt_BatchNo.Text.Length, 0);
         Edt_BatchNo.Focus();
     }
 }
예제 #3
0
        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);
            }
        }