From c41fce4524aaf930da42d2b86a41f0ec8570c0a0 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 30 八月 2023 11:26:11 +0800
Subject: [PATCH] #

---
 src/main/webapp/views/console.html |  268 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 141 insertions(+), 127 deletions(-)

diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index 6a6ff76..8b09f68 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -23,15 +23,22 @@
                 <button class="floorBtn  btn-16" onclick="changFloor(this,2)" style="margin-top: 200px">2F</button>
                 <button class="floorBtn  btn-16" onclick="changFloor(this,3)" style="margin-top: 250px">3F</button>
                 <button class="floorBtn  btn-16" onclick="changFloor(this,4)" style="margin-top: 300px">4F</button>
+                <button class="floorBtn  btn-16" onclick="changFloor(this,5)" style="margin-top: 350px">5F</button>
+                <button class="floorBtn  btn-16" onclick="changFloor(this,6)" style="margin-top: 400px">6F</button>
+                <button class="floorBtn  btn-16" onclick="changFloor(this,7)" style="margin-top: 450px">7F</button>
+                <button class="floorBtn  btn-16" onclick="changFloor(this,8)" style="margin-top: 500px">8F</button>
+                <button class="floorBtn  btn-16" onclick="changFloor(this,9)" style="margin-top: 550px">9F</button>
+                <button class="floorBtn  btn-16" onclick="changFloor(this,10)" style="margin-top: 600px">10F</button>
             </div>
-            <button class="floorBtn  btn-16" onclick="testMove()" style="margin-top: 350px">娴嬭瘯绉诲姩杞�</button>
+            <button class="floorBtn  btn-16" onclick="resetMap()" style="margin-top: 650px;font-size: 14px;">閲嶇疆鍦板浘</button>
+            <button class="floorBtn  btn-16" onclick="testMove()" style="margin-top: 700px;font-size: 14px;">娴嬭瘯绉诲姩杞�</button>
 
         <!-- 璐ф灦 + 鍫嗗灈鏈� + 鍏ュ簱绔欑偣 -->
-        <div class="main-part">
-            <!-- 绗竴缁� -->
-            <div class="lane" id="mapDataId" style="margin-bottom: 280px">
+        <div class="main-part" id="mapDataId">
+<!--            &lt;!&ndash; 绗竴缁� &ndash;&gt;-->
+<!--            <div class="lane" id="mapDataId" style="margin-bottom: 280px">-->
 
-            </div>
+<!--            </div>-->
         </div>
     </main>
     <footer class="footer">
@@ -59,13 +66,7 @@
         <!-- 鍥涘悜绌挎杞︾姸鎬� -->
         <div class="line-status">
             <div class="body-head">绌挎杞︾姸鎬�</div>
-            <div class="state">
-                <span>鍥涘悜绌挎杞� 1</span>
-                <span class="state-ss shuttle-idle">绌洪棽</span>
-            </div>
-            <div class="state">
-                <span>鍥涘悜绌挎杞� 2</span>
-                <span class="state-ss shuttle-idle">绌洪棽</span>
+            <div id="shuttle-status-box" style="height: 100px;overflow-y: scroll;overflow-x: hidden;">
             </div>
             <div class="button"><span>鎵�鏈夌姸鎬�</span></div>
             <div class="button item-group">
@@ -75,20 +76,21 @@
                 <span class="shuttle-charging">鍏呯數涓�</span>
                 <span class="shuttle-charging-waiting">鍏呯數浠诲姟绛夊緟纭</span>
                 <span class="shuttle-fixing">鏁呴殰淇涓�</span>
+                <span class="shuttle-offline">绂荤嚎</span>
             </div>
         </div>
         <!-- 鎻愬崌鏈虹姸鎬� -->
         <div class="line-status">
             <div class="body-head">鎻愬崌鏈虹姸鎬�</div>
-            <div class="state states">
-                <span>鎻愬崌鏈�</span>
-                <span class="state-ss shuttle-idle">绌洪棽</span>
+            <div id="lift-status-box" style="height: 120px;overflow-y: scroll;overflow-x: hidden;">
+
             </div>
             <div class="button"><span>鎵�鏈夌姸鎬�</span></div>
             <div class="button item-group">
                 <span class="lift-idle">绌洪棽</span>
                 <span class="lift-working">浣滀笟涓�</span>
                 <span class="lift-waiting">绛夊緟纭</span>
+                <span class="lift-offline">绂荤嚎</span>
             </div>
         </div>
         <!-- 杈撻�佺嚎鐘舵�� -->
@@ -418,7 +420,44 @@
 
     setInterval(() => {
         getShuttleStateInfo()
+        getLiftStateInfo()
     },1000)
+
+    // 鎻愬崌鏈轰俊鎭〃鑾峰彇
+    function getLiftStateInfo() {
+        $.ajax({
+            url: baseUrl+ "/lift/table/lift/state",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                $("#lift-status-box").empty()
+                res.data.forEach((item,index) => {
+                    let liftStatusClass = "lift-idle"
+                    switch (item.protocolStatus) {
+                        case 1://绌洪棽
+                            liftStatusClass = "lift-idle";
+                            break
+                        case 2://浣滀笟涓�
+                            liftStatusClass = "lift-working";
+                            break
+                        case 3://绛夊緟纭
+                            liftStatusClass = "lift-waiting";
+                            break
+                        case 4://绂荤嚎
+                            liftStatusClass = "lift-offline";
+                            break
+                        default:
+                            liftStatusClass = "lift-idle"
+                    }
+                    let liftStatus = '<div class="state states">' +
+                        '<span>鎻愬崌鏈� ' + item.liftNo + '</span>' +
+                        '<span class="state-ss ' + liftStatusClass + '">' + item.protocolStatus$ + '</span></div>';
+                    $("#lift-status-box").append(liftStatus)
+
+                })
+            }
+        });
+    }
 
     // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇
     function getShuttleStateInfo() {
@@ -427,13 +466,45 @@
             headers: {'token': localStorage.getItem('token')},
             method: 'POST',
             success: function (res) {
+                $("#shuttle-status-box").empty()
                 res.data.forEach((item,index) => {
-                    if(item.locNoLev != currentLev){
+                    let shuttleStatusClass = "shuttle-idle"
+                    switch (item.protocolStatus) {
+                        case 1://绌洪棽
+                            shuttleStatusClass = "shuttle-idle";
+                            break
+                        case 2://浣滀笟涓�
+                            shuttleStatusClass = "shuttle-working";
+                            break
+                        case 3://绛夊緟纭
+                            shuttleStatusClass = "shuttle-waiting";
+                            break
+                        case 4://鍏呯數涓�
+                            shuttleStatusClass = "shuttle-charging";
+                            break
+                        case 5://鍏呯數浠诲姟绛夊緟纭
+                            shuttleStatusClass = "shuttle-charging-waiting";
+                            break
+                        case 6://鏁呴殰淇涓�
+                            shuttleStatusClass = "shuttle-fixing";
+                            break
+                        case 7://绂荤嚎
+                            shuttleStatusClass = "shuttle-offline";
+                            break
+                        default:
+                            shuttleStatusClass = "shuttle-offline"
+                    }
+                    let shuttleStatus = '<div class="state">' +
+                        '<span>鍥涘悜绌挎杞� ' + item.shuttleNo + '</span>' +
+                        '<span class="state-ss ' + shuttleStatusClass + '">' + item.protocolStatus$ + '</span></div>';
+                    $("#shuttle-status-box").append(shuttleStatus)
+
+                    if(item.wcsPoint.z != currentLev){
                         //鍥涘悜绌挎杞︽ゼ灞傚拰褰撳墠鍦板浘妤煎眰涓嶄竴鑷达紝鍒犻櫎璇ヨ溅杈�
                         $("#sxcar-" + item.shuttleNo).remove()
                     }else {
                         //绉诲姩鍥涘悜绌挎杞�
-                        moveCar(item.shuttleNo,item.locNoX,item.locNoY)
+                        moveCar(item.shuttleNo,item.wcsPoint.x,item.wcsPoint.y)
                     }
                 })
             }
@@ -443,7 +514,7 @@
     //璁$畻鍥涘悜绌挎杞﹀浘鏍囦綅缃�
     function getCarPosition(x,y) {
         let top = (x * 35 - 35) + "px" //闇�瑕佸噺鍘诲皬杞﹁嚜宸辨墍鍗犻珮搴�
-        let left = (y * 70 - 70) + "px" //闇�瑕佸噺鍘诲皬杞﹁嚜宸辨墍鍗犲搴�
+        let left = (y * 35 - 35) + "px" //闇�瑕佸噺鍘诲皬杞﹁嚜宸辨墍鍗犲搴�
         return [top,left];
     }
 
@@ -458,13 +529,35 @@
 
     //鍒濆鍖栧湴鍥�
     function initMap(lev) {
+        getMap(lev)
+
+        $.ajax({
+            url: baseUrl+ "/shuttle/table/shuttle/state",
+            headers: {'token': localStorage.getItem('token')},
+            method: 'POST',
+            success: function (res) {
+                res.data.forEach((item,index) => {
+                    if(lev == item.wcsPoint.z){
+                        let carBox = '<div class="sxcar" id="sxcar-' + item.shuttleNo + '">' + item.shuttleNo + '</div>'
+                        $("#mapDataId").append(carBox)
+                    }
+                })
+            }
+        });
+    }
+
+    //鑾峰彇鍦板浘鏁版嵁
+    function getMap(lev) {
         //姣嶈建閬撶涓�娆$储寮曪紝鐢ㄤ簬瀹氫綅灏忚溅
         let firstMotherIndex = [0,0];
         $("#mapDataId").empty()
         $.ajax({
             type:"get",
-            url: baseUrl + "/static/js/map_" + lev + ".json",
-            success: (data) => {
+            // url: baseUrl + "/static/js/map_" + lev + ".json",
+            url: baseUrl + "/console/map/" + lev + "/auth",
+            headers: {'token': localStorage.getItem('token')},
+            success: (res) => {
+                let data = res.data
                 mapData = data
                 let content = ""
                 data.forEach((rowData,index) => {
@@ -476,6 +569,9 @@
                             if(!(idx == 0 || rowData.length - 1 == idx)){
                                 let col;
                                 switch (colData.value){
+                                    case -999:
+                                        col = '<button class="item" style="background:#f83333;color: #fff;">' + idx + '</button>';
+                                        break;
                                     case -1:
                                         col = '<button class="item" style="visibility: hidden">' + idx + '</button>';
                                         break;
@@ -490,14 +586,18 @@
                                     case 4:
                                         //绔欑偣
                                         var data = colData.data;
-                                        col = '<div id="site-' + data + '" class="site">' + data + '(9991)</div>';
+                                        col = '<div id="site-' + data + '" class="site">' + data + '</div>';
                                         break;
                                     case 5:
                                         //鍏呯數妗�
                                         col = '<button class="item" style="font-size: 24px">&#9889;</button>';
                                         break;
                                     default:
-                                        col = '<button class="item">' + idx + '</button>';
+                                        let val = idx;
+                                        if (colData.data.length > 0) {
+                                            val = colData.data
+                                        }
+                                        col = '<button class="item">' + val + '</button>';
                                 }
 
                                 if(rowData.length - 2 == idx){
@@ -515,20 +615,6 @@
                 $("#mapDataId").append(content)
             }
         })
-
-        $.ajax({
-            url: baseUrl+ "/shuttle/table/shuttle/state",
-            headers: {'token': localStorage.getItem('token')},
-            method: 'POST',
-            success: function (res) {
-                res.data.forEach((item,index) => {
-                    if(lev == item.locNoLev){
-                        let carBox = '<div class="sxcar" id="sxcar-' + item.shuttleNo + '"></div>'
-                        $("#mapDataId").append(carBox)
-                    }
-                })
-            }
-        });
     }
 
     //灏嗗湴鍥炬暟鎹浆鎹㈡垚int浜岀淮鏁扮粍(鍚庣画鐢ㄤ簬璇锋眰璁$畻璺緞鏃舵惡甯﹀湴鍥炬暟鎹弬鏁颁娇鐢�)
@@ -547,100 +633,28 @@
 
     function testMove() {
         getMap2TwoArr()//娴嬭瘯鍦板浘鏁版嵁杞崲鏄惁姝e父
-        let json = "[{\n" +
-            "\t\t\"x\": 5,\n" +
-            "\t\t\"y\": 5\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 6,\n" +
-            "\t\t\"y\": 5\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 7,\n" +
-            "\t\t\"y\": 5\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 8,\n" +
-            "\t\t\"y\": 5\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 9,\n" +
-            "\t\t\"y\": 5\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 10,\n" +
-            "\t\t\"y\": 5\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 11,\n" +
-            "\t\t\"y\": 5\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 11,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 12,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 13,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 14,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 15,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 16,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 17,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 18,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 19,\n" +
-            "\t\t\"y\": 6\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 19,\n" +
-            "\t\t\"y\": 7\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 19,\n" +
-            "\t\t\"y\": 8\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 20,\n" +
-            "\t\t\"y\": 8\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 21,\n" +
-            "\t\t\"y\": 8\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 22,\n" +
-            "\t\t\"y\": 8\n" +
-            "\t},\n" +
-            "\t{\n" +
-            "\t\t\"x\": 23,\n" +
-            "\t\t\"y\": 8\n" +
-            "\t}\n" +
-            "]";
+        let json = "[{\"x\":5,\"y\":5},{\"x\":6,\"y\":5},{\"x\":7,\"y\":5},{\"x\":8,\"y\":5},{\"x\":9,\"y\":5},{\"x\":10,\"y\":5},{\"x\":11,\"y\":5},{\"x\":11,\"y\":6},{\"x\":12,\"y\":6},{\"x\":13,\"y\":6},{\"x\":14,\"y\":6},{\"x\":15,\"y\":6},{\"x\":16,\"y\":6}]";
         json = JSON.parse(json)
         json.forEach((item,index) => {
             moveCar(1, item.x, item.y);
         })
+    }
 
+    /**
+     * 閲嶇疆鍦板浘
+     */
+    function resetMap() {
+        $.ajax({
+            url:baseUrl+"/console/map/resetMap/auth",
+            headers:{
+                'token': localStorage.getItem('token')
+            },
+            data:{},
+            method:'get',
+            success:function (res) {
+                layer.msg('閲嶇疆瀹屾垚');
+            }
+        })
     }
 
     // 灏忚溅鍋忕Щ鍔ㄧ敾
@@ -854,11 +868,11 @@
             success: function (res) {
                 if (res.code === 200){
                     if (res.data.status) {
-                        $('#system-icon').attr("class", "system-icon-open");
+                        $('#system-toggle-checked').attr("checked", true);
                         $('#system-run-desc').html("绯荤粺杩愯涓�...");
                         parent.systemRunning = true;
                     } else {
-                        $('#system-icon').attr("class", "system-icon-close");
+                        $('#system-toggle-checked').attr("checked", false);
                         $('#system-run-desc').html("绯荤粺宸插仠姝�!");
                         parent.systemRunning = false;
                     }

--
Gitblit v1.9.1