private void tsbAdd_Click(object sender, EventArgs e) { frmSalesReturn frmSalesReturn = new frmSalesReturn(); frmSalesReturn.BringToFront(); frmSalesReturn.StartPosition = FormStartPosition.CenterScreen; frmSalesReturn.ShowDialog(); frmSalesReturn.RefreshParentForm += delegate { BindDataGridView(pgSalesReturn.PageIndex); }; }
private void tsbEdit_Click(object sender, EventArgs e) { if (srguid != null) { frmSalesReturn frmSalesReturn = new frmSalesReturn(); frmSalesReturn.SRGuid = srguid; frmSalesReturn.BringToFront(); frmSalesReturn.StartPosition = FormStartPosition.CenterScreen; frmSalesReturn.ShowDialog(); frmSalesReturn.RefreshParentForm += delegate { BindDataGridView(pgSalesReturn.PageIndex); }; } else { this.ShowMessage("请选择要编辑的销售退货单"); } }
private void dgvSalesOrder_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > -1) { Guid?_SOGuid = dgvSalesOrder["colSOGuid", e.RowIndex].Value.ToGuid(); if (dgvSalesOrder.Columns[e.ColumnIndex].Name == "colOperOut") { ORD_SalesOrderResult orderResult = orderLogic.GetInfo(new ORD_SalesOrderParam() { SOGuid = soguid }); if (orderResult != null && orderResult.Status == "Complete" && orderResult.StkOutStatus != "全部出库" && orderResult.StkOutOccStatus != "全部占有")//没有全部出库的销售单才能创建出库单 { List <ORD_SalesOrderLineResult> lineList = orderResult.OrderLineList; if (lineList != null && lineList.Count > 0) { //判断是否存在有未取消的,出库数量小于下单数量 List <ORD_SalesOrderLineResult> effLineList = lineList.Where(a => a.IsCancel == false && a.StkOutOccQty < a.Qty).ToList(); if (effLineList != null && effLineList.Count > 0) { //如果存在未提交的关联的出库单,则直接调出出库单 STK_OutResult outResult = outLogic.GetInfo(new STK_OutParam() { SourceBillGuid = soguid, Status = "New" }); frmStkOut frmStkOut = new STK.frmStkOut("SO_OUT", _SOGuid); frmStkOut.BringToFront(); frmStkOut.StartPosition = FormStartPosition.CenterParent; if (frmStkOut != null) { //存在关联的未提交的出库单 frmStkOut.StkOutGuid = outResult.StkOutGuid; } frmStkOut.ShowDialog(); } else { this.ShowMessage("当前销售单没有需出库的销售明细!若存在有关联的已提交未审核的出库单,请及时联系相关人员审核!"); } } } else { this.ShowMessage("未审核或者全部出库占有的销售单据不允许再继续出库!"); } } if (dgvSalesOrder.Columns[e.ColumnIndex].Name == "colOperReturn") { ORD_SalesOrderResult orderResult = orderLogic.GetInfo(new ORD_SalesOrderParam() { SOGuid = _SOGuid }); if (orderResult != null && orderResult.Status == "Complete" && orderResult.StkOutOccStatus != "待出库" && orderResult.ReturnOccStatus != "全部占有")//没有全部退货的销售单才能创建退货单 { List <ORD_SalesOrderLineResult> lineList = orderResult.OrderLineList; if (lineList != null && lineList.Count > 0) { //判断是否存在有未取消的,出库数量大于0,且出库数量大于退货占有数量的销售明细 List <ORD_SalesOrderLineResult> effLineList = lineList.Where(a => a.IsCancel == false && a.StkOutQty > 0 && a.StkOutQty > a.ReturnOccQty.ToInt32()).ToList(); if (effLineList != null && effLineList.Count > 0) { //如果存在未提交的关联的退货单,则直接调出退货单 List <ORD_SalesReturnResult> returnResultList = returnLogic.GetList(new ORD_SalesReturnParam() { SOGuid = _SOGuid, Status = "New" }); frmSalesReturn frmSalesReturn = new frmSalesReturn(_SOGuid); frmSalesReturn.BringToFront(); frmSalesReturn.StartPosition = FormStartPosition.CenterParent; if (returnResultList != null && returnResultList.Count > 0) { //存在关联的未提交的退货单 frmSalesReturn.SRGuid = returnResultList[0].SRGuid; } frmSalesReturn.ShowDialog(); } else { this.ShowMessage("当前销售单没有需退货的销售明细!若存在有关联的已提交未审核的退货单,请及时联系相关人员审核!"); } } } else { this.ShowMessage("未审核或者未出库或者全部退货占有的销售单据不允许退货!"); } } } }