// Sub procedure: Issue new box id private string getNewBoxId() { ValueObjectList <GA1ModelVo> outd = (ValueObjectList <GA1ModelVo>)DefaultCbmInvoker.Invoke(new GetNewBoxIDCbm(), new GA1ModelVo()); string boxIdOld = outd.GetList()[0].BoxID; DateTime dateOld = new DateTime(0); long numberOld = 0; string boxIdNew; if (boxIdOld != string.Empty) { dateOld = DateTime.ParseExact(VBStrings.Mid(boxIdOld, 5, 6), "yyMMdd", CultureInfo.InvariantCulture); numberOld = long.Parse(VBStrings.Right(boxIdOld, 3)); } if (dateOld != DateTime.Today) { boxIdNew = "GR1" + "-" + DateTime.Today.ToString("yyMMdd") + "001"; } else { boxIdNew = "GR1" + "-" + DateTime.Today.ToString("yyMMdd") + (numberOld + 1).ToString("000"); } return(boxIdNew); }
private void txtProduct_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { // Disenalbe the textbox to block scanning //txtProduct.Enabled = false; if (txtProduct.Text.Length != 8) { return; } DataTable dt1 = new DataTable(); GA1ModelVo getList = (GA1ModelVo)DefaultCbmInvoker.Invoke(new SearchBoxIDProductCbm(), new GA1ModelVo { A90Barcode = txtProduct.Text }); dt1 = getList.dt; // Even when no tester data is found, the module have to appear in the datagridview DataRow newrow = dtOverall.NewRow(); string serial = txtProduct.Text; string lot = VBStrings.Left(txtProduct.Text, 5); // If tester data exists, show it in the datagridview if (dt1.Rows.Count != 0) { string model = dt1.Rows[0][0].ToString(); string line = dt1.Rows[0][1].ToString(); string thurst = dt1.Rows[0][2].ToString(); string thurst_mc = dt1.Rows[0][3].ToString(); string noise = dt1.Rows[0][4].ToString(); string noise_mc = dt1.Rows[0][5].ToString(); newrow["Model"] = model; newrow["Line"] = line; newrow["Thurst"] = thurst; newrow["Thurst_MC"] = thurst_mc; newrow["Noise"] = noise; newrow["Noise_MC"] = noise_mc; } newrow["Serial"] = serial; newrow["Lot"] = lot; // Add the row to the datatable dtOverall.Rows.Add(newrow); dgvProductSerial.DataSource = dtOverall; txtProduct.SelectAll(); ShowRowNumber(dgvProductSerial); colorViewForFailAndBlank(ref dgvProductSerial); colorViewForDuplicateSerial(ref dgvProductSerial); //colorMixedConfig(dtOverall, ref dgvProductSerial); limitOkChange(); updateDataGripViewsSub(dtOverall, ref dgvProductSerial); } }
private void txtNewSerial_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { // Disenalbe the textbox to block scanning if (txtNewSerial.Text.Length != 8) { return; } DataTable dt = new DataTable(); defineDataTable(ref dt); DataTable dt1 = new DataTable(); GA1ModelVo getList = (GA1ModelVo)DefaultCbmInvoker.Invoke(new SearchBoxIDProductCbm(), new GA1ModelVo { A90Barcode = txtNewSerial.Text }); dt1 = getList.dt; // Even when no tester data is found, the module have to appear in the datagridview DataRow newrow = dt.NewRow(); string serial = txtNewSerial.Text; string lot = VBStrings.Left(txtNewSerial.Text, 5); // If tester data exists, show it in the datagridview if (dt1.Rows.Count != 0) { string model = dt1.Rows[0][0].ToString(); string line = dt1.Rows[0][1].ToString(); string thurst = dt1.Rows[0][2].ToString(); string thurst_mc = dt1.Rows[0][3].ToString(); string noise = dt1.Rows[0][4].ToString(); string noise_mc = dt1.Rows[0][5].ToString(); newrow["Model"] = model; newrow["Line"] = line; newrow["Thurst"] = thurst; newrow["Thurst_MC"] = thurst_mc; newrow["Noise"] = noise; newrow["Noise_MC"] = noise_mc; } newrow["Serial"] = serial; newrow["Lot"] = lot; // Add the row to the datatable dt.Rows.Add(newrow); dgvNewSerial.DataSource = dt; txtNewSerial.SelectAll(); bool col = colorViewForFailAndBlank(ref dgvNewSerial); if (!col) { btnReplace.Enabled = true; } } }
private void btnRegisterBoxId_Click(object sender, EventArgs e) { string boxIdNew; boxIdNew = txtBoxId.Text; // Print barcode printBarcode(directory, boxIdNew, txtModel.Text, dgvDateCode, ref dgvDateCode2, ref txtBoxIdPrint); //txtBoxId.Text = boxIdNew; dtpPrintDate.Value = DateTime.ParseExact(VBStrings.Mid(boxIdNew, 5, 6), "yyMMdd", CultureInfo.InvariantCulture); }
// サブプロシージャ:データグリットビューの更新 public void updateDataGridViews(ref DataTable dt, ref DataGridView dgv) { string batchNo = txtBatchNo.Text; string modelNo = cmbModelNo.Text; string modelName = txtModelName.Text; string subAssyName = cmbSubAssy.Text; DateTime batchDate = dtpBatchDate.Value.Date; DateTime batchNextDate = dtpBatchDate.Value.Date.AddDays(1); string shift = cmbShift.Text; string line = cmbLine.Text; string leader = txtLeaderId.Text; string leaderName = txtLeaderName.Text; bool b_batch = chkBatch.Checked; bool b_model = chkModel.Checked; bool b_subAssy = chkSubAssy.Checked; bool b_batchDate = chkBatchDate.Checked; bool b_shift = chkShift.Checked; bool b_line = chkLine.Checked; bool b_leader = chkLeader.Checked; string sql1 = "select approve_by, check_by, batch_no, model_no, model_name, sub_assy_no, sub_assy_name, batch_date, " + "shift, line, leader_id, leader_name, in_qty, out_qty, in_time, out_time, remark from t_batch_no where "; bool[] cr = { batchNo == String.Empty ? false : true, modelNo == String.Empty ? false : true, subAssyNo == String.Empty ? false : true, true, shift == String.Empty ? false : true, line == String.Empty ? false : true, leader == String.Empty ? false : true }; bool[] ck = { b_batch, b_model, b_subAssy, b_batchDate, b_shift, b_line, b_leader }; string sql2 = (!(cr[0] && ck[0]) ? String.Empty : "batch_no like '" + batchNo + "%' AND ") + (!(cr[1] && ck[1]) ? String.Empty : "model_no = '" + modelNo + "' AND ") + (!(cr[2] && ck[2]) ? String.Empty : "sub_assy_no = '" + subAssyNo + "' AND ") + (!(cr[3] && ck[3]) ? String.Empty : "batch_date >= '" + batchDate + "' AND batch_date < '" + batchNextDate + "' AND ") + (!(cr[4] && ck[4]) ? String.Empty : "shift = '" + shift + "' AND ") + (!(cr[5] && ck[5]) ? String.Empty : "line = '" + line + "' AND ") + (!(cr[6] && ck[6]) ? String.Empty : "leader_id = '" + leader + "' AND "); bool b_all = (cr[0] && ck[0]) || (cr[1] && ck[1]) || (cr[2] && ck[2]) || (cr[3] && ck[3]) || (cr[4] && ck[4]) || (cr[5] && ck[5]) || (cr[6] && ck[6]); System.Diagnostics.Debug.Print(b_all.ToString()); System.Diagnostics.Debug.Print(cr[0].ToString() + " " + ck[0].ToString() + " " + cr[1].ToString() + " " + ck[1].ToString() + " " + cr[2].ToString() + " " + ck[2].ToString() + " " + cr[3].ToString() + " " + ck[3].ToString() + " " + cr[4].ToString() + " " + ck[4].ToString() + cr[5].ToString() + " " + ck[5].ToString() + " " + cr[6].ToString() + " " + ck[6].ToString()); if (!b_all) { MessageBox.Show("Please select at least one check box and fill the criteria.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); return; } string sql3 = sql1 + VBStrings.Left(sql2, sql2.Length - 5); System.Diagnostics.Debug.Print(sql3); dt.Clear(); TfSQL tf = new TfSQL(); tf.sqlDataAdapterFillDatatable(sql3, ref dt); // データグリットビューへDTAATABLEを格納 dgv.DataSource = dt; dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //行ヘッダーに行番号を表示する for (int i = 0; i < dgv.Rows.Count; i++) { dgv.Rows[i].HeaderCell.Value = (i + 1).ToString(); if (dgv.Rows[i].Cells[1].Value.ToString() != "") { dgv.Rows[i].Cells[0].Value = true; dgv.Rows[i].Cells[0].ReadOnly = true; } else { dgv.Rows[i].Cells[0].Value = false; } if (dgv.Rows[i].Cells[2].Value.ToString() == "") { dgv.Rows[i].Cells[0].ReadOnly = true; } } //行ヘッダーの幅を自動調節する dgv.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); // 一番下の行を表示する if (dgv.Rows.Count != 0) { dgv.FirstDisplayedScrollingRowIndex = dgv.Rows.Count - 1; } }
private void txt_barcode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } if (txt_barcode.Text == string.Empty) { return; } if (txt_barcode.ReadOnly == true) { return; } //Check Thurst, Noise, TestTime bool res1 = checkTestTimes(txt_barcode.Text); if (!res1) { return; } bool res = checkThurstNoise(txt_barcode.Text); if (!res) { return; } //Count lot DataRow newrow = dtOv.NewRow(); string serial = txt_barcode.Text; string lot = VBStrings.Left(txt_barcode.Text, 5); newrow["Serial"] = serial; newrow["Lot"] = lot; dtOv.Rows.Add(newrow); dgvLot.DataSource = dtOv; updateDataGripViewsSub(dtOv, ref dgvDateCode); //Output GA1ModelVo check = (GA1ModelVo)DefaultCbmInvoker.Invoke(new CheckIBarcodeDuplicateCbm(), new GA1ModelVo { A90Barcode = txt_barcode.Text }); bool dup = checkDuplicate(); if (check.AffectedCount > 0) { if (dup) { MessageBox.Show("Duplicate barcode!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); } return; } GA1ModelVo outVo = (GA1ModelVo)DefaultCbmInvoker.Invoke(new AddBarcodeCheckCmb(), new GA1ModelVo { A90Barcode = txt_barcode.Text, ModelCode = cmb_model.Text, LineCode = dgvTestTimeThurst["line", 0].Value.ToString() }); count = count + 1; lblCounter.Text = count.ToString(); }
private void btnRegisterBoxId_Click(object sender, EventArgs e) { string boxIdNew; if (String.IsNullOrEmpty(txtUser.Text)) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, lblUser.Text); popUpMessage.Warning(messageData, Text); txtUser.Focus(); return; } // Check if the product serials had already registered in the database table string checkResult = CheckDuplicateBarcode(dtOverall); if (checkResult != String.Empty) { MessageBox.Show("The following serials are already registered with box id:" + Environment.NewLine + checkResult + Environment.NewLine + "Please check and delete.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); btnRegisterBoxId.Enabled = true; btnDeleteSelection.Enabled = true; btnDeleteAll.Enabled = true; return; } // Issue new box id boxIdNew = getNewBoxId(); GA1ModelVo outVo = new GA1ModelVo(); outVo = (GA1ModelVo)DefaultCbmInvoker.Invoke(new AddBoxIDCbm(), new GA1ModelVo { BoxID = boxIdNew, User = txtUser.Text, ModelCode = cmbModel.Text }); for (int i = 0; i < dgvProductSerial.Rows.Count; i++) { outVo = (GA1ModelVo)DefaultCbmInvoker.Invoke(new AddProductCbm(), new GA1ModelVo { BoxID = boxIdNew, A90Barcode = dgvProductSerial["Serial", i].Value.ToString(), LineCode = dgvProductSerial["Line", i].Value.ToString(), Lot = dgvProductSerial["Lot", i].Value.ToString(), A90ThurstStatus = dgvProductSerial["Thurst", i].Value.ToString(), A90NoiseStatus = dgvProductSerial["Noise", i].Value.ToString(), Thurst_MC = dgvProductSerial["Thurst_MC", i].Value.ToString(), Noise_eq_id = dgvProductSerial["Noise_MC", i].Value.ToString(), ModelCode = dgvProductSerial["Model", i].Value.ToString() }); } // Print barcode printBarcode(directory, boxIdNew, cmbModel.Text, dgvDateCode, ref dgvDateCode2, ref txtBoxIdPrint); // Clear the datatable dtOverall.Clear(); txtBoxId.Text = boxIdNew; dtpPrint.Value = DateTime.ParseExact(VBStrings.Mid(boxIdNew, 5, 6), "yyMMdd", CultureInfo.InvariantCulture); MessageBox.Show("BoxID is registered", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvDateCode.DataSource = null; txtLimit.Text = "350"; txtOkCount.Text = "0/350"; txtProduct.Enabled = true; txtBoxId.ResetText(); }
private void btnRegisterBoxId_Click(object sender, EventArgs e) { string boxIdNew; if (btnRegisterBoxId.Text == "Register Box ID") { if (String.IsNullOrEmpty(txtUser.Text)) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, lblUser.Text); popUpMessage.Warning(messageData, Text); txtUser.Focus(); return; } // Issue new box id boxIdNew = getNewBoxId(); GA1ModelVo outVo = new GA1ModelVo(); outVo = (GA1ModelVo)DefaultCbmInvoker.Invoke(new AddBoxIDCbm(), new GA1ModelVo { BoxID = boxIdNew, User = txtUser.Text }); for (int i = 0; i < dgvProductSerial.Rows.Count; i++) { outVo = (GA1ModelVo)DefaultCbmInvoker.Invoke(new AddProductCbm(), new GA1ModelVo { BoxID = boxIdNew, A90Barcode = dgvProductSerial["Serial", i].Value.ToString(), LineCode = dgvProductSerial["Line", i].Value.ToString(), Lot = dgvProductSerial["Lot", i].Value.ToString(), A90ThurstStatus = dgvProductSerial["Thurst", i].Value.ToString(), A90NoiseStatus = dgvProductSerial["Noise", i].Value.ToString(), Thurst_MC = dgvProductSerial["Thurst_MC", i].Value.ToString(), Noise_eq_id = dgvProductSerial["Noise_MC", i].Value.ToString(), ModelCode = dgvProductSerial["Model", i].Value.ToString() }); } // Print barcode printBarcode(directory, boxIdNew, "GR1", dgvDateCode, ref dgvDateCode2, ref txtBoxIdPrint); // Clear the datatable dtOverall.Clear(); txtBoxId.Text = boxIdNew; dtpPrintDate.Value = DateTime.ParseExact(VBStrings.Mid(boxIdNew, 5, 6), "yyMMdd", CultureInfo.InvariantCulture); MessageBox.Show("BoxID is registered", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvDateCode.DataSource = null; txtLimit.Text = "350"; txtOkCount.Text = "0/300"; txtProduct.Enabled = true; } else { boxIdNew = txtBoxId.Text; // Print barcode printBarcode(directory, boxIdNew, "GR1", dgvDateCode, ref dgvDateCode2, ref txtBoxIdPrint); //txtBoxId.Text = boxIdNew; dtpPrintDate.Value = DateTime.ParseExact(VBStrings.Mid(boxIdNew, 5, 6), "yyMMdd", CultureInfo.InvariantCulture); } }