<!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='type782 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-ups.png" style="width: 50%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>UPS</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID782'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr782'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port782'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd782'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State782'> </span></td></tr>
    </table>

    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>运行参数</h1></td></tr>
        <tr><td >输入电压:<span class='Vin1782'> </span>&nbsp;<span class='Vin2782'> </span>&nbsp;<span class='Vin3782'> </span></td><td> 输出电压:<span class='Vout782'> </span>&nbsp;<span class='Vout2782'> </span>&nbsp;<span class='Vout3782'> </span></td><td>输出负载:<span class='Aout782'> </span>&nbsp;<span class='Aout2782'> </span>&nbsp;<span class='Aout3782'> </span></td><td>输入频率:<span class='Fin782'> </span></td></tr>
        <tr><td>电池电压:<span class='Vbatt782'> </span></td><td>放电时间:<span class='Mbatt782'> </span></td><td>环境温度:<span class='Tem782'> </span></td><td><span class='xx'> </span></td></tr>
    </table>
	
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>工作状态</h1></td></tr>
        <tr><td >市电电压:<span class='b7782'> </span></td><td> 电池电压:<span class='b6782'> </span></td><td>旁路模式:<span class='b5782'> </span></td><td>UPS故障:<span class='b4782'> </span></td></tr>
        <tr><td>放电状态:<span class='b3782'> </span></td><!--<td>UPS模式:<span class='b2782'> </span></td><td>UPS状态:<span class='b1782'> </span></td><td>蜂鸣器:<span class='b0782'> </span></td>--></tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
    </div>
<script>
var itype=782;
var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbUps 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){
        $(".SID782").html(n.SID);
        $(".Addr782").html(n.Addr);
        $(".Port782").html(n.Port%256);
        $(".DateUpd782").html(n.DateUpd);
        $(".State782").html(window.parent.parseState(n.State));

        $(".Vin1782").html(n.Vin1/10+"V");
		$(".Vin2782").html(n.Vin2/10+"V");
		$(".Vin3782").html(n.Vin3/10+"V");
		
        $(".Vout782").html(n.Vout/10+"V");
		$(".Vout2782").html(n.v2/10+"V");
		$(".Vout3782").html(n.v3/10+"V");
		
        $(".Vbatt782").html(n.Vbatt/10+"V");
		
		$(".Aout782").html(n.Aout/10+"A");
		$(".Aout2782").html(n.Aed/10+"A");
		$(".Aout3782").html(n.v4/10+"A");
		
        $(".Mbatt782").html(n.Mbatt/10+"Min");
        $(".Tem782").html(n.Tem/10+"℃");
        $(".Fin782").html(n.Fin/10+"Hz");            

		/*if (n.b0 == "0")
			$(".b0782").html("关");
		else
			$(".b0782").html("开");
			
		if (n.b1 == "0")
			$(".b1782").html("开机");
		else
			$(".b1782").html("关机");
			
		if (n.b2 == "0")
			$(".b2782").html("普通工作");
		else
			$(".b2782").html("测试中");	*/

		if (n.b3 == "0")
			$(".b3782").html("逆变");
		else
			$(".b3782").html("放电");	

		if (n.b4 == "0")
			$(".b4782").html("正常");
		else
			$(".b4782").html("故障");	

		if (n.b5 == "0")
			$(".b5782").html("逆变");
		else
			$(".b5782").html("旁路");	

		if (n.b6 == "0")
			$(".b6782").html("正常");
		else
			$(".b6782").html("低压");		

		if (n.b7 == "0")
			$(".b7782").html("正常");
		else
			$(".b7782").html("异常");					
    })
    $("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
    $("span:contains('正常')").addClass("ger").removeClass("red");
}
</script>
</body>
</html>