private void InitRow(int index, OrderGoodsVO vo) { dtgvOrderGList.Rows[index].Cells[colGID.Name].Value = vo.GID; dtgvOrderGList.Rows[index].Cells[colGNane.Name].Value = vo.GName; dtgvOrderGList.Rows[index].Cells[colNum.Name].Value = vo.Num; dtgvOrderGList.Rows[index].Cells[colPrice.Name].Value = vo.Price; dtgvOrderGList.Rows[index].Cells[colSpecs.Name].Value = vo.Specs; }
private void btnRefund_Click(object sender, EventArgs e) { RefundOrderVO refundVO = null; List <Refund> list = new List <Refund>(); List <OrderGoodsVO> glist = new List <OrderGoodsVO>(); if (cboxNSupplier.SelectedIndex == -1) { return; } foreach (DataGridViewRow row in dtgvRfGoods.Rows) { object numObj = row.Cells[colNum.Name].Value; object priceObj = row.Cells[colPrice.Name].Value; if (null == numObj || null == priceObj) { continue; } Refund rf = new Refund(); rf.Direct = DIRECT.REFUND2SUPPLIER; rf.InvID = StringUtil.Obj2Long(row.Cells[colInvID.Name].Value); rf.Num = StringUtil.Obj2Int(numObj); rf.Price = StringUtil.Obj2Decimal(priceObj); rf.TgtSID = StringUtil.Obj2Long(row.Cells[colTgtSID.Name].Value); if (rf.Num * rf.Price == 0) { continue; } list.Add(rf); OrderGoodsVO vo = new OrderGoodsVO(); vo.GID = StringUtil.Obj2Int(row.Cells[colGID.Name].Value); vo.GName = StringUtil.Obj2Str(row.Cells[colGName.Name].Value); vo.Num = (int)rf.Num; vo.Price = (int)rf.Price; vo.Specs = StringUtil.Obj2Str(row.Cells[colSpecs.Name].Value); glist.Add(vo); } if (list.Count < 1) { return; } Customer supplier = cboxNSupplier.SelectedItem as Customer; OrderCnfrmDialog cnfrmDialog = new OrderCnfrmDialog("【退货单-明细】 " + supplier.CName, glist); DialogResult rslt = cnfrmDialog.ShowDialog(); if (DialogResult.OK != rslt) { return; } refundVO = new RefundOrderVO(); refundVO.CustID = supplier.CID__PK; refundVO.CustName = supplier.CName; refundVO.Direct = DIRECT.REFUND2SUPPLIER; refundVO.UptUID = MainForm.usr.UId__PK; refundVO.CrtUID = MainForm.usr.UId__PK; refundVO._RefundList = list; string orderNO = refundManager.Refund(refundVO); if (!StringUtil.isEmpty(orderNO)) { MainForm.Info("商品已退回!退单号:" + orderNO); dtgvRfGoods.Rows.Clear(); } else { MainForm.Warn("商品退回失败!"); } }
private void btnCreate_Click(object sender, EventArgs e) { StockOutOrderVO orderVO = null; List <StockOut> soutList = new List <StockOut>(); List <OrderGoodsVO> glist = new List <OrderGoodsVO>(); if (cboxNResellers.SelectedIndex == -1) { return; } foreach (DataGridViewRow row in dtgvSOutGoods.Rows) { object numObj = row.Cells[colNum.Name].Value; object priceObj = row.Cells[colPrice.Name].Value; if (null == numObj || null == priceObj) { continue; } StockOut sout = new StockOut(); sout.InvID = StringUtil.Obj2Long(row.Cells[colInvID.Name].Value); sout.Num = StringUtil.Obj2Int(numObj); sout.Price = StringUtil.Obj2Decimal(priceObj); if (sout.Num * sout.Price == 0) { continue; } soutList.Add(sout); OrderGoodsVO vo = new OrderGoodsVO(); vo.GID = StringUtil.Obj2Int(row.Cells[colGID.Name].Value); vo.GName = StringUtil.Obj2Str(row.Cells[colGName.Name].Value); vo.Num = (int)sout.Num; vo.Price = (decimal)sout.Price; vo.Specs = StringUtil.Obj2Str(row.Cells[colSpecs.Name].Value); glist.Add(vo); } if (soutList.Count < 1) { return; } Customer reseller = cboxNResellers.SelectedItem as Customer; OrderCnfrmDialog cnfrmDialog = new OrderCnfrmDialog("【出货单-明细】 " + reseller.CName, glist); DialogResult rslt = cnfrmDialog.ShowDialog(); if (DialogResult.OK != rslt) { return; } orderVO = new StockOutOrderVO(); orderVO.Direct = DIRECT.STOCK_OUT; orderVO._StockOutList = soutList; orderVO.CustID = reseller.CID__PK; orderVO.CustName = reseller.CName; Usr lgnUsr = MainForm.usr; orderVO.CrtUID = lgnUsr.UId__PK; orderVO.UptUID = lgnUsr.UId__PK; string orderNO = stockOutManager.StockOut(orderVO); if (!StringUtil.isEmpty(orderNO)) { MainForm.Info("出货单创建成功! 单号:" + orderNO); dtgvSOutGoods.Rows.Clear(); } else { MainForm.Warn("出货单创建失败!"); } }
private void btnCreate_Click(object sender, EventArgs e) { StockInOrderVO orderVO = null; List <StockIn> list = new List <StockIn>(); List <OrderGoodsVO> glist = new List <OrderGoodsVO>(); if (cboxNSupplier.SelectedIndex == -1) { return; } foreach (DataGridViewRow row in dtgvStockin.Rows) { object numObj = row.Cells[colNum.Name].Value; object priceObj = row.Cells[colPrice.Name].Value; if (null == numObj || null == priceObj) { continue; } StockIn sin = new StockIn(); sin.Num = StringUtil.Obj2Int(row.Cells[colNum.Name].Value); sin.Price = StringUtil.Obj2Decimal(row.Cells[colPrice.Name].Value); sin.GID = StringUtil.Obj2Int(row.Cells[colGID.Name].Value); if (sin.Num * sin.Price == 0) { continue; } if (!StringUtil.isEmpty(row.Cells[colMfDt.Name].Value + "")) { DateTime?expDt = null; DateTime mfDt = DateTime.ParseExact(StringUtil.Obj2Str(row.Cells[colMfDt.Name].Value), "yyyy/MM/dd", null); string shelfLifeStr = StringUtil.Obj2Str(row.Cells[colShelfLife.Name].Value); string num = shelfLifeStr.Substring(0, shelfLifeStr.Length - 1); string term = shelfLifeStr.Substring(shelfLifeStr.Length - 1); if (term == TERM.DAY) { expDt = mfDt.AddDays(int.Parse(num)); } else if (term == TERM.MONTH) { expDt = mfDt.AddMonths(int.Parse(num)); } else if (term == TERM.YEAR) { expDt = mfDt.AddYears(int.Parse(num)); } sin.ExpDt = expDt; sin.MfDt = mfDt; } list.Add(sin); OrderGoodsVO vo = new OrderGoodsVO(); vo.GID = StringUtil.Obj2Int(row.Cells[colGID.Name].Value); vo.GName = StringUtil.Obj2Str(row.Cells[colGName.Name].Value); vo.Num = (int)sin.Num; vo.Price = (decimal)sin.Price; vo.Specs = StringUtil.Obj2Str(row.Cells[colSpecs.Name].Value); glist.Add(vo); } if (list.Count < 1) { return; } Customer supplier = cboxNSupplier.SelectedItem as Customer; OrderCnfrmDialog cnfrmDialog = new OrderCnfrmDialog("【进货单-明细】 " + supplier.CName, glist); DialogResult rslt = cnfrmDialog.ShowDialog(); if (DialogResult.OK != rslt) { return; } orderVO = new StockInOrderVO(); orderVO.CustID = supplier.CID__PK; orderVO.CustName = supplier.CName; orderVO.Direct = DIRECT.STOCK_IN; orderVO.UptUID = MainForm.usr.UId__PK; orderVO.CrtUID = MainForm.usr.UId__PK; orderVO._StockinList = list; string orderNO = stockinManager.Stockin(orderVO); if (!StringUtil.isEmpty(orderNO)) { MessageBox.Show("进货单创建成功! 单号:" + orderNO, "操作结果", MessageBoxButtons.OK, MessageBoxIcon.Information); dtgvStockin.Rows.Clear(); } else { MessageBox.Show("进货单创建失败!", "操作结果", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }