private void comGoods_SelectedIndexChanged(object sender, EventArgs e) { try { string[] strGoods = comGoods.Text.ToString().Split('$'); MesGoodsBLL GoodsBLL = new MesGoodsBLL(); //MesMaterInDetailEntity MaterInDetail = new MesMaterInDetailEntity(); var Goods_rows = GoodsBLL.GetList(strGoods[0], strGoods[1]); if (Goods_rows == null || Goods_rows.Count < 1 || Goods_rows[0].G_Kind == 2) { untCommon.InfoMsg("输入的物料编码错误,请重新输入!"); return; } if (Goods_rows[0].G_Kind == 1) { //txtGoodsCode.Text = Goods_rows[0].G_Code; //txtGoodsName.Text = Goods_rows[0].G_Name; txtUnit.Text = Goods_rows[0].G_Unit.ToString(); Itox = Goods_rows[0].G_Itax; //txtPrice.Text = Goods_rows[0].G_Price.ToString(); if (Goods_rows[0].G_Kind == 1) { txtKind.Text = "原物料"; } txtBatch.Text = DateTime.Now.ToString("yyyyMMdd"); Mes_InPriceBLL InPriceBLL = new Mes_InPriceBLL(); var InPrice_row = InPriceBLL.GetList_Mes_Price(" where P_GoodsCode = '" + strGoods[0] + "' and P_SupplyCode = '" + Globels.strSupplyCode + "'"); if (InPrice_row.Count > 0) { txtPrice.Text = InPrice_row[0].P_InPrice.ToString(); } else { untCommon.InfoMsg("请先维护商品的入库价格"); return; } txtQty.Focus(); } else { untCommon.InfoMsg("输入的物料编码不是原物料,请重新输入!"); //txtGoodsCode.Text = ""; //txtGoodsCode.Focus(); } } catch (Exception Exception) { MessageBox.Show(Exception.ToString()); } }
private void comGoods_SelectedIndexChanged(object sender, EventArgs e) { string[] strGoods = comGoods.Text.ToString().Split('$'); MesGoodsBLL GoodsBLL = new MesGoodsBLL(); //MesMaterInDetailEntity MaterInDetail = new MesMaterInDetailEntity(); var Goods_rows = GoodsBLL.GetList(strGoods[0], strGoods[1]); if (Goods_rows == null || Goods_rows.Count < 1 || Goods_rows[0].G_Kind == 2) { untCommon.InfoMsg("输入的物料编码错误,请重新输入!"); return; } if (Goods_rows[0].G_Kind == 1) { //txtGoodsCode.Text = Goods_rows[0].G_Code; //txtGoodsName.Text = Goods_rows[0].G_Name; txtUnit.Text = Goods_rows[0].G_Unit; txtPrice.Text = Goods_rows[0].G_Price.ToString(); if (Goods_rows[0].G_Kind == 1) { txtKind.Text = "原物料"; } txtBatch.Text = DateTime.Now.ToString("yyyyMMdd"); cmbSupply.Items.Clear(); Mes_InPriceBLL InPriceBLL = new Mes_InPriceBLL(); var InPrice_row = InPriceBLL.GetList_Mes_Price("where P_GoodsCode = '" + strGoods[0] + "'"); if (InPrice_row.Count > 0) { for (int i = 0; i < InPrice_row.Count; i++) { cmbSupply.Items.Add(InPrice_row[i].P_SupplyCode); } if (InPrice_row.Count == 1) { cmbSupply.Text = InPrice_row[0].P_SupplyCode; } } else { untCommon.InfoMsg("请先维护商品的入库价格"); return; } txtQty.Focus(); } else { untCommon.InfoMsg("输入的物料编码不是原物料,请重新输入!"); //txtGoodsCode.Text = ""; //txtGoodsCode.Focus(); } }