예제 #1
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);
        }
예제 #2
0
        public void ShowData(ShowDataInfo item)
        {
            _alertList.Insert(0, item);

            if (_alertList.Count > 1000)
            {
                _alertList.RemoveAt(1000);
            }

            this.mainGridView.RefreshData();
            this.Show();
        }