<!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='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 class='smName'></h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID2096'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr2096'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port2096'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd2096'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State2096'> </span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>基本信息</h1></td></tr>
		<tr><td width='25%'>设定温度：<span class='TemSet2096'></span></td>
		    <td width='25%'>设定湿度：<span class='HumSet2096'></span></td>
		    <td width='25%'>当前温度：<span class='Tem2096'></span></td>
			<td width='25%'>当前湿度：<span class='Hum2096'></span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>输出状态信息</h1></td></tr>
		<tr><td width='25%'>关机/开机：<span class='StRunMode2096'></span></td>
		    <td width='25%'>除湿工作：<span class='StHumer2096'></span></td>
			<td width='25%'>湿控状态：<span class='StHumCtrl2096'></span></td>
		    <td width='25%'>化霜：<span class='StFrost2096'></span></td></tr>
		<tr><td width='25%'>水满：<span class='StWaterFollow2096'></span></td>
		    <td width='25%'>压缩机延时启动：<span class='StCompDelay2096'></span></td>
			<td width='25%'>风机：<span class='StFan2096'></span></td>
		    <td width='25%'>压机2：<span class='StComp22096'></span></td></tr>
		<tr><td width='25%'>压机1：<span class='StComp12096'></span></td>
		    <td width='25%'><span class='2096'></span></td>
		    <td width='25%'><span class='2096'></span></td>
		    <td width='25%'><span class='2096'></span></td></tr>
	</table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>故障信息</h1></td></tr>
		<tr><td width='25%'>B缺相：<span class='StLostPhaseB2096'></span></td>
			<td width='25%'>C缺相：<span class='StLostPhaseC2096'></span></td>
		    <td width='25%'>压缩机2低压保护：<span class='StComp2Protect2096'></span></td>
		    <td width='25%'>压缩机1低压保护：<span class='StComp1Protect2096'></span></td></tr>
		<tr><td width='25%'>湿度传感器故障：<span class='StHSenFault2096'></span></td>
			<td width='25%'>化霜传感器2故障：<span class='StFSenFault22096'></span></td>
		    <td width='25%'>化霜传感器1故障：<span class='StFSenFault12096'></span></td>
			<td width='25%'>温度传感器故障：<span class='StTSenFault2096'></span></td></tr>
		<tr><td width='25%'>通信故障：<span class='StCommFault2096'></span></td>
			<td width='25%'>A缺相：<span class='StLostPhaseA2096'></span></td>
		    <td width='25%'><span class='2096'></span></td>
		    <td width='25%'><span class='2096'></span></td></tr>
    </table>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=2096;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbCyberDeHumer where SID="+sid,0);%>;
var jname = <% db_QryAdv("select Name from tbSM where SID="+sid,0); %>
<% db_Close(); %>

$(".smName").html(jname.recs[0].Name);
	
$(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){
	if (data.reccnt == 0)
		return;
    $.each(data.recs,function(i,n){
        $(".SID2096").html(n.SID);
        $(".Addr2096").html(n.Addr);
        $(".Port2096").html(n.Port%256);
        $(".DateUpd2096").html(n.DateUpd);
        $(".State2096").html(parseState(n.State));
		
		$(".TemSet2096").html((n.TemSet) + "℃");
		$(".HumSet2096").html((n.HumSet) + "％");
		$(".StRunMode2096").html((n.StRunMode) ? "开" : "关");
		$(".StHumer2096").html((n.StHumer) ? "开" : "关");
		$(".StHumCtrl2096").html((n.StHumCtrl) ? "开" : "关");
		$(".StFrost2096").html((n.StFrost) ? "开" : "关");
		$(".StWaterFollow2096").html((n.StWaterFollow) ? "开" : "关");
		$(".Tem2096").html((n.Tem) + "℃");
		$(".Hum2096").html((n.Hum) + "％");
		$(".StCompDelay2096").html((n.StCompDelay) ? "开" : "关");
		$(".StFan2096").html((n.StFan) ? "开" : "关");
		$(".StComp22096").html((n.StComp2) ? "开" : "关");
		$(".StComp12096").html((n.StComp1) ? "开" : "关");
		$(".StLostPhaseB2096").html((n.StLostPhaseB) ? "是" : "否");
		$(".StLostPhaseC2096").html((n.StLostPhaseC) ? "是" : "否");
		$(".StComp2Protect2096").html((n.StComp2Protect) ? "是" : "否");
		$(".StComp1Protect2096").html((n.StComp1Protect) ? "是" : "否");
		$(".StHSenFault2096").html((n.StHSenFault) ? "是" : "否");
		$(".StFSenFault22096").html((n.StFSenFault2) ? "是" : "否");
		$(".StFSenFault12096").html((n.StFSenFault1) ? "是" : "否");
		$(".StTSenFault2096").html((n.StTSenFault) ? "是" : "否");
		$(".StCommFault2096").html((n.StCommFault) ? "是" : "否");
		$(".StLostPhaseA2096").html((n.StLostPhaseA) ? "是" : "否");
		
    })

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

function parseAlm(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "无效";
}

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

function alarmState(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "短路";
    else return "开路";
}

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