/// <summary>入库仓Changed事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DDLWaerhouse_OnSelectedIndexChanged(object sender, EventArgs e) { Guid warehouseId = string.IsNullOrEmpty(DDL_Waerhouse.SelectedValue) ? Guid.Empty : new Guid(DDL_Waerhouse.SelectedValue); //绑定入库储 var list = new List <StorageAuth>(); var wlist = CurrentSession.Personnel.WarehouseList; if (wlist != null && wlist.Count > 0) { var warehouse = wlist.FirstOrDefault(act => act.WarehouseId == warehouseId); if (warehouse != null && warehouse.Storages != null) { list = warehouse.Storages; } } DDL_StorageAuth.DataSource = list; DDL_StorageAuth.DataTextField = "StorageTypeName"; DDL_StorageAuth.DataValueField = "StorageType"; DDL_StorageAuth.DataBind(); DDL_StorageAuth.Items.Insert(0, new ListItem("请选择", "0")); if (list.Count == 1) { var storage = list.First(); DDL_StorageAuth.SelectedValue = storage.StorageType.ToString(); var saleAndHostingFilialeList = MISService.GetAllSaleAndHostingFilialeList(); DDL_HostingFilialeAuth.DataSource = saleAndHostingFilialeList; DDL_HostingFilialeAuth.DataTextField = "Name"; DDL_HostingFilialeAuth.DataValueField = "Id"; DDL_HostingFilialeAuth.DataBind(); DDL_HostingFilialeAuth.Items.Insert(0, new ListItem("全部", Guid.Empty.ToString())); if (saleAndHostingFilialeList.Count == 1) { DDL_HostingFilialeAuth.SelectedValue = saleAndHostingFilialeList.First().ID.ToString(); DdlHostingFilialeAuthChanged(MISService.GetAllFiliales().Where(ent => ent.ParentId == saleAndHostingFilialeList.First().ID)); } else { DdlHostingFilialeAuthChanged(new List <FilialeInfo>()); DDL_HostingFilialeAuth.SelectedValue = Guid.Empty.ToString(); } } else { DDL_StorageAuth.SelectedValue = "0"; DDL_HostingFilialeAuth.DataSource = new List <HostingFilialeAuth>(); DDL_HostingFilialeAuth.DataBind(); DdlHostingFilialeAuthChanged(new List <FilialeInfo>()); } RG_StorageRecord.Rebind(); }
/// <summary> /// 绑定入库仓储 /// </summary> private void BindWarehouse() { var wList = CurrentSession.Personnel.WarehouseList; DDL_Waerhouse.DataSource = wList; DDL_Waerhouse.DataTextField = "WarehouseName"; DDL_Waerhouse.DataValueField = "WarehouseId"; DDL_Waerhouse.DataBind(); DDL_Waerhouse.Items.Insert(0, new ListItem("请选择", Guid.Empty.ToString())); Guid selectWarehouseId = Guid.Empty; if (wList.Count == 1) { var warehouse = wList.First(); selectWarehouseId = warehouse.WarehouseId; if (warehouse.Storages.Count == 1) { var storage = warehouse.Storages.First(); DDL_StorageAuth.DataSource = warehouse.Storages; DDL_StorageAuth.DataTextField = "StorageTypeName"; DDL_StorageAuth.DataValueField = "StorageType"; DDL_StorageAuth.DataBind(); DDL_StorageAuth.Items.Insert(0, new ListItem("请选择", "0")); DDL_StorageAuth.SelectedValue = storage.StorageType.ToString(); var saleAndHostingFilialeList = MISService.GetAllSaleAndHostingFilialeList(); DDL_HostingFilialeAuth.DataSource = saleAndHostingFilialeList; DDL_HostingFilialeAuth.DataTextField = "Name"; DDL_HostingFilialeAuth.DataValueField = "Id"; DDL_HostingFilialeAuth.DataBind(); DDL_HostingFilialeAuth.Items.Insert(0, new ListItem("全部", Guid.Empty.ToString())); DDL_HostingFilialeAuth.SelectedValue = saleAndHostingFilialeList.Count == 1 ? saleAndHostingFilialeList.First().ID.ToString() : Guid.Empty.ToString(); if (saleAndHostingFilialeList.Count == 1) { var filiales = MISService.GetAllFiliales() .Where(ent => ent.ParentId == saleAndHostingFilialeList.First().ID); DdlHostingFilialeAuthChanged(filiales); } } } DDL_Waerhouse.SelectedValue = selectWarehouseId.ToString(); }