/// <summary> /// 选择仓库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChoose_Click(object sender, EventArgs e) { ViewStoreInfoModel selInfo = null; if (dgvStoreList.SelectedRows.Count == 0) { selInfo = dgvStoreList.Rows[0].DataBoundItem as ViewStoreInfoModel; } else { selInfo = dgvStoreList.SelectedRows[0].DataBoundItem as ViewStoreInfoModel; } StoreInfoModel storeInfo = new StoreInfoModel() { StoreId = selInfo.StoreId, StoreName = selInfo.StoreName }; //typecode 区分要返回的页面 switch (typeName) { case "Store-StartStock": //期初入库单页面 FrmStartStockInfo fStartStockInfo = cModel.FGet as FrmStartStockInfo; fStartStockInfo.store = storeInfo; break; case "Store-PerchaseInStore": //采购单页面 FrmPerchaseInStore fPerchaseInStoreInfo = cModel.FGet as FrmPerchaseInStore; fPerchaseInStoreInfo.store = storeInfo; break; case "Store-SaleOutStore": //销售单页面 FrmSaleOutStore fSaleOutStoreInfo = cModel.FGet as FrmSaleOutStore; fSaleOutStoreInfo.store = storeInfo; break; case "Store-SheetQuery": //单据选择页面 FrmSheetQuery fSheetQuery = cModel.FGet as FrmSheetQuery; fSheetQuery.store = storeInfo; break; case "Store-PerQueryBySupplier": //采购统计按供应商选择页面 FrmPerchaseQueryBySupplier fPerBySupplier = cModel.FGet as FrmPerchaseQueryBySupplier; fPerBySupplier.store = storeInfo; break; case "Store-PerQueryByStore": //采购统计按仓库选择页面 FrmPerchaseQueryByStore fPerByStore = cModel.FGet as FrmPerchaseQueryByStore; fPerByStore.store = storeInfo; break; case "Store-PerQueryByGoods": //采购统计按商品选择页面 FrmPerchaseQueryByGoods fPerByGoods = cModel.FGet as FrmPerchaseQueryByGoods; fPerByGoods.store = storeInfo; break; case "Store-SaleQueryByCustomer": //销售统计按客户选择页面 FrmSaleQueryByCustomer fSaleByCustomer = cModel.FGet as FrmSaleQueryByCustomer; fSaleByCustomer.store = storeInfo; break; case "Store-SaleQueryByStore": //销售统计按客户选择页面 FrmSaleQueryByStore fSaleByStore = cModel.FGet as FrmSaleQueryByStore; fSaleByStore.store = storeInfo; break; case "Store-SaleQueryByGoods": //销售统计按商品选择页面 FrmSaleQueryByGoods fSaleByGoods = cModel.FGet as FrmSaleQueryByGoods; fSaleByGoods.store = storeInfo; break; case "Store-StoreStockQuery": //仓库库存查询页面 FrmStoreStockQuery fStoreStockQuery = cModel.FGet as FrmStoreStockQuery; fStoreStockQuery.store = storeInfo; break; } this.SetStore?.Invoke(); this.Close(); }
/// <summary> /// 选择 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChoose_Click(object sender, EventArgs e) { UnitInfoModel selInfo = null; if (dgvUnitList.SelectedRows.Count == 0) { selInfo = dgvUnitList.Rows[0].DataBoundItem as UnitInfoModel; } else { selInfo = dgvUnitList.SelectedRows[0].DataBoundItem as UnitInfoModel; } //将选择的单位信息赋值给要选择页面的selUnit公有变量 switch (typeName) { case "Supplier-PerInStore": //采购单页面 FrmPerchaseInStore frmPerInStore = cModel.FGet as FrmPerchaseInStore; frmPerInStore.selUnit = selInfo; break; case "Customer-SaleOutStore": //销售单页面 FrmSaleOutStore frmSaleOutStore = cModel.FGet as FrmSaleOutStore; frmSaleOutStore.selCust = selInfo; break; case "Unit-SheetQuery": //单据查询页面 FrmSheetQuery frmSheetQuery = cModel.FGet as FrmSheetQuery; frmSheetQuery.unit = selInfo; break; case "Supplier-PerQueryBySupplier": //采购统计按供应商页面 FrmPerchaseQueryBySupplier frmPerQueryBySupplier = cModel.FGet as FrmPerchaseQueryBySupplier; frmPerQueryBySupplier.unit = selInfo; break; case "Supplier-PerQueryByStore": //采购统计按仓库页面 FrmPerchaseQueryByStore frmPerQueryByStore = cModel.FGet as FrmPerchaseQueryByStore; frmPerQueryByStore.unit = selInfo; break; case "Supplier-PerQueryByGoods": //采购统计按商品页面 FrmPerchaseQueryByGoods frmPerQueryByGoods = cModel.FGet as FrmPerchaseQueryByGoods; frmPerQueryByGoods.unit = selInfo; break; case "Customer-SaleQueryByCustomer": //销售统计按客户页面 FrmSaleQueryByCustomer fSaleQueryCustomer = cModel.FGet as FrmSaleQueryByCustomer; fSaleQueryCustomer.unit = selInfo; break; case "Customer-SaleQueryByStore": //销售统计按仓库页面 FrmSaleQueryByStore fSaleQueryStore = cModel.FGet as FrmSaleQueryByStore; fSaleQueryStore.unit = selInfo; break; case "Customer-SaleQueryByGoods": //销售统计按仓库页面 FrmSaleQueryByGoods fSaleQueryGoods = cModel.FGet as FrmSaleQueryByGoods; fSaleQueryGoods.unit = selInfo; break; } this.SetUnit?.Invoke();//显示到文本框 this.Close(); }