Пример #1
0
 public void UpdateStatusOQC(MouseEventArgs e)
 {
     if (login)
     {
         if (txt_barcodeOQC.Text.Trim() != "" || txt_dataOQC.Text.Trim() != "")
         {
             TfSQL  tf = new TfSQL();
             string sqlcheckbarcode = "select count(*) from t_checkpusha90main where a90_barcode = '" + txt_barcodeOQC.Text + "'";
             int    checkbarcode    = int.Parse(tf.sqlExecuteScalarString(sqlcheckbarcode));
             if (checkbarcode > 0)
             {
                 string status = "";
                 if (e.Button == MouseButtons.Right)
                 {
                     status                  = "NG";
                     btn_statusOQC.Text      = "NG";
                     btn_statusOQC.BackColor = Color.Red;
                 }
                 if (e.Button == MouseButtons.Left)
                 {
                     status                  = "OK";
                     btn_statusOQC.Text      = "OK";
                     btn_statusOQC.BackColor = Color.Green;
                 }
                 string sqlUpdate = "update t_checkpusha90main set a90_oqc_status = '" + status + "', a90_oqc_data = '" + txt_dataOQC.Text + "' where a90_barcode = '" + txt_barcodeOQC.Text + "'";
                 if (tf.sqlExecuteNonQuery(sqlUpdate, false))
                 {
                     LoadDGVOQC(dgv_OQC, txt_barcodeOQC.Text, true);
                     txt_barcodeOQC.Text = null;
                     txt_barcodeOQC.SelectNextControl(txt_barcodeOQC, true, false, true, true); //trả lại con chỏ vô textbox
                     timerOQC.Interval = int.Parse(txt_timerOQC.Text) * 1000;
                     timerOQC.Enabled  = true;
                 }
                 else
                 {
                     dgv_OQC.DataSource = null;
                 }
             }
             else
             {
                 MessageBox.Show("Barocde No is Null <Không có Mã barcode này >", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
             }
         }
         else
         {
             return;
         }
     }
     else
     {
         MessageBox.Show("Not Login <Chưa đăng nhập> ", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
Пример #2
0
        private void btn_check_Click(object sender, EventArgs e)
        {
            if (txt_barcodeCheck.Text != "")
            {
                LoadDGVOQC(dgvCheck, txt_barcodeCheck.Text, false);
                TfSQL  con           = new TfSQL();
                string sql_thurst    = "select a90_status from t_checkpusha90main where  a90_barcode = '" + txt_barcodeCheck.Text + "' order by a90_id desc limit 1";
                string sql_noise     = "select a90_noise_status from t_checkpusha90main where  a90_barcode = '" + txt_barcodeCheck.Text + "' order by a90_id desc limit 1";
                string sql_oqc       = "select a90_oqc_status from t_checkpusha90main where  a90_barcode = '" + txt_barcodeCheck.Text + "' order by a90_id desc limit 1";
                string thurst_status = con.sqlExecuteScalarString(sql_thurst);
                string noise_status  = con.sqlExecuteScalarString(sql_noise);
                string oqc_status    = con.sqlExecuteScalarString(sql_oqc);

                if (thurst_status == "OK")
                {
                    btn_thurststatus.Text      = "OK";
                    btn_thurststatus.BackColor = Color.Green;
                    txt_barcodeCheck.Text      = "";
                }
                else if (thurst_status == "NG")
                {
                    btn_thurststatus.Text      = "NG";
                    btn_thurststatus.BackColor = Color.Red;
                    txt_barcodeCheck.Text      = "";
                }
                if (noise_status == "OK")
                {
                    btn_noisestatus.Text      = "OK";
                    btn_noisestatus.BackColor = Color.Green;
                    txt_barcodeCheck.Text     = "";
                }
                else if (noise_status == "NG")
                {
                    btn_noisestatus.Text      = "NG";
                    btn_noisestatus.BackColor = Color.Red;
                    txt_barcodeCheck.Text     = "";
                }
                if (oqc_status == "OK")
                {
                    lblOQC.Text           = "Checked";
                    txt_barcodeCheck.Text = "";
                }
                else if (oqc_status == "NG")
                {
                    lblOQC.Text           = "Checked";
                    txt_barcodeCheck.Text = "";
                }
                if (oqc_status == "")
                {
                    lblOQC.Text           = "Not Checked";
                    txt_barcodeCheck.Text = "";
                    //192, 192, 255
                }
                if (thurst_status == "")
                {
                    btn_thurststatus.Text      = "WAITING";
                    btn_thurststatus.BackColor = SystemColors.Control;
                    txt_barcodeCheck.Text      = "";
                }
                if (noise_status == "")
                {
                    btn_noisestatus.Text      = "WAITING";
                    btn_noisestatus.BackColor = SystemColors.Control;
                    txt_barcodeCheck.Text     = "";
                }
            }
            else
            {
                MessageBox.Show("Barocde No is Null <Chưa nhập Barcode>", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                btn_thurststatus.Text      = "WAITING";
                btn_thurststatus.BackColor = SystemColors.Control;
                btn_noisestatus.Text       = "WAITING";
                btn_noisestatus.BackColor  = SystemColors.Control;
            }
        }