Exemple #1
0
        /// <summary>
        /// 获取最大时间
        /// </summary>
        /// <returns></returns>
        public BasicResponse <DateTime> GetMaxTimeFromJCR()
        {
            var      response = new BasicResponse <DateTime>();
            DateTime time     = DateTime.Now;

            try
            {
                var runLogCacheGetAllRequest  = new RunLogCacheGetAllRequest();
                var runLogCacheGetAllResponse = runLogCacheService.GetAllRunLogCache(runLogCacheGetAllRequest);
                if (runLogCacheGetAllResponse.Data != null && runLogCacheGetAllResponse.Data.Count > 0)
                {
                    var listR = runLogCacheGetAllResponse.Data.OrderBy(a => a.Timer).LastOrDefault();
                    if (listR != null)
                    {
                        time = listR.Timer;
                    }
                }
            }
            catch (Exception ex)
            {
                response.Code    = -100;
                response.Message = ex.Message;
                this.ThrowException("GetNowMaxTimeFromJCR-获取报警记录的当前最大时间-发生异常", ex);
            }
            response.Data = time;

            return(response);
        }
Exemple #2
0
        /// <summary>
        ///获取最大Id
        /// </summary>
        /// <returns></returns>
        public BasicResponse <long> GetMaxId()
        {
            var response = new BasicResponse <long>();

            try
            {
                var runLogCacheGetAllRequest  = new RunLogCacheGetAllRequest();
                var runLogCacheGetAllResponse = runLogCacheService.GetAllRunLogCache(runLogCacheGetAllRequest);
                if (runLogCacheGetAllResponse.Data != null && runLogCacheGetAllResponse.Data.Count > 0)
                {
                    var log = runLogCacheGetAllResponse.Data.OrderBy(x => x.Counter).LastOrDefault();
                    if (log != null)
                    {
                        response.Data = log.Counter;
                    }
                }
            }
            catch (Exception ex)
            {
                response.Code    = -100;
                response.Message = ex.Message;
                this.ThrowException("GetMaxID-获取报警记录的当前最大ID号-发生异常", ex);
            }

            return(response);
        }
Exemple #3
0
        public BasicResponse <List <Jc_RInfo> > GetAllRunLogCache(RunLogCacheGetAllRequest runLogCacheRequest)
        {
            var runLogCache         = RunLogCache.RunLogCahceInstance.Query();
            var runLogCacheResponse = new BasicResponse <List <Jc_RInfo> >();

            runLogCacheResponse.Data = runLogCache;
            return(runLogCacheResponse);
        }
Exemple #4
0
        public BasicResponse <List <ShowDataInfo> > GetReleaseAlarmRecords(GetReleaseAlarmRecordsRequest alarmRequest)
        {
            var response = new BasicResponse <List <ShowDataInfo> >();
            var runLogCacheGetAllRequest  = new RunLogCacheGetAllRequest();
            var runLogCacheGetAllResponse = runLogCacheService.GetAllRunLogCache(runLogCacheGetAllRequest);
            //var pointDefineCacheGetAllRequest = new PointDefineCacheGetAllRequest();
            var pointDefineCacheGetAllResponse = pointDefineCacheService.GetAllPointDefineCache();//从多系统缓存中查找  20171213

            if (runLogCacheGetAllResponse.Data != null && runLogCacheGetAllResponse.Data.Count > 0)
            {
                //跨天0点的记录不查询
                var listR    = runLogCacheGetAllResponse.Data.Where(a => a.Counter > alarmRequest.Id && a.Timer > DateTime.Parse(DateTime.Now.ToShortDateString() + " 00:00:00")).ToList();
                var listData = new List <ShowDataInfo>();
                try
                {
                    foreach (var item in listR)
                    {
                        if (item.Point == "000000")
                        {
                            continue;
                        }
                        ShowDataInfo sd      = new ShowDataInfo();
                        var          defInfo = pointDefineCacheGetAllResponse.Data.Find(x => x.Point == item.Point && x.Wzid == item.Wzid && x.Devid == item.Devid);
                        if (defInfo == null)
                        {
                            continue;
                        }
                        sd.ID       = long.Parse(item.ID);
                        sd.Counter  = item.Counter;
                        sd.Fzh      = item.Fzh;
                        sd.Kh       = item.Kh;
                        sd.Devid    = item.Devid;
                        sd.Wzid     = item.Wzid;
                        sd.Property = defInfo.DevPropertyID;
                        sd.Class    = defInfo.DevClassID;
                        sd.Type     = item.Type;
                        sd.Point    = item.Point;
                        sd.Devname  = defInfo.DevName;
                        sd.Wz       = defInfo.Wz;
                        sd.Ssz      = item.Val;
                        sd.Unit     = defInfo.Unit;
                        sd.State    = item.State;
                        sd.Timer    = item.Timer;
                        sd.Flag     = 0;
                        listData.Add(sd);
                    }
                    response.Data = listData;
                }
                catch (Exception ex)
                {
                    response.Code    = -100;
                    response.Message = ex.Message;
                    this.ThrowException("GetReleaseAlarmRecords-发生异常", ex);;
                }
            }

            return(response);
        }