<!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>
    <script src="js/omara.js"></script>

</head>
<body style="background: #F3F3F3">
<div class='type2078 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='SID2078'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr2078'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port2078'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd2078'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State2078'> </span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>基本信息</h1></td></tr>
		<tr><td width='50%'>当前温度: <span class='Tem2078'></span></td><td width='50%'>当前湿度: <span class='Hum2078'></span></td></tr>
		<tr><td width='50%'>设定温度: <span class='TemSet2078'></span></td><td width='50%'>设定湿度: <span class='HumSet2078'></span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>运行状态</h1></td></tr>
		<tr><td width='50%'>机组启停状态: <span class='RunSt2078'></span></td><td width='50%'>总故障:<span class='Fault2078'></span></td></tr>
		<tr><td width='50%'>传感器故障: <span class='SenFault2078'></span></td><td width='50%'>风机故障: <span class='FanFault2078'></span></td></tr>
		<tr><td width='50%'>系统 A故障: <span class='SysAFault2078'></span></td><td width='50%'>系统 B故障: <span class='SysBFault2078'></span></td></tr>
    	<tr><td width='50%'>A低压故障:<span class='LowPowAFault2078'></span></td><td width='50%'>B低压故障:<span class='LowPowBFault2078'></span></td></tr>
	</table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>运行状态</h1></td></tr>
		<tr><td width='50%'>风机运行:<span class='FanRunSt2078'></span></td><td width='50%'><span class='2078'></span></td></tr>
		<tr><td width='50%'>系统 A运行:<span class='SysARunSt2078'></span></td><td width='50%'>系统 B运行:<span class='SysBRunSt2078'></span></td></tr>
		<tr><td width='50%'>电加热运行:<span class='HeatRunSt2078'></span></td><td width='50%'>加湿器运行:<span class='HumRunSt2078'></span></td></tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=2078;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbCyberDelta 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){
        $(".SID2078").html(n.SID);
        $(".Addr2078").html(n.Addr);
        $(".Port2078").html(n.Port%256);
        $(".DateUpd2078").html(n.DateUpd);
        $(".State2078").html(parseState(n.State));
		
		$(".Tem2078").html(n.Tem/10 + "℃");
		$(".Hum2078").html(n.Hum/10 + "％");
		$(".TemSet2078").html(n.TemSet/10 + "℃");
		$(".HumSet2078").html(n.HumSet/10 + "％");
		
		$(".RunSt2078").html(!n.RunSt ? "停止" : "运行");
		
		$(".Fault2078").html(!n.Fault ? "正常" : "故障");
		$(".SenFault2078").html(!n.SenFault ? "正常" : "故障");
		$(".FanFault2078").html(!n.FanFault ? "正常" : "故障");
		$(".SysAFault2078").html(!n.SysAFault ? "正常" : "故障");
		$(".SysBFault2078").html(!n.SysBFault ? "正常" : "故障");
		$(".LowPowAFault2078").html(!n.LowPowAFault ? "正常" : "故障");
		$(".LowPowBFault2078").html(!n.LowPowBFault ? "正常" : "故障");
		
		$(".FanRunSt2078").html(!n.FanRunSt ? "停止" : "运行");
		$(".SysARunSt2078").html(!n.SysARunSt ? "停止" : "运行");
		$(".SysBRunSt2078").html(!n.SysBRunSt ? "停止" : "运行");
		$(".HeatRunSt2078").html(!n.HeatRunSt ? "停止" : "运行");
		$(".HumRunSt2078").html(!n.HumRunSt ? "停止" : "运行");
		
    })

	$("span:contains('故障'),span:contains('告警'),,span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
}

function parseState(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "故障";
}


</script>

</body>

</html>