public string SOID; //耗材销售单号 #endregion /// <summary> /// 页面初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmConSalesCreate_Load(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(SOID)) //SOID不为空,说明是销售单修改 { this.Title1.TitleText = "耗材销售单编辑"; ///表头信息 ConSalesOrderOutputDto Order = autofacConfig.ConSalesOrderService.GetBySOID(SOID); txtRealID.Text = Order.REALID; txtName.Text = Order.NAME; btnCustomer.Tag = Order.CUSID; btnCustomer.Text = Order.CUSTOMERNAME + " > "; btnDealMan.Tag = Order.SALESPERSON; btnDealMan.Text = Order.SALESPERSONNAME + " > "; //耗材行项信息 List <ConPurAndSaleCreateInputDto> OrderRows = autofacConfig.ConSalesOrderService.GetOrderRows(SOID); if (OrderRows.Count > 0) { Rows = OrderRows; Bind(); } } } catch (Exception ex) { Toast(ex.Message); } }
/// <summary> /// 数据绑定 /// </summary> public void Bind() { try { ConSalesOrderOutputDto Order = autofacConfig.ConSalesOrderService.GetBySOID(SOID); List <ConSalesOrderOutboundOutputDto> outRows = autofacConfig.ConSalesOrderService.GetOutRowsBySOID(SOID); List <ConSalesOrderRowInputDto> retRows = autofacConfig.ConSalesOrderService.GetRetRowsBySOID(SOID); if (Order.STATUS == (int)SalesOrderStatus.已完成 && outRows.Count == 0 && retRows.Count == 0) ////如果无可退库耗材,无可入库耗材,则隐藏按钮 { Form.ActionButton.Items.RemoveAt(1); Form.ActionButton.Items.RemoveAt(0); } if (Form.ActionButton.Items.Count == 0) { Form.ActionButton.Enabled = false; } List <ConPurAndSaleCreateInputDto> AlRows = autofacConfig.ConSalesOrderService.GetOrderRows(SOID); lvData.Rows.Clear(); lvData.DataSource = AlRows; lvData.DataBind(); } catch (Exception ex) { Toast(ex.Message); } }
private string UserId; //用户编号 #endregion /// <summary> /// 页面初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmConSalesResult_Load(object sender, EventArgs e) { try { UserId = Client.Session["UserID"].ToString(); ///表头信息 ConSalesOrderOutputDto Order = autofacConfig.ConSalesOrderService.GetBySOID(SOID); lblRealID.Text = Order.REALID; lblName.Text = Order.NAME; lblCustomer.Text = Order.CUSTOMERNAME; lblDealMan.Text = Order.SALESPERSONNAME; //数据绑定 Bind(); } catch (Exception ex) { Toast(ex.Message); } }
/// <summary> /// 扫描到单号时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bsOrder_BarcodeScanned(object sender, BarcodeResultArgs e) { try { if (String.IsNullOrEmpty(e.error)) { ConSalesOrderOutputDto conSales = autofacConfig.ConSalesOrderService.GetBySOID(e.Value); if (conSales != null) { SOID = e.Value; Bind(); } else { throw new Exception("该订单号不存在"); } } } catch (Exception ex) { Toast(ex.Message); } }
/// <summary> /// 删除列表行项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelRow_Press(object sender, EventArgs e) { try { switch (Parent.Parent.ToString()) { case "SMOWMS.UI.Layout.frmAssPOLayout": AssPurchaseOrderOutputDto assPurchase = autofacConfig.AssPurchaseOrderService.GetById(((frmAssPOLayout)Parent.Parent).POID); if (assPurchase.STATUS == (int)PurchaseOrderStatus.采购中) { MessageBox.Show("你确定要删除该采购单吗?", "系统提醒", MessageBoxButtons.OKCancel, (object sender1, MessageBoxHandlerArgs args) => { try { if (args.Result == ShowResult.OK) //删除该采购单 { ReturnInfo rInfo = autofacConfig.AssPurchaseOrderService.DeletePurchaseOrder(((frmAssPOLayout)Parent.Parent).POID); if (rInfo.IsSuccess) { ((frmOrder)Form).Bind(((frmOrder)Form).type, ((frmOrder)Form).orderType); //刷新当前列表 Toast("删除采购单成功"); } else { throw new Exception(rInfo.ErrorInfo); } } } catch (Exception ex) { Form.Toast(ex.Message); } }); } else { throw new Exception("当前状态下无法删除该采购单"); } break; case "SMOWMS.UI.Layout.frmAssSOLayout": AssSalesOrderOutputDto assSale = autofacConfig.AssSalesOrderService.GetById(((frmAssSOLayout)Parent.Parent).SOID); if (assSale.STATUS == (int)SalesOrderStatus.销售中) { MessageBox.Show("你确定要刪除该销售单吗?", "系统提醒", MessageBoxButtons.OKCancel, (object sender1, MessageBoxHandlerArgs args) => { try { if (args.Result == ShowResult.OK) //删除该销售单 { ReturnInfo rInfo = autofacConfig.AssSalesOrderService.DeleteSalesOrder(((frmAssSOLayout)Parent.Parent).SOID); if (rInfo.IsSuccess) { ((frmOrder)Form).Bind(((frmOrder)Form).type, ((frmOrder)Form).orderType); //刷新当前列表 Toast("删除销售单成功"); } else { throw new Exception(rInfo.ErrorInfo); } } } catch (Exception ex) { Form.Toast(ex.Message); } }); } else { throw new Exception("当前状态下无法删除该销售单"); } break; case "SMOWMS.UI.Layout.frmConPurchaseLayout": ConPurchaseOrderOutputDto conPurchaseOrder = autofacConfig.ConPurchaseOrderService.GetByPOID(((frmConPurchaseLayout)Parent.Parent).POID); if (conPurchaseOrder.STATUS == (int)PurchaseOrderStatus.采购中) { MessageBox.Show("你确定要删除该采购单吗?", "系统提醒", MessageBoxButtons.OKCancel, (object sender1, MessageBoxHandlerArgs args) => { try { if (args.Result == ShowResult.OK) //删除该采购单 { ReturnInfo rInfo = autofacConfig.ConPurchaseOrderService.DeletePurchaseOrder(((frmConPurchaseLayout)Parent.Parent).POID); if (rInfo.IsSuccess) { ((frmOrder)Form).Bind(((frmOrder)Form).type, ((frmOrder)Form).orderType); //刷新当前列表 Toast("删除采购单成功"); } else { Toast(rInfo.ErrorInfo); } } } catch (Exception ex) { Form.Toast(ex.Message); } }); } else { throw new Exception("当前状态下无法删除该采购单"); } break; case "SMOWMS.UI.Layout.frmConSalesLayout": ConSalesOrderOutputDto conSalesOrder = autofacConfig.ConSalesOrderService.GetBySOID(((frmConSalesLayout)Parent.Parent).SOID); if (conSalesOrder.STATUS == (int)SalesOrderStatus.销售中) { MessageBox.Show("你确定要删除该销售单吗?", "系统提醒", MessageBoxButtons.OKCancel, (object sender1, MessageBoxHandlerArgs args) => { try { if (args.Result == ShowResult.OK) //删除该销售单 { ReturnInfo rInfo = autofacConfig.ConSalesOrderService.DeleteSalesOrder(((frmConSalesLayout)Parent.Parent).SOID); if (rInfo.IsSuccess) { ((frmOrder)Form).Bind(((frmOrder)Form).type, ((frmOrder)Form).orderType); //刷新当前列表 Toast("删除销售单成功"); } else { Toast(rInfo.ErrorInfo); } } } catch (Exception ex) { Form.Toast(ex.Message); } }); } else { throw new Exception("当前状态下无法删除该销售单"); } break; case "SMOWMS.UI.Layout.frmCustomerLayout": MessageBox.Show("你确定要删除该客户吗?", "系统提醒", MessageBoxButtons.OKCancel, (object sender1, MessageBoxHandlerArgs args) => { try { if (args.Result == ShowResult.OK) //启用该仓库 { ReturnInfo rInfo = autofacConfig.customerService.DeleteCustomer(((frmCustomerLayout)Parent.Parent).cusId); if (rInfo.IsSuccess) { ((frmCustomer)Form).Bind(); Toast("删除客户成功"); } else { throw new Exception(rInfo.ErrorInfo); } } } catch (Exception ex) { Form.Toast(ex.Message); } }); break; case "SMOWMS.UI.Layout.frmVendorLayout": MessageBox.Show("你确定要删除该供货商吗?", "系统提醒", MessageBoxButtons.OKCancel, (object sender1, MessageBoxHandlerArgs args) => { try { if (args.Result == ShowResult.OK) //启用该仓库 { ReturnInfo rInfo = autofacConfig.vendorService.DeleteVendor(((frmVendorLayout)Parent.Parent).vId); if (rInfo.IsSuccess) { ((frmCustomer)Form).Bind(); Toast("删除供货商成功"); } else { throw new Exception(rInfo.ErrorInfo); } } } catch (Exception ex) { Form.Toast(ex.Message); } }); break; } } catch (Exception ex) { Form.Toast(ex.Message); } }