| | |
| | | <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> |
| | | </div> |
| | | <button class="floorBtn btn-16" onclick="testMove()" style="margin-top: 350px">测试移动车</button> |
| | | <button class="floorBtn btn-16" onclick="testMove()" style="margin-top: 350px;font-size: 14px;">测试移动车</button> |
| | | <button class="floorBtn btn-16" onclick="resetMap()" style="margin-top: 400px;font-size: 14px;">重置地图</button> |
| | | |
| | | <!-- 货架 + 堆垛机 + 入库站点 --> |
| | | <div class="main-part"> |
| | |
| | | shuttleStatusClass = "shuttle-offline"; |
| | | break |
| | | default: |
| | | shuttleStatusClass = "shuttle-idle" |
| | | shuttleStatusClass = "shuttle-offline" |
| | | } |
| | | let shuttleStatus = '<div class="state">' + |
| | | '<span>四向穿梭车 ' + item.shuttleNo + '</span>' + |
| | |
| | | |
| | | //初始化地图 |
| | | 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.locNoLev){ |
| | | let carBox = '<div class="sxcar" id="sxcar-' + 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) => { |
| | |
| | | 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; |
| | |
| | | $("#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二维数组(后续用于请求计算路径时携带地图数据参数使用) |
| | |
| | | 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('重置完成'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 小车偏移动画 |
| | |
| | | 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; |
| | | } |