<% Dim uid, rse, isAdmin, rsRole uid = trim(request("uid")) if trim(Lcase(AdminName)) = "admin" then isAdmin = true else isAdmin = false end if set rse = conn.execute("select devicename from t_dev_property where uid = '" & uid & "'") %>
 
 
<% ' select case equipType ' case "type1" ' call type1() ' case "main" ' call main() ' case else ' call main() ' end select if uid = "" then call main() else call testPage() end if If FoundErr = True Then Call WriteErrMsg(ErrMsg, ComeUrl) End If sub main() %>

 

<% end sub sub testPage() dim rsv, sqlv 'if isAdmin = true then sqlv = "select * from t_dev_variant where uid = '" & uid & "' and realtimeflag = true order by id" 'else ' sqlv = "select * from t_dev_variant where uid = '" & uid & "' and realtimeflag = true and uid in (select uid from t_role_equip where userid = '"&trim(AdminName)&"') order by id" ' end if set rsv = server.CreateObject("ADODB.Recordset") rsv.open sqlv, conn, 1, 1 if rsv.bof and rsv.eof then response.write "无变量或无权限!" else %>
<% if instr(rse(0),"(") <> 0 then response.write left(rse(0),instr(rse(0),"(")-1) else response.write rse(0) end if %>
<% do while not rsv.eof dim sqlsl, rssl, sqlvs, rsvs sqlsl = "select curr_value,varuid from t_summary_log where varname = '" & rsv("varname") & "' order by happentime desc limit 1" set rssl = server.CreateObject("adodb.recordset") rssl.open sqlsl, conn, 1, 1 if rssl.bof and rssl.eof then %> <% else '判断是否需要报警 dim needAlarm, rsNeedAlarm set rsNeedAlarm = conn.execute("select boolreserved2 from t_dev_variant where varname = '" & rsv("varname") & "'") if rsNeedAlarm(0) = 0 or rssl(0) = -1 then '不需要报警的变量 '无上下限的情况 '判断是否有报警描述 dim haveRec, rsHaveRec set rsHaveRec = conn.execute("select * from t_var_status where varid = '" & rsv("id") & "'") if rshaveRec.bof and rsHaveRec.eof then haveRec = false else haveRec = true end if '上下限为0时与normalstate比较,相等则正常 if rsv("upperlimit") = 0 and rsv("lowerlimit") = 0 then if haveRec = true and rssl(0) = rsv("normalstate") then %> <% elseif haveRec = true and rssl(0) <> rsv("normalstate") then sqlvs = "select statusdesc from t_var_status where varid = '" & rsv("id") & "' and devuid = '" & rsv("uid") & "' and statusid = '" & CInt(rssl(0)) & "'" set rsvs = conn.execute(sqlvs) if rsvs.bof and rsvs.eof then %> <% else %> <% end if elseif haveRec = false and rsv("ondesc") <> "" and rsv("offdesc") <> "" then %> <% else %> <% end if else '有上下限的情况 if rssl(0) < rsv("lowerlimit") then %> <% elseif rssl(0) > rsv("upperlimit") then %> <% else %> <% end if end if else '需要报警的变量 '无上下限的情况 '判断是否有报警描述 set rsHaveRec = conn.execute("select * from t_var_status where varid = '" & rsv("id") & "'") if rshaveRec.bof and rsHaveRec.eof then haveRec = false else haveRec = true end if '上下限为0时与normalstate比较,相等则正常 if rsv("upperlimit") = 0 and rsv("lowerlimit") = 0 then if haveRec = true and rssl(0) = rsv("normalstate") then %> <% elseif haveRec = true and rssl(0) <> rsv("normalstate") then sqlvs = "select statusdesc from t_var_status where varid = '" & rsv("id") & "' and devuid = '" & rsv("uid") & "' and statusid = '" & CInt(rssl(0)) & "'" set rsvs = conn.execute(sqlvs) if rsvs.bof and rsvs.eof then %> <% else %> <% end if elseif haveRec = false and rsv("ondesc") <> "" and rsv("offdesc") <> "" then %> <% else %> <% end if else '有上下限的情况 if rssl(0) < rsv("lowerlimit") then %> <% elseif rssl(0) > rsv("upperlimit") then %> <% else %> <% end if end if '判断是否需要报警结束 end if end if %> <% rsv.movenext loop rsv.close set rsv = nothing end if %>
变量名 当前状态/值
<%=rsv("description")%> -
<%=rsv("description")%> 正常
<%=rsv("description")%> 正常
<%=rsv("description")%> <%=rsvs(0)%>
<%=rsv("description")%> <%if rssl(0) = rsv("normalstate") then response.write rsv("ondesc") else response.write rsv("offdesc")%>
<%=rsv("description")%> <% response.write FormatNumber(rssl(0),1,-1) & rsv("unit") %>
<%=rsv("description")%> <%response.write "下限报警(" &FormatNumber(rssl(0),1,-1) & rsv("unit") & ")"%>
<%=rsv("description")%> <%response.write "上限报警(" &FormatNumber(rssl(0),1,-1) & rsv("unit") & ")"%>
<%=rsv("description")%> <%response.write "正常(" &FormatNumber(rssl(0),1,-1) & rsv("unit") & ")"%>
<%=rsv("description")%> 正常
<%=rsv("description")%> 正常
<%=rsv("description")%> <%response.write rsvs(0) & "(" & FormatNumber(rssl(0),1,-1) & rsv("unit") & ")"%>
<%=rsv("description")%> <%if rssl(0) = rsv("normalstate") then response.write rsv("ondesc") else response.write rsv("offdesc")%>
<%=rsv("description")%> <%response.write FormatNumber(rssl(0),1,-1) & rsv("unit")%>
<%=rsv("description")%> <%response.write "下限报警(" &FormatNumber(rssl(0),1,-1) & rsv("unit") & ")"%>
<%=rsv("description")%> <%response.write "上限报警(" &FormatNumber(rssl(0),1,-1) & rsv("unit") & ")"%>
<%=rsv("description")%> <%response.write "正常(" &FormatNumber(rssl(0),1,-1) & rsv("unit") & ")"%>

<% dim a a = split(uid, ".") response.write "" %>

<% end sub %>