<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<QMAPP.FJC.Web.Models.Andon.TempCallLogModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    报警查询
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <input id="ids" style="display:none"> 
    <input id="types" style="display:none"> 
    <div style="width: 1165px; height: 500px; background-image: url(/Content/Img/Plant3.png);       
        background-size: 100% 100%;position: relative;">
        <img id="bj" style="position: absolute;background-color: transparent; width: 50px; height: 50px;left: 1050px; top: 30px; display: none;z-index:999 " src="/Content/Img/bj1.gif"/>
        <%--<div id="dcount" style="position: absolute; left: 1000px; top: 30px; font-size: 50px; color: yellow;">
        5
        </div>--%>
        <div name='divN' onclick="Count(this)" id="DP_R_INSP" 
        style="position: absolute; left: 130px; top: 60px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="DP_L_INSP" 
        style="position: absolute; left: 130px; top: 160px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="DP_R_WELD" 
        style="position: absolute; left: 280px; top: 85px; font-size: 30px; color: red;">
            
        </div>
        <div name='divN' onclick="Count(this)" id="DP_L_WELD" 
        style="position: absolute; left: 280px; top: 130px; font-size: 30px; color: red;">
           
        </div>
        <div name='divN' onclick="Count(this)" id="DP_R_HWELD" 
        style="position: absolute; left: 520px; top: 20px; font-size: 30px; color: red;">
            
        </div>
        <div name='divN' onclick="Count(this)" id="DP_L_HWELD" 
        style="position: absolute; left: 520px; top: 200px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="DP_R_PRE2" 
        style="position: absolute; left: 700px; top: 50px; font-size: 30px; color: red;">
            
        </div>
        <div name='divN' onclick="Count(this)" id="DP_L_PRE2" 
        style="position: absolute; left: 700px; top: 170px; font-size: 30px; color: red;">
            
        </div>
        <div name='divN' onclick="Count(this)" id="DP_R_PRE1" 
        style="position: absolute; left: 830px; top: 50px; font-size: 30px; color: red;">
           
        </div>
        <div name='divN' onclick="Count(this)" id="DP_L_PRE1" 
        style="position: absolute; left: 830px; top: 170px; font-size: 30px; color: red;">
            
        </div>
        <%--<div name='divN' id="Div17" 
        style="position: absolute; left: 290px; top: 210px; font-size: 30px; color: red;">
        20
        </div>
        

        <div name='divN' id="Div21" 
        style="position: absolute; left: 50px; top: 380px; font-size: 30px; color: red;">
        10
        </div>--%>
        <div name='divN' onclick="Count(this)" id="IP_ASSEMBLY" 
        style="position: absolute; left: 210px; top: 450px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="IP_SWELD_4" 
        style="position: absolute; left: 190px; top: 400px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="IP_SWELD_3" 
        style="position: absolute; left: 190px; top: 330px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="IP_SWELD_2" 
        style="position: absolute; left: 330px; top: 280px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="IP_VWELD_2" 
        style="position: absolute; left: 530px; top: 280px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="IP_SWELD_1" 
        style="position: absolute; left: 680px; top: 280px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="IP_VWELD_1" 
        style="position: absolute; left: 780px; top: 340px; font-size: 30px; color: red;">
        
        </div>
        <div name='divN' onclick="Count(this)" id="IP_LASER"   
        style="position: absolute; left: 780px; top: 430px; font-size: 30px; color: red;">
        
        </div>
        <%--<div name='divN' id="Div57" 
        style="position: absolute; left: 930px; top: 310px; font-size: 30px; color: red;">
        10
        </div>
        <div name='divN' id="Div61" 
        style="position: absolute; left: 1030px; top: 310px; font-size: 30px; color: red;">
        10
        </div>--%>
        
    </div>
    <style type="text/css">
        body{  
            text-align:center;  
          } 
         .UnUsedDataSpace
         {
             background: LawnGreen;
         }
        
        .UsedDataSpace
        {
            background: Gold;
        }
        
        .FullDataSpace
        {
            background: Green;
        }
        
        .OverDataSpace
        {
            background: Red;
        }
        
        .EmptySpaceShow
        {
            background: white;
        }
        
        .TitleSpace
        {
            background: #C0C0C0;
        }
        
        .SelectBin
        {
            background: #BDB76B;
        }
        
        .DivD
        {
            padding: 20px 10px 20px 10px; 
            width: 240px;
            height: 190px; 
            background-color: royalblue;
            text-align: center;
        }
        
        .DivC
        {
            font-size: 40px;
            font-weight: bold;
            height: 60px;
        }
        .DivN
        {
            font-size: 30px;
            font-weight: bold;
            height: 80px;
        }
        .DivR
        {
            font-size: 40px; 
            height: 40px;
        }
        
        #dtView td
        {
            width: 100px;
            height: 50px;
            overflow: hidden;
            text-align: center;
        }
    </style>
    <script language="javascript">

        $(document).ready(function () {
            init();
            Get();
        });
        //初始化
        function init() {
            $.ajax({
                url: "/TempCallLog/GetDivStyle",
                data: {
                    type : "0"
        },
                type: "POST",
                cache: false,
                dataType: "json",
                async: true,
                success: function (data) {
                    if (data != null && data.length > 0) {
                        for (var i = 0; i < data.length; i++) {
                            var divTemp = document.getElementById(data[i].id);
                            divTemp.style.left = data[i].divLeft;
                            divTemp.style.top = data[i].divTop;
                            divTemp.style.fontSize = data[i].fontSize;
                            divTemp.style.color = data[i].divColor;
                        }
                    } 
                }
            });
//            $("div[name='divN']")
//               .each(function () {
//                   var dvid = this.id;                  
//               });
        }
        //获取传递过来的参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) {
                if (r[2] != null) {
                    return decodeURIComponent(r[2]);
                }
            }
            return null;
        }
        //获取table
        function Get() {
            //获取隐藏控件的值
//            var types = document.getElementById("types");
//            var ids = document.getElementById("ids");
            //获取传递过来的参数
            var callType = GetQueryString("CALL_TYPE");
//            var callTypeTxt = "维修: ";
//            if (callType === "1") {
//                callTypeTxt = "质量: ";
//            }
//            else if (callType === "2") {
//                callTypeTxt = "物料: ";
//            }
            $.ajax({
                url: "/TempCallLog/GetList",
                data: {
                    CALL_TYPE: callType
                },
                type: "POST",
                cache: false,
                dataType: "json",
                async: true,
                success: function (data) {
                    if (data != null && data.length > 0) {
                        FillView(data);
                        document.getElementById("types").value = callType;
                        document.getElementById("bj").style.display = "block";
                    } else {
                        document.getElementById("bj").style.display = "none";
                    }
                }
                });
                
            //指定?秒刷新一次 
            setTimeout("Get()", 5000);
        }
        //第一次和有变化时填充table
        function FillView(data) {
            var ids = document.getElementById("ids");
            var types = document.getElementById("types");
            ids.value = "";

            //循环所有的道次对象
            for (var i = 0; i < data.length; i++) {
                var did = data[i].MACHINECODDE;

                //把变化的id存起来.
                ids.value = ids.value + did + ";";
                if (document.getElementById(did) != null) {
                    //debugger;
                    var divget = document.getElementById(did);
                    if (divget.innerText != data[i].CALL_COUNT) {
                        divget.innerText = data[i].CALL_COUNT;
                        if (types.value != "") {
                        //第二次加载操作
                            //                                alert("id:" +
                            //                                    data[i].MACHINECODDE +
                            //                                    " count:" +
                            //                                    data[i].CALL_COUNT +
                            //                                    " type:" +
                            //                                    data[i].CALL_TYPE);
                            //                                document.getElementById("bj").style.display = "block";
                            //                                setTimeout(function () { document.getElementById("bj").style.display = "none"; }, 3000);
                        }
                    }
                }
            }
            //遍历所有div
            if (ids.value != '') {
                $("div[name='divN']")
                            .each(function () {
                                var dvid = this.id;
                                var str = ids.value;
                                //没变化的id赋值
                                if (str.indexOf(dvid) == -1) {
                                    //this.innerText = "";
                                }
                            });
            }

        }
        //没有变化时填充table
        

        //统计
        function Count(obj) {
            //debugger;
            var ids =document.getElementById("types").value + obj.id;
            openAppWindow1('统计', 'Count?PID=' + ids, '950', '500');
        }

        
        //Get();

    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
</asp:Content>