<!DOCTYPE html>
<% language=javascript %>
<html>
<head lang="en">
    <meta charset="GB2312">
    <title></title>
    <link href="css/style.css" title="style" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.6.3.min.js"></script>

</head>
<body style="background: #F3F3F3">
<div class='type2056 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-cyber.png" style="width: 60%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>精密空调监测</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID2056'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr2056'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port2056'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd2056'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State2056'> </span></td></tr>
    </table>
	
    <table width='100%' style='margin-top: 10px'>
        <tr><td style='border: none'> <h1>空调监测量</h1></td></tr>
		<tr><td style='width: 200px;'>温度单位</td><td><span class='unit2056'> </span></td></tr>
		<tr><td style='width: 200px;'>定时运行</td><td><span class='ds2056'> </span></td><td style='width: 200px;'>风机</td><td><span class='fj2056'> </span></td></tr>
		<tr><td style='width: 200px;'>制冷</td><td><span class='zl2056'> </span></td><td style='width: 200px;'>加热器</td><td><span class='jrq2056'> </span></td></tr>
		<tr><td style='width: 200px;'>加湿器</td><td><span class='jsq2056'> </span></td><td style='width: 200px;'>除湿机</td><td><span class='csj2056'> </span></td></tr>
		<tr><td style='width: 200px;'>送风温度</td><td><span class='stem2056'> </span>&nbsp;</td><td style='width: 200px;'>回风温度</td><td><span class='rtem2056'> </span>&nbsp;</td></tr>
		<tr><td style='width: 200px;'>设定温度</td><td><span class='tem22056'> </span>&nbsp;</td></tr>
		<tr><td style='width: 200px;'>回风湿度</td><td><span class='hum2056'> </span>&nbsp;%RH</td></tr>
		<tr><td style='width: 200px;'>设定湿度</td><td><span class='hum22056'> </span>&nbsp;%RH</td></tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
  var itype=2056;
  var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbPex where SID="+sid,0); %>;
<% db_Close(); %>


  $(function() {
    time = setInterval(ajax, tescape)
  });

  function ajax() {
    $.ajax({
      type: "POST",
      url: "omdev/smdat0.asp",
      data: "itype=" + itype + "&sid=" + sid,
      dataType: "json",
      success: function(msg) {
        list3(msg);
      }
    });
  }
  var monitorStatus = ["正常","告警","故障"];
  list3(json);

  function list3(data) {
    $.each(data.recs, function(i, n) {
      if (n.unit == 0) {
        n.unit = "F";
      } else {
        n.unit = "℃";
      }
      if (n.ds == 0) {
        n.ds = "关";
      } else {
        n.ds = "开";
      }
      if (n.s_fj == 0) {
        n.s_fj = "关";
      } else {
        n.s_fj = "开";
      }
      if (n.s_zl == 0) {
        n.s_zl = "关";
      } else {
        n.s_zl = "开";
      }
      if (n.s_jrq == 0) {
        n.s_jrq = "关";
      } else {
        n.s_jrq = "开";
      }
      if (n.s_jsq == 0) {
        n.s_jsq = "关";
      } else {
        n.s_jsq = "开";
      }
      if (n.s_csj == 0) {
        n.s_csj = "关";
      } else {
        n.s_csj = "开";
      }
      $(".SID2056").html(n.SID);
      $(".Addr2056").html(n.Addr);
      $(".Port2056").html(n.Port % 256);
      $(".DateUpd2056").html(n.DateUpd);
	  $(".State2056").html(monitorStatus[n.State%3]);
      $(".unit2056").html(n.unit);
      $(".ds2056").html(n.ds);
      $(".fj2056").html(n.s_fj);
      $(".zl2056").html(n.s_zl);
      $(".jrq2056").html(n.s_jrq);
      $(".jsq2056").html(n.s_jsq);
      $(".csj2056").html(n.s_csj);
      $(".stem2056").html((n.s_tem < 0) ? "未定义" : (n.s_tem/10+n.unit));
      $(".rtem2056").html((n.r_tem < 0) ? "未定义" : (n.r_tem/10+n.unit));
      $(".tem22056").html((n.temset < 0) ? "未定义" : (n.temset/10+n.unit));
      $(".hum2056").html((n.r_hum < 0) ? "未定义" : n.r_hum);
      $(".hum22056").html((n.humset < 0) ? "未定义" : n.humset);
    })
    $("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
  }
</script>
</body>
</html>