#
luxiaotao1123
2022-01-06 1e9c546bb09141c75559f0850a254d6f1d538005
src/main/webapp/views/crn.html
@@ -44,19 +44,39 @@
<!-- 日志监控板 -->
<div class="log-board">
    <!-- 执行命令 -->
    <!-- 执行命令 -->
    <div class="command-log">
        <h2>执行中的命令</h2>
        <h3>执行中的命令</h3>
        <div class="crn-command-item">
            <label>1#</label>
<!--            <button id="demoBtn-1" class="demoBtn" onclick="demoSwitch(this.id)">演示</button>-->
                        <span>&nbsp;</span>
            <button id="demoBtn-1" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
            <!--            <span>&nbsp;</span>-->
            <input id="crn1" disabled="disabled">
        </div>
        <div class="crn-command-item">
            <label>2#</label>
<!--            <button id="demoBtn-2" class="demoBtn" onclick="demoSwitch(this.id)">演示</button>-->
                        <span>&nbsp;</span>
            <button id="demoBtn-2" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
            <!--            <span>&nbsp;</span>-->
            <input id="crn2" disabled="disabled">
        </div>
        <div class="crn-command-item">
            <label>3#</label>
            <button id="demoBtn-3" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
            <!--            <span>&nbsp;</span>-->
            <input id="crn3" disabled="disabled">
        </div>
        <div class="crn-command-item">
            <label>4#</label>
            <button id="demoBtn-4" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
            <!--            <span>&nbsp;</span>-->
            <input id="crn4" disabled="disabled">
        </div>
        <div class="crn-command-item">
            <label>5#</label>
            <button id="demoBtn-5" class="demoBtn" onclick="demoSwitch(this.id)"> - </button>
            <!--            <span>&nbsp;</span>-->
            <input id="crn5" disabled="disabled">
        </div>
    </div>
    <!-- 堆垛机状态位信息 -->
@@ -70,13 +90,11 @@
                    <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>
@@ -96,7 +114,6 @@
                <th>目标站</th>
                <th>源库位</th>
                <th>目标库位</th>
                <th>异常</th>
                <th>走行速度(m/min)</th>
                <th>升降速度(m/min)</th>
                <th>叉牙速度(m/min)</th>
@@ -128,6 +145,9 @@
            <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>
                <label><input type="radio" name="crnSelect" value="3">&nbsp;3号堆垛机</label>
                <label><input type="radio" name="crnSelect" value="4">&nbsp;4号堆垛机</label>
                <label><input type="radio" name="crnSelect" value="5">&nbsp;5号堆垛机</label>
            </div>
        </div>
        <!-- 源站/源库位 选择 -->
@@ -229,6 +249,7 @@
    setInterval(function () {
        getCrnOutput();
        operatorBlockShow();
        initDemo();
    },500);
    // 判断手动操作模块是否可用
@@ -287,13 +308,11 @@
                        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].liftPos);
                        setVal(tr.children("td").eq(7), table[i-1].sitePos);
                        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);
                        setVal(tr.children("td").eq(6), table[i-1].forkOffset);
                        setVal(tr.children("td").eq(7), table[i-1].liftPos);
                        setVal(tr.children("td").eq(8), table[i-1].walkPos);
                        setVal(tr.children("td").eq(9), table[i-1].warnCode);
                        setVal(tr.children("td").eq(10), table[i-1].alarm);
                    }
                } else if (res.code === 403){
                    window.location.href = baseUrl+"/login";
@@ -327,14 +346,13 @@
                        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].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);
                        setVal(tr.children("td").eq(7), table[i-1].xspeed);
                        setVal(tr.children("td").eq(8), table[i-1].yspeed);
                        setVal(tr.children("td").eq(9), table[i-1].zspeed);
                        setVal(tr.children("td").eq(10), table[i-1].xdistance);
                        setVal(tr.children("td").eq(11), table[i-1].ydistance);
                        setVal(tr.children("td").eq(12), table[i-1].xduration);
                        setVal(tr.children("td").eq(13), table[i-1].yduration);
                    }
                } else if (res.code === 403){
                    window.location.href = baseUrl+"/login";
@@ -501,8 +519,6 @@
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "     </tr>\n";
        }
        $('#crn-state-table tbody').after(html);
@@ -538,7 +554,6 @@
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "       <td></td>\n" +
                "     </tr>\n";
        }
        $('#crn-msg-table tbody').after(html);
@@ -550,22 +565,45 @@
        crnOutputDom.scrollTop = crnOutputDom.scrollHeight;
    }
    // function demoSwitch(el) {
    //     var crnId = el.split("-")[1];
    //     layer.prompt({title: '请输入口令,并开始'+crnId+"号堆垛机演示", formType: 1, shadeClose: true}, function (pass, idx) {
    //         layer.close(idx);
    //         doDemo(crnId, pass); // 停止wcs系统
    //     });
    // }
    var crnDemoData;
    function initDemo() {
        $.ajax({
            url: baseUrl+"/crn/demo/status",
            async: false,
            method: 'GET',
            success: function (res) {
                if (res.code === 200) {
                    crnDemoData = res.data;
                    crnDemoData.forEach(function (e) {
                        $("#demoBtn-"+e.crnNo).html(e.demo?'停止':'演示');
                    })
                } else if (res.code === 403){
                    parent.location.href = baseUrl+"/login";
                }  else {
                    layer.msg(res.msg, {icon: 2});
                }
            }
        })
    }
    function demoSwitch(el) {
        var crnId = el.split("-")[1];
        layer.confirm(crnId + ' 号堆垛机确定开始演示吗?', function(){
            doDemo(crnId, 'root'); // 停止wcs系统
        var opt;
        if (crnDemoData == null) {
            initDemo();
        }
        for (var i = 0; i<crnDemoData.length; i++) {
            if (Number(crnDemoData[i].crnNo) === Number(crnId)) {
                opt = !crnDemoData[i].demo;
            }
        }
        layer.confirm(crnId + ' 号堆垛机确定'+ (opt?'开始':'停止') + '演示吗?', function(){
            doDemo(crnId, 'root', opt); // 停止wcs系统
        });
    }
    function doDemo(crnId, password) {
    function doDemo(crnId, password, opt) {
        // 加载tips
        var index = layer.load(1, {
            shade: [0.1,'#fff']
@@ -576,7 +614,8 @@
            // async: false,
            data: {
                crnId: Number(crnId),
                password: password
                password: password,
                opt: opt
            },
            method: 'POST',
            success: function (res) {
@@ -594,4 +633,4 @@
    }
</script>
</html>
</html>