private AlarmRecordInfo getAlarmRecord(AlarmRuleInfo alarmRuleInfo, SlNoiseInfo slNoiseInfo) { if (null != alarmRuleInfo) { float curValue = float.Parse(slNoiseInfo.DENSEDATA); IDevice deviceDal = SensorHub.DALFactory.Device.Create(); ISlNoise slNoiseDal = SensorHub.DALFactory.SlNoise.Create(); AlarmRecordInfo alarmRecordInfo = new AlarmRecordInfo(); alarmRecordInfo.ACTIVE = true; alarmRecordInfo.DEVICE_CODE = slNoiseInfo.SRCID; alarmRecordInfo.DEVICE_ID = alarmRuleInfo.DeviceId; alarmRecordInfo.DEVICE_TYPE_NAME = deviceDal.getDevTypeByCode(slNoiseInfo.SRCID); alarmRecordInfo.ITEMNAME = "噪声值"; alarmRecordInfo.ITEMVALUE = curValue.ToString(); alarmRecordInfo.MESSAGE_STATUS = 0; alarmRecordInfo.RECORDCODE = ""; alarmRecordInfo.RECORDDATE = System.DateTime.Now; if (alarmRuleInfo.HighValue != 0 && curValue > alarmRuleInfo.HighValue) { alarmRecordInfo.MESSAGE = "管线泄漏"; return(alarmRecordInfo); } if (alarmRuleInfo.LowValue != 0 && curValue < alarmRuleInfo.LowValue) { alarmRecordInfo.MESSAGE = "噪声低于下限"; //return alarmRecordInfo; return(null); } if (alarmRuleInfo.Saltation != 0) { float lastData = slNoiseDal.getLastData(slNoiseInfo); if (-100 != lastData && Math.Abs(curValue - lastData) > alarmRuleInfo.Saltation) { alarmRecordInfo.MESSAGE = "噪声异常"; // return alarmRecordInfo; return(null); } } } return(null); }