<!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='type2060 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='SID2060'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr2060'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port2060'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd2060'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State2060'> </span></td></tr>
    </table>		

    <table width='100%' style='margin-top: 10px'>
        <tr><td style='border: none'> <h1>空调监测量</h1></td></tr>
		<tr><td >回风温度</td><td><span class='tem2060'> </span>&nbsp;℃</td> <td >回风湿度</td><td><span class='hum2060'> </span>&nbsp;%RH</td></tr>
		<tr><td >设定温度</td><td><span class='temset2060'> </span>&nbsp;℃</td> <td >设定湿度</td><td><span class='humset2060'> </span>&nbsp;%RH</td></tr>
		<tr><td >回风温度上限</td><td><span class='temh2060'> </span>&nbsp;℃</td> <td >回风湿度上限</td><td><span class='humh2060'> </span>&nbsp;%RH</td></tr>
		<tr><td >回风温度下限</td><td><span class='teml2060'> </span>&nbsp;℃</td> <td >回风湿度下限</td><td><span class='huml2060'> </span>&nbsp;%RH</td></tr>
	</table>
	
    <table width='100%' style='margin-top: 10px'>
        <tr><td style='border: none'> <h1>空调工作状态</h1></td></tr>
		<tr><td >工作时间</td><td><span class='worktime2060'> </span> </td> <td >工作状态</td><td><span class='workmode2060'> </span></td></tr>
		<tr><td >风机状态</td><td><span class='stfj2060'> </span> </td> <td >开关机状态</td><td><span class='onoff2060'> </span> </td></tr>
		<tr><td >压缩机1状态</td><td><span class='stys12060'> </span> </td> <td >压缩机2状态</td><td><span class='stys22060'> </span> </td></tr>
		<tr><td >加热器1状态</td><td><span class='stjy12060'> </span> </td> <td >加热器2状态</td><td><span class='stjy22060'> </span> </td></tr>
		<tr><td >除湿器状态</td><td><span class='stcs2060'> </span> </td> <td >加湿器状态</td><td><span class='stcs2060'> </span> </td></tr>
	</table>
	
    <table width='100%' style='margin-top: 10px'>
        <tr><td style='border: none'> <h1>空调报警状态</h1></td></tr>
		<tr><td >告警状态1</td><td><span class='almst12060'> </span></td> <td >告警状态2</td><td><span class='almst22060'> </span></td></tr>
		<tr><td >告警状态3</td><td><span class='almst32060'> </span></td> <td >告警状态4</td><td><span class='almst42060'> </span></td></tr>
	</table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=2060;
var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbTEMaster 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);
      }
    });
  }
  list3(json);

  function list3(data) {
    $.each(data.recs, function(i, n) {
      $(".SID2060").html(n.SID);
      $(".Addr2060").html(n.Addr);
      $(".Port2060").html(n.Port % 256);
      $(".DateUpd2060").html(n.DateUpd);
      $(".State2060").html(window.parent.parseState(n.State));
	  
	  
      $(".tem2060").html(n.tem/10);
      $(".hum2060").html(n.hum/10);
      $(".temset2060").html(n.temset/10);
      $(".humset2060").html(n.humset/10);
      $(".temh2060").html(n.temh/10);
      $(".teml2060").html(n.teml/10);
      $(".humh2060").html(n.humh/10);
      $(".huml2060").html(n.huml/10);
	  
      $(".worktime2060").html(n.worktime);
      $(".workmode2060").html(_workmode(n.workmode));
      $(".stfj2060").html(_asertState(n.stfj));
      $(".onoff2060").html(_asertState(n.onoff));
      $(".stys12060").html(_asertState(n.stys1));
      $(".stys22060").html(_asertState(n.stys2));
      $(".stjy12060").html(_asertState(n.stjy1));
      $(".stjy22060").html(_asertState(n.stjy2));
      $(".stcs2060").html(_asertState(n.stcs));
      $(".stcs2060").html(_asertState(n.stcs));
	  
	  
      $(".almst12060").html(_almState(n.almst1));
      $(".almst22060").html(_almState(n.almst2));
      $(".almst32060").html(_almState(n.almst3));
      $(".almst42060").html(_almState(n.almst4));
    })
    $("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
  }
  
function _workmode(st)
{
	var state = "开";
	if (st == 0) {
		state = "关";
	}
	return state;
}

function _asertState(st)
{
	var state = "未知";
	if (st == 0) {
		state = "告警关机";
	}
	else if (st == 1) {
		state = "手动";
	}
	else if (st == 2) {
		state = "逻辑关机";
	}
	else if (st == 3) {
		state = "空调关机";
	}
	else if (st == 4) {
		state = "告警待机";
	}
	else if (st == 5) {
		state = "待机";
	}
	else if (st == 6) {
		state = "静默关机";
	}
	else if (st == 7) {
		state = "空调开机";
	}
	else if (st == 8) {
		state = "警告开机";
	}
	else if (st == 9) {
		state = "报警开机";
	}
	else if (st == 10) {
		state = "静默";
	}
	return state;
}

function _almState(st)
{
	var state = "告警(";
	if (st == 0) {
		state = "正常(";
	}
	return state + st + ")";
}

</script>
</body>
</html>