<!DOCTYPE html> 
 | 
<html lang="en"> 
 | 
<head> 
 | 
    <meta charset="UTF-8"> 
 | 
    <title>提升机监控管理</title> 
 | 
    <link rel="stylesheet" type="text/css" href="../static/css/normalize.css"> 
 | 
    <link rel="stylesheet" type="text/css" href="../static/css/common_wcs.css"> 
 | 
    <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css"> 
 | 
    <link rel="stylesheet" href="../static/css/lift.css"> 
 | 
    <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script> 
 | 
    <script type="text/javascript" src="../static/js/layer/layer.js"></script> 
 | 
    <script type="text/javascript" src="../static/layui/layui.js"></script> 
 | 
    <script type="text/javascript" src="../static/js/common.js"></script> 
 | 
</head> 
 | 
<body> 
 | 
<div style="padding: 10px;height: 100%;float: left;width: 6%"> 
 | 
    <div class="button-window"></div> 
 | 
</div> 
 | 
<div style="height: 100%;padding-left: 6%"> 
 | 
    <div style="padding: 10px;height: 100%"> 
 | 
        <!-- 日志监控板 --> 
 | 
        <div class="log-board"> 
 | 
            <div class="command-log" id="commandLogId" style="width: 10%;"> 
 | 
            </div> 
 | 
            <div class="lift-state" style="width: 90%;"> 
 | 
                <table id="lift-state-table"> 
 | 
                    <thead> 
 | 
                    <tr> 
 | 
                        <th>提升机</th> 
 | 
                        <th>工作号</th> 
 | 
                        <th>任务状态</th> 
 | 
                        <th>模式</th> 
 | 
                        <th>忙闲</th> 
 | 
                        <th>有托盘</th> 
 | 
                        <th>有小车</th> 
 | 
                        <th>设备故障</th> 
 | 
                        <th>前超限</th> 
 | 
                        <th>后超限</th> 
 | 
                        <th>左超限</th> 
 | 
                        <th>右超限</th> 
 | 
                        <th>超高</th> 
 | 
                        <th>超重</th> 
 | 
                        <th>异常信息</th> 
 | 
                    </tr> 
 | 
                    </thead> 
 | 
                    <tbody> 
 | 
                    </tbody> 
 | 
                </table> 
 | 
            </div> 
 | 
        </div> 
 | 
        <!-- 提升机状态 --> 
 | 
        <div class="lift-msg"> 
 | 
            <table id="lift-msg-table"> 
 | 
                <thead> 
 | 
                <tr> 
 | 
                    <th>提升机</th> 
 | 
                    <th>工作号</th> 
 | 
                    <th>已完成的任务号</th> 
 | 
                    <th>层</th> 
 | 
                    <th>作业标记</th> 
 | 
                    <th>穿梭车号</th> 
 | 
                </tr> 
 | 
                </thead> 
 | 
                <tbody> 
 | 
                </tbody> 
 | 
            </table> 
 | 
        </div> 
 | 
        <!-- 手动操作 --> 
 | 
        <div class="lift-operation"> 
 | 
            <!-- 遮罩层 --> 
 | 
            <div class="lift-operation-shade"> 
 | 
                    <span class="lift-operation-shade-span"> 
 | 
                        WCS 系统运行中,请停止后操作 
 | 
                    </span> 
 | 
            </div> 
 | 
            <!-- 设备任务选择 --> 
 | 
            <div class="task-select"> 
 | 
                <!-- 选择 --> 
 | 
                <div id="lift-select" class="operator-item"> 
 | 
                    <span class="select-title">提升机号</span> 
 | 
                    <div class="select-container" id="liftRadioBoxId"> 
 | 
                        <!--                            <label><input type="radio" name="liftSelect" value="1" checked> 1号提升机</label>--> 
 | 
                    </div> 
 | 
                </div> 
 | 
            </div> 
 | 
  
 | 
            <!-- 设备任务操作 --> 
 | 
            <div class="task-operator"> 
 | 
                <fieldset> 
 | 
                    <legend>手动操作</legend> 
 | 
                    <div class="button-group"> 
 | 
                        <select id="liftLev"> 
 | 
                            <option value="1" selected>1F</option> 
 | 
                            <option value="2">2F</option> 
 | 
                            <option value="3">3F</option> 
 | 
                            <option value="4">4F</option> 
 | 
                            <option value="5">5F</option> 
 | 
                            <option value="6">6F</option> 
 | 
                            <option value="7">7F</option> 
 | 
                            <option value="8">8F</option> 
 | 
                            <option value="9">9F</option> 
 | 
                        </select> 
 | 
                        <button class="item" onclick="liftOperator(1)">移动提升机</button> 
 | 
  
 | 
                        <div class="select-container-item"> 
 | 
                            <span>源站</span> 
 | 
                            <label><input id="sourceStaNo" type="text" name="sourceStaNo" /></label> 
 | 
                        </div> 
 | 
                        <div class="select-container-item"> 
 | 
                            <span>目标站</span> 
 | 
                            <label><input id="staNo" type="text" name="staNo" /></label> 
 | 
                        </div> 
 | 
                        <button class="item" onclick="liftOperator(5)">托盘入</button> 
 | 
                        <button class="item" onclick="liftOperator(6)">托盘出</button> 
 | 
                        <button class="item" onclick="liftOperator(7)">移动</button> 
 | 
                        <button class="item" onclick="liftOperator(8)">车货移动</button> 
 | 
                        <button class="item" onclick="liftOperator(0)">复位</button> 
 | 
                        <button class="item" onclick="liftOperator(3)">等待确认</button> 
 | 
                    </div> 
 | 
                </fieldset> 
 | 
            </div> 
 | 
  
 | 
        </div> 
 | 
        <!-- 提升机日志输出 --> 
 | 
        <div class="lift-output-board"> 
 | 
            <textarea id="lift-output"></textarea> 
 | 
        </div> 
 | 
  
 | 
        <div id="lift-detl" style="display: none"> 
 | 
            <div> 
 | 
                <div class="form-item"> 
 | 
                    <label class="form-label">站号:</label> 
 | 
                    <div class="form-input"> 
 | 
                        <input id="liftNo" name="liftNo" class="layui-input" lay-verify="required|number" autocomplete="off" disabled="disabled"> 
 | 
                    </div> 
 | 
                </div> 
 | 
                <div class="form-item"> 
 | 
                    <label class="form-label">工作号:</label> 
 | 
                    <div class="form-input"> 
 | 
                        <input id="workNo" name="workNo" type="number" class="layui-input" lay-verify="number" autocomplete="off"> 
 | 
                    </div> 
 | 
                </div> 
 | 
                <div class="form-item"> 
 | 
                    <label class="form-label">作业标记:</label> 
 | 
                    <div class="form-input"> 
 | 
                        <input id="pakMk" name="pakMk" type="text" class="layui-input" autocomplete="off"> 
 | 
                    </div> 
 | 
                </div> 
 | 
                <div class="form-item form-button-container"> 
 | 
                    <button class="form-button" id="save">保存</button> 
 | 
                    <button class="form-button" id="cancel" style="background-color: #D0D0D0">取消</button> 
 | 
                </div> 
 | 
            </div> 
 | 
        </div> 
 | 
    </div> 
 | 
</div> 
 | 
</body> 
 | 
</html> 
 | 
<script> 
 | 
    // 空白行数 
 | 
    var liftStateTableBlankRows = 0; 
 | 
    var liftMsgTableBlankRows = 0; 
 | 
    // 实际行数 
 | 
    var liftStateTableFullRows = 0; 
 | 
    var liftMsgTableFullRows = 0; 
 | 
    // 初始化 
 | 
    var liftOutputDom = document.getElementById("lift-output"); 
 | 
    $(document).ready(function() { 
 | 
        initliftStateTable(); 
 | 
        getliftStateInfo(); 
 | 
        initliftMsgTable(); 
 | 
        getliftMsgInfo(); 
 | 
        operatorBlockShow(); 
 | 
        setliftRadio(); 
 | 
    }); 
 | 
  
 | 
    setInterval(function () { 
 | 
        getliftStateInfo() 
 | 
        getliftMsgInfo(); 
 | 
    },1000) 
 | 
    setInterval(function () { 
 | 
        getliftOutput(); 
 | 
        operatorBlockShow(); 
 | 
    },500); 
 | 
  
 | 
    // 判断手动操作模块是否可用 
 | 
    function operatorBlockShow() { 
 | 
        if (parent.systemRunning) { 
 | 
            $('.lift-operation').css("opacity", "0.5"); 
 | 
            $('.lift-operation-shade').show(); 
 | 
            $('.lift-operation-shade-span').show(); 
 | 
        }  else { 
 | 
            $('.lift-operation').css("opacity", "1"); 
 | 
            $('.lift-operation-shade').hide(); 
 | 
            $('.lift-operation-shade-span').hide(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    function getColor(res,e){ 
 | 
        $(e).val(res?"✔":"—"); 
 | 
        if (res){ 
 | 
            $(e).attr("style", "color: #FD482C;"); 
 | 
        }else { 
 | 
            $(e).attr("style", "color: #00FF00;"); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    $(document).on('click ','#save', function () { 
 | 
        http.post(baseUrl+ "/lift/detl/update", { 
 | 
            liftNo: $('#liftNo').val(), 
 | 
            workNo: $('#workNo').val(), 
 | 
            pakMk: $('#pakMk').val(), 
 | 
        }, function (res) { 
 | 
            layer.msg("修改成功", {icon: 1,}); 
 | 
            layer.close(layerDetl); 
 | 
        }) 
 | 
    }) 
 | 
  
 | 
    function setliftRadio() { 
 | 
        $.ajax({ 
 | 
            url: baseUrl+ "/lift/table/lift/state", 
 | 
            headers: {'token': localStorage.getItem('token')}, 
 | 
            method: 'POST', 
 | 
            success: function (res) { 
 | 
                if (res.code === 200){ 
 | 
                    let table = res.data; 
 | 
                    for (let i=1;i<=table.length;i++){ 
 | 
                        //渲染提升机选项html 
 | 
                        let liftRadioBox = '<label><input type="radio" name="liftSelect" '; 
 | 
                        if (i === 1) { 
 | 
                            liftRadioBox += 'checked ' 
 | 
                        } 
 | 
                        liftRadioBox += 'value="' + table[i - 1].liftNo + '"> ' + table[i - 1].liftNo + '号提升机</label>' 
 | 
                        $("#liftRadioBoxId").append(liftRadioBox) 
 | 
  
 | 
  
 | 
                        //渲染提升机数据维护和设备信息html 
 | 
                        let liftCommandLogBox = '<div class="lift-command-item" data-liftNo="' + table[i - 1].liftNo + '">\n' + 
 | 
                            '<label>' + table[i - 1].liftNo + '#</label>\n' + 
 | 
                            '</div>' 
 | 
                        $("#commandLogId").append(liftCommandLogBox); 
 | 
                    } 
 | 
                } else if (res.code === 403){ 
 | 
                    window.location.href = baseUrl+"/login"; 
 | 
                }  else { 
 | 
                    console.log(res.msg); 
 | 
                } 
 | 
            } 
 | 
        }); 
 | 
    } 
 | 
  
 | 
    // 提升机信息表获取 ---- 表一 
 | 
    function getliftStateInfo() { 
 | 
        let tableEl = $('#lift-state-table'); 
 | 
        $.ajax({ 
 | 
            url: baseUrl+ "/lift/table/lift/state", 
 | 
            headers: {'token': localStorage.getItem('token')}, 
 | 
            method: 'POST', 
 | 
            success: function (res) { 
 | 
                if (res.code === 200){ 
 | 
                    let table = res.data; 
 | 
                    if (table.length > liftStateTableBlankRows && table.length !== liftStateTableFullRows) { 
 | 
                        initliftStateTable(table.length-liftStateTableBlankRows); 
 | 
                        liftStateTableFullRows = table.length; 
 | 
                    } 
 | 
                    for (let i=1;i<=table.length;i++){ 
 | 
                        // $("#mode-"+table[i-1].liftNo).html(table[i-1].statusVal===0?'联机':'脱机'); 
 | 
                        let tr = tableEl.find("tr").eq(i); 
 | 
                        setVal(tr.children("td").eq(0), table[i-1].liftNo); 
 | 
                        setVal(tr.children("td").eq(1), table[i-1].taskNo); 
 | 
                        setVal(tr.children("td").eq(2), table[i-1].protocolStatus$); 
 | 
                        setVal(tr.children("td").eq(3), table[i-1].model$); 
 | 
                        setVal(tr.children("td").eq(4), table[i-1].run$); 
 | 
                        setVal(tr.children("td").eq(5), table[i-1].hasTray$); 
 | 
                        setVal(tr.children("td").eq(6), table[i-1].hasCar$); 
 | 
                        setVal(tr.children("td").eq(7), table[i-1].errCode$); 
 | 
                        setVal(tr.children("td").eq(8), table[i-1].frontOverrun$); 
 | 
                        setVal(tr.children("td").eq(9), table[i-1].backOverrun$); 
 | 
                        setVal(tr.children("td").eq(10), table[i-1].leftOverrun$); 
 | 
                        setVal(tr.children("td").eq(11), table[i-1].rightOverrun$); 
 | 
                        setVal(tr.children("td").eq(12), table[i-1].overHeight$); 
 | 
                        setVal(tr.children("td").eq(13), table[i-1].overWeight$); 
 | 
                        setVal(tr.children("td").eq(14), table[i-1].errCode$); 
 | 
                    } 
 | 
                } else if (res.code === 403){ 
 | 
                    window.location.href = baseUrl+"/login"; 
 | 
                }  else { 
 | 
                    console.log(res.msg); 
 | 
                } 
 | 
            } 
 | 
        }); 
 | 
    } 
 | 
  
 | 
    // 提升机数据表获取 ---- 表二 
 | 
    function getliftMsgInfo() { 
 | 
        let tableEl = $('#lift-msg-table'); 
 | 
        $.ajax({ 
 | 
            url: baseUrl+ "/lift/table/lift/msg", 
 | 
            headers: {'token': localStorage.getItem('token')}, 
 | 
            method: 'POST', 
 | 
            success: function (res) { 
 | 
                if (res.code === 200){ 
 | 
                    var table = res.data; 
 | 
                    if (table.length > liftMsgTableBlankRows && table.length !== liftMsgTableFullRows) { 
 | 
                        initliftMsgTable(table.length-liftMsgTableBlankRows); 
 | 
                        liftMsgTableFullRows = table.length; 
 | 
                    } 
 | 
                    for (var i=1;i<=table.length;i++){ 
 | 
                        var tr = tableEl.find("tr").eq(i); 
 | 
                        setVal(tr.children("td").eq(0), table[i-1].liftNo); 
 | 
                        setVal(tr.children("td").eq(1), table[i-1].workNo); 
 | 
                        setVal(tr.children("td").eq(2), table[i-1].completeTaskNo); 
 | 
                        setVal(tr.children("td").eq(3), table[i-1].lev); 
 | 
                        setVal(tr.children("td").eq(4), table[i-1].pakMk); 
 | 
                        setVal(tr.children("td").eq(5), table[i-1].shuttleNo); 
 | 
                    } 
 | 
                } else if (res.code === 403){ 
 | 
                    window.location.href = baseUrl+"/login"; 
 | 
                }  else { 
 | 
                    console.log(res.msg); 
 | 
                } 
 | 
            } 
 | 
        }); 
 | 
    } 
 | 
  
 | 
    // 提升机日志输出 ----------------------------------------------------------------------- 
 | 
    function getliftOutput() { 
 | 
        $.ajax({ 
 | 
            url: baseUrl + "/lift/output/lift", 
 | 
            headers: {'token': localStorage.getItem('token')}, 
 | 
            method: 'POST', 
 | 
            success: function (res) { 
 | 
                if (res.code === 200) { 
 | 
                    liftOutput(res.data); 
 | 
                } else if (res.code === 403) { 
 | 
                    window.location.href = baseUrl + "/login"; 
 | 
                } else { 
 | 
                    console.log(res.msg); 
 | 
                } 
 | 
            } 
 | 
        }) 
 | 
    } 
 | 
  
 | 
    // 任务指令下发 
 | 
    function liftOperator(liftTaskMode) { 
 | 
        http.post(baseUrl+"/lift/operator/lift", { 
 | 
            liftNo: $('input[name="liftSelect"]:checked').val(), 
 | 
            liftTaskMode: liftTaskMode, 
 | 
            lev: $("#liftLev").val(), 
 | 
            sourceStaNo: $("#sourceStaNo").val(), 
 | 
            staNo: $("#staNo").val() 
 | 
        }, function (res) { 
 | 
            layer.msg(res.msg, {icon: 1}); 
 | 
        }); 
 | 
    } 
 | 
  
 | 
  
 | 
    // ------------------------------------------------------------------------------------------------ 
 | 
  
 | 
    // 提升机信息表获取  ----- 表一 
 | 
    function initliftStateTable(row) { 
 | 
        let line; 
 | 
        if (row === undefined){ 
 | 
            let one = $('#lift-state-table thead').height(); 
 | 
            let total = $('.lift-state').height(); 
 | 
            let count = total / one; 
 | 
            count = parseInt(count) - 1; 
 | 
            liftStateTableBlankRows = count; 
 | 
            line = count; 
 | 
        } else { 
 | 
            line = row; 
 | 
        } 
 | 
        let html = ""; 
 | 
        for (let i = 0; i < line; i ++){ 
 | 
            html += " <tr>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "     </tr>\n"; 
 | 
        } 
 | 
        $('#lift-state-table tbody').after(html); 
 | 
    } 
 | 
  
 | 
    // 提升机数据表获取  ----- 表二 
 | 
    function initliftMsgTable(row) { 
 | 
        let line; 
 | 
        if (row === undefined){ 
 | 
            let one = $('#lift-msg-table thead').height(); 
 | 
            let total = $('.lift-msg').height(); 
 | 
            let count = total / one; 
 | 
            count = parseInt(count) - 1; 
 | 
            liftMsgTableBlankRows = count; 
 | 
            line = count; 
 | 
        } else { 
 | 
            line = row; 
 | 
        } 
 | 
        let html = ""; 
 | 
        for (let i = 0; i < line; i ++){ 
 | 
            html += " <tr>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "       <td></td>\n" + 
 | 
                "     </tr>\n"; 
 | 
        } 
 | 
        $('#lift-msg-table tbody').after(html); 
 | 
    } 
 | 
  
 | 
    // 日志输出框 
 | 
    function liftOutput(content){ 
 | 
        liftOutputDom.value += content; 
 | 
        liftOutputDom.scrollTop = liftOutputDom.scrollHeight; 
 | 
    } 
 | 
  
 | 
    // 详情操作 ------------------------------------------------------------------------- 
 | 
    var layerDetl; 
 | 
    $(document).on('dblclick ','#lift-msg-table tr', function () { 
 | 
        var liftNo = $(this).children("td").eq(0).html(); 
 | 
        if (liftNo !== null && liftNo !== "") { 
 | 
            layerDetl = layer.open({ 
 | 
                type: 1, 
 | 
                title: false, 
 | 
                shadeClose: true, 
 | 
                offset: 'rt', 
 | 
                anim: 5, 
 | 
                shade: [0], 
 | 
                area: ['340px', '255px'], 
 | 
                closeBtn: 0, 
 | 
                content: $("#lift-detl"), 
 | 
                success: function(layero, index){ 
 | 
                    $.ajax({ 
 | 
                        url: baseUrl+ "/lift/table/lift/msg", 
 | 
                        headers: {'token': localStorage.getItem('token')}, 
 | 
                        method: 'POST', 
 | 
                        success: function (res) { 
 | 
                            if (res.code === 200){ 
 | 
                                var table = res.data; 
 | 
                                for (var i=1;i<=table.length;i++){ 
 | 
                                    if (liftNo == table[i-1].liftNo) { 
 | 
                                        $('#liftNo').val(liftNo); 
 | 
                                        $('#workNo').val(table[i-1].workNo); 
 | 
                                        $('#pakMk').val(table[i-1].pakMk); 
 | 
                                        $('#token').val(table[i-1].token); 
 | 
                                    } 
 | 
                                } 
 | 
                            } else if (res.code === 403){ 
 | 
                                window.location.href = baseUrl+"/login"; 
 | 
                            }  else { 
 | 
                                console.log(res.msg); 
 | 
                            } 
 | 
                        } 
 | 
                    }); 
 | 
                }, 
 | 
                end: function () { 
 | 
                    $('#liftNo').val(""); 
 | 
                    $('#workNo').val(""); 
 | 
                    $('#pakMk').val(""); 
 | 
                    $('#token').val(""); 
 | 
                } 
 | 
            }) 
 | 
        } 
 | 
    }); 
 | 
  
 | 
    $(document).on('click ','#cancel', function () { 
 | 
        $('#liftNo').val(""); 
 | 
        $('#workNo').val(""); 
 | 
        $('#pakMk').val(""); 
 | 
        $('#token').val(""); 
 | 
        layer.close(layerDetl); 
 | 
    }) 
 | 
  
 | 
</script> 
 |