/// <summary> /// 数据绑定 /// </summary> public void Bind() { try { ConPurchaseOrderOutputDto Order = autofacConfig.ConPurchaseOrderService.GetByPOID(POID); List <ConPurchaseOrderReturnOutputDto> returnRows = autofacConfig.ConPurchaseOrderService.GetReturnRowsByPOID(POID); List <ConPORInstorageOutputDto> rows = autofacConfig.ConPurchaseOrderService.GetInStoRowsByPOID(POID); if (Order.STATUS == (int)PurchaseOrderStatus.已完成 && returnRows.Count == 0 && rows.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.ConPurchaseOrderService.GetOrderRows(POID); lvData.Rows.Clear(); lvData.DataSource = AlRows; lvData.DataBind(); } catch (Exception ex) { Toast(ex.Message); } }
public string POID; //耗材采购单号 #endregion /// <summary> /// 页面初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmConPurchaseCreate_Load(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(POID)) //POID不为空,说明是采购单修改 { this.Title1.TitleText = "耗材采购单编辑"; ///表头信息 ConPurchaseOrderOutputDto Order = autofacConfig.ConPurchaseOrderService.GetByPOID(POID); txtRealID.Text = Order.REALID; txtName.Text = Order.NAME; btnDealMan.Tag = Order.PURCHASER; btnDealMan.Text = Order.PURCHASERNAME + " > "; //耗材行项信息 List <ConPurAndSaleCreateInputDto> OrderRows = autofacConfig.ConPurchaseOrderService.GetOrderRows(POID); if (OrderRows.Count > 0) { Rows = OrderRows; Bind(); } } } catch (Exception ex) { Toast(ex.Message); } }
private string UserId; //用户编号 #endregion /// <summary> /// 页面初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmConPurChaseResult_Load(object sender, EventArgs e) { try { UserId = Client.Session["UserID"].ToString(); ///表头信息 ConPurchaseOrderOutputDto Order = autofacConfig.ConPurchaseOrderService.GetByPOID(POID); lblRealID.Text = Order.REALID; lblName.Text = Order.NAME; lblVendor.Text = Order.VENDORNAME; lblDealMan.Text = Order.PURCHASERNAME; //数据绑定 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)) { ConPurchaseOrderOutputDto conPurchaseOrder = autofacConfig.ConPurchaseOrderService.GetByPOID(e.Value); if (conPurchaseOrder != null) { POID = 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); } }