private void txtBarcode_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyValue == 13) { string strBarcode = txtBarcode.Text; string[] strTemp = strBarcode.Split(','); //MessageBox.Show(strTemp.Length.ToString()); txtCode.Text = Resolve(strTemp[0].ToString()); txtBatch.Text = Resolve(strTemp[1].ToString()); txtQty.Text = Resolve(strTemp[2].ToString()); m_strBarcode = strTemp[4].ToString();; MesGoodsBLL GoodsBLL = new MesGoodsBLL(); var Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + txtCode.Text + "'"); int nLen = Goods_rows.Count; if (nLen > 0) { txtName.Text = Goods_rows[0].G_Name; txtUnit.Text = Goods_rows[0].G_Unit; //txtPrice.Text = Goods_rows[0].G_Price.ToString(); } } } catch (Exception) { MessageBox.Show("输入法错误"); txtBarcode.Clear(); } }
private int BZQ(string strGoodsCode) { int dd = 0; MesGoodsBLL GoodsBLL = new MesGoodsBLL(); var Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + strGoodsCode + "'"); int nLen = Goods_rows.Count; if (nLen > 0) { dd = Goods_rows[0].G_Period * 24; } return(dd); }
private void cmbGoodsCode_SelectedIndexChanged(object sender, EventArgs e) { MesGoodsBLL GoodsBLL = new MesGoodsBLL(); var Goods_rows = GoodsBLL.GetListCondit("where G_Name = '" + txtGoodsName.Text + "'"); int nLen = Goods_rows.Count; if (nLen > 0) { txtCode.Text = Goods_rows[0].G_Code; txtUnit.Text = Goods_rows[0].G_Unit; int dd = Goods_rows[0].G_Period * 24; strBZQ = dd.ToString(); } txtBatch.Text = DateTime.Now.ToString("yyyyMMdd"); //ShowYWL(txtCode.Text); }
private void listView1_SelectedIndexChanged(object sender, EventArgs e) { try { int nLen2 = listView1.SelectedIndices[0]; string strGoodsName = listView1.Items[nLen2].SubItems[0].Text.ToString(); MesGoodsBLL GoodsBLL = new MesGoodsBLL(); var Goods_rows = GoodsBLL.GetListCondit("where G_Name = '" + strGoodsName + "'"); int nLen = Goods_rows.Count; if (nLen > 0) { txtCode.Text = Goods_rows[0].G_Code; txtGoodsName.Text = Goods_rows[0].G_Name; txtUnit.Text = Goods_rows[0].G_Unit; int dd = Goods_rows[0].G_Period * 24; strBZQ = dd.ToString(); } txtBatch.Text = DateTime.Now.ToString("yyyyMMdd"); } catch (Exception ex) { ; } }
private void txtBarcode_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyValue == 13) { string strBarcode = txtBarcode.Text; if (strBarcode.IndexOf('*') > 0) { string[] strTemp = strBarcode.Split('*'); txtCode.Text = strTemp[0].ToString(); txtPc.Text = strTemp[1].ToString(); txtQty.Text = strTemp[2].ToString(); MesGoodsBLL GoodsBLL = new MesGoodsBLL(); var Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + txtCode.Text + "'"); int nLen = Goods_rows.Count; if (nLen > 0) { txtName.Text = Goods_rows[0].G_Name; txtPrice.Text = Goods_rows[0].G_Price.ToString(); strUnit = Goods_rows[0].G_Unit.ToString(); } } else { string[] strTemp = strBarcode.Split(','); //MessageBox.Show(strTemp.Length.ToString()); txtCode.Text = Resolve(strTemp[0].ToString()); txtPc.Text = Resolve(strTemp[1].ToString()); txtQty.Text = Resolve(strTemp[2].ToString()); m_strBarcode = strTemp[4].ToString(); Mes_BarcodeBLL BarcodeBLL = new Mes_BarcodeBLL(); var Barcode_rows = BarcodeBLL.GetList_Mes_Barcode("select * from Mes_Barcode where B_Status = 1 and B_Barcode = '" + m_strBarcode + "'"); if (Barcode_rows.Count > 0) { } else { MessageBox.Show("此标签已经入库, 或者状态不对"); txtBarcode.Text = ""; txtBarcode.Focus(); txtBarcode.SelectAll(); return; } MesGoodsBLL GoodsBLL = new MesGoodsBLL(); var Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + txtCode.Text + "'"); int nLen = Goods_rows.Count; if (nLen > 0) { txtName.Text = Goods_rows[0].G_Name; strUnit = Goods_rows[0].G_Unit; txtPrice.Text = Goods_rows[0].G_Price.ToString(); } } Save(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }