<!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='type1280 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-card.png" style="width: 70%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>V6V8门禁系统</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SIDV6V8'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='AddrV6V8'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='PortV6V8'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpdV6V8'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='StateV6V8'> </span></td></tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>各项基本信息</h1></td></tr>
        <tr><td width='50%'>机器类型Type: <span class='TypeV6V8'></span></td><td width='50%'>SnapID: <span class='SnapV6V8'></span></td></tr>
		<tr><td width='50%'>当前进人数: <span class='EnterV6V8'></span></td><td width='50%'>当前出人数: <span class='ExportV6V8'></span></td></tr>
		<tr><td width='50%'>当前滞留人数: <span class='EENumV6V8'></span></td><td width='50%'><span></span></td></tr>
		
    </table>
    </td>
    </tr>
  </table>
	
	<div id="sonDev">
	</div>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
</div>
<script>
var itype=3332;
var tescape= 5000,time;
  
<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbCXV6V8 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 = ["正常","告警","故障"];
var sonDevStatus = new Array()
sonDevStatus[0xa] = "运行正常"
sonDevStatus[0xb] = "红外线故障"
sonDevStatus[0xc] = "无线信号故障"
list3(json);
function list3(data){
    $.each(data.recs,function(i,n){
        $(".SIDV6V8").html(n.SID);
        $(".AddrV6V8").html(n.Addr);
        $(".PortV6V8").html(n.Port%256);
        $(".DateUpdV6V8").html(n.DateUpd);
        $(".StateV6V8").html(monitorStatus[n.State%3]);
        $(".TypeV6V8").html(n.Type);
        $(".SnapV6V8").html(n.SnapID);
		
		if(n.State ==2)
		{
			$(".EnterV6V8").html(0+" 人");
			$(".ExportV6V8").html(0+" 人");
			$(".EENumV6V8").html(0+" 人");
		}
		else
		{
			$(".EnterV6V8").html(n.curEnter+" 人");
			$(".ExportV6V8").html(n.curExport+" 人");
			$(".EENumV6V8").html(n.EEnum+" 人");
			var s ="<table width='100%' style='margin-top: 30px'><tr><td style='border: none'> <h1>子设备状态</h1></td></tr>";
			var i=0;
			if(n.st1<=0xc && n.st1>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备1</td><td><span class='son1'>" +sonDevStatus[n.st1]  + " </span></td></tr>";
				i++;
			}
			if(n.st2<=0xc && n.st2>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备2</td><td><span class='son2'>" +sonDevStatus[n.st2]  + " </span></td></tr>";
				i++;
			}
			if(n.st3<=0xc && n.st3>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备3</td><td><span class='son3'>" +sonDevStatus[n.st3]  + " </span></td></tr>";
				i++;
			}
			if(n.st4<=0xc && n.st4>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备4</td><td><span class='son4'>" +sonDevStatus[n.st4]  + " </span></td></tr>";
				i++;
			}
			if(n.st5<=0xc && n.st5>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备5</td><td><span class='son5'>" +sonDevStatus[n.st5]  + " </span></td></tr>";
				i++;
			}
			if(n.st6<=0xc && n.st6>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备6</td><td><span class='son6'>" +sonDevStatus[n.st6]  + " </span></td></tr>";
				i++;
			}
			if(n.st7<=0xc && n.st7>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备7</td><td><span class='son7'>" +sonDevStatus[n.st7]  + " </span></td></tr>";
				i++;
			}
			if(n.st8<=0xc && n.st8>=0xa)
			{
				s+="<tr><td style='width: 200px;'>子设备8</td><td><span class='son8'>" +sonDevStatus[n.st8]  + " </span></td></tr>";
				i++;
			}
			s+="</table>";
			if(i>0)
				$("#sonDev").html(s);
		}
        
		
    })
	$("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
        $("span:contains('正常')").addClass("ger").removeClass("red");
    
}

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