Browse Source

SubDevices

dev
CODE 1 year ago
parent
commit
31da6d9c01
  1. 14
      api/app/lib/schedule/alarms_push.js

14
api/app/lib/schedule/alarms_push.js

@ -1243,7 +1243,8 @@ module.exports = function (app, opts) {
alarms.SourceName AS SourceName,
alarms.AlarmCode AS AlarmCode,
alarms.SourceTypeId AS SourceTypeId,
alarms.StructureId AS StructureId
alarms.StructureId AS StructureId,
alarms.SubDevices AS SubDevices
FROM
alarms
WHERE
@ -1253,17 +1254,16 @@ module.exports = function (app, opts) {
AND
alarms.State < 3
`
// ,
// alarms.subStations AS subStations
).toPromise() || []
let alarmDatas = []
for (let alarms of alarmDataRes) {
if (alarms.subStations && alarms.subStations.length) {
pLog('拆解 subStations' + alarms.alarmId + ' ' + alarms.subStations.length + '个')
for (let subStation of alarms.subStations) {
if (alarms.SubDevices && alarms.SubDevices.length) {
pLog('拆解 SubDevices' + alarms.alarmId + ' ' + alarms.SubDevices.length + '个')
for (let SubDevice of alarms.SubDevices) {
alarmDatas.push({
...alarms,
alarmId: subStation
alarmId: SubDevice
})
}
} else {

Loading…
Cancel
Save