#
luxiaotao1123
2020-09-24 483c41227f5945d4d60bcece39f688ca9b5980ef
src/main/webapp/views/crn.html
@@ -11,6 +11,7 @@
    <link rel="stylesheet" type="text/css" href="../static/css/crn.css">
    <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../static/js/common.js"></script>
    <script type="text/javascript" src="../static/js/layer/layer.js"></script>
    <style>
    </style>
@@ -26,11 +27,6 @@
            <span>&nbsp;</span>
            <input id="crn1" disabled="disabled">
        </div>
        <div class="crn-command-item">
            <label>2#</label>
            <span>&nbsp;</span>
            <input id="crn2" disabled="disabled">
        </div>
    </div>
    <!-- 堆垛机状态位信息 -->
    <div class="crn-state">
@@ -39,17 +35,17 @@
                <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>
                    <th>报警码</th>
                    <th>走行定位</th>
                    <th>升降定位</th>
                    <th>急停</th>
                    <th>异常码</th>
                </tr>
            </thead>
            <tbody>
@@ -63,15 +59,20 @@
        <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>走行速度(m/min)</th>
                <th>升降速度(m/min)</th>
                <th>叉牙速度(m/min)</th>
                <th>走行距离(Km)</th>
                <th>升降距离(Km)</th>
                <th>走行时长(H)</th>
                <th>升降时长(H)</th>
            </tr>
        </thead>
        <tbody>
@@ -81,6 +82,13 @@
<!-- 手动操作 -->
<div class="crn-operation">
    <!-- 遮罩层 -->
    <div class="crn-operation-shade">
        <span class="crn-operation-shade-span">
            WCS 系统运行中,请停止后操作
        </span>
    </div>
    <!-- 设备任务选择 -->
    <div class="task-select">
        <!-- 堆垛机选择 -->
@@ -88,7 +96,6 @@
            <span class="select-title">堆垛机号</span>
            <div class="select-container">
                <label><input type="radio" name="crnSelect" value="1" checked>&nbsp;1号堆垛机</label>
                <label><input type="radio" name="crnSelect" value="2">&nbsp;2号堆垛机</label>
            </div>
        </div>
        <!-- 源站/源库位 选择 -->
@@ -146,12 +153,14 @@
                <button class="item" onclick="take()">出库</button>
                <button class="item" onclick="stockMove()">库位转移</button>
                <button class="item" onclick="siteMove()">站到站</button>
                <button class="item" onclick="coorMove()">坐标移动</button>
                <button class="item" onclick="bacOrigin()">回原点</button>
                <button class="item" onclick="reverseOrigin()">反原点</button>
                <button class="item" onclick="coorMove()">坐标移行</button>
                <button class="item" onclick="taskComplete()">任务完成</button>
                <button class="item" onclick="pause()">暂停</button>
                <button class="item" onclick="boot()">启动</button>
<!--                <button class="item" onclick="pause()">暂停</button>-->
<!--                <button class="item" onclick="boot()">启动</button>-->
                <button class="item" onclick="clearCommand()">清除命令</button>
                <button class="item" onclick="handleReset()">复位</button>
            </div>
        </fieldset>
    </div>
@@ -177,6 +186,7 @@
        getCrnStateInfo();
        initCrnMsgTable();
        getCrnMsgInfo();
        operatorBlockShow();
    });
    // 数据更新
    setInterval(function () {
@@ -185,8 +195,22 @@
        getCommandLog();
    },1000);
    setInterval(function () {
        getSiteOutput();
        getCrnOutput();
        operatorBlockShow();
    },500);
    // 判断手动操作模块是否可用
    function operatorBlockShow() {
        if (parent.systemRunning) {
            $('.crn-operation').css("opacity", "0.5");
            $('.crn-operation-shade').show();
            $('.crn-operation-shade-span').show();
        }  else {
            $('.crn-operation').css("opacity", "1");
            $('.crn-operation-shade').hide();
            $('.crn-operation-shade-span').hide();
        }
    }
    // 获取堆垛机执行中的命令
    function getCommandLog() {
@@ -201,14 +225,13 @@
                        $("#crn"+commands[i].crnNo).val(commands[i].command);
                    }
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/login";
                    window.location.href = baseUrl + "/login";
                } else {
                    alert(res.msg);
                    console.log(res.msg);
                }
            }
        })
    }
    // 堆垛机信息表获取 ---- 表一
    function getCrnStateInfo() {
@@ -227,23 +250,23 @@
                    for (var i=1;i<=table.length;i++){
                        var tr = tableEl.find("tr").eq(i);
                        setVal(tr.children("td").eq(0), table[i-1].crnNo);
                        setVal(tr.children("td").eq(1), table[i-1].type);
                        setVal(tr.children("td").eq(2), table[i-1].warn);
                        setVal(tr.children("td").eq(1), table[i-1].statusType);
                        setVal(tr.children("td").eq(2), table[i-1].status);
                        setVal(tr.children("td").eq(3), table[i-1].loading);
                        setVal(tr.children("td").eq(4), table[i-1].bay);
                        setVal(tr.children("td").eq(5), table[i-1].lev);
                        setVal(tr.children("td").eq(6), table[i-1].forkOffset);
                        setVal(tr.children("td").eq(7), table[i-1].bayCoor);
                        setVal(tr.children("td").eq(8), table[i-1].levCoor);
                        setVal(tr.children("td").eq(9), table[i-1].complete);
                        setVal(tr.children("td").eq(10), table[i-1].workNo);
                        setVal(tr.children("td").eq(11), table[i-1].status);
                        setVal(tr.children("td").eq(6), table[i-1].xorigin);
                        setVal(tr.children("td").eq(7), table[i-1].yorigin);
                        setVal(tr.children("td").eq(8), table[i-1].forkOffset);
                        setVal(tr.children("td").eq(9), table[i-1].xlocation);
                        setVal(tr.children("td").eq(10), table[i-1].ylocation);
                        setVal(tr.children("td").eq(11), table[i-1].stop);
                        setVal(tr.children("td").eq(12), table[i-1].warnCode);
                    }
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/login";
                    window.location.href = baseUrl+"/login";
                }  else {
                    alert(res.msg);
                    console.log(res.msg);
                }
            }
        });
@@ -266,20 +289,25 @@
                    for (var i=1;i<=table.length;i++){
                        var tr = tableEl.find("tr").eq(i);
                        setVal(tr.children("td").eq(0), table[i-1].crnNo);
                        setVal(tr.children("td").eq(1), table[i-1].status);
                        setVal(tr.children("td").eq(2), table[i-1].workNo);
                        setVal(tr.children("td").eq(1), table[i-1].workNo);
                        setVal(tr.children("td").eq(2), table[i-1].status);
                        setVal(tr.children("td").eq(3), table[i-1].sourceStaNo);
                        setVal(tr.children("td").eq(4), table[i-1].staNo);
                        setVal(tr.children("td").eq(5), table[i-1].sourceLocNo);
                        setVal(tr.children("td").eq(6), table[i-1].locNo);
                        setVal(tr.children("td").eq(7), table[i-1].error);
                        setVal(tr.children("td").eq(8), table[i-1].origin);
                        setVal(tr.children("td").eq(9), table[i-1].command);
                        setVal(tr.children("td").eq(8), table[i-1].xspeed);
                        setVal(tr.children("td").eq(9), table[i-1].yspeed);
                        setVal(tr.children("td").eq(10), table[i-1].zspeed);
                        setVal(tr.children("td").eq(11), table[i-1].xdistance);
                        setVal(tr.children("td").eq(12), table[i-1].ydistance);
                        setVal(tr.children("td").eq(13), table[i-1].xduration);
                        setVal(tr.children("td").eq(14), table[i-1].yduration);
                    }
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/login";
                    window.location.href = baseUrl+"/login";
                }  else {
                    alert(res.msg);
                    console.log(res.msg);
                }
            }
        });
@@ -313,75 +341,89 @@
    // 入库
    function put() {
        http.post(baseUrl+"/crn/operator/put", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 出库
    function take() {
        http.post(baseUrl+"/crn/operator/take", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 库位转移
    function stockMove() {
        http.post(baseUrl+"/crn/operator/stockMove", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 站到站
    function siteMove() {
        http.post(baseUrl+"/crn/operator/siteMove", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 坐标移动
    function coorMove() {
        http.post(baseUrl+"/crn/operator/coorMove", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 回原点
    function bacOrigin() {
        http.post(baseUrl+"/crn/operator/bacOrigin", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 回原点
    function reverseOrigin() {
        http.post(baseUrl+"/crn/operator/reverseOrigin", getReqParam(), function (res) {
            layer.msg(res.msg);
        });
    }
    // 任务完成
    function taskComplete() {
        http.post(baseUrl+"/crn/operator/taskComplete", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 暂停
    function pause() {
        http.post(baseUrl+"/crn/operator/pause", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 启动
    function boot() {
        http.post(baseUrl+"/crn/operator/boot", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 清除命令
    function clearCommand() {
        http.post(baseUrl+"/crn/operator/clearCommand", getReqParam(), function (res) {
            alert(res.msg);
            layer.msg(res.msg);
        });
    }
    // 手动复位
    function handleReset() {
        http.post(baseUrl+"/crn/operator/handleReset", getReqParam(), function (res) {
            layer.msg(res.msg);
        });
    }
    // 输送设备日志输出 -----------------------------------------------------------------------
    function getSiteOutput() {
    function getCrnOutput() {
        $.ajax({
            url: baseUrl + "/crn/output/site",
            headers: {'token': localStorage.getItem('token')},
@@ -390,9 +432,9 @@
                if (res.code === 200) {
                    crnOutput(res.data);
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/login";
                    window.location.href = baseUrl + "/login";
                } else {
                    alert(res.msg);
                    console.log(res.msg);
                }
            }
        })
@@ -460,6 +502,11 @@
                "       <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";
        }
        $('#crn-msg-table tbody').after(html);