|  |  |  | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 源站/源库位 选择 --> | 
|---|
|  |  |  | <div id="source-select" class="operator-item"> | 
|---|
|  |  |  | <span class="select-title">源站/源库位</span> | 
|---|
|  |  |  | <span class="select-title">源站</span> | 
|---|
|  |  |  | <div class="select-container"> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>站</span> | 
|---|
|  |  |  | <span>工位1源站</span> | 
|---|
|  |  |  | <label><input id="sourceStaNo" type="number" name="points" min="0" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--                        <div class="select-container-item">--> | 
|---|
|  |  |  | <!--                            <span>排</span>--> | 
|---|
|  |  |  | <!--                            <label><input id="sourceRow" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label>--> | 
|---|
|  |  |  | <!--                        </div>--> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>排</span> | 
|---|
|  |  |  | <label><input id="sourceRow" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>列</span> | 
|---|
|  |  |  | <span>工位2源站</span> | 
|---|
|  |  |  | <label><input id="sourceBay" type="number" name="points" min="0" style="background-color: #a9eeff" value="0" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>层</span> | 
|---|
|  |  |  | <label><input id="sourceLev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--                        <div class="select-container-item">--> | 
|---|
|  |  |  | <!--                            <span>层</span>--> | 
|---|
|  |  |  | <!--                            <label><input id="sourceLev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label>--> | 
|---|
|  |  |  | <!--                        </div>--> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!-- 目标站/目标库位 选择 --> | 
|---|
|  |  |  | <div id="target-select" class="operator-item"> | 
|---|
|  |  |  | <span class="select-title">目标站/目标库位</span> | 
|---|
|  |  |  | <span class="select-title">目标站</span> | 
|---|
|  |  |  | <div class="select-container"> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>站</span> | 
|---|
|  |  |  | <span>工位1目标站</span> | 
|---|
|  |  |  | <label><input id="staNo" type="number" name="points" min="0" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--                        <div class="select-container-item">--> | 
|---|
|  |  |  | <!--                            <span>排</span>--> | 
|---|
|  |  |  | <!--                            <label><input id="row" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label>--> | 
|---|
|  |  |  | <!--                        </div>--> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>排</span> | 
|---|
|  |  |  | <label><input id="row" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>列</span> | 
|---|
|  |  |  | <span>工位2目标站</span> | 
|---|
|  |  |  | <label><input id="bay" type="number" name="points" min="0" style="background-color: #a9eeff" value="0" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="select-container-item"> | 
|---|
|  |  |  | <span>层</span> | 
|---|
|  |  |  | <label><input id="lev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <!--                        <div class="select-container-item">--> | 
|---|
|  |  |  | <!--                            <span>层</span>--> | 
|---|
|  |  |  | <!--                            <label><input id="lev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label>--> | 
|---|
|  |  |  | <!--                        </div>--> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | <fieldset> | 
|---|
|  |  |  | <legend>手动操作</legend> | 
|---|
|  |  |  | <div class="button-group"> | 
|---|
|  |  |  | <button class="item" onclick="put()">入库</button> | 
|---|
|  |  |  | <button class="item" onclick="take()">出库</button> | 
|---|
|  |  |  | <button class="item" onclick="stockMove()">库位转移</button> | 
|---|
|  |  |  | <button class="item" onclick="put()">取放货</button> | 
|---|
|  |  |  | <button class="item" onclick="take()">取货</button> | 
|---|
|  |  |  | <button class="item" onclick="stockMove()">放货</button> | 
|---|
|  |  |  | <!--                        <button class="item" onclick="siteMove()">站到站</button>--> | 
|---|
|  |  |  | <!--                <button class="item" onclick="bacOrigin()">回原点</button>--> | 
|---|
|  |  |  | <!--                <button class="item" onclick="reverseOrigin()">反原点</button>--> | 
|---|
|  |  |  | 
|---|
|  |  |  | // 初始化 | 
|---|
|  |  |  | var rgvOutputDom = document.getElementById("rgv-output"); | 
|---|
|  |  |  | $(document).ready(function() { | 
|---|
|  |  |  | getCommandLog(); | 
|---|
|  |  |  | // getCommandLog(); | 
|---|
|  |  |  | initRgvStateTable(); | 
|---|
|  |  |  | getRgvStateInfo(); | 
|---|
|  |  |  | initRgvMsgTable(); | 
|---|
|  |  |  | 
|---|
|  |  |  | setInterval(function () { | 
|---|
|  |  |  | getRgvStateInfo(); | 
|---|
|  |  |  | getRgvMsgInfo(); | 
|---|
|  |  |  | getCommandLog(); | 
|---|
|  |  |  | // getCommandLog(); | 
|---|
|  |  |  | },1000); | 
|---|
|  |  |  | setInterval(function () { | 
|---|
|  |  |  | getRgvOutput(); | 
|---|
|  |  |  | operatorBlockShow(); | 
|---|
|  |  |  | initDemo(); | 
|---|
|  |  |  | // initDemo(); | 
|---|
|  |  |  | },500); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 判断手动操作模块是否可用 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取堆垛机执行中的命令 | 
|---|
|  |  |  | // 获取RGV执行中的命令 | 
|---|
|  |  |  | function getCommandLog() { | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl + "/rgv/command/ongoing", | 
|---|
|  |  |  | 
|---|
|  |  |  | function rgvOutput(content){ | 
|---|
|  |  |  | rgvOutputDom.value += content; | 
|---|
|  |  |  | rgvOutputDom.scrollTop = rgvOutputDom.scrollHeight; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var rgvDemoData; | 
|---|
|  |  |  | function initDemo() { | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/rgv/demo/status", | 
|---|
|  |  |  | async: false, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | rgvDemoData = res.data; | 
|---|
|  |  |  | rgvDemoData.forEach(function (e) { | 
|---|
|  |  |  | $("#demoBtn-"+e.rgvNo).html(e.demo?'停止':'演示'); | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | parent.location.href = baseUrl+"/login"; | 
|---|
|  |  |  | }  else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function demoSwitch(el) { | 
|---|
|  |  |  | var rgvId = el.split("-")[1]; | 
|---|
|  |  |  | var opt; | 
|---|
|  |  |  | if (rgvDemoData == null) { | 
|---|
|  |  |  | initDemo(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (var i = 0; i<rgvDemoData.length; i++) { | 
|---|
|  |  |  | if (Number(rgvDemoData[i].rgvNo) === Number(rgvId)) { | 
|---|
|  |  |  | opt = !rgvDemoData[i].demo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | layer.confirm(rgvId + ' 号堆垛机确定'+ (opt?'开始':'停止') + '演示吗?', function(){ | 
|---|
|  |  |  | doDemo(rgvId, 'root', opt); // 停止wcs系统 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function doDemo(rgvId, password, opt) { | 
|---|
|  |  |  | // 加载tips | 
|---|
|  |  |  | var index = layer.load(1, { | 
|---|
|  |  |  | shade: [0.1,'#fff'] | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+ "/rgv/demo/switch", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | // async: false, | 
|---|
|  |  |  | data: { | 
|---|
|  |  |  | rgvId: Number(rgvId), | 
|---|
|  |  |  | password: password, | 
|---|
|  |  |  | opt: opt | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(index); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | window.location.href = baseUrl+"/login"; | 
|---|
|  |  |  | }  else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </script> | 
|---|