|
|
@ -370,11 +370,15 @@ func (the *consumerAxySkAlarm) isRuleAlarm(trigger AXY_SK.AlarmTrigger, stationA |
|
|
|
if trigger.Rule == 0 { |
|
|
|
isAlarm := true |
|
|
|
for _, conditionInt := range trigger.ConditionArray { |
|
|
|
if isAlarm == false { |
|
|
|
//一旦有条件不满足 就跳出循环
|
|
|
|
continue |
|
|
|
} |
|
|
|
switch conditionInt { |
|
|
|
case 0: |
|
|
|
if stationAlarm.Alarm3007 == nil || stationAlarm.Alarm3007.CurrentLevel > trigger.AlarmLevel { |
|
|
|
isAlarm = false |
|
|
|
detail += fmt.Sprintf("测量值恢复正常") |
|
|
|
detail = fmt.Sprintf("测量值恢复正常") |
|
|
|
} |
|
|
|
if isAlarm { |
|
|
|
|
|
|
@ -391,7 +395,7 @@ func (the *consumerAxySkAlarm) isRuleAlarm(trigger AXY_SK.AlarmTrigger, stationA |
|
|
|
case 1: |
|
|
|
if stationAlarm.Alarm3008 == nil || stationAlarm.Alarm3008.CurrentLevel > trigger.AlarmLevel { |
|
|
|
isAlarm = false |
|
|
|
detail += fmt.Sprintf("变化速率恢复正常") |
|
|
|
detail = fmt.Sprintf("变化速率恢复正常") |
|
|
|
} |
|
|
|
if isAlarm { |
|
|
|
|
|
|
@ -416,26 +420,30 @@ func (the *consumerAxySkAlarm) isRuleAlarm(trigger AXY_SK.AlarmTrigger, stationA |
|
|
|
//3007和3008 任何一个
|
|
|
|
if trigger.Rule == 1 { |
|
|
|
isAlarm := false |
|
|
|
|
|
|
|
recoverDetail := "" |
|
|
|
for _, conditionInt := range trigger.ConditionArray { |
|
|
|
switch conditionInt { |
|
|
|
case 0: |
|
|
|
if stationAlarm.Alarm3007 != nil && stationAlarm.Alarm3007.CurrentLevel <= trigger.AlarmLevel { |
|
|
|
isAlarm = true |
|
|
|
detail += stationAlarm.Alarm3007.Detail |
|
|
|
detail = stationAlarm.Alarm3007.Detail |
|
|
|
if stationAlarm.Alarm3007.EndTime.After(dt) { |
|
|
|
dt = stationAlarm.Alarm3007.EndTime |
|
|
|
} |
|
|
|
triggerTypeCodes = append(triggerTypeCodes, stationAlarm.Alarm3007.AlarmTypeCode) |
|
|
|
} else { |
|
|
|
recoverDetail = fmt.Sprintf("测量值恢复正常") |
|
|
|
} |
|
|
|
case 1: |
|
|
|
if stationAlarm.Alarm3008 != nil && stationAlarm.Alarm3008.CurrentLevel <= trigger.AlarmLevel { |
|
|
|
isAlarm = true |
|
|
|
detail += stationAlarm.Alarm3008.Detail |
|
|
|
detail = stationAlarm.Alarm3008.Detail |
|
|
|
if stationAlarm.Alarm3008.EndTime.After(dt) { |
|
|
|
dt = stationAlarm.Alarm3008.EndTime |
|
|
|
} |
|
|
|
triggerTypeCodes = append(triggerTypeCodes, stationAlarm.Alarm3008.AlarmTypeCode) |
|
|
|
} else { |
|
|
|
recoverDetail = fmt.Sprintf("变化速率恢复正常") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -444,6 +452,11 @@ func (the *consumerAxySkAlarm) isRuleAlarm(trigger AXY_SK.AlarmTrigger, stationA |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//单个恢复
|
|
|
|
if isAlarm == false { |
|
|
|
detail = recoverDetail |
|
|
|
} |
|
|
|
return isAlarm, level, detail, dt, triggerTypeCodes |
|
|
|
} |
|
|
|
return false, level, detail, dt, triggerTypeCodes |
|
|
|