<!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='type799 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>基本信息</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID799'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr799'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port799'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd799'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State799'> </span></td></tr>
    </table>

    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>运行参数</h1></td></tr>
        <tr>
			<td >输入电压:<span class='VinA799'> </span>&nbsp;<span class='VinB799'> </span>&nbsp;<span class='VinC799'> </span></td>
			<td> 输出电压:<span class='VoutA799'> </span>&nbsp;<span class='VoutB799'> </span>&nbsp;<span class='VoutC799'> </span></td>
			<td> 旁路电压:<span class='VBA799'> </span>&nbsp;<span class='VBB799'> </span>&nbsp;<span class='VBC799'> </span></td>
		</tr>
		<tr>
			<td>输入频率:<span class='FinA799'> </span>&nbsp;<span class='FinB799'> </span>&nbsp;<span class='FinC799'> </span></td>
			<td>输出频率:<span class='FoutA799'> </span>&nbsp;<span class='FoutB799'> </span>&nbsp;<span class='FoutC799'> </span></td>
			<td>旁路频率:<span class='FBA799'> </span>&nbsp;<span class='FBB799'> </span>&nbsp;<span class='FBC799'> </span></td>
		</tr>
		<tr>
			<td>输入电流:<span class='IinA799'> </span>&nbsp;<span class='IinB799'> </span>&nbsp;<span class='IinC799'> </span></td>
			<td>输出电流:<span class='IoutA799'> </span>&nbsp;<span class='IoutB799'> </span>&nbsp;<span class='IoutC799'> </span></td>
			<td>旁路电流:<span class='IBA799'> </span>&nbsp;<span class='IBB799'> </span>&nbsp;<span class='IBC799'> </span></td>
		</tr>
        <tr>
			<td>电池电压:<span class='Vbatt799'> </span></td>
			<td>电池温度:<span class='Tem799'> </span></td>
			<td>电池剩于时间:<span class='Mbatt799'> </span></td>
		</tr>
		<tr>
			<td>电池容量:<span class='Pbatt799'> </span></td>
			<td> <span class='v1799'> </span></td>
			<td> <span class='xx799'> </span></td>
		</tr>
    </table>
    <table width='100%' style='margin-top: 30px'>
        <tr><td style='border: none'> <h1>工作状态</h1></td></tr>
        <tr>
			<td >电池工作条件:<span class='b15799'> </span></td>
			<td> 电池供电状态:<span class='b14799'> </span></td>
			<td>电池工作状态:<span class='b13799'> </span></td>
			<td >高温告警:<span class='b12799'> </span></td>
		</tr>
			<tr><td >输入异常:<span class='b11799'> </span></td>
			<td> 输出异常:<span class='b10799'> </span></td>
			<td>UPS过载:<span class='b9799'> </span></td>
			<td >旁路异常:<span class='b8799'> </span></td>
		</tr>
        <tr>
			<td >输出关闭:<span class='b7799'> </span></td>
			<td> UPS关机:<span class='b6799'> </span></td>
			<td>充电失败:<span class='b5799'> </span></td>
			<td >旁路告警:<span class='b4799'> </span></td>
		</tr>
        <tr>
			<td >风机异常:<span class='b3799'> </span></td>
			<td> 保险丝异常:<span class='b2799'> </span></td>
			<td>蜂鸣器状态:<span class='b1799'> </span></td>
			<td >ECO模式打开:<span class='b0799'> </span></td>
		</tr>
    </table>
    </td>
    </tr>
  </table>
    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
    </div>
<script>
var itype=799;
var tescape= 5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var json=<% db_QryAdv("select * from tbUpsEx 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){
        $(".SID799").html(n.SID);
        $(".Addr799").html(n.Addr);
        $(".Port799").html(n.Port%256);
        $(".DateUpd799").html(n.DateUpd);
        $(".State799").html(parseState(n.State));

        $(".VinA799").html(n.Vin1/10+"V");
		$(".VinB799").html(n.Vin2/10+"V");
		$(".VinC799").html(n.Vin3/10+"V");
		
        $(".VoutA799").html(n.Vout1/10+"V");
		$(".VoutB799").html(n.Vout2/10+"V");
		$(".VoutC799").html(n.Vout3/10+"V");
		
        $(".VBA799").html(n.VB1/10+"V");
		$(".VBB799").html(n.VB2/10+"V");
		$(".VBC799").html(n.VB3/10+"V");
		
		$(".IinA799").html(n.Iin1/10+"A");
		$(".IinB799").html(n.Iin2/10+"A");
		$(".IinC799").html(n.Iin3/10+"A");
		
		$(".IoutA799").html(n.Iout1/10+"A");
		$(".IoutB799").html(n.Iout2/10+"A");
		$(".IoutC799").html(n.Iout3/10+"A");
		
		$(".IBA799").html(n.IB1/10+"A");
		$(".IBB799").html(n.IB2/10+"A");
		$(".IBC799").html(n.IB3/10+"A");
		
		$(".FinA799").html(n.Fin1/10+"Hz");
		$(".FinB799").html(n.Fin2/10+"Hz");
		$(".FinC799").html(n.Fin3/10+"Hz");
		
		$(".FoutA799").html(n.Fout1/10+"Hz");
		$(".FoutB799").html(n.Fout2/10+"Hz");
		$(".FoutC799").html(n.Fout3/10+"Hz");
		
		$(".FBA799").html(n.FB1/10+"Hz");
		$(".FBB799").html(n.FB2/10+"Hz");
		$(".FBC799").html(n.FB3/10+"Hz");
		
        $(".Tem799").html(n.Tem/10+"℃");  
        $(".Vbatt799").html(n.Vbatt/10+"V");            
		$(".Pbatt799").html(n.Pbatt+"%");
        $(".Mbatt799").html(n.Mbatt+"min");  
		
		if (n.b15 == 0)
			n.b15 = "良好";
		else if (n.b15 == 1)
			n.b15 = "较差";
		else
			n.b15 = "需更换";
        $(".b15799").html(n.b15);
		
		if (n.b14 == 0)
			n.b14 = "正常";
		else if (n.b14 == 1)
			n.b14 = "低压";
		else
			n.b14 = "资源耗尽";
        $(".b14799").html(n.b14);
		
		if (n.b13 == 1)
			n.b13 = "充电";
		else if (n.b13 == 2)
			n.b13 = "休眠";
		else if (n.b13 == 3)
			n.b13 = "放电";
		else
			n.b13 = "废弃";
        $(".b13799").html(n.b13);
		
        $(".b12799").html(n.b12 ? "是" : "否");
        $(".b11799").html(n.b11 ? "是" : "否");
        $(".b10799").html(n.b10 ? "是" : "否");
        $(".b9799").html(n.b9 ? "是" : "否");
        $(".b8799").html(n.b8 ? "是" : "否");
        $(".b7799").html(n.b7 ? "是" : "否");
        $(".b6799").html(n.b6 ? "是" : "否");
        $(".b5799").html(n.b5 ? "是" : "否");
        $(".b4799").html(n.b4 ? "是" : "否");
        $(".b3799").html(n.b3 ? "是" : "否");
        $(".b2799").html(n.b2 ? "是" : "否");
        $(".b1799").html(n.b1 ? "是" : "否");
        $(".b0799").html(n.b0 ? "是" : "否");

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

function parseState(istate){
    if(istate==0) return "正常";
    else   if(istate==1) return "告警";
    else return "故障";
}
</script>
</body>
</html>