Beispiel #1
0
        /// <summary>
        /// 创建新的报警记录对象
        /// </summary>
        /// <param name="dev">设备信息</param>
        /// <param name="msite">测量位置信息</param>
        /// <param name="signal">振动信号信息</param>
        /// <param name="signalAlmSet">振动信号报警设置信息</param>
        /// <param name="samplingData">采集时间</param>
        /// <param name="value">采集数据值</param>
        /// <returns></returns>
        private DevAlmRecord CreatNewVibrationAlmRecord(Device dev, MeasureSite msite, VibSingal signal,
                                                        SignalAlmSet signalAlmSet, 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.SingalID  = signal.SingalID;

                string singalName          = string.Empty;
                var    vibratingSingalType = cacheDICT.GetInstance().GetCacheType <VibratingSingalType>(p => p.ID == signal.SingalType).FirstOrDefault();
                if (vibratingSingalType != null)
                {
                    singalName = vibratingSingalType.Name;
                }
                nRecord.SingalName  = singalName;
                nRecord.SingalAlmID = signalAlmSet.SingalAlmID;
                string eigenValueName = string.Empty;
                var    eigenValueType = cacheDICT.GetInstance().GetCacheType <EigenValueType>(p => p.ID == signalAlmSet.ValueType).FirstOrDefault();
                if (eigenValueType != null)
                {
                    eigenValueName = eigenValueType.Name;
                }
                nRecord.SingalValue     = eigenValueName;
                nRecord.MSAlmID         = (int)EnumAlarmRecordType.DeviceVibration;
                nRecord.AlmStatus       = signalAlmSet.Status;
                nRecord.SamplingValue   = value;
                nRecord.WarningValue    = signalAlmSet.WarnValue;
                nRecord.DangerValue     = signalAlmSet.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}{4}", nRecord.DevName, nRecord.MSiteName,
                                                        nRecord.SingalName, nRecord.SingalValue,
                                                        ConvertStatusToString(signalAlmSet.Status));

                return(nRecord);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                return(null);
            }
        }
Beispiel #2
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);
            }
        }