private void btnAdd2List_Click(object sender, EventArgs e) { if (null == autxtGoodsInStock.SelectedObj) { if (!StringUtil.isEmpty(autxtGoodsInStock.Term)) { MainForm.Warn("无此商品!请重新选择!"); } autxtGoodsInStock.clear(); return; } StockGoodsVO goodsInStock = autxtGoodsInStock.SelectedObj as StockGoodsVO; foreach (DataGridViewRow row in dtgvSOutGoods.Rows) { long invId = StringUtil.Obj2Long(row.Cells[colInvID.Name].Value); if (invId == goodsInStock.InvID) { MainForm.Warn("此商品已添加,请重新选择!"); autxtGoodsInStock.clear(); return; } } int index = dtgvSOutGoods.Rows.Add(); InitRow(index, goodsInStock); autxtGoodsInStock.clear(); }
private void btnAdd2List_Click(object sender, EventArgs e) { StockGoodsVO soldGoods = autxtSodGoods.SelectedObj as StockGoodsVO; if (null == soldGoods) { if (!StringUtil.isEmpty(autxtSodGoods.Term)) { MainForm.Warn("无此商品!请重新选择!"); } return; } foreach (DataGridViewRow row in dtgvResellerRfGoods.Rows) { object gId = row.Cells[colGID.Name].Value; string ordrNO = StringUtil.Obj2Str(row.Cells[colSOutOrderNO.Name].Value); if (gId + "" + ordrNO == soldGoods.GID + "" + soldGoods.OrderNO) { MainForm.Warn("此商品已添加,请重新选择!"); autxtSodGoods.clear(); return; } } int index = dtgvResellerRfGoods.Rows.Add(); InitRow(index, soldGoods); autxtSodGoods.clear(); }
public InvGoodsDialog(IInventoryManager manager, StockGoodsVO gvo) { InitializeComponent(); this.manager = manager; txtGID.Text = gvo.GID + ""; txtGName.Text = gvo.GName; txtSpecs.Text = gvo.Specs; txtOrderNo.Text = gvo.OrderNO; txtSupplier.Text = gvo.CustName; txtInvNum.Text = gvo.Num + ""; invId = gvo.InvID; befNum = gvo.Num; }
private void dtgvSoldGoods_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { if (dtgvSoldGoods.Columns[e.ColumnIndex].Name == colCkboxs.Name) { DataGridViewRow row = dtgvSoldGoods.Rows[e.RowIndex]; string value = StringUtil.Obj2Str(row.Cells[colCkboxs.Name].Value); long invID = StringUtil.Obj2Long(row.Cells[colInvID.Name].Value); if (value == "true") { if (goodsMap.ContainsKey(invID)) { goodsMap.Remove(invID); } row.Cells[colCkboxs.Name].Value = "false"; } else { if (!goodsMap.ContainsKey(invID)) { StockGoodsVO vo = new StockGoodsVO(); vo.GID = StringUtil.Obj2Int(row.Cells[colGId.Name].Value); vo.GName = StringUtil.Obj2Str(row.Cells[colGName.Name].Value); vo.Specs = StringUtil.Obj2Str(row.Cells[colSpecs.Name].Value); vo.Price = StringUtil.Obj2Decimal(row.Cells[colPrice.Name].Value); vo.Num = StringUtil.Obj2Int(row.Cells[colInvNum.Name].Value); vo.OrderNO = StringUtil.Obj2Str(row.Cells[colSinOrdreNO.Name].Value); vo.InvID = StringUtil.Obj2Long(row.Cells[colInvID.Name].Value); vo.Remark = StringUtil.Obj2Str(row.Cells[colRemark.Name].Value); vo.TgtSID = StringUtil.Obj2Long(row.Cells[colTgtSID.Name].Value); object expDt = row.Cells[colExpDt.Name].Value; if (null != expDt) { vo.ExpDt = (DateTime)expDt; } vo.RfNum = StringUtil.Obj2Int(row.Cells[colRfNum.Name].Value); vo.CustID = (int)customer.CID__PK; vo.CustName = customer.CName; goodsMap.Add(invID, vo); } row.Cells[colCkboxs.Name].Value = "true"; } } } }
private void InitRow(int index, StockGoodsVO goods) { dtgvSOutGoods.Rows[index].Cells[colGID.Name].Value = goods.GID; dtgvSOutGoods.Rows[index].Cells[colSpecs.Name].Value = goods.Specs; dtgvSOutGoods.Rows[index].Cells[colInPric.Name].Value = goods.Price; dtgvSOutGoods.Rows[index].Cells[colInvNum.Name].Value = goods.Num; dtgvSOutGoods.Rows[index].Cells[colExpDt.Name].Value = goods.ExpDt; dtgvSOutGoods.Rows[index].Cells[colSInOrderNO.Name].Value = goods.OrderNO; dtgvSOutGoods.Rows[index].Cells[colInvID.Name].Value = goods.InvID; dtgvSOutGoods.Rows[index].Cells[colSupplier.Name].Value = goods.CustName; if (goods.GName.IndexOf("[") > 0) { dtgvSOutGoods.Rows[index].Cells[colGName.Name].Value = goods.GName.Substring(0, goods.GName.IndexOf("[")); } else { dtgvSOutGoods.Rows[index].Cells[colGName.Name].Value = goods.GName; } }
private void UpdateInv() { DataGridViewRow row = dtgvGoods.CurrentRow; StockGoodsVO vo = new StockGoodsVO(); vo.CustName = StringUtil.Obj2Str(row.Cells["colCustName"].Value); vo.OrderNO = StringUtil.Obj2Str(row.Cells["colSinOrdreNO"].Value); vo.GID = StringUtil.Obj2Int(row.Cells["colGId"].Value); vo.GName = StringUtil.Obj2Str(row.Cells["colGName"].Value); vo.Specs = StringUtil.Obj2Str(row.Cells["colSpecs"].Value); vo.Num = StringUtil.Obj2Int(row.Cells["colInvNum"].Value); vo.InvID = StringUtil.Obj2Long(row.Cells["colInvID"].Value); InvGoodsDialog dialog = new InvGoodsDialog(manager, vo); DialogResult rslt = dialog.ShowDialog(); if (DialogResult.OK == rslt) { btnQuery.PerformClick(); } }
private void dtgvGoodsInStock_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { if (dtgvGoodsInStock.Columns[e.ColumnIndex].Name == colCkboxs.Name) { DataGridViewRow row = dtgvGoodsInStock.Rows[e.RowIndex]; string value = StringUtil.Obj2Str(row.Cells[colCkboxs.Name].Value); long invId = StringUtil.Obj2Long(row.Cells[colInvID.Name].Value); if (value == "true") { if (goodsMap.ContainsKey(invId)) { goodsMap.Remove(invId); } row.Cells[colCkboxs.Name].Value = "false"; } else { if (!goodsMap.ContainsKey(invId)) { StockGoodsVO vo = new StockGoodsVO(); vo.GID = StringUtil.Obj2Int(row.Cells[colGId.Name].Value); vo.GName = StringUtil.Obj2Str(row.Cells[colGName.Name].Value); vo.Specs = StringUtil.Obj2Str(row.Cells[colSpecs.Name].Value); vo.Price = StringUtil.Obj2Decimal(row.Cells[colPrice.Name].Value); vo.Num = StringUtil.Obj2Int(row.Cells[colInvNum.Name].Value); vo.OrderNO = StringUtil.Obj2Str(row.Cells[colSinOrdreNO.Name].Value); vo.InvID = StringUtil.Obj2Long(row.Cells[colInvID.Name].Value); vo.CustID = StringUtil.Obj2Int(row.Cells[colCustID.Name].Value); vo.CustName = StringUtil.Obj2Str(row.Cells[colCustName.Name].Value); vo.TgtSID = StringUtil.Obj2Long(row.Cells[colTgtSID.Name].Value); vo.ExpDt = (DateTime)row.Cells[colExpDt.Name].Value; goodsMap.Add(invId, vo); } row.Cells[colCkboxs.Name].Value = "true"; } } } }
private void InitRow(int index, StockGoodsVO goods) { dtgvResellerRfGoods.Rows[index].Cells[colGID.Name].Value = goods.GID; dtgvResellerRfGoods.Rows[index].Cells[colSpecs.Name].Value = goods.Specs; dtgvResellerRfGoods.Rows[index].Cells[colSalePrice.Name].Value = goods.Price; dtgvResellerRfGoods.Rows[index].Cells[colSoldNum.Name].Value = goods.Num; dtgvResellerRfGoods.Rows[index].Cells[colExpDt.Name].Value = goods.ExpDt; dtgvResellerRfGoods.Rows[index].Cells[colSOutOrderNO.Name].Value = goods.OrderNO; dtgvResellerRfGoods.Rows[index].Cells[colInvID.Name].Value = goods.InvID; dtgvResellerRfGoods.Rows[index].Cells[colReseller.Name].Value = goods.CustName; dtgvResellerRfGoods.Rows[index].Cells[colNum.Name].Value = goods.Num - goods.RfNum; dtgvResellerRfGoods.Rows[index].Cells[colRfNum.Name].Value = goods.RfNum; dtgvResellerRfGoods.Rows[index].Cells[colPrice.Name].Value = goods.Price; dtgvResellerRfGoods.Rows[index].Cells[colTgtSID.Name].Value = goods.TgtSID; if (goods.GName.IndexOf("[") > 0) { dtgvResellerRfGoods.Rows[index].Cells[colGName.Name].Value = goods.GName.Substring(0, goods.GName.IndexOf("[")); } else { dtgvResellerRfGoods.Rows[index].Cells[colGName.Name].Value = goods.GName; } }