From cb15c6400b7dfc3855e5fdd76b8b217bf6bc9567 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <xltys1995> Date: 星期三, 30 十二月 2020 10:55:09 +0800 Subject: [PATCH] # --- src/main/webapp/views/crn.html | 366 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 317 insertions(+), 49 deletions(-) diff --git a/src/main/webapp/views/crn.html b/src/main/webapp/views/crn.html index 2a5be06..4747862 100644 --- a/src/main/webapp/views/crn.html +++ b/src/main/webapp/views/crn.html @@ -11,8 +11,33 @@ <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> + .demoBtn { + vertical-align: middle; + width: 20%; + height: 25px; + left: 0; + top: 0; + text-shadow: inherit; + font-size: 15px; + margin-left: 5px; + margin-right: 5px; + display: inline-block; + background-color: #FF5722; + border: none; + color: #FFF; + box-shadow: 1px 1px 5px #B6B6B6; + border-radius: 3px; + cursor: pointer; + } + .demoBtn:hover { + opacity: 0.8 + } + .demoBtn:focus { + outline: 0; + } </style> </head> <body> @@ -23,12 +48,14 @@ <h2>鎵ц涓殑鍛戒护</h2> <div class="crn-command-item"> <label>1#</label> - <span> </span> + <button id="demoBtn-1" class="demoBtn" onclick="demoSwitch(this.id)">婕旂ず</button> + <!-- <span> </span>--> <input id="crn1" disabled="disabled"> </div> <div class="crn-command-item"> <label>2#</label> - <span> </span> + <button id="demoBtn-2" class="demoBtn" onclick="demoSwitch(this.id)">婕旂ず</button> + <!-- <span> </span>--> <input id="crn2" disabled="disabled"> </div> </div> @@ -39,17 +66,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 +90,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>璧拌閫熷害锛坢/min)</th> + <th>鍗囬檷閫熷害锛坢/min)</th> + <th>鍙夌墮閫熷害锛坢/min)</th> + <th>璧拌璺濈(Km)</th> + <th>鍗囬檷璺濈(Km)</th> + <th>璧拌鏃堕暱(H)</th> + <th>鍗囬檷鏃堕暱(H)</th> </tr> </thead> <tbody> @@ -81,14 +113,21 @@ <!-- 鎵嬪姩鎿嶄綔 --> <div class="crn-operation"> + <!-- 閬僵灞� --> + <div class="crn-operation-shade"> + <span class="crn-operation-shade-span"> + WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔 + </span> + </div> + <!-- 璁惧浠诲姟閫夋嫨 --> <div class="task-select"> <!-- 鍫嗗灈鏈洪�夋嫨 --> <div id="crn-select" class="operator-item"> <span class="select-title">鍫嗗灈鏈哄彿</span> <div class="select-container"> - <label><input type="radio" name="crn" value="1" checked> 1鍙峰爢鍨涙満</label> - <label><input type="radio" name="crn" value="2"> 2鍙峰爢鍨涙満</label> + <label><input type="radio" name="crnSelect" value="1" checked> 1鍙峰爢鍨涙満</label> + <label><input type="radio" name="crnSelect" value="2"> 2鍙峰爢鍨涙満</label> </div> </div> <!-- 婧愮珯/婧愬簱浣� 閫夋嫨 --> @@ -97,19 +136,19 @@ <div class="select-container"> <div class="select-container-item"> <span>绔�</span> - <label><input type="number" name="points" min="0" /></label> + <label><input id="sourceStaNo" type="number" name="points" min="0" /></label> </div> <div class="select-container-item"> <span>鎺�</span> - <label><input type="number" name="points" min="0" style="background-color: #a9eeff" /></label> + <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 type="number" name="points" min="0" style="background-color: #a9eeff" /></label> + <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 type="number" name="points" min="0" style="background-color: #a9eeff" /></label> + <label><input id="sourceLev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> </div> </div> </div> @@ -119,19 +158,19 @@ <div class="select-container"> <div class="select-container-item"> <span>绔�</span> - <label><input type="number" name="points" min="0" /></label> + <label><input id="staNo" type="number" name="points" min="0" /></label> </div> <div class="select-container-item"> <span>鎺�</span> - <label><input type="number" name="points" min="0" style="background-color: #a9eeff" /></label> + <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 type="number" name="points" min="0" style="background-color: #a9eeff" /></label> + <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 type="number" name="points" min="0" style="background-color: #a9eeff" /></label> + <label><input id="lev" type="number" name="points" min="1" style="background-color: #a9eeff" value="1" /></label> </div> </div> </div> @@ -142,16 +181,18 @@ <fieldset> <legend>鎵嬪姩鎿嶄綔</legend> <div class="button-group"> - <button class="item">鍏ュ簱</button> - <button class="item">鍑哄簱</button> - <button class="item">搴撲綅杞Щ</button> - <button class="item">绔欏埌绔�</button> - <button class="item">鍧愭爣绉诲姩</button> - <button class="item">鍥炲師鐐�</button> - <button class="item">浠诲姟瀹屾垚</button> - <button class="item">鏆傚仠</button> - <button class="item">鍚姩</button> - <button class="item">娓呴櫎鍛戒护</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> + <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="clearCommand()">娓呴櫎鍛戒护</button> + <button class="item" onclick="handleReset()">澶嶄綅</button> </div> </fieldset> </div> @@ -163,7 +204,6 @@ </div> </body> <script> - // 绌虹櫧琛屾暟 var crnStateTableBlankRows = 0; var crnMsgTableBlankRows = 0; @@ -173,18 +213,57 @@ // 鍒濆鍖� var crnOutputDom = document.getElementById("crn-output"); $(document).ready(function() { + getCommandLog(); initCrnStateTable(); getCrnStateInfo(); initCrnMsgTable(); + getCrnMsgInfo(); + operatorBlockShow(); }); // 鏁版嵁鏇存柊 setInterval(function () { getCrnStateInfo(); - },500); + getCrnMsgInfo(); + 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() { + $.ajax({ + url: baseUrl + "/crn/command/ongoing", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + success: function (res) { + if (res.code === 200) { + var commands = res.data; + for (var i=0; i<commands.length;i++){ + $("#crn"+commands[i].crnNo).val(commands[i].command); + } + } else if (res.code === 403) { + window.location.href = baseUrl + "/login"; + } else { + console.log(res.msg); + } + } + }) + } // 鍫嗗灈鏈轰俊鎭〃鑾峰彇 ---- 琛ㄤ竴 function getCrnStateInfo() { @@ -203,30 +282,180 @@ 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); } } }); } - // 杈撻�佽澶囨棩蹇楄緭鍑� - function getSiteOutput() { + // 鍫嗗灈鏈烘暟鎹〃鑾峰彇 ---- 琛ㄤ簩 + function getCrnMsgInfo() { + var tableEl = $('#crn-msg-table'); + $.ajax({ + url: baseUrl+ "/crn/table/crn/msg", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + success: function (res) { + if (res.code === 200){ + var table = res.data; + if (table.length > crnStateTableBlankRows && table.length !== crnMsgTableFullRows) { + initCrnStateTable(table.length-crnStateTableBlankRows); + crnMsgTableFullRows = 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].crnNo); + 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].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){ + window.location.href = baseUrl+"/login"; + } else { + console.log(res.msg); + } + } + }); + } + + // 鍫嗗灈鏈烘墜鍔ㄦ搷浣滃尯 ----------------------------------------------------------------------- + + function getReqParam() { + var crnNo = $('input[name="crnSelect"]:checked').val(); + var sourceStaNo = $('#sourceStaNo').val(); + var sourceRow = $('#sourceRow').val(); + var sourceBay = $('#sourceBay').val(); + var sourceLev = $('#sourceLev').val(); + var staNo = $('#staNo').val(); + var row = $('#row').val(); + var bay = $('#bay').val(); + var lev = $('#lev').val(); + return { + crnNo: crnNo, + sourceStaNo: sourceStaNo, + sourceRow: sourceRow, + sourceBay: sourceBay, + sourceLev: sourceLev, + staNo: staNo, + row: row, + bay: bay, + lev: lev + }; + } + + // 鍏ュ簱 + function put() { + http.post(baseUrl+"/crn/operator/put", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 鍑哄簱 + function take() { + http.post(baseUrl+"/crn/operator/take", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 搴撲綅杞Щ + function stockMove() { + http.post(baseUrl+"/crn/operator/stockMove", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 绔欏埌绔� + function siteMove() { + http.post(baseUrl+"/crn/operator/siteMove", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 鍧愭爣绉诲姩 + function coorMove() { + http.post(baseUrl+"/crn/operator/coorMove", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 鍥炲師鐐� + function bacOrigin() { + http.post(baseUrl+"/crn/operator/bacOrigin", getReqParam(), function (res) { + 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) { + layer.msg(res.msg); + }); + } + + // 鏆傚仠 + function pause() { + http.post(baseUrl+"/crn/operator/pause", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 鍚姩 + function boot() { + http.post(baseUrl+"/crn/operator/boot", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 娓呴櫎鍛戒护 + function clearCommand() { + http.post(baseUrl+"/crn/operator/clearCommand", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 鎵嬪姩澶嶄綅 + function handleReset() { + http.post(baseUrl+"/crn/operator/handleReset", getReqParam(), function (res) { + layer.msg(res.msg); + }); + } + + // 杈撻�佽澶囨棩蹇楄緭鍑� ----------------------------------------------------------------------- + function getCrnOutput() { $.ajax({ url: baseUrl + "/crn/output/site", headers: {'token': localStorage.getItem('token')}, @@ -235,9 +464,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); } } }) @@ -305,6 +534,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); @@ -316,7 +550,41 @@ 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绯荤粺 + }); + } + function doDemo(crnId, password) { + // 鍔犺浇tips + var index = layer.load(1, { + shade: [0.1,'#fff'] + }); + $.ajax({ + url: baseUrl+ "/crn/demo/switch", + headers: {'token': localStorage.getItem('token')}, + // async: false, + data: { + crnId: Number(crnId), + password: password + }, + 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> </html> \ No newline at end of file -- Gitblit v1.9.1