/// <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())); DDL_Waerhouse.SelectedValue = wList.Count == 1 ? wList.First().WarehouseId.ToString() : Guid.Empty.ToString(); }
/// <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(); }