/// <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;
            }
        }
 /// <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;
 }
 /// <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;
 }
 /// <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;
 }