From d63e87164a8dd1a178301080dd9a450802149f97 Mon Sep 17 00:00:00 2001 From: whycq <whycq> Date: 星期三, 25 五月 2022 09:06:22 +0800 Subject: [PATCH] # ycq --- src/main/webapp/views/test.html | 35 + src/main/webapp/views/render.js | 709 +++++++++++++++++++++ src/main/webapp/static/css/render.css | 475 ++++++++++++++ src/main/webapp/views/render.html | 711 +++++++++++++++++++++ 4 files changed, 1,930 insertions(+), 0 deletions(-) diff --git a/src/main/webapp/static/css/render.css b/src/main/webapp/static/css/render.css new file mode 100644 index 0000000..6f7e0a4 --- /dev/null +++ b/src/main/webapp/static/css/render.css @@ -0,0 +1,475 @@ +* { + margin: 0; + padding: 0; + overflow: hidden; +} +body { + height: 1080px; + width: 1920px; +} +#main { + height: 100%; + width: 100%; + background-color: rgb(108,167,168); +} +.head { + height: 10%; + width: 100%; + color: #FFFFFF; +} +.head-left { + height: 100%; + width: 20%; + display: inline-block; +} +.head-right { + height: 100%; + width: 30%; + display: inline-block; + float: right; +} +.head h1 { + display: inline; + margin-top: 2%; + margin-left: 2%; + font-weight: 400; + letter-spacing:3px; +} +.head h6 { + display: inline; + margin-left: 2%; + font-weight: 400; +} + +img { + float: right; + margin-top: 10px; + margin-right: 10px; +} +.rack { + position: absolute; + display: inline-block; +} +.rackDescs { + height: 100%; + width: 100%; + position: absolute; + display: inline-block; + text-align: center; +} +.stn { + text-align: center; + background-color: rgb(120,255,129); + position: absolute; +} +.crn { + position: absolute; + display: inline-block; + background-color: #00ff90; + z-index: 999; +} +.track { + position: absolute; + display: inline-block; + background-color: #000000; +} +.item { + border: 1px solid rgb(194,76,65); + color: rgb(194,76,65); + height: 100%; + width: 100%; +} + +/*鎿嶄綔鏄剧ず鏍�*/ +#body { + width: 100%; + height: 23% ; + position: absolute; + bottom: 2.5%; +} +/* 鎺у埗寮�鍏� */ +.system-state { + display: inline-block; + width: 15%; + height: 100%; + background-color: rgba(0, 0, 0, 0.3); + border-radius: 15px; + margin-left: 1%; +} +/* 鍫嗗灈鏈虹姸鎬� */ +.machine-status { + display: inline-block; + width: 15%; + height: 100%; + background-color: rgba(0, 0, 0, 0.3); + border-radius: 15px; + margin-left: 1%; +} +.state-ss { + margin-left: 60px; + +} + +/* 杈撻�佺嚎鐘舵�� */ +.line-status { + display: inline-block; + width: 15%; + height: 100%; + background-color: rgba(0, 0, 0, 0.3); + border-radius: 15px; + margin-left: 1%; +} +.line-ss { + display: inline-block; + float: right; + height: 15px; + width: 40px; + margin-top: 10px; + margin-right: 15px; + line-height: 15px; + text-align: center; + background-color: rgba(5, 5, 5, 0.3); + color: #ffdd00; +} +/* 鏉$爜鎵弿鍣� */ +.bar-code { + display: inline-block; + width: 49%; + height: 100%; + background-color: rgba(0, 0, 0, 0.3); + border-radius: 15px; + margin-left: 1%; +} +/*鎵爜琛ㄥ崟*/ +.tablebox { + display: inline-block; + width: 290px; + height: 162px; + margin-left: 1.5%; + color: white; + font-size: 14px; + list-style: none; + line-height: 27px; + text-indent: 10px; +} +.table-head { + width: 100%; + height: 27px; + background:linear-gradient(to right, rgb(94, 193, 184),rgb(12,71,63)); +} +.right { + float: right; + text-indent: 10px; + padding-right: 10px; +} +.table-body li { + background-color: #5D7677; +} +.table-body li:nth-child(even) { + background-color: #4A6565; +} + + + +/* 鎺у埗琛ㄥご */ +.body-head { + height: 35px; + width: 100%; + background-image: url(../images/status_bar_1.png); + background-repeat: no-repeat; + margin-left: 5%; + margin-top: 20px; + text-indent: 25px; + color: white; +} + + +.system-icon-open { + width: 153px; + height: 153px; + background-image: url(../images/start48.png); + display: inline-block; +} +.system-icon-close { + width: 153px; + height: 153px; + background-image: url(../images/stop48.png); + display: inline-block; +} +.switch_r { + color: #FFFFFF; + font-size: 14px; + width: 130px; + height: 153px; + float: right; + padding-top: 30px; +} +#system-run-desc { + font-size: 20px; + margin-top: 15px; +} +.state { + height: 34px; + width: 200px; + background-color: rgba(255,255,255,0.1); + background-image: url(../images/stacker.png); + background-repeat: no-repeat; + border-radius: 17px 0 0 17px; + padding-left: 50px; + line-height: 34px; + margin-bottom: 10px; + margin-left: 5%; + color: #FFFFFF; + font-size: 10px; +} +.states { + background-image: url(../images/line.png); + margin-bottom:54px; +} +.button { + margin-left: 5%; + font-size: 14px; + color: #FFFFFF; +} +/* 绔欑偣 */ +.site { + position: absolute; + color: #333; + cursor: pointer; + text-align: center; + background-color: rgb(120,255,129); + font-size: 14px; +} +/*绌虹珯鐐�*/ +.site-k { + border: 1px solid rgb(108,167,168); + background-color: rgb(108, 167, 168); +} +/* 鍏ュ簱 */ +.machine-put-flag { + padding: 0 10px; + background-color: rgb(163,214,242); +} +/* 鍑哄簱 */ +.machine-take-flag { + padding: 0 10px; + background-color: rgb(151,180,0); +} +/* 搴撳埌搴� */ +.machine-stock-move-flag { + padding: 0 10px; + background-color: rgb(58,77,249); +} +/* 绔欏埌绔� */ +.machine-site-move-flag { + padding: 0 10px; + background-color: rgb(240,140,10); +} +/* PToP */ +.machine-p-move-flag { + padding: 0 10px; + background-color: rgb(29,152,23); +} +/* 寮傚父 */ +.machine-error-flag { + padding: 0 10px; + background-color: rgb(252,48,48); +} +/* 鑷姩 */ +.machine-auto-flag { + padding: 0 10px; + background-color: rgb(132,255,115); +} +/* 闈炶嚜鍔�/鎵嬪姩 */ +.machine-unauto-flag { + padding: 0 10px; + background-color: rgb(184,184,184); +} +/* 鑷姩+鏈夌墿+ID */ +.site-auto-run-id { + background-color: rgb(252,48,48); +} +/* 鑷姩+鏈夌墿 */ +.site-auto-run { + background-color: rgb(250,81,246); +} +/* 鑷姩+ID */ +.site-auto-id { + background-color: rgb(196,196,0); +} +/* 鑷姩 */ +.site-auto { + background-color: rgb(120,255,129); +} +/* 闈炶嚜鍔�/鎵嬪姩 */ +.site-unauto { + background-color: rgb(184,184,184); +} +#code { + background-image: url(../images/status_bar_2.png); + background-repeat: no-repeat; + margin-left: 2%; +} +/* 鍫嗗灈鏈� */ +.machine { + position: absolute; + background-color: rgb(108,167,168); + margin-left: 1116px; + height: 20px; + width: 80px; + background-image: url("../images/Crane_auto.png"); + background-repeat: no-repeat; + background-size:100% 100%; + background-position: top center; + cursor: pointer; + z-index: 99; +} +/* 鍏ュ簱 */ +.machine-pakin { + background-image: url("../images/Crane_store.png"); +} +/* 鍑哄簱 */ +.machine-pakout { + background-image: url("../images/Crane_retrieve.png"); +} +/* 搴撳埌搴� */ +.machine-stock-move { + background-image: url("../images/Crane_loctoloc.png"); +} +/* 绔欏埌绔� */ +.machine-site-move { + background-image: url("../images/Crane_stntostn.png"); +} +/* p to p */ +.machine-p-move { + background-image: url("../images/Crane_hptoohp.png"); +} +/* 寮傚父 */ +.machine-error { + background-image: url("../images/Crane_error.png"); +} +/* 鑷姩 */ +.machine-auto { + background-image: url("../images/Crane_auto.png"); +} +/* 闈炶嚜鍔�/鏀跺埌 */ +.machine-un-auto { + background-image: url("../images/Crane_manual.png"); +} + +/* 鍫嗗灈鏈哄脊绐� */ +#crnWindow { + width: 291px; + height: 365px; + background-image: url(../images/Popup-yellow.png); + position: fixed; + color:white; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); + z-index: 101; +} +/* 杈撻�佽澶囧脊绐� */ +#siteWindow { + width: 291px; + height: 336px; + background-image: url(../images/Popup-green.png); + position: fixed; + color:white; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); + z-index: 101; +} +#siteWindow-head { + width: 291px; + height: 55px; + line-height: 55px; + margin-left: 25px; + color: #000000; + font-weight: 700; + letter-spacing: 2px; +} +#siteWindow-head .detailed { + display: inline-block; +} +#siteWindow-head button { + width: 25px; + height: 25px; + padding: 0px; + border: none; + border-radius: 25px; + background-image: url(../images/siteclose.png); + display: inline-block; + float: right; + margin-top: 15px; + margin-right: 50px; +} +#crnWindow-head { + width: 291px; + height: 55px; + line-height: 55px; + margin-left: 55px; + color: #000000; + font-weight: 700; + letter-spacing: 2px; + +} +#crnWindow-head .detailed { + display: inline-block; +} +#crnWindow-head button { + width: 25px; + height: 25px; + padding: 0px; + border: none; + border-radius: 25px; + background-image: url(../images/siteclose.png); + display: inline-block; + float: right; + margin-top: 15px; + margin-right: 80px; +} + + + +/* 寮圭獥 */ +form .form-item { + display: inline-block; + padding-left: 10px; +} +form .form-item-label { + display: inline-block; + width: 90px; + font-size: 10px; +} +form .form-item-input { + display: inline-block; + width: 180px; + +} +form .form-item-input input { + background-color: rgba(255,255,255,.3); + color: #FFFFFF; + padding: 0; + border: none; + border-radius: 2px; + height: 18px; + padding-left: 10px; +} +/* checkbox */ +form .form-item-checkbox { + display: inline-block; + padding-left: 10px; + width: 20%; +} +form .form-item-label-checkbox { + display: inline-block; + width: auto; + font-size: 14px; +} +form .form-item-input-checkbox { + display: inline-block; + width: auto; + +} diff --git a/src/main/webapp/views/render.html b/src/main/webapp/views/render.html new file mode 100644 index 0000000..b8c025e --- /dev/null +++ b/src/main/webapp/views/render.html @@ -0,0 +1,711 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>鑷姩浠撳簱wcs绯荤粺</title> + <link rel="stylesheet" href="../static/css/render.css"> + <script src="../static/js/jquery/jquery-3.3.1.min.js"></script> + <script src="../static/js/layer/layer.js"></script> + <script src="./render.js"></script> + <script src="../static/js/common.js"></script> + + +</head> +<body> + <div id="main"> + <div class="head"> + <div class="head-left"> + <h1>鑷姩浠撳簱WCS鐩戞帶鍥�</h1> + <h6>AUTOMATIC WAREHOUSE WCS MONITORING DIAGRAM</h6> + </div> + <div class="head-right"> + <img src="../static/images/zy-logo.png" alt="涓壃" height="44" width="80"> + </div> + </div> + <!-- 璐ф灦 + 鍫嗗灈鏈� + 鍏ュ簱绔欑偣 --> + <div class="main-part"> + + </div> + <div id="body"> + <!-- 鎬诲紑鍏� --> + <div class="system-state"> + <div class="body-head">鎬诲紑鍏�</div> + <div class="switch"> + <div id="system-icon" class="system-icon-open" onclick="systemSwitch()"></div> + <div class="switch_r"> + <p>绯荤粺鐘舵��</p> + <p id="system-run-desc">绯荤粺杩愯涓�</p> + </div> + </div> + </div> + <!-- 鍫嗗灈鏈虹姸鎬� --> + <div class="machine-status"> + <div class="body-head">鍫嗗灈鏈虹姸鎬�</div> + <div class="state"> + <span>鍫嗗灈鏈� 1</span> + <span class="state-ss machine-put-flag ">鍏ュ簱</span> + </div> + <div class="state"> + <span>鍫嗗灈鏈� 2</span> + <span class="state-ss machine-auto-flag ">鑷姩</span> + + </div> + <div class="button"><span>鎵�鏈夌姸鎬�</span></div> + <div class="button item-group"> + <span class="machine-put-flag">鍏ュ簱</span> + <span class="machine-take-flag">鍑哄簱</span> + <span class="machine-stock-move-flag">搴撳埌搴�</span> + <span class="machine-site-move-flag">绔欏埌绔�</span> + <span class="machine-p-move-flag">PToP</span> + <span class="machine-error-flag">寮傚父</span> + <span class="machine-auto-flag">鑷姩</span> + <span class="machine-unauto-flag">闈炶嚜鍔�/鎵嬪姩</span> + </div> + </div> + <div class="line-status"> + <div class="body-head">杈撻�佺嚎鐘舵��</div> + <div class="state states"> + <span>杩愯緭绾挎�绘暟</span> + <span class="line-ss">58</span> + </div> + <div class="button"><span>鎵�鏈夌姸鎬�</span></div> + <div class="button item-group"> + <span class="site-auto-run-id">鑷姩+鏈夌墿+ID</span> + <span class="site-auto-run">鑷姩+鏈夌墿</span> + <span class="site-auto-id">鑷姩+ID</span> + <span class="site-auto">鑷姩</span> + <span class="site-unauto">闈炶嚜鍔�/鎵嬪姩</span> + </div> + </div> + <div class="bar-code"> + <div class="body-head" id="code">鏉$爜鎵弿鍣�</div> + <div class="tablebox"> + <div class="table-head"> + <li><span>鏉$爜鍚嶇О</span><span class="right">鎵爜鏃堕棿</span></li> + </div> + <div id="barcode1" class="table-body"> + + </div> + </div> + <div class="tablebox"> + <div class="table-head"> + <li><span>鏉$爜鍚嶇О</span><span class="right">鎵爜鏃堕棿</span></li> + </div> + <div id="barcode2" class="table-body"> + + </div> + </div> + <div class="tablebox"> + <div class="table-head"> + <li><span>鏉$爜鍚嶇О</span><span class="right">鎵爜鏃堕棿</span></li> + </div> + <div id="barcode3" class="table-body"> + + </div> + </div> + </div> + </div> + <!-- 鍫嗗灈鏈哄脊绐� --> + <div id="crnWindow" style="display: none;" class="animate__animated animate__fadeIn"> + <div id="crnWindow-head"> + <div class='detailed'></div> + <button></button> + </div> + <form> + <!-- 鍫嗗灈鏈哄彿 --> + <div class="form-item"> + <div class="form-item-label" style> + <span>鍫嗗灈鏈哄彿锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="crnNo" value=""> + </div> + </div> + <!-- 宸ヤ綔鍙� --> + <div class="form-item"> + <div class="form-item-label"> + <span>宸ヤ綔鍙凤細</span> + </div> + <div class="form-item-input"> + <input type="text" name="workNo" value=""> + </div> + </div> + <!-- 绔欐簮 --> + <div class="form-item"> + <div class="form-item-label"> + <span>绔欐簮锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="sourceStaNo" value=""> + </div> + </div> + <!-- 鐩爣绔� --> + <div class="form-item"> + <div class="form-item-label"> + <span>鐩爣绔欙細</span> + </div> + <div class="form-item-input"> + <input type="text" name="staNo" value=""> + </div> + </div> + <!-- 宸ヤ綔鐘舵�� --> + <div class="form-item"> + <div class="form-item-label"> + <span>宸ヤ綔鐘舵�侊細</span> + </div> + <div class="form-item-input"> + <input type="text" name="wrkSts" value=""> + </div> + </div> + <!-- 鍑哄叆绫诲瀷 --> + <div class="form-item"> + <div class="form-item-label"> + <span>鍑哄叆绫诲瀷锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="ioType" value=""> + </div> + </div> + <!-- 婧愬簱浣� --> + <div class="form-item"> + <div class="form-item-label"> + <span>婧愬簱浣嶏細</span> + </div> + <div class="form-item-input"> + <input type="text" name="sourceLocNo" value=""> + </div> + </div> + <!-- 鐩爣搴撲綅 --> + <div class="form-item"> + <div class="form-item-label"> + <span>鐩爣搴撲綅锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="locNo" value=""> + </div> + </div> + <!-- 鍫嗗灈鏈虹姸鎬� --> + <div class="form-item"> + <div class="form-item-label"> + <span>鍫嗗灈鏈虹姸鎬侊細</span> + </div> + <div class="form-item-input"> + <input type="text" name="crnStatus" value=""> + </div> + </div> + <!-- 寮傚父 --> + <div class="form-item"> + <div class="form-item-label"> + <span>寮傚父锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="error" value=""> + </div> + </div> + </form> + </div> + <!-- 杈撻�佽澶囧脊绐� --> + <div id="siteWindow" style="display: none;" class="animate__animated animate__fadeIn"> + <!-- 琛ㄥご --> + <div id="siteWindow-head"> + <div class='detailed'></div> + <button></button> + </div> + <form> + <!-- 璁惧鍙� --> + <div class="form-item"> + <div class="form-item-label"> + <span>璁惧鍙凤細</span> + </div> + <div class="form-item-input"> + <input type="text" name="siteId" value=""> + </div> + </div> + <!-- 宸ヤ綔鍙� --> + <div class="form-item"> + <div class="form-item-label"> + <span>宸ヤ綔鍙凤細</span> + </div> + <div class="form-item-input"> + <input type="text" name="workNo" value=""> + </div> + </div> + <!-- 宸ヤ綔鐘舵�� --> + <div class="form-item"> + <div class="form-item-label"> + <span>宸ヤ綔鐘舵�侊細</span> + </div> + <div class="form-item-input"> + <input type="text" name="wrkSts" value=""> + </div> + </div> + <!-- 鑷姩 --> + <div class="form-item-checkbox"> + <div class="form-item-label-checkbox"> + <span>鑷姩</span> + </div> + <div class="form-item-input-checkbox"> + <input type="checkbox" name="autoing"> + </div> + </div> + <!-- 鏈夌墿 --> + <div class="form-item-checkbox"> + <div class="form-item-label-checkbox"> + <span>鏈夌墿</span> + </div> + <div class="form-item-input-checkbox"> + <input type="checkbox" name="loading"> + </div> + </div> + <!-- 鑳藉叆 --> + <div class="form-item-checkbox"> + <div class="form-item-label-checkbox"> + <span>鑳藉叆</span> + </div> + <div class="form-item-input-checkbox"> + <input type="checkbox" name="canining"> + </div> + </div> + <!-- 鑳藉嚭 --> + <div class="form-item-checkbox"> + <div class="form-item-label-checkbox"> + <span>鑳藉嚭</span> + </div> + <div class="form-item-input-checkbox"> + <input type="checkbox" name="canouting"> + </div> + </div> + <!-- 鍑哄叆绫诲瀷 --> + <div class="form-item"> + <div class="form-item-label"> + <span>鍑哄叆绫诲瀷锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="ioType" value=""> + </div> + </div> + <!-- 婧愮珯 --> + <div class="form-item"> + <div class="form-item-label"> + <span>婧愮珯锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="sourceStaNo" value=""> + </div> + </div> + <!-- 鐩爣绔� --> + <div class="form-item"> + <div class="form-item-label"> + <span>鐩爣绔欙細</span> + </div> + <div class="form-item-input"> + <input type="text" name="staNo" value=""> + </div> + </div> + <!-- 婧愬簱浣� --> + <div class="form-item"> + <div class="form-item-label"> + <span>婧愬簱浣嶏細</span> + </div> + <div class="form-item-input"> + <input type="text" name="sourceLocNo" value=""> + </div> + </div> + <!-- 鐩爣搴撲綅 --> + <div class="form-item"> + <div class="form-item-label"> + <span>鐩爣搴撲綅锛�</span> + </div> + <div class="form-item-input"> + <input type="text" name="locNo" value=""> + </div> + </div> + + </form> + </div> + </div> + +</body> + +</html> +<script> + getMap(); +</script> +<script> + setInterval(function () { + getCodeData(); + renderBarCode(); + }, 1000) + var tData = [],tData1 = [],tData2 = [],tData3 = []; + function getCodeData() { + $.ajax({ + url: baseUrl + '/console/barcode/output/site', + method: 'GET', + success: function (res) { + if (res.code === 200) { + tData = eval(res.data); + if (tData.length <= 5) { + tData1 = tData + } else if (tData.length <= 10) { + tData1 = tData.slice(0, 5) + tData.splice(0, 5) + tData2 = tData + } else if (tData.length <= 15) { + tData1 = tData.slice(0, 5) + tData2 = tData.slice(6, 10) + tData.splice(0, 10) + tData3 = tData + } else { + tData = tData.slice(-15) + tData1 = tData.slice(-15) + tData2 = tData.slice(-10) + tData3 = tData.slice(-5) + } + } + } + }) + } + function renderBarCode() { + for (var i = 0; i < tData1.length; i++) { + var str1 = '<li><span>' + tData1[i].barcode + '</span><span class="right">' + tData1[i].time + '</span></li>' + $('#barcode1').append(str1) + } + for (var j = 0; j < tData2.length; j++) { + var str2 = '<li><span>' + tData2[j].barcode + '</span><span class="right">' + tData2[j].time + '</span></li>' + $('#barcode2').append(str2) + } + for (var k = 0; k < tData3.length; k++) { + var str3 = '<li><span>' + tData3[k].barcode + '</span><span class="right">' + tData3[k].time + '</span></li>' + $('#barcode3').append(str3) + } + } +</script> +<script type="text/javascript"> + // 寮圭獥绔欑偣淇℃伅 + $('.site').on('click', function () { + var id = this.id.split("-")[1]; + $("#siteWindow").attr("style", "display:block;");//鏄剧ずdiv + $("#crnWindow").attr("style", "display:none;"); + $(".detailed").empty(); + $('.detailed').append(id + '绔欑偣璇︾粏淇℃伅'); + $.ajax({ + url: baseUrl + "/console/site/detail", + headers: { + 'token': localStorage.getItem('token') + }, + data: { + siteId: id + }, + method: 'post', + success: function (res) { + for (var val in res.data) { + var find = $("#siteWindow").find(":input[name='" + val + "']"); + if (find[0].type === 'text') { + find.val(res.data[val]); + } else if (find[0].type === 'checkbox') { + find.attr("checked", res.data[val] === 'Y'); + } + } + } + + }) + + }); + // 鍫嗗灈鏈轰俊鎭� + $('.machine').on('click', function () { + var id = this.id.split("-")[1]; + $("#crnWindow").attr('style', 'display:block;'); + $("#siteWindow").attr("style", "display:none;"); + $('.detailed').empty(); + $('.detailed').append(id + '鍙峰爢鍨涙満'); + $.ajax({ + url: baseUrl + "/console/crn/detail", + headers: { + 'token': localStorage.getItem('token') + }, + data: { + crnNo: id + }, + method: 'post', + success: function (res) { + for (var val in res.data) { + var find = $("#crnWindow").find(":input[name='" + val + "']"); + if (find[0].type === 'text') { + find.val(res.data[val]); + } else if (find[0].type === 'checkbox') { + find.attr("checked", res.data[val] === 'Y'); + } + } + } + + }) + + }) + // 寮圭獥鍏抽棴 + $('button').on('click', function () { + $('#siteWindow').attr('style', 'display:none') + $('#crnWindow').attr('style', 'display:none') + }) + + + var crn1Position = 0; + var crn2Position = 0; + var crn3Position = 0; + var crn4Position = 0; + var crn5Position = 0; + + // 鍒濆鍖� + getSitesInfo(); + getCrnInfo(); + getSystemRunningStatus(); + getBarcodeInfo(); + getScaleInfo(); + // 瀹炴椂璁块棶 + setInterval(function () { + getCrnInfo(); + getSystemRunningStatus(); + getBarcodeInfo(); + getScaleInfo(); + }, 1000); + setInterval(function () { + getSitesInfo(); + }, 3000); + + // 绯荤粺杩愯寮�鍏� + function systemSwitch() { + if (parent.systemRunning) { + layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞跺仠姝� WCS 绯荤粺', formType: 1, shadeClose: true}, function (pass, idx) { + layer.close(idx); + doSwitch(0, pass); // 鍋滄wcs绯荤粺 + }); + } else { + doSwitch(1); // 鍚姩wcs绯荤粺 + } + } + + // 璇锋眰鏈嶅姟鍣ㄦ帶鍒秝cs绯荤粺杩愯鐘舵�� + function doSwitch(operatorType, password) { + // 鍔犺浇tips + var index = layer.load(1, { + shade: [0.1, '#fff'] + }); + $.ajax({ + url: baseUrl + "/console/system/switch", + headers: {'token': localStorage.getItem('token')}, + // async: false, + data: { + operatorType: operatorType, + password: password + }, + method: 'POST', + success: function (res) { + layer.close(index); + if (res.code === 200) { + if (res.data.status) { + $('#system-icon').attr("class", "system-icon-open"); + $('#system-run-desc').html("绯荤粺杩愯涓�..."); + parent.systemRunning = true; + } else { + $('#system-icon').attr("class", "system-icon-close"); + $('#system-run-desc').html("绯荤粺宸插仠姝�!"); + parent.systemRunning = false; + } + } else if (res.code === 403) { + parent.location.href = baseUrl + "/login"; + } else { + console.log(res.msg); + + } + } + }); + + } + + // 鑾峰彇wcs绯荤粺杩愯鐘舵�� + function getSystemRunningStatus() { + $.ajax({ + url: baseUrl + "/console/system/running/status", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + success: function (res) { + if (res.code === 200) { + if (res.data.status) { + $('#system-icon').attr("class", "system-icon-open"); + $('#system-run-desc').html("绯荤粺杩愯涓�..."); + parent.systemRunning = true; + } else { + $('#system-icon').attr("class", "system-icon-close"); + $('#system-run-desc').html("绯荤粺宸插仠姝�!"); + parent.systemRunning = false; + } + } else if (res.code === 403) { + parent.location.href = baseUrl + "/login"; + } else { + console.log(res.msg); + } + } + }); + } + + // 杈撻�佽澶囧疄鏃舵暟鎹幏鍙� + function getSitesInfo() { + $.ajax({ + url: baseUrl + "/console/latest/data/site", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + success: function (res) { + if (res.code === 200) { + var sites = res.data; + for (var i = 0; i < sites.length; i++) { + var siteEl = $("#site-" + sites[i].siteId); + siteEl.attr("class", "site " + sites[i].siteStatus); + if (sites[i].workNo != null && sites[i].workNo > 0) { + siteEl.html(sites[i].siteId + "[" + sites[i].workNo + "]"); + } else { + siteEl.html(sites[i].siteId); + } + if (i + 1 === 8) { + carAnimate(i + 1, Number(sites[i].nearbySta)); + } + } + } else if (res.code === 403) { + parent.location.href = baseUrl + "/login"; + } else { + console.log(res.msg); + } + } + }); + } + + // 鍫嗗灈鏈哄疄鏃舵暟鎹幏鍙� + function getCrnInfo() { + $.ajax({ + url: baseUrl + "/console/latest/data/crn", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + success: function (res) { + console.log(res) + if (res.code === 200) { + var crns = res.data; + for (var i = 0; i < crns.length; i++) { + var crnEl = $("#crn-" + crns[i].crnId); + crnEl.attr("class", "machine " + crns[i].crnStatus); + var unit = ($('.item').eq(0).width() + 13) / 2; + if (crns[i].bay < 0) { + crns[i].bay = 0 + } + crnEl.animate({left: (crns[i].bay * unit) + 'px'}, 1000); + } + } else if (res.code === 403) { + parent.location.href = baseUrl + "/login"; + } else { + console.log(res.msg); + } + } + }); + } + + // 鎵爜鍣ㄥ疄鏃舵暟鎹幏鍙� + function getBarcodeInfo() { + $.ajax({ + url: baseUrl + "/console/latest/data/barcode", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + success: function (res) { + if (res.code === 200) { + var barcodes = res.data; + for (var i = 0; i < barcodes.length; i++) { + $("#code-decoder-data-" + barcodes[i].barcodeId).html(barcodes[i].codeValue); + } + } else if (res.code === 403) { + parent.location.href = baseUrl + "/login"; + } else { + console.log(res.msg); + } + } + }); + } + + // 纾呯Г瀹炴椂鏁版嵁鑾峰彇 + function getScaleInfo() { + $.ajax({ + url: baseUrl + "/console/latest/data/scale", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + success: function (res) { + + if (res.code === 200) { + var sclaes = res.data; + for (var i = 0; i < sclaes.length; i++) { + console.log(sclaes[i].scaleId + ":" + sclaes[i].value) + $("#scale-data-" + sclaes[i].scaleId).text(sclaes[i].value); + } + } else if (res.code === 403) { + parent.location.href = baseUrl + "/login"; + } else { + console.log(res.msg); + } + } + }); + } + + // 鍫嗗灈鏈哄亸绉诲姩鐢� + function crnAnimate(id, leftVal) { + console.log(crn1Position) + switch (id) { + case 1: + $("#crn-1").animate({left: leftVal + 'px'}, 1000); + crn1Position = leftVal; + break; + case 2: + $("#crn-2").animate({left: leftVal + 'px'}, 1000); + crn2Position = leftVal; + break; + case 3: + $("#crn-3").animate({left: leftVal + 'px'}, 1000); + crn3Position = leftVal; + break; + case 4: + $("#crn-4").animate({left: leftVal + 'px'}, 1000); + crn4Position = leftVal; + break; + case 5: + $("#crn-5").animate({left: leftVal + 'px'}, 1000); + crn5Position = leftVal; + break; + default: + break + } + } + + // 灏忚溅鍋忕Щ鍔ㄧ敾 + function carAnimate(id, target) { + var targetTop = 122; + if (id === 8) { + switch (target) { + case 1: + targetTop += 160; + break; + case 2: + targetTop += 140; + break; + case 3: + targetTop += 80; + break; + case 4: + targetTop += 40; + break; + case 7: + targetTop += 0; + break; + default: + return; + } + } else { + return; + } + $("#site-" + id).animate({top: targetTop + 'px'}, 1000); + } + + +</script> \ No newline at end of file diff --git a/src/main/webapp/views/render.js b/src/main/webapp/views/render.js new file mode 100644 index 0000000..ff6158c --- /dev/null +++ b/src/main/webapp/views/render.js @@ -0,0 +1,709 @@ +data = { + "mapName": "鍏嬪姵鏂帥鑿瞁CS", + "rackCount": 12, + "crnCount": 3, + "stbCount": 36, + "hpPosition": 1, + "minBayNo": 2, + "floors": 1, + "racks": [ + { + "type": "rack", + "id": "rack12", + "top": 646, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack11", + "top": 613, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack10", + "top": 516, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack9", + "top": 483, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack8", + "top": 451, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack7", + "top": 418, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack6", + "top": 323, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack5", + "top": 290, + "left": 324, + "width": 887, + "height": 30, + "minBayNo": 2, + "maxBayNo": 52 + }, + { + "type": "rack", + "id": "rack3", + "top": 225, + "left": 188, + "width": 1023, + "height": 30, + "minBayNo": 2, + "maxBayNo": 60 + }, + { + "type": "rack", + "id": "rack1", + "top": 97, + "left": 188, + "width": 1023, + "height": 30, + "minBayNo": 2, + "maxBayNo": 60 + }, + { + "type": "rack", + "id": "rack4", + "top": 257, + "left": 188, + "width": 1023, + "height": 30, + "minBayNo": 2, + "maxBayNo": 60 + }, + { + "type": "rack", + "id": "rack2", + "top": 129, + "left": 188, + "width": 1023, + "height": 30, + "minBayNo": 2, + "maxBayNo": 60 + } +], + "rackDescs": [ + { + "type": "rackDescs", + "id": "lb_desc12", + "text": "#12", + "top": 646, + "left": 260, + "width": 47, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc11", + "text": "#11", + "top": 618, + "left": 260, + "width": 44, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc10", + "text": "#10", + "top": 516, + "left": 257, + "width": 49, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc9", + "text": "#9", + "top": 488, + "left": 257, + "width": 38, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc8", + "text": "#8", + "top": 449, + "left": 260, + "width": 39, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc7", + "text": "#7", + "top": 421, + "left": 260, + "width": 37, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc6", + "text": "#6", + "top": 327, + "left": 260, + "width": 38, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc5", + "text": "#5", + "top": 291, + "left": 261, + "width": 38, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc4", + "text": "#4", + "top": 253, + "left": 145, + "width": 38, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc3", + "text": "#3", + "top": 225, + "left": 145, + "width": 38, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc2", + "text": "#2", + "top": 128, + "left": 145, + "width": 38, + "height": 27 + }, + { + "type": "rackDescs", + "id": "lb_desc1", + "text": "#1", + "top": 100, + "left": 145, + "width": 35, + "height": 27 + } +], + "crns": [ + { + "type": "crane", + "id": "crn-1", + "text": "1", + "top": 184, + "left": 777, + "width": 93, + "height": 22 + }, + { + "type": "crane", + "id": "crn-2", + "text": "2", + "top": 378, + "left": 777, + "width": 93, + "height": 22 + }, + { + "type": "crane", + "id": "crn-3", + "text": "3", + "top": 572, + "left": 777, + "width": 93, + "height": 22 + }, + { + "type": "track", + "id": "lb_track2", + "text": "", + "top": 390, + "left": 325, + "width": 1010, + "height": 2 + }, + { + "type": "track", + "id": "lb_track3", + "text": "", + "top": 584, + "left": 325, + "width": 1010, + "height": 2 + }, + { + "type": "track", + "id": "lb_track1", + "text": "", + "top": 197, + "left": 188, + "width": 1148, + "height": 2 + } +], + "stns": [ + { + "type": "stn", + "id": "site-132", + "text": "132", + "top": 547, + "left": 1399, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-126", + "text": "126", + "top": 450, + "left": 1461, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-125", + "text": "125", + "top": 450, + "left": 1399, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-119", + "text": "119", + "top": 353, + "left": 1461, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-118", + "text": "118", + "top": 353, + "left": 1399, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-136", + "text": "136", + "top": 611, + "left": 1461, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-135", + "text": "135", + "top": 611, + "left": 1399, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-134", + "text": "134", + "top": 611, + "left": 1337, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-133", + "text": "133", + "top": 611, + "left": 1215, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-130", + "text": "130", + "top": 515, + "left": 1461, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-129", + "text": "129", + "top": 515, + "left": 1399, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-128", + "text": "128", + "top": 515, + "left": 1337, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-127", + "text": "127", + "top": 515, + "left": 1215, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-131", + "text": "131", + "top": 515, + "left": 1522, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-123", + "text": "123", + "top": 418, + "left": 1461, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-122", + "text": "122", + "top": 418, + "left": 1399, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-121", + "text": "121", + "top": 418, + "left": 1337, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-120", + "text": "120", + "top": 418, + "left": 1215, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-124", + "text": "124", + "top": 418, + "left": 1522, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-112", + "text": "112", + "top": 256, + "left": 1461, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-111", + "text": "111", + "top": 256, + "left": 1399, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-116", + "text": "116", + "top": 321, + "left": 1461, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-115", + "text": "115", + "top": 321, + "left": 1399, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-114", + "text": "114", + "top": 321, + "left": 1337, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-113", + "text": "113", + "top": 321, + "left": 1215, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-117", + "text": "117", + "top": 321, + "left": 1522, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-105", + "text": "105", + "top": 159, + "left": 1399, + "width": 60, + "height": 63 + }, + { + "type": "stn", + "id": "site-109", + "text": "109", + "top": 224, + "left": 1461, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-108", + "text": "108", + "top": 224, + "left": 1399, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-107", + "text": "107", + "top": 224, + "left": 1337, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-106", + "text": "106", + "top": 224, + "left": 1215, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-104", + "text": "104", + "top": 128, + "left": 1461, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-103", + "text": "103", + "top": 128, + "left": 1399, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-102", + "text": "102", + "top": 128, + "left": 1337, + "width": 60, + "height": 30 + }, + { + "type": "stn", + "id": "site-101", + "text": "101", + "top": 128, + "left": 1215, + "width": 120, + "height": 30 + }, + { + "type": "stn", + "id": "site-110", + "text": "110", + "top": 224, + "left": 1522, + "width": 60, + "height": 30 + } +] +} +// 搴撲綅鍥� +function getMap() { + let mapName = "<div class='mapName'>" + data.mapName + "</div>" + let rack = '', racks = '', rackDesc = '', + rackDescs = '', crn = '', crns = '',track = '', + tracks = '', stn = '', stns = ''; + let rackss = data.racks, + rackDescss = data.rackDescs, + crnss = data.crns, + stnss = data.stns; + // 璐ф灦 + for (let i = 0;i < rackss.length;i++) { + let btn ='' + let btns = '' + var maxBayNo = rackss[i].maxBayNo + var minBayNo = rackss[i].minBayNo + let bLen = maxBayNo / minBayNo + if (data.hpPosition == 1) { + for (let j = bLen;j > 0; j--) { + btn = "<button class='item' style='width: 34px'>" + maxBayNo + "</button>" + btns = btns + btn + maxBayNo = maxBayNo - minBayNo; + } + }else { + for (let j = 0;j < bLen; j++) { + btn = "<button class='item' style='width: 34px'>" + minBayNo + "</button>" + btns = btns + btn + minBayNo = minBayNo + minBayNo; + } + } + + rack = "<div class='rack' id='" + rackss[i].id + + "'style='width:"+ rackss[i].width + + "px;height: "+ rackss[i].height+ + "px;top: "+ rackss[i].top + + "px;left: "+ rackss[i].left + + "px'>" + btns + "</div>" + racks = racks + rack + } + // 璐ф灦鎻忚堪 + for (let i = 0;i < rackDescss.length;i++) { + rackDesc = "<div class='rackDescs' id='" + rackDescss[i].id + + "'style='width:"+ rackDescss[i].width + + "px;height: "+ rackDescss[i].height+ + "px;line-height: "+ rackDescss[i].height+ + "px;top: "+ rackDescss[i].top + + "px;left: "+ rackDescss[i].left + + "px'>" + rackDescss[i].text + "</div>" + rackDescs = rackDescs + rackDesc + } + // 鍫嗗灈鏈哄拰鍦拌建 + for (let i = 0;i < crnss.length;i++) { + if (crnss[i].type == "crane") { + crn = "<div class='machine' id='" + crnss[i].id + + "'style='width:"+ crnss[i].width + + "px;height: "+ crnss[i].height+ + "px;top: "+ crnss[i].top + + "px;left: "+ crnss[i].left + + "px'></div>" + crns = crns + crn + } else { + track = "<div class='track' id='" + crnss[i].id + + "'style='width:"+ crnss[i].width + + "px;height: "+ crnss[i].height+ + "px;top: "+ crnss[i].top + + "px;left: "+ crnss[i].left + + "px'>" + crnss[i].text + "</div>" + tracks = tracks + track + } + } + // 杈撻�佺嚎 绔欑偣 + for (let i = 0;i < stnss.length;i++) { + stn = "<div class='site' id='" + stnss[i].id + + "'style='width:"+ stnss[i].width + + "px;height: "+ stnss[i].height+ + "px;line-height: "+ stnss[i].height+ + "px;top: "+ stnss[i].top + + "px;left: "+ stnss[i].left + + "px'>" + stnss[i].text + "</div>" + stns = stns + stn + } + let whycq = racks + stns + rackDescs + crns + tracks + $(".main-part").append(whycq) +}; + + diff --git a/src/main/webapp/views/test.html b/src/main/webapp/views/test.html new file mode 100644 index 0000000..d65a6e7 --- /dev/null +++ b/src/main/webapp/views/test.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>Title</title> +</head> +<body> + <button onclick="closeBtn()">鍏抽棴</button> + <button onclick="openBtn()">寮�濮�</button> +</body> +<script> + var i = 1 + var a = true + setInterval(()=>{ + addI(); + },1000) + function addI() { + if (a) { + console.log("姝e湪鎵撳嵃"+i++) + }else { + return; + } + } + + + function closeBtn() { + console.log("鏆傚仠鎵撳嵃") + a = false + } + function openBtn() { + console.log("鎭㈠鎵撳嵃") + a = true + } +</script> +</html> \ No newline at end of file -- Gitblit v1.9.1