/// <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>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void LB_Search_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(DDL_Waerhouse.SelectedValue) || DDL_Waerhouse.SelectedValue == Guid.Empty.ToString())
     {
         RAM.Alert("请选择仓库!");
         return;
     }
     RG_StorageRecord.CurrentPageIndex = 0;
     RG_StorageRecord.Rebind();
 }
        /// <summary>物流配送公司Changed事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DDLHostingFilialeAuth_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            Guid hostingFilialeId = string.IsNullOrEmpty(DDL_HostingFilialeAuth.SelectedValue)
                  ? Guid.Empty
                  : new Guid(DDL_HostingFilialeAuth.SelectedValue);
            var filialeList = MISService.GetAllFiliales().ToList();

            DdlHostingFilialeAuthChanged(hostingFilialeId != Guid.Empty ? filialeList.Where(act => act.ParentId == hostingFilialeId) : new List <FilialeInfo>());
            RG_StorageRecord.Rebind();
        }
        /// <summary>入库储Changed事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DDLStorageAuth_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            //仓库id
            Guid warehouseId = string.IsNullOrEmpty(DDL_Waerhouse.SelectedValue)
                ? Guid.Empty
                : new Guid(DDL_Waerhouse.SelectedValue);
            //储位id
            byte storageType = string.IsNullOrEmpty(DDL_StorageAuth.SelectedValue)
                ? default(byte)
                : byte.Parse(DDL_StorageAuth.SelectedValue);

            //绑定物流配送公司
            var list  = new List <HostingFilialeAuth>();
            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)
                {
                    var storageTypeAuth = warehouse.Storages.FirstOrDefault(p => p.StorageType == storageType);
                    if (storageTypeAuth != null && storageTypeAuth.Filiales != null)
                    {
                        list.AddRange(storageTypeAuth.Filiales);
                    }
                }
            }

            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 = Guid.Empty.ToString();

            var filialeList = MISService.GetAllFiliales().ToList();
            var dataFiliale = new List <FilialeInfo>();

            foreach (var filialeId in list)
            {
                dataFiliale.AddRange(filialeList.Where(w => w.ParentId == filialeId.HostingFilialeId));
            }

            DdlHostingFilialeAuthChanged(dataFiliale);

            RG_StorageRecord.Rebind();
        }
 /// <summary>采购单位Changed事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void DDLPurchase_OnSelectedIndexChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(DDL_Purchase.SelectedValue))
     {
         OutPurchase(DDL_Purchase.SelectedValue == "1");
     }
     else
     {
         DDL_PurchaseFiliale.Items.Clear();
         DDL_PurchaseFiliale.DataSource     = null;
         DDL_PurchaseFiliale.DataTextField  = "CompanyName";
         DDL_PurchaseFiliale.DataValueField = "CompanyId";
         DDL_PurchaseFiliale.DataBind();
     }
     RG_StorageRecord.Rebind();
 }
 protected void Lb_Reload_Click(object sender, EventArgs e)
 {
     RG_StorageRecord.Rebind();
 }