Esempio n. 1
0
        /// <summary>
        /// 设置为默认
        /// </summary>
        /// <param name="LocalNum"></param>
        /// <returns></returns>
        public int SetDefault(string LocalNum)
        {
            string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID);

            LocationEntity location = GetSingleByNum(LocalNum);

            location           = new LocationEntity();
            location.IsDefault = (int)EBool.No;
            location.IncludeIsDefault(true);
            location.And(a => a.CompanyID == this.CompanyID);
            this.Location.Update(location);

            LocationEntity entity = new LocationEntity();

            entity.IsDefault = (int)EBool.Yes;
            entity.IncludeIsDefault(true);
            entity.Where(a => a.LocalNum == LocalNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            int line = this.Location.Update(entity);

            if (line > 0)
            {
                CacheHelper.Remove(Key);
            }
            return(line);
        }
Esempio n. 2
0
        /// <summary>
        /// 获得所有的库位
        /// </summary>
        /// <returns></returns>
        public List <LocationEntity> GetList()
        {
            List <LocationEntity> listResult = CacheHelper.Get <List <LocationEntity> >(CacheKey.JOOSHOW_LOCATION_CACHE);

            if (!listResult.IsNullOrEmpty())
            {
                return(listResult);
            }
            LocationEntity entity = new LocationEntity();

            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity.IncludeAll();
            listResult = this.Location.GetList(entity);
            if (!listResult.IsNullOrEmpty())
            {
                StorageProvider      storageProvider = new StorageProvider();
                List <StorageEntity> listStorage     = storageProvider.GetList();
                listStorage = listStorage.IsNull() ? new List <StorageEntity>() : listStorage;
                foreach (LocationEntity item in listResult)
                {
                    StorageEntity storage = listStorage.FirstOrDefault(a => a.StorageNum == item.StorageNum);
                    if (storage != null)
                    {
                        item.StorageName = storage.StorageName;
                    }
                }
                CacheHelper.Insert(CacheKey.JOOSHOW_LOCATION_CACHE, listResult, null, DateTime.Now.AddHours(6));
            }
            return(listResult);
        }
Esempio n. 3
0
        /// <summary>
        /// 获得所有的库位
        /// </summary>
        /// <returns></returns>
        public List <LocationEntity> GetList()
        {
            string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID);
            List <LocationEntity> listResult = CacheHelper.Get <List <LocationEntity> >(Key);

            if (!listResult.IsNullOrEmpty())
            {
                return(listResult);
            }
            LocationEntity entity = new LocationEntity();

            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID);
            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            listResult = this.Location.GetList(entity);

            if (!listResult.IsNullOrEmpty())
            {
                StorageProvider      storageProvider = new StorageProvider(this.CompanyID);
                List <StorageEntity> listStorage     = storageProvider.GetList();
                listStorage = listStorage.IsNull() ? new List <StorageEntity>() : listStorage;
                foreach (LocationEntity item in listResult)
                {
                    StorageEntity storage = listStorage.FirstOrDefault(a => a.SnNum == item.StorageNum);
                    if (storage != null)
                    {
                        item.StorageName = storage.StorageName;
                    }
                }
                CacheHelper.Insert(Key, listResult);
            }
            return(listResult);
        }
Esempio n. 4
0
        public ActionResult Add([ModelBinder(typeof(JsonBinder <LocationEntity>))] LocationEntity entity)
        {
            LocationProvider provider = new LocationProvider();

            if (entity.LocalNum.IsEmpty())
            {
                entity.LocalNum     = SequenceProvider.GetSequence(typeof(LocationEntity));
                entity.LocalBarCode = entity.LocalBarCode.IsEmpty() ? entity.LocalNum : entity.LocalBarCode;
                entity.IsForbid     = (int)EBool.No;
                entity.IsDelete     = (int)EIsDelete.NotDelete;
                entity.UnitNum      = "";
                entity.UnitName     = "";
                entity.CreateTime   = DateTime.Now;
                int line = provider.Add(entity);
                if (line > 0)
                {
                    this.ReturnJson.AddProperty("d", "success");
                }
            }
            else
            {
                entity.LocalBarCode = entity.LocalBarCode.IsEmpty() ? entity.LocalNum : entity.LocalBarCode;
                entity.Include(a => new { a.LocalName, a.LocalBarCode, a.StorageNum, a.LocalType, a.IsDefault });
                entity.Where(a => a.LocalNum == entity.LocalNum);
                int line = provider.Update(entity);
                if (line > 0)
                {
                    this.ReturnJson.AddProperty("d", "success");
                }
            }
            return(Content(this.ReturnJson.ToString()));
        }
Esempio n. 5
0
        /// <summary>
        /// 根据库存编码查询仓库信息
        /// </summary>
        /// <param name="storageNum"></param>
        /// <returns></returns>
        public LocationEntity GetSingleByNum(string LocalNum)
        {
            LocationEntity entity = new LocationEntity();

            entity.IncludeAll();
            entity.Where(a => a.LocalNum == LocalNum);
            entity = this.Location.GetSingle(entity);
            return(entity);
        }
Esempio n. 6
0
        public ActionResult GetList()
        {
            int      pageIndex = WebUtil.GetFormValue <int>("pageIndex", 1);
            int      pageSize  = WebUtil.GetFormValue <int>("pageSize", 15);
            string   LocalName = WebUtil.GetFormValue <string>("LocalName", string.Empty);
            string   LocalType = WebUtil.GetFormValue <string>("LocalType", string.Empty);
            PageInfo pageInfo  = new PageInfo()
            {
                PageIndex = pageIndex, PageSize = pageSize
            };
            LocationProvider provider = new LocationProvider();
            LocationEntity   entity   = new LocationEntity();
            StorageEntity    SEntity  = new StorageEntity();

            SEntity.Include(a => new { StorageName = a.StorageName });
            entity.Left <StorageEntity>(SEntity, new Params <string, string>()
            {
                Item1 = "StorageNum", Item2 = "StorageNum"
            });
            string StorageNum = this.DefaultStore;

            entity.Where <LocationEntity>("StorageNum", ECondition.Eth, StorageNum);
            if (!LocalName.IsEmpty())
            {
                entity.Begin <LocationEntity>()
                .Where <LocationEntity>("LocalName", ECondition.Like, "%" + LocalName + "%")
                .Or <LocationEntity>("LocalNum", ECondition.Like, "%" + LocalName + "%")
                .Or <LocationEntity>("LocalBarCode", ECondition.Like, "%" + LocalName + "%")
                .End <LocationEntity>()
                ;
            }
            if (!LocalType.IsEmpty())
            {
                entity.Where <LocationEntity>("LocalType", ECondition.Eth, LocalType);
            }

            List <LocationEntity> listResult = provider.GetList(entity, ref pageInfo);
            string json = ConvertJson.ListToJson <LocationEntity>(listResult, "List");

            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return(Content(this.ReturnJson.ToString()));
        }
Esempio n. 7
0
        /// <summary>
        /// 根据库存编码查询仓库信息
        /// </summary>
        /// <param name="storageNum"></param>
        /// <returns></returns>
        public LocationEntity GetSingleByNum(string LocalNum)
        {
            LocationEntity entity = new LocationEntity();

            entity.IncludeAll();
            entity.Where(a => a.LocalNum == LocalNum)
            .And(a => a.IsDelete == (int)EIsDelete.NotDelete)
            .And(a => a.CompanyID == this.CompanyID);
            entity = this.Location.GetSingle(entity);
            return(entity);
        }
Esempio n. 8
0
        /// <summary>
        /// 新增库位
        /// 如果设置为默认库位,则其他的库位修改为非默认库位
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Add(LocationEntity entity)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                //设置默认值
                if (entity.IsDefault == (int)EBool.Yes)
                {
                    LocationEntity temp = new LocationEntity();
                    temp.IsDefault = (int)EBool.No;
                    temp.IncludeIsDefault(true);
                    temp.Where(a => a.LocalNum == entity.LocalNum);
                    this.Location.Update(temp);
                }

                //绑定仓库信息
                StorageProvider      storageProvider = new StorageProvider();
                List <StorageEntity> listStorage     = storageProvider.GetList();
                if (entity.StorageNum.IsEmpty())
                {
                    if (!listStorage.IsNullOrEmpty())
                    {
                        StorageEntity storage = listStorage.FirstOrDefault(a => a.IsDefault == (int)EBool.Yes);
                        if (storage != null)
                        {
                            entity.StorageNum  = storage.StorageNum;
                            entity.StorageType = storage.StorageType;
                        }
                    }
                }
                else
                {
                    if (!listStorage.IsNullOrEmpty())
                    {
                        StorageEntity storage = listStorage.FirstOrDefault(a => a.StorageNum == entity.StorageNum);
                        if (storage != null)
                        {
                            entity.StorageType = storage.StorageType;
                        }
                    }
                }
                entity.IncludeAll();
                int line = this.Location.Add(entity);
                if (line > 0)
                {
                    Clear();
                }
                ts.Complete();
                return(line);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 删除库位信息
        /// </summary>
        /// <param name="storageNum"></param>
        /// <returns></returns>
        public int Delete(string LocalNum)
        {
            LocationEntity entity = new LocationEntity();

            entity.IsDelete = (int)EIsDelete.Deleted;
            entity.IncludeIsDelete(true);
            entity.Where(a => a.LocalNum == LocalNum);
            int line = this.Location.Update(entity);

            if (line > 0)
            {
                Clear();
            }
            return(line);
        }
Esempio n. 10
0
        /// <summary>
        /// 删除库位信息
        /// </summary>
        /// <param name="storageNum"></param>
        /// <returns></returns>
        public int Delete(IEnumerable <string> list)
        {
            string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID);

            LocationEntity entity = new LocationEntity();

            entity.IsDelete = (int)EIsDelete.Deleted;
            entity.IncludeIsDelete(true);
            entity.Where("LocalNum", ECondition.In, list.ToArray());
            entity.And(a => a.CompanyID == this.CompanyID);
            int line = this.Location.Update(entity);

            if (line > 0)
            {
                CacheHelper.Remove(Key);
            }
            return(line);
        }
Esempio n. 11
0
        /// <summary>
        /// 设置禁用和启用
        /// </summary>
        /// <returns></returns>
        public int SetForbid(string LocalNum, EBool IsForbid)
        {
            string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID);

            LocationEntity entity = new LocationEntity();

            entity.IsForbid = (int)IsForbid;
            entity.IncludeIsForbid(true);
            entity.Where(a => a.LocalNum == LocalNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;
            int line = this.Location.Update(entity);

            if (line > 0)
            {
                CacheHelper.Remove(Key);
            }
            return(line);
        }
Esempio n. 12
0
        /// <summary>
        /// 获得库存信息
        /// </summary>
        /// <param name="barCode"></param>
        /// <returns></returns>
        public List <LocalProductEntity> GetList(string barCode)
        {
            LocalProductEntity entity = new LocalProductEntity();

            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.BarCode == barCode).Or(a => a.ProductNum == barCode);

            LocationEntity location = new LocationEntity();

            entity.Left <LocationEntity>(location, new Params <string, string>()
            {
                Item1 = "LocalNum", Item2 = "LocalNum"
            });
            location.Where(a => a.LocalType == (int)ELocalType.Normal);
            List <LocalProductEntity> listResult = this.LocalProduct.GetList(entity);

            return(listResult);
        }
Esempio n. 13
0
        public ActionResult Audit(string LocalNum, string IsForbid)
        {
            LocationProvider provider = new LocationProvider();
            LocationEntity   entity   = new LocationEntity();

            entity.IncludeIsForbid(true);
            entity.IsForbid = ConvertHelper.ToType <int>(IsForbid);
            entity.Where(a => a.LocalNum == LocalNum);
            int line = provider.Update(entity);

            if (line > 0)
            {
                this.ReturnJson.AddProperty("d", "success");
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            return(Content(this.ReturnJson.ToString()));
        }
Esempio n. 14
0
 /// <summary>
 /// 查询分页
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <returns></returns>
 public List <LocationEntity> GetList(LocationEntity entity, ref PageInfo pageInfo)
 {
     try
     {
         entity.IncludeAll();
         entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
         entity.OrderBy(a => a.ID, EOrderBy.DESC);
         int rowCount = 0;
         List <LocationEntity> listResult = this.Location.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
         pageInfo.RowCount = rowCount;
         if (!listResult.IsNullOrEmpty())
         {
             StorageProvider      storageProvider = new StorageProvider();
             List <StorageEntity> listStorage     = storageProvider.GetList();
             listStorage = listStorage.IsNull() ? new List <StorageEntity>() : listStorage;
             foreach (LocationEntity item in listResult)
             {
                 StorageEntity storage = listStorage.FirstOrDefault(a => a.StorageNum == item.StorageNum);
                 if (storage != null)
                 {
                     item.StorageName = storage.StorageName;
                 }
                 else
                 {
                     item.StorageName = "";
                 }
             }
         }
         return(listResult);
     }
     catch (Exception e)
     {
         log.Error(e.Message);
     }
     return(null);
 }
Esempio n. 15
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(LocationEntity entity)
        {
            using (TransactionScope ts = new TransactionScope())
            {
                string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID);

                if (entity.IsDefault == (int)EBool.Yes)
                {
                    LocationEntity location = new LocationEntity();
                    location.IsDefault = (int)EBool.No;
                    location.IncludeIsDefault(true);
                    location.Where(a => a.LocalType == entity.LocalType)
                    .And(a => a.CompanyID == this.CompanyID)
                    ;
                    this.Location.Update(location);

                    LocationEntity temp = new LocationEntity();
                    temp.IsDefault = (int)EBool.No;
                    temp.IncludeIsDefault(true);
                    temp.Where(a => a.CompanyID == this.CompanyID);
                    this.Location.Update(temp);
                }

                //绑定仓库信息
                StorageProvider      storageProvider = new StorageProvider(this.CompanyID);
                List <StorageEntity> listStorage     = storageProvider.GetList();
                listStorage = listStorage.IsNull() ? new List <StorageEntity>() : listStorage;
                if (entity.StorageNum.IsEmpty())
                {
                    StorageEntity storage = listStorage.FirstOrDefault(a => a.IsDefault == (int)EBool.Yes);
                    if (storage != null)
                    {
                        entity.StorageNum  = storage.StorageNum;
                        entity.StorageType = storage.StorageType;
                    }
                }
                else
                {
                    StorageEntity storage = listStorage.FirstOrDefault(a => a.StorageNum == entity.StorageNum);
                    if (storage != null)
                    {
                        entity.StorageType = storage.StorageType;
                    }
                }
                if (entity.UnitName.IsEmpty() && !entity.UnitNum.IsEmpty())
                {
                    MeasureProvider      provider    = new MeasureProvider(this.CompanyID);
                    List <MeasureEntity> listMeasure = provider.GetList();
                    listMeasure = listMeasure.IsNull() ? new List <MeasureEntity>() : listMeasure;
                    MeasureEntity measureEntity = listMeasure.FirstOrDefault(a => a.SN == entity.UnitNum);
                    entity.UnitName = measureEntity != null ? measureEntity.MeasureName : entity.UnitName;
                }
                entity.UnitNum  = entity.UnitNum.IsEmpty() ? "" : entity.UnitNum;
                entity.UnitName = entity.UnitName.IsEmpty() ? "" : entity.UnitName;

                entity.Include(a => new { a.LocalBarCode, a.LocalName, a.StorageNum, a.StorageType, a.LocalType, a.Rack, a.Length, a.Width, a.Height, a.X, a.Y, a.Z, a.UnitNum, a.UnitName, a.Remark, a.IsForbid, a.IsDefault });
                entity.Where(a => a.LocalNum == entity.LocalNum)
                .And(a => a.CompanyID == this.CompanyID)
                ;
                int line = this.Location.Update(entity);
                if (line > 0)
                {
                    CacheHelper.Remove(Key);
                }
                ts.Complete();
                return(line);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 初始化某个仓库的库位
        /// </summary>
        /// <param name="StorageNum"></param>
        /// <param name="CreateUser"></param>
        /// <returns></returns>
        public int Init(string StorageNum, string CreateUser)
        {
            string Key = string.Format(CacheKey.JOOSHOW_LOCATION_CACHE, this.CompanyID);

            int            line   = 0;
            LocationEntity entity = new LocationEntity();

            entity.Where(item => item.StorageNum == StorageNum)
            .And(item => item.CompanyID == this.CompanyID)
            ;
            if (this.Location.GetCount(entity) == 0)
            {
                StorageProvider storageProvider = new StorageProvider(this.CompanyID);
                StorageEntity   storage         = storageProvider.GetSingleByNum(StorageNum);
                if (storage != null)
                {
                    LocationEntity location = new LocationEntity();
                    location.LocalNum     = ConvertHelper.NewGuid();
                    location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity));
                    location.LocalName    = "默认待入库位";
                    location.LocalType    = (int)ELocalType.WaitIn;
                    location.StorageNum   = storage.SnNum;
                    location.StorageType  = storage.StorageType;
                    location.CreateUser   = CreateUser;
                    location.CreateTime   = DateTime.Now;
                    location.IsDefault    = (int)EBool.Yes;
                    location.IsDelete     = (int)EIsDelete.NotDelete;
                    location.IsForbid     = (int)EBool.No;
                    location.CompanyID    = this.CompanyID;
                    location.IncludeAll();
                    line += this.Location.Add(location);


                    location              = new LocationEntity();
                    location.LocalNum     = ConvertHelper.NewGuid();
                    location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity));
                    location.LocalName    = "默认正式库位";
                    location.LocalType    = (int)ELocalType.Normal;
                    location.StorageNum   = storage.SnNum;
                    location.StorageType  = storage.StorageType;
                    location.CreateUser   = CreateUser;
                    location.CreateTime   = DateTime.Now;
                    location.IsDefault    = (int)EBool.Yes;
                    location.IsDelete     = (int)EIsDelete.NotDelete;
                    location.IsForbid     = (int)EBool.No;
                    location.CompanyID    = this.CompanyID;
                    location.IncludeAll();
                    line += this.Location.Add(location);

                    location              = new LocationEntity();
                    location.LocalNum     = ConvertHelper.NewGuid();
                    location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity));
                    location.LocalName    = "默认待检库位";
                    location.LocalType    = (int)ELocalType.WaitCheck;
                    location.StorageNum   = storage.SnNum;
                    location.StorageType  = storage.StorageType;
                    location.CreateUser   = CreateUser;
                    location.CreateTime   = DateTime.Now;
                    location.IsDefault    = (int)EBool.Yes;
                    location.IsDelete     = (int)EIsDelete.NotDelete;
                    location.IsForbid     = (int)EBool.No;
                    location.CompanyID    = this.CompanyID;
                    location.IncludeAll();
                    line += this.Location.Add(location);

                    location              = new LocationEntity();
                    location.LocalNum     = ConvertHelper.NewGuid();
                    location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity));
                    location.LocalName    = "默认待出库位";
                    location.LocalType    = (int)ELocalType.WaitOut;
                    location.StorageNum   = storage.SnNum;
                    location.StorageType  = storage.StorageType;
                    location.CreateUser   = CreateUser;
                    location.CreateTime   = DateTime.Now;
                    location.IsDefault    = (int)EBool.Yes;
                    location.IsDelete     = (int)EIsDelete.NotDelete;
                    location.IsForbid     = (int)EBool.No;
                    location.CompanyID    = this.CompanyID;
                    location.IncludeAll();
                    line += this.Location.Add(location);

                    location              = new LocationEntity();
                    location.LocalNum     = ConvertHelper.NewGuid();
                    location.LocalBarCode = new SequenceProvider(this.CompanyID).GetSequence(typeof(LocationEntity));
                    location.LocalName    = "默认报损库位";
                    location.LocalType    = (int)ELocalType.Bad;
                    location.StorageNum   = storage.SnNum;
                    location.StorageType  = storage.StorageType;
                    location.CreateUser   = CreateUser;
                    location.CreateTime   = DateTime.Now;
                    location.IsDefault    = (int)EBool.Yes;
                    location.IsDelete     = (int)EIsDelete.NotDelete;
                    location.IsForbid     = (int)EBool.No;
                    location.CompanyID    = this.CompanyID;
                    location.IncludeAll();
                    line += this.Location.Add(location);
                }
            }

            if (line > 0)
            {
                CacheHelper.Remove(Key);
            }

            return(line);
        }
Esempio n. 17
0
        public ActionResult ToExcel()
        {
            PageInfo pageInfo = new Git.Framework.DataTypes.PageInfo()
            {
                PageIndex = 1, PageSize = Int32.MaxValue
            };
            string           StorageNum = WebUtil.GetFormValue <string>("StorageName", string.Empty);
            string           LocalName  = WebUtil.GetFormValue <string>("LocalName", string.Empty);
            string           LocalType  = WebUtil.GetFormValue <string>("LocalType", string.Empty);
            LocationProvider provider   = new LocationProvider();
            LocationEntity   entity     = new LocationEntity();

            StorageEntity SEntity = new StorageEntity();

            SEntity.Include(a => new { StorageName = a.StorageName });
            entity.Left <StorageEntity>(SEntity, new Params <string, string>()
            {
                Item1 = "StorageNum", Item2 = "StorageNum"
            });
            if (!StorageNum.IsEmpty())
            {
                entity.Where <LocationEntity>("StorageNum", ECondition.Like, "%" + StorageNum + "%");
            }
            if (!LocalName.IsEmpty())
            {
                entity.Begin <LocationEntity>()
                .Where <LocationEntity>("LocalName", ECondition.Like, "%" + LocalName + "%")
                .Or <LocationEntity>("LocalNum", ECondition.Like, "%" + LocalName + "%")
                .Or <LocationEntity>("LocalBarCode", ECondition.Like, "%" + LocalName + "%")
                .End <LocationEntity>()
                ;
            }
            if (!LocalType.IsEmpty())
            {
                entity.Where <LocationEntity>("LocalType", ECondition.Like, "%" + LocalType + "%");
            }
            List <LocationEntity> listResult = provider.GetList(entity, ref pageInfo);

            listResult = listResult.IsNull() ? new List <LocationEntity>() : listResult;
            if (listResult.IsNotNull())
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("序号 "));
                dt.Columns.Add(new DataColumn("库位编号 "));
                dt.Columns.Add(new DataColumn("库位名 "));
                dt.Columns.Add(new DataColumn("所在仓库 "));
                dt.Columns.Add(new DataColumn("库位类型"));
                dt.Columns.Add(new DataColumn("是否禁用"));
                dt.Columns.Add(new DataColumn("是否默认"));
                dt.Columns.Add(new DataColumn("创建时间"));
                int count = 1;
                foreach (LocationEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.LocalNum;
                    row[2] = t.LocalName;
                    row[3] = t.StorageName;
                    row[4] = EnumHelper.GetEnumDesc <ELocalType>(t.LocalType);
                    row[5] = EnumHelper.GetEnumDesc <EBool>(t.IsForbid);
                    row[6] = EnumHelper.GetEnumDesc <EBool>(t.IsDefault);
                    row[7] = t.CreateTime.ToString("yyyy-MM-dd");
                    dt.Rows.Add(row);
                    count++;
                }
                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string    filename = string.Format("库位管理{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                NPOIExcel excel    = new NPOIExcel("库位管理", "库位", System.IO.Path.Combine(filePath, filename));
                excel.ToExcel(dt);
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return(Content(this.ReturnJson.ToString()));
        }