/// <summary> /// 输入条码时响应的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barcode_txt_Enter(object sender, KeyEventArgs e) { if (barcode_txt.Text == "") { return; } if (e.KeyCode != Keys.Enter) { return; } int strLength = barcode_txt.Text.Length; if (strLength < Check.minLength || strLength > Check.maxLength) { MessageBox.Show(string.Format("号码必须最少{0}位,最多{1}位", Check.minLength, Check.maxLength)); return; } result_lbl.Text = ""; if (model_cbx.SelectedItem.ToString() == "") { result_lbl.Text = "Error"; return; } //if (barcode_txt.Text.Length < 24) //{ // result_lbl.Text = "Error"; // return; //} //barcode_txt.Text = barcode_txt.Text.Substring(0, 24); CheckAPI APIcheck = new CheckAPI(); string category = APIcheck.modelCategory(barcode_txt.Text, model_cbx.SelectedItem.ToString()); if (IsExists(barcode_txt.Text.ToUpper()) == false) { result_lbl.Text = "重复Error"; return; } // if (IsOkReturn(barcode_txt.Text.ToUpper(), model_cbx.SelectedItem.ToString()) == false) // { // result_lbl.Text = "Error"; // return; // } serial se = new serial(); se.serial_cd = barcode_txt.Text.ToUpper(); se.model = model_cbx.SelectedItem.ToString(); se.category = category; rInfo.serials.Add(se); updateGridView(); barcode_txt.Text = ""; barcode_txt.SelectAll(); }
private void Sumary_dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { int currentRow = int.Parse(e.RowIndex.ToString()); if (Sumary_dgv.Columns[e.ColumnIndex] == openTray && currentRow >= 0) { rInfo = new RecordInfo(); foreach (Form buff in Application.OpenForms) { if (buff.Name == "InfoFrm") { MessageBox.Show("Please close the currently open form.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); return; } } rInfo.record_id = Sumary_dgv["record_id", currentRow].Value.ToString(); DataTable t1 = new DataTable(); string sql = "select * from t_record left join t_user on t_record.register_emp=t_user.user_id where record_id='" + rInfo.record_id + "'"; dbFac.ExecuteDataTable(sql, ref t1); if (t1.Rows.Count > 0) { rInfo.site = t1.Rows[0]["site"].ToString(); rInfo.holder_dept = t1.Rows[0]["holder_dept"].ToString(); rInfo.holder_emp = t1.Rows[0]["holder_emp"].ToString(); rInfo.holder_name = t1.Rows[0]["holder_name"].ToString(); rInfo.type = int.Parse(t1.Rows[0]["type"].ToString()); rInfo.statue = t1.Rows[0]["category_id"].ToString(); rInfo.register_date = DateTime.Parse(t1.Rows[0]["register_date"].ToString()); rInfo.register_emp = t1.Rows[0]["register_emp"].ToString(); rInfo.register_name = t1.Rows[0]["user_name"].ToString(); rInfo.reason = t1.Rows[0]["category_cd"].ToString(); } t1 = new DataTable(); sql = "select serial_cd,model from t_module where record_id='" + rInfo.record_id + "'"; dbFac.ExecuteDataTable(sql, ref t1); if (t1.Rows.Count > 0) { for (int i = 0; i < t1.Rows.Count; i++) { serial se = new serial(); se.serial_cd = t1.Rows[i]["serial_cd"].ToString().Trim(); se.model = t1.Rows[i]["model"].ToString().Trim(); rInfo.serials.Add(se); } } InfoFrm iFrm = new InfoFrm(rInfo); iFrm.Show(); } }
/// <summary> /// 输入条码时响应的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barcode_txt_Enter(object sender, KeyEventArgs e) { result_lbl.Text = ""; if (e.KeyCode != Keys.Enter) { return; } if (model_cbx.SelectedItem.ToString() == "") { result_lbl.Text = "Error"; return; } if (barcode_txt.Text.Length < 24) { result_lbl.Text = "Error"; return; } barcode_txt.Text = barcode_txt.Text.Substring(0, 24); if (IsExists(barcode_txt.Text.ToUpper()) == false) { result_lbl.Text = "Error"; return; } if (IsOkReturn(barcode_txt.Text.ToUpper(), model_cbx.SelectedItem.ToString()) == false) { result_lbl.Text = "Error"; return; } serial se = new serial(); se.serial_cd = barcode_txt.Text.ToUpper(); se.model = model_cbx.SelectedItem.ToString(); rInfo.serials.Add(se); updateGridView(); barcode_txt.SelectAll(); }