From 5cf81e2b0e9c3490f83a06811ea6939c5b5ae7c7 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期四, 23 五月 2024 16:45:21 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/wcs/js/console.map.js     |   92 ++++++++++++++++++
 src/main/webapp/views/realtimeWatch/console.html |   28 -----
 src/main/webapp/static/wcs/js/console.js         |  139 ++++++++++-----------------
 src/main/webapp/static/wcs/css/render.css        |    9 +
 4 files changed, 155 insertions(+), 113 deletions(-)

diff --git a/src/main/webapp/static/wcs/css/render.css b/src/main/webapp/static/wcs/css/render.css
index e40e9eb..01d778f 100644
--- a/src/main/webapp/static/wcs/css/render.css
+++ b/src/main/webapp/static/wcs/css/render.css
@@ -553,6 +553,15 @@
     height: auto ;
     white-space: normal;
 }
+.barcode {
+    position: absolute;
+    color: #a19c9c;
+    border: 1px solid rgb(108,167,168);
+    cursor: pointer;
+    text-align: center;
+    background-color: rgb(157, 217, 162);
+    font-size: 10px;
+}
 .barcode1{
     position: absolute;
     width: 100px;
diff --git a/src/main/webapp/static/wcs/js/console.js b/src/main/webapp/static/wcs/js/console.js
index c7984a3..fed00b7 100644
--- a/src/main/webapp/static/wcs/js/console.js
+++ b/src/main/webapp/static/wcs/js/console.js
@@ -9,8 +9,10 @@
     track = '',
     tracks = '',
     stn = '',
+    barcode = '',
     stns = '',
     stnArr = [],
+    barcodeArr = [],
     floorBtn = '',
     floorBtns = '',
     floorBtnss = '',
@@ -25,26 +27,58 @@
     for (let i = 0;i < rackss.length;i++) {
         let bay ='' // 鍗曚釜搴撲綅
         let bays = '' // 搴撲綅闆嗗悎
-        let bayWidth = rackss[i].width / (rackss[i].maxBayNo / rackss[i].minBayNo)
         let maxBayNo = rackss[i].maxBayNo // 鏈�澶у簱浣嶅彿
         let minBayNo = rackss[i].minBayNo // 鏈�灏忓簱浣嶅彿
-        let bLen = maxBayNo / minBayNo // 搴撲綅涓暟
+        let bLen
+        let interval // 闂撮殧鏁�
+
+        if (maxBayNo<35) {
+            interval = 1
+            bLen = maxBayNo / interval // 搴撲綅涓暟
+        } else {
+            interval = 2
+            bLen = maxBayNo / interval // 搴撲綅涓暟
+        }
+        let bayWidth // 鍗曚釜搴撲綅瀹藉害
         let bNum // 搴撲綅鍙风爜
-        // hpPosition 0 琛ㄧず璐ф灦搴忓彿 宸�->鍙� 1 琛ㄧず璐ф灦搴忓彿 鍙�->宸�
+
+        if (minBayNo % 2 == 0) { // 浠�2寮�濮�
+            if(interval == 1) {
+                bLen = bLen - 1
+            } else if (interval == 2) {
+                if (maxBayNo % 2 == 0) { // 鍋舵暟
+                    bLen = bLen
+                } else { // 濂囨暟
+                    maxBayNo = maxBayNo + 1
+                    bLen = maxBayNo / interval // 搴撲綅涓暟
+                }
+            }
+        } else { // 浠�1寮�濮�
+            if(interval == 1) {
+                bLen = bLen
+            } else if (interval == 2) {
+                if (maxBayNo % 2 == 0) { // 鍋舵暟
+                    bLen = bLen
+                } else { // 濂囨暟
+                    bLen = bLen + 1
+                }
+            }
+        }
+        bayWidth = rackss[i].width / bLen
+        // hpPosition 0 琛ㄧず璐ф灦搴忓彿 宸�->鍙� 1 琛ㄧず璐ф灦搴忓彿 宸�<-鍙�
         if (mapInfo.hpPosition == 1) {
             bNum = maxBayNo
             for (let j = bLen; j > 0; j--) {
                 bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>"
                 bays = bays + bay
-                bNum = bNum - minBayNo;
+                bNum = bNum - interval;
             }
         }else {
             bNum = minBayNo
             for (let j = 0; j < bLen; j++) {
-
                 bay = "<button class='item' style='width: "+ bayWidth +"px'>" + bNum + "</button>"
                 bays = bays + bay
-                bNum = bNum + minBayNo;
+                bNum = bNum + interval;
             }
         }
 
@@ -92,13 +126,12 @@
     for (let i = 0; i < areas.length;i++) {
 
         let stnss = areas[i].stns
+        let barcodes = areas[i].barcode
         let floor = areas[i].text
-        console.log(areas[i].top)
         floorId = areas[i].id
         var position = (i+1)*100
         floorBtn =
             "<button class='floorBtn btn-16' onclick='changFloor("+i+")' style='top: "+position+"px;'>" + floor +"</button>"
-        console.log(mapInfo.areas[0].floors.length)
         if (mapInfo.areas[0].floors.length == 1) {
             floorBtnss = ''
         } else {
@@ -108,6 +141,7 @@
         var index = i
         var n = 1
         stnArr[index] = ''
+        barcodeArr[index] = ''
         total[index] = ''
         for (let j = 0; j < stnss.length; j++) {
             if (stnss[j].type == "stn") {
@@ -130,11 +164,18 @@
                     "px'>" + stnss[j].text  + "</div>"
                 stnArr[i] = stnArr[i] + stn
             }
-
         }
-
+        for (let k = 0; k < barcodes.length; k++) {
+            barcode = "<div class='barcode' id='" + barcodes[k].id +
+                "'style='width:" + barcodes[k].width +
+                "px;height: " + barcodes[k].height +
+                "px;line-height: " + barcodes[k].height +
+                "px;top: "+ barcodes[k].top +
+                "px;left: "+ barcodes[k].left + "px'>" + "</div>"
+            barcodeArr[i] = barcodeArr[i] + barcode
+        }
     }
-    floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss
+    floorInfo = racks + rackDescs + tracks + crns + stnArr[0] + floorBtnss + barcodeArr[0]
 
     $(".main-part").append(floorInfo)
     $("#line-total").html(total[0])
@@ -143,81 +184,9 @@
 }
 function changFloor(e) {
     $(".main-part").empty()  // 娓呯┖鑺傜偣
-    floorInfo = racks  + stnArr[e] +rackDescs + crns + tracks + floorBtnss
+    floorInfo = racks  + stnArr[e] +rackDescs + crns + tracks + floorBtnss + barcodeArr[e]
     $(".main-part").append(floorInfo)
     $("#line-total").empty()
     $("#line-total").html(total[e])
     // listenChange();
-}
-
-
-layui.config({
-    base: baseUrl + "/static/wms/layui/lay/modules/"
-}).use(['table', 'form'], function () {
-    var table = layui.table;
-    var $ = layui.jquery;
-    var cache;
-
-    // 鏁版嵁娓叉煋
-    tableIns = table.render({
-        elem: '#deviceInfo',
-        headers: {token: localStorage.getItem('token')},
-        url: baseUrl + '/console/deviceInfo',
-        page: false,
-        limit: 16,
-        limits: [16, 30, 50, 100, 200, 500],
-        even: true,
-        cellMinWidth: 50,
-        cols: [[
-            {field: 'device', align: 'center', title: '璁惧'}
-            , {field: 'deviceId', align: 'center', title: '缂栧彿'}
-            , {field: 'battery', align: 'center', title: '鐢甸噺'}
-            , {field: 'error', align: 'center', title: '寮傚父', templet: '#errorTpl'}
-            , {field: 'status', align: 'center', title: '鐘舵��', width: 150}
-        ]],
-        request: {
-            pageName: 'curr',
-            pageSize: 'limit'
-        },
-        parseData: function (res) {
-            return {
-                'code': res.code,
-                'msg': res.msg,
-                'count': res.data.total,
-                'data': res.data.records
-            }
-        },
-        response: {
-            statusCode: 200
-        },
-        done: function (res, curr, count) {
-            $(".layui-table-tool").hide()
-            $(".layui-table-view").css({"margin":"0px"})
-            $(".layui-table-box").css({"padding-bottom":"0px"})
-
-            cache = table.cache['deviceInfo'];
-        }
-    });
-
-    setInterval(() => {
-        tableReload()
-    },10000)
-
-    function tableReload() {
-        $.ajax({
-            url: baseUrl + "/console/deviceInfo",
-            headers: {'token': localStorage.getItem('token')},
-            contentType: 'application/json;charset=UTF-8',
-            method: 'GET',
-            traditional: true,
-            success: function (res) {
-                cache = res.data.records
-                table.reload('deviceInfo',{
-                    data: cache
-                })
-            }
-        })
-    }
-
-});
-
+}
\ No newline at end of file
diff --git a/src/main/webapp/static/wcs/js/console.map.js b/src/main/webapp/static/wcs/js/console.map.js
index 3840f2c..28ab492 100644
--- a/src/main/webapp/static/wcs/js/console.map.js
+++ b/src/main/webapp/static/wcs/js/console.map.js
@@ -632,7 +632,83 @@
                 "left": 1656,
                 "width": 49,
                 "height": 20
-            }]
+            }],
+            "barcode": [
+                {
+                    "type": "barcode",
+                    "id": "barcode-1",
+                    "text": "",
+                    "top": 136,
+                    "left": 355,
+                    "width": 80,
+                    "height": 20
+                },
+                {
+                    "type": "barcode",
+                    "id": "barcode-2",
+                    "text": "",
+                    "top": 229,
+                    "left": 355,
+                    "width": 80,
+                    "height": 20
+                },
+                {
+                    "type": "barcode",
+                    "id": "barcode-3",
+                    "text": "",
+                    "top": 320,
+                    "left": 355,
+                    "width": 80,
+                    "height": 20
+                },
+                {
+                    "type": "barcode",
+                    "id": "barcode-4",
+                    "text": "",
+                    "top": 435,
+                    "left": 355,
+                    "width": 80,
+                    "height": 20
+                },
+                {
+                    "type": "barcode",
+                    "id": "barcode-5",
+                    "text": "",
+                    "top": 550,
+                    "left": 355,
+                    "width": 80,
+                    "height": 20
+                },
+                {
+                    "type": "barcode",
+                    "id": "barcode-6",
+                    "text": "",
+                    "top": 663,
+                    "left": 355,
+                    "width": 80,
+                    "height": 20
+                }
+                ,
+                {
+                    "type": "barcode",
+                    "id": "barcode-7",
+                    "text": "",
+                    "top": 455,
+                    "left": 1590,
+                    "width": 80,
+                    "height": 20
+                }
+                ,
+                {
+                    "type": "barcode",
+                    "id": "barcode-8",
+                    "text": "",
+                    "top": 570,
+                    "left": 1590,
+                    "width": 80,
+                    "height": 20
+                }
+            ]
         }, {
             "type": "floor",
             "id": "page_floor2",
@@ -1026,7 +1102,19 @@
                 "left": 1489,
                 "width": 40,
                 "height": 20
-            }]
+            }],
+            "barcode": [
+                {
+                    "type": "barcode",
+                    "id": "barcode-10",
+                    "text": "",
+                    "top": 153,
+                    "left": 1153,
+                    "width": 80,
+                    "height": 0
+                }
+
+            ]
         }]
     }]
 }
\ No newline at end of file
diff --git a/src/main/webapp/views/realtimeWatch/console.html b/src/main/webapp/views/realtimeWatch/console.html
index a320e8b..b6ff3e7 100644
--- a/src/main/webapp/views/realtimeWatch/console.html
+++ b/src/main/webapp/views/realtimeWatch/console.html
@@ -31,30 +31,6 @@
                 <h6>AUTOMATIC WAREHOUSE WCS MONITORING DIAGRAM</h6>
             </div>
         </div>
-        <div class="barcode1">
-            <span style="color: red" id="code1">1</span>
-        </div>
-        <div class="barcode2">
-            <span style="color: red" id="code2">2</span>
-        </div>
-        <div class="barcode3">
-            <span style="color: red" id="code3">3</span>
-        </div>
-        <div class="barcode4">
-            <span style="color: red" id="code4">4</span>
-        </div>
-        <div class="barcode5">
-            <span style="color: red" id="code5">5</span>
-        </div>
-        <div class="barcode6">
-            <span style="color: red" id="code6">6</span>
-        </div>
-        <div class="barcode7">
-            <span style="color: red" id="code7">7</span>
-        </div>
-        <div class="barcode8">
-            <span style="color: red" id="code8">8</span>
-        </div>
 
         <!-- 璐ф灦 + 鍫嗗灈鏈� + 鍏ュ簱绔欑偣 -->
         <div class="main-part">
@@ -697,7 +673,7 @@
                 if (res.code === 200) {
                     var barcodes = res.data;
                     for (var i = 0; i < barcodes.length; i++) {
-                        $("#code" + barcodes[i].barcodeId).html(barcodes[i].codeValue);
+                        $("#barcode-"+barcodes[i].barcodeId).html(barcodes[i].codeValue ? barcodes[i].codeValue : "--");
                     }
                 } else if (res.code === 403) {
                     parent.location.href = baseUrl + "/login";
@@ -764,7 +740,7 @@
     function carAnimate(id, target) {
         var targetTop = 0;
         var targetLeft = 1489;
-        console.log(id+" ....>>>"+target)
+        // console.log(id+" ....>>>"+target)
             switch (target) {
                 case 3:
                     targetTop += 67;

--
Gitblit v1.9.1