public BasicResponse <List <Jc_WzInfo> > GetAllPositongCache(PositionCacheGetAllRequest positionCacheRequest)
        {
            var positionCache         = PositionCache.PositionCahceInstance.Query();
            var positionCacheResponse = new BasicResponse <List <Jc_WzInfo> >();

            positionCacheResponse.Data = positionCache;
            return(positionCacheResponse);
        }
        /// <summary>
        /// 获取所有安装位置缓存
        /// </summary>
        /// <returns></returns>
        public BasicResponse <List <Jc_WzInfo> > GetAllPositionCache()
        {
            BasicResponse <List <Jc_WzInfo> > Result = new BasicResponse <List <Jc_WzInfo> >();
            PositionCacheGetAllRequest        positionCacheRequest = new PositionCacheGetAllRequest();
            var result = _PositionCacheService.GetAllPositongCache(positionCacheRequest);

            Result.Data = result.Data;
            return(Result);
        }
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="PositionRequest"></param>
        /// <returns></returns>
        public BasicResponse AddPositions(PositionsRequest PositionRequest)
        {
            BasicResponse    Result         = new BasicResponse();
            List <Jc_WzInfo> items          = PositionRequest.PositionsInfo;
            List <Jc_WzInfo> PositionCaches = new List <Jc_WzInfo>();
            Jc_WzInfo        olditem        = null;

            PositionCacheGetAllRequest positionCacheRequest = new PositionCacheGetAllRequest();
            var result = _PositionCacheService.GetAllPositongCache(positionCacheRequest);

            PositionCaches = result.Data;

            foreach (Jc_WzInfo item in items)
            {
                olditem = PositionCaches.Find(a => a.WzID == item.WzID);
                //增加重复判断
                if (result.Data != null)
                { //缓存中存在此测点
                    Result.Code    = 1;
                    Result.Message = "当前添加的安装位置已存在!";
                    return(Result);
                }
            }


            TransactionsManager.BeginTransaction(() =>
            {
                foreach (Jc_WzInfo item in items)
                {
                    //保存数据库
                    var _jc_Wz      = ObjectConverter.Copy <Jc_WzInfo, Jc_WzModel>(item);
                    var resultjc_Wz = _Repository.AddPosition(_jc_Wz);
                }

                //保存缓存
                PositionCacheBatchAddRequest BatchAddPositionCacheRequest = new PositionCacheBatchAddRequest();
                BatchAddPositionCacheRequest.PositionInfos = items;
                _PositionCacheService.BatchAddPositionCache(BatchAddPositionCacheRequest);
            });

            return(Result);
        }
        /// <summary>
        /// 获取缓存中当前最大的位置ID
        /// </summary>
        /// <returns></returns>
        public BasicResponse <long> GetMaxPositionId()
        {
            BasicResponse <long> Result = new BasicResponse <long>();
            long MaxPositionId          = 0;
            PositionCacheGetAllRequest positionCacheRequest = new PositionCacheGetAllRequest();
            var result = _PositionCacheService.GetAllPositongCache(positionCacheRequest);

            foreach (Jc_WzInfo item in result.Data)
            {
                if (item.InfoState == InfoState.Delete)
                {
                    continue;
                }
                if (long.Parse(item.WzID) > MaxPositionId)
                {
                    MaxPositionId = long.Parse(item.WzID);
                }
            }
            Result.Data = MaxPositionId;
            return(Result);
        }