From 5bf2b51ec743cd422a0eb3277b9c93a08c700315 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 10 二月 2025 08:46:30 +0800
Subject: [PATCH] #
---
src/main/webapp/views/console.html | 265 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 193 insertions(+), 72 deletions(-)
diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index 74bdbab..7f5fb5d 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -22,28 +22,28 @@
<div v-for="(col,idx) in row" :key="idx">
<div v-if="col.value == 0">
<!-- 瀛愯建閬� 璺緞涓虹┛姊溅棰勮璺緞鍒欐樉绀虹┛姊溅棰滆壊鍜岀┛姊溅鍙� -->
- <div :style="{background: checkAdvancePath(index,idx) == null ? '':shuttleColorList[checkAdvancePath(index,idx)]}" class="item" v-if="col.data.length > 0">{{col.data}}</div>
- <div :style="{background: checkAdvancePath(index,idx) == null ? '':shuttleColorList[checkAdvancePath(index,idx)]}" class="item" v-else>{{checkAdvancePath(index,idx) == null ? idx:checkAdvancePath(index,idx)}}</div>
+ <div :style="{background: checkAdvancePath(index,idx).length == 0 ? '':shuttleColorList[checkAdvancePath(index,idx)[0]]}" class="item" v-if="col.data.length > 0">{{col.data}}</div>
+ <div :style="{background: checkAdvancePath(index,idx).length == 0 ? '':shuttleColorList[checkAdvancePath(index,idx)[0]]}" class="item" v-else>{{checkAdvancePath(index,idx).length == 0 ? idx:checkAdvancePath(index,idx)}}</div>
</div>
<div v-else-if="col.value == 3">
<!-- 姣嶈建閬� 璺緞涓虹┛姊溅棰勮璺緞鍒欐樉绀虹┛姊溅棰滆壊鍜岀┛姊溅鍙� -->
- <div :style="{background: checkAdvancePath(index,idx) == null ? '#5af':shuttleColorList[checkAdvancePath(index,idx)]}" class="item">{{checkAdvancePath(index,idx) == null ? '⇅⇄':checkAdvancePath(index,idx)}}</div>
+ <div :style="{background: checkAdvancePath(index,idx).length == 0 ? '#5af':shuttleColorList[checkAdvancePath(index,idx)[0]]}" class="item">{{checkAdvancePath(index,idx).length == 0 ? '⇅⇄':checkAdvancePath(index,idx)}}</div>
</div>
<div v-else-if="col.value == 4">
<!-- 绔欑偣 -->
- <div class="site" @click="openSite(col.data)">{{col.data}}</div>
+ <div class="site" :id="'site-' + col.data" @click="openSite(col.data)">{{col.data}}</div>
</div>
<div v-else-if="col.value == 5">
<!-- 鍏呯數妗� -->
<div class="item" style="font-size: 24px">⚡</div>
</div>
- <div v-else-if="col.value < 0">
- <!-- 绂佹鏄剧ず鍖哄煙 -->
- <div class="item" style="visibility: hidden">{{idx}}</div>
- </div>
<div v-else-if="col.value == -999">
<!-- 璺緞鍗犵敤鍖哄煙 -->
<div class="item" style="background:#f83333;color: #fff;">{{idx}}</div>
+ </div>
+ <div v-else-if="col.value < 0">
+ <!-- 绂佹鏄剧ず鍖哄煙 -->
+ <div class="item" style="visibility: hidden">{{idx}}</div>
</div>
<div v-else>
<div class="item" v-if="col.data.length > 0">{{col.data}}</div>
@@ -60,8 +60,8 @@
<!--杈撳嚭灏忚溅-->
<div v-for="(car,idx) in currentLevShuttleList"
:style="{
- left: getCarPosition(car.wcsPoint.x,car.wcsPoint.y)[1]
- ,top: getCarPosition(car.wcsPoint.x,car.wcsPoint.y)[0]
+ left: getCarPosition(car.point.x,car.point.y)[1]
+ ,top: getCarPosition(car.point.x,car.point.y)[0]
,color: shuttleColorList[car.shuttleNo]
}"
class="sxcar" :id="'sxcar-' + car.shuttleNo">
@@ -73,10 +73,12 @@
<!--杈撳嚭妤煎眰-->
<div style="height: 100%;">
<div class="floorBtnBox" v-for="(lev,idx) in floorList">
- <el-button @click="changFloor(lev)">{{lev}}F</el-button>
+ <el-button :style="{background:currentLev === lev ? '#7DCDFF':''}" @click="changFloor(lev)">{{lev}}F</el-button>
</div>
<div>
- <el-button @click="testMove()">娴嬭瘯绉诲姩杞�</el-button>
+<!-- <el-button @click="testMove()">娴嬭瘯绉诲姩杞�</el-button>-->
+ <el-button @click="resetMap()">閲嶇疆鍦板浘</el-button>
+<!-- <el-button @click="initLoc()">鍒濆鍖栧簱浣�</el-button>-->
</div>
</div>
</div>
@@ -186,7 +188,7 @@
<li><span>鏉$爜鍚嶇О</span><span class="right">鎵爜鏃堕棿</span></li>
</div>
<div id="barcode1" class="table-body">
-
+ <li v-for="(item,index) in codeList1" :key="index"><span>{{item.barcode}}</span><span class="right">{{item.time}}</span></li>
</div>
</div>
<div class="tablebox">
@@ -194,7 +196,7 @@
<li><span>鏉$爜鍚嶇О</span><span class="right">鎵爜鏃堕棿</span></li>
</div>
<div id="barcode2" class="table-body">
-
+ <li v-for="(item,index) in codeList2" :key="index"><span>{{item.barcode}}</span><span class="right">{{item.time}}</span></li>
</div>
</div>
</div>
@@ -332,13 +334,16 @@
map: [],//鍦板浘鏁版嵁
currentLev: 1,//鍦板浘褰撳墠妤煎眰
siteWindow: false, //绔欑偣寮圭獥鏄剧ず榛樿涓嶆樉绀�
- floorList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], //褰撳墠椤圭洰妤煎眰
+ floorList: [1, 2, 3, 4], //褰撳墠椤圭洰妤煎眰
shuttleList: [], //鍥涘悜绌挎杞﹂泦鍚�
currentLevShuttleList: [],//褰撳墠妤煎眰鍥涘悜绌挎杞﹂泦鍚�
shuttleColorList: [],//鍥涘悜绌挎杞﹂鑹查泦鍚�
liftList: [], //鎻愬崌鏈洪泦鍚�
systemStatus: true,//绯荤粺杩愯鐘舵��
consoleInterval: null,//瀹氭椂鍣ㄥ瓨鍌ㄥ彉閲�
+ codeList1: [],//鏉$爜List
+ codeList2: [],//鏉$爜List
+ ws: null,
},
created() {
this.init()
@@ -348,32 +353,39 @@
},
methods: {
init() {
+ this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket");
+ this.ws.onopen = this.webSocketOnOpen
+ this.ws.onerror = this.webSocketOnError
+ this.ws.onmessage = this.webSocketOnMessage
+ this.ws.onclose = this.webSocketClose
+
this.getMap(this.currentLev)
this.getSystemRunningStatus() //鑾峰彇绯荤粺杩愯鐘舵��
this.consoleInterval = setInterval(() => {
this.getShuttleStateInfo() //鑾峰彇鍥涘悜绌挎杞︿俊鎭�
this.getLiftStateInfo() //鑾峰彇鎻愬崌鏈轰俊鎭�
- console.log('interval')
+ this.getSiteInfo() //鑾峰彇杈撻�佺珯鐐规暟鎹�
+ this.getMap(this.currentLev) //鑾峰彇瀹炴椂鍦板浘鏁版嵁
+ this.getCodeData()//鑾峰彇鏉$爜
}, 1000)
},
//鑾峰彇鍦板浘鏁版嵁
getMap(lev) {
- $.ajax({
- type: "get",
- url: baseUrl + "/console/map/" + lev + "/auth",
- headers: {
- 'token': localStorage.getItem('token')
- },
- success: (res) => {
- let data = res.data
- let tmp = []
- for (let i = 1; i < data.length - 1; i++) {
- tmp.push(data[i])
- }
- this.map = tmp
- }
- })
+ this.sendWs(JSON.stringify({
+ "url": "/console/map/auth",
+ "data": lev
+ }))
+ },
+ setMap(res) {
+ //鑾峰彇鍦板浘鏁版嵁
+ let data = res.data
+ let tmp = []
+ for (let i = 1; i < data.length - 1; i++) {
+ tmp.push(data[i])
+ }
+ // console.log(tmp)
+ this.map = tmp
},
openSite(id) {
this.siteWindow = true; //鎵撳紑绔欑偣淇℃伅寮圭獥
@@ -401,57 +413,79 @@
})
},
+ getSiteInfo() {
+ //鑾峰彇杈撻�佺珯鐐规暟鎹�
+ this.sendWs(JSON.stringify({
+ "url": "/console/latest/data/site",
+ "data": {}
+ }))
+ },
+ setSiteInfo(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);
+ }
+ }
+ } else if (res.code === 403){
+ parent.location.href = baseUrl+"/login";
+ } else {
+ console.log(res.msg);
+ }
+ },
changFloor(lev) {
this.currentLev = lev
this.currentLevShuttleList = []
this.getMap(lev)
},
getShuttleStateInfo() {
+ this.sendWs(JSON.stringify({
+ "url": "/shuttle/table/shuttle/state",
+ "data": {}
+ }))
+ },
+ setShuttleStateInfo(res) {
// 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇
let that = this
- $.ajax({
- url: baseUrl + "/shuttle/table/shuttle/state",
- headers: {
- 'token': localStorage.getItem('token')
- },
- method: 'POST',
- success: function(res) {
- if (res.code == 200) {
- let currentLevShuttle = []//褰撳墠妤煎眰灏忚溅闆嗗悎
- res.data.forEach((item,idx) => {
- if (item.point.z == that.currentLev) {
- currentLevShuttle.push(item)
- }
- })
- that.currentLevShuttleList = currentLevShuttle
- that.shuttleList = res.data
-
- if (that.shuttleColorList.length == 0) {
- let colorList = []//闅忔満灏忚溅棰滆壊
- res.data.forEach((item,idx) => {
- colorList[item.shuttleNo] = that.colorRGB()
- })
- that.shuttleColorList = colorList
+ if (res.code == 200) {
+ let currentLevShuttle = []//褰撳墠妤煎眰灏忚溅闆嗗悎
+ res.data.forEach((item,idx) => {
+ if (item != null && item.point != undefined && item.point != null) {
+ if (item.point.z == that.currentLev) {
+ currentLevShuttle.push(item);
}
}
+ })
+ that.currentLevShuttleList = currentLevShuttle
+ that.shuttleList = res.data
+
+ if (that.shuttleColorList.length == 0) {
+ let colorList = []//闅忔満灏忚溅棰滆壊
+ res.data.forEach((item,idx) => {
+ colorList[item.shuttleNo] = that.colorRGB()
+ })
+ that.shuttleColorList = colorList
}
- });
+ }
},
getLiftStateInfo() {
// 鎻愬崌鏈轰俊鎭〃鑾峰彇
- let that = this
- $.ajax({
- url: baseUrl + "/lift/table/lift/state",
- headers: {
- 'token': localStorage.getItem('token')
- },
- method: 'POST',
- success: function(res) {
- if (res.code == 200) {
- that.liftList = res.data
- }
- }
- });
+ this.sendWs(JSON.stringify({
+ "url": "/lift/table/lift/state",
+ "data": {}
+ }))
+ },
+ setLiftStateInfo(res) {
+ // 鎻愬崌鏈轰俊鎭〃鑾峰彇
+ if (res.code == 200) {
+ this.liftList = res.data
+ }
},
systemSwitch() {
// 绯荤粺寮�鍏�
@@ -489,10 +523,12 @@
$('#system-toggle-checked').attr("checked", true);
$('#system-run-desc').html("绯荤粺杩愯涓�...");
that.systemStatus = true;
+ parent.systemRunning = true;
} else {
$('#system-toggle-checked').attr("checked", false);
$('#system-run-desc').html("绯荤粺宸插仠姝�!");
that.systemStatus = false;
+ parent.systemRunning = false;
}
} else if (res.code === 403) {
parent.location.href = baseUrl + "/login";
@@ -520,10 +556,12 @@
$('#system-toggle-checked').attr("checked", true);
$('#system-run-desc').html("绯荤粺杩愯涓�...");
that.systemStatus = true;
+ parent.systemRunning = true;
} else {
$('#system-toggle-checked').attr("checked", false);
$('#system-run-desc').html("绯荤粺宸插仠姝�!");
that.systemStatus = false;
+ parent.systemRunning = false;
}
} else if (res.code === 403) {
parent.location.href = baseUrl + "/login";
@@ -561,8 +599,8 @@
let tmp = null
tmp = setInterval(() => {
if (index < res.length) {
- that.currentLevShuttleList[0].wcsPoint.y = res[index].y
- that.currentLevShuttleList[0].wcsPoint.x = res[index].x
+ that.currentLevShuttleList[0].point.y = res[index].y
+ that.currentLevShuttleList[0].point.x = res[index].x
index++
}else {
clearInterval(tmp)
@@ -590,6 +628,7 @@
})
}
})
+ let data = []
let shuttleList = this.currentLevShuttleList;
for (var i = 0; i < shuttleList.length; i++) {
let shuttle = shuttleList[i]
@@ -598,12 +637,94 @@
for (var j = 0; j < moveAdvancePath.length; j++) {
let path = moveAdvancePath[j]
if (path.x-1 === x && path.y === y) {//璺緞绗﹀悎
- return shuttle.shuttleNo;//杩斿洖灏忚溅鍙�
+ data.push(shuttle.shuttleNo)
+ continue;
}
}
}
}
- return null;
+ return data;//杩斿洖灏忚溅鍙烽泦鍚�
+ },
+ resetMap() {
+ //閲嶇疆鍦板浘
+ let that = this
+ $.ajax({
+ url:baseUrl+"/console/map/resetMap/" + this.currentLev,
+ headers:{
+ 'token': localStorage.getItem('token')
+ },
+ data:{},
+ method:'get',
+ success:function (res) {
+ that.$message({
+ message: that.currentLev + '灞傚湴鍥鹃噸缃畬鎴�',
+ type: 'success'
+ });
+ }
+ })
+ },
+ initLoc() {
+ //鍒濆鍖栧簱浣�
+ let that = this
+ $.ajax({
+ url:baseUrl+"/locMast/init",
+ headers:{
+ 'token': localStorage.getItem('token')
+ },
+ data:{},
+ method:'post',
+ success:function (res) {
+ that.$message({
+ message: '鍒濆鍖栧畬鎴�',
+ type: 'success'
+ });
+ }
+ })
+ },
+ getCodeData(){
+ this.sendWs(JSON.stringify({
+ "url": "/console/barcode/output/site",
+ "data": {}
+ }))
+ },
+ setCodeData(res) {
+ if(res.code === 200){
+ let data = JSON.parse(res.data)
+ if (data.length <= 5) {
+ this.codeList1 = data;
+ } else {
+ this.codeList1 = data.slice(0, 5);
+ this.codeList2 = data.splice(5, 10);
+ }
+ }
+ },
+ webSocketOnOpen(e) {
+ console.log("open");
+ },
+ webSocketOnError(e) {
+ console.log(e);
+ },
+ webSocketOnMessage(e) {
+ const result = JSON.parse(e.data);
+ if (result.url == "/shuttle/table/shuttle/state") {
+ this.setShuttleStateInfo(JSON.parse(result.data))
+ }else if (result.url == "/lift/table/lift/state") {
+ this.setLiftStateInfo(JSON.parse(result.data))
+ }else if (result.url == "/console/latest/data/site") {
+ this.setSiteInfo(JSON.parse(result.data))
+ }else if (result.url == "/console/map/auth") {
+ this.setMap(JSON.parse(result.data))
+ }else if (result.url == "/console/barcode/output/site") {
+ this.setCodeData(JSON.parse(result.data))
+ }
+ },
+ webSocketClose(e) {
+ console.log("close");
+ },
+ sendWs(message) {
+ if (this.ws.readyState == WebSocket.OPEN) {
+ this.ws.send(message)
+ }
}
}
})
--
Gitblit v1.9.1