%
dim rsa, rsa2, rsa3, rsa4, sql4, devicename, noAlarm, alarm_msg, sql
noAlarm = 1 '1-没有报警 2-有报警 3-其他状况
sql = "select * from t_dev_variant where realtimeflag = true and boolreserved2 = true and uid in (select uid from t_dev_property where isuse = '1') order by description"
set rsa = server.CreateObject("adodb.recordset")
rsa.open sql, conn, 1, 1
if rsa.bof and rsa.eof then
noAlarm = 3
alarm_msg = "No Data"
else
do while not rsa.eof
sql = "select curr_value,varuid from t_summary_log where varname = '" & rsa("varname") & "' and curr_value <> '-1' order by happentime desc limit 1"
set rsa2 = server.CreateObject("adodb.recordset")
rsa2.open sql, conn, 1, 1
dim rsRec, haveRec
set rsRec = conn.execute("select * from t_var_status where varid = " & rsa("id"))
if rsRec.bof and rsRec.eof then
haveRec = false
else
haveRec = true
end if
if rsa2.bof and rsa2.eof then
if noAlarm = 2 then noAlarm = 2 else noAlarm = 3
alarm_msg = "运行良好"
else
if rsa("upperlimit") = 0 and rsa("lowerlimit") = 0 then
if haveRec = true then
if rsa2(0) <> rsa("normalstate") then
set rsa3 = conn.execute("select statusdesc from t_var_status where varid = '" & rsa("id") & "' and devuid = '" & rsa("uid") & "' and statusid = '" & CInt(rsa2(0)) & "'")
if rsa3.bof and rsa3.eof then
'response.write "
"
'noAlarm = 2
else
response.write "
"
noAlarm = 2
end if
end if
end if
else
if rsa2(0) < rsa("lowerlimit") then
response.write "
"
noAlarm = 2
elseif rsa2(0) > rsa("upperlimit") then
response.write "
"
noAlarm = 2
end if
end if
end if
rsa2.close
set rsa2 = nothing
rsa.movenext
loop
rsa.close
set rsa = nothing
end if
if noAlarm = 1 then
response.write "运行良好"
elseif noAlarm = 2 then
if trim(request.Cookies("voiceAlarm")) = "on" then
response.write "