public string GetDeviceTempeAlmSet(int id)
        {
            string result = string.Empty;
            TempeDeviceSetMSiteAlm tempeAlmset = tempeDeviceSetMSiteAlmRepository.GetByKey(id);

            if (tempeAlmset != null)
            {
                AlarmThreshold alm = GetTempeAlmSet(tempeAlmset);
                if (alm != null)
                {
                    result = Json.Stringify(alm);
                }
            }

            return(result);
        }
        private AlarmThreshold GetTempeAlmSet(TempeDeviceSetMSiteAlm almset)
        {
            AlarmThreshold        alarm   = null;
            GetYunyiInterfaceData getData = new GetYunyiInterfaceData();

            MeasureSite site = measureSiteRepository.GetByKey(almset.MsiteID);

            if (site != null)
            {
                YunyiCloudDataType type      = YunyiCloudDataType.MeasureSite;
                string             valueType = CommonVariate.DEVICE_TEMPE_SET;
                int objectid = almset.MsiteID;
                type = YunyiCloudDataType.MeasureSite;

                alarm = getData.GetMeasureSiteAlmSet(almset, type, objectid, valueType);
            }
            return(alarm);
        }
Beispiel #3
0
        /// <summary>
        /// 创建新的报警记录对象
        /// </summary>
        /// <param name="dev">设备信息</param>
        /// <param name="msite">测量位置信息</param>
        /// <param name="msiteAlmSite">设备温度告警设置</param>
        /// <param name="samplingTime">采集时间</param>
        /// <param name="value">采集值</param>
        /// <returns></returns>
        private DevAlmRecord CreatNewTempAlmRecord(Device dev, MeasureSite msite, TempeDeviceSetMSiteAlm msiteAlmSite, DateTime samplingTime, float value)
        {
            try
            {
                DevAlmRecord nRecord = new DevAlmRecord();
                //GetMonitorTree getMonitorTree = new GetMonitorTree(wgRepository, deviceRepository, monitorTreeRepository);
                nRecord.DevID   = dev.DevID;
                nRecord.DevName = dev.DevName;
                nRecord.DevNO   = dev.DevNO.ToString();
                nRecord.MSiteID = msite.MSiteID;
                string measureSiteName = string.Empty;
                var    measureSiteType = cacheDICT.GetInstance().GetCacheType <MeasureSiteType>(p => p.ID == msite.MSiteName).FirstOrDefault();
                //空判断 王颖辉  2016-08-30
                if (measureSiteType != null)
                {
                    measureSiteName = measureSiteType.Name;
                }
                nRecord.MSiteName       = measureSiteName;
                nRecord.MSAlmID         = (int)EnumAlarmRecordType.DeviceTemperature;
                nRecord.AlmStatus       = msiteAlmSite.Status;
                nRecord.SamplingValue   = value;
                nRecord.WarningValue    = msiteAlmSite.WarnValue;
                nRecord.DangerValue     = msiteAlmSite.AlmValue;
                nRecord.BDate           = samplingTime;
                nRecord.EDate           = samplingTime;
                nRecord.LatestStartTime = samplingTime;
                nRecord.MonitorTreeID   = string.Empty; //getMonitorTree.ConvertMonitorTreeIDString(dev.DevID, null);
                nRecord.Content         = string.Format("{0}{1}{2}{3}", nRecord.DevName, nRecord.MSiteName,
                                                        "设备温度", ConvertStatusToString(msiteAlmSite.Status));

                return(nRecord);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(null);
            }
        }