From d139f7bf7abb80a6672adcca7d45d88dfe8156ed Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期二, 02 十二月 2025 12:41:17 +0800
Subject: [PATCH] #
---
src/main/webapp/views/watch/console2.html | 506 ++++++++++++++++---------------------------------------
1 files changed, 149 insertions(+), 357 deletions(-)
diff --git a/src/main/webapp/views/watch/console2.html b/src/main/webapp/views/watch/console2.html
index 9ae1c46..ead3743 100644
--- a/src/main/webapp/views/watch/console2.html
+++ b/src/main/webapp/views/watch/console2.html
@@ -55,16 +55,6 @@
</div>
</el-drawer>
- <el-drawer title="灏忚溅淇℃伅" :visible.sync="drawerShuttle" :with-header="true" :modal="false">
- <div v-if="drawerShuttleData!=null">
- <div style="margin: 10px;">
- <div style="margin-top: 5px;">灏忚溅锛歿{drawerShuttleData.shuttleNo}}</div>
- <div style="margin-top: 5px;">宸ヤ綔鍙凤細{{drawerShuttleData.wrkNo}}</div>
- <div style="margin-top: 5px;">鐘舵�侊細{{drawerShuttleData}}</div>
- </div>
- </div>
- </el-drawer>
-
<el-drawer title="绔欑偣淇℃伅" :visible.sync="drawerSta" :with-header="true" :modal="false">
<div v-if="drawerStaData!=null">
<div style="margin: 10px;">
@@ -85,20 +75,8 @@
</div>
</el-drawer>
- <el-drawer title="鎻愬崌鏈轰俊鎭�" :visible.sync="drawerLift" :with-header="true" :modal="false">
- <div v-if="drawerLiftData!=null">
- <div style="margin: 10px;">
- <div style="margin-top: 5px;">鎻愬崌鏈猴細{{liftList[drawerLiftData-1].liftNo}}</div>
- <div style="margin-top: 5px;">宸ヤ綔鍙凤細{{liftList[drawerLiftData-1].taskNo}}</div>
- <div style="margin-top: 5px;">鐘舵�侊細{{liftList[drawerLiftData-1]}}</div>
- </div>
- </div>
- </el-drawer>
-
</div>
<script>
- let width = 25;
- let height = 25;
let pixiApp;
let pixiStageList = [];
let pixiShuttleMap = new Map();
@@ -106,6 +84,7 @@
let pixiShuttleMoveAdvancePathList = [];
let pixiStaMap = new Map();
let pixiCrnMap = new Map();
+ let pixiShelfMap = new Map();
let objectsContainer;
let objectsContainer2;
let graphicsShelf;
@@ -126,17 +105,11 @@
drawerLocNo: false,
drawerLocNoData: null,
drawerLocDetls: [],
- reloadMap: true,
mapFps: 0,
- drawerShuttle: false,
- drawerShuttleData: null,
currentLevStaList: [],//褰撳墠妤煎眰绔欑偣list
reloadSta: true,
drawerSta: false,
drawerStaData: null,
- drawerLift: false,
- drawerLiftData: null,
- liftList: [],
},
mounted() {
this.init()
@@ -227,7 +200,6 @@
changeFloor(lev) {
this.currentLev = lev
this.currentLevShuttleList = []
- this.reloadMap = true
this.reloadSta = true
this.getMap(lev)
@@ -251,10 +223,10 @@
pixiApp.loader.add('shuttle', '../static/images/sxcar.png');
// 浠嶨raphics瀵硅薄鍒涘缓涓�涓汗鐞�
- graphicsShelf = pixiApp.renderer.generateTexture(getContainer('shelf'));
- graphicsDevp = pixiApp.renderer.generateTexture(getContainer('devp'));
- graphicsCrn = createCrnTexture();
- graphicsCrnTrack = createTrackTexture();
+ // graphicsShelf = pixiApp.renderer.generateTexture(getContainer('shelf'));
+ // graphicsDevp = pixiApp.renderer.generateTexture(getContainer('devp'));
+ graphicsCrn = createCrnTexture(25,25);
+ graphicsCrnTrack = createTrackTexture(25,25);
// 鍒涘缓涓�涓鍣ㄦ潵绠$悊澶ф壒閲忕殑鏄剧ず瀵硅薄
objectsContainer = new PIXI.Container();
@@ -358,114 +330,125 @@
},
createMapData(map) {
- if (this.reloadMap) {
- this.reloadMap = false
- pixiStageList = [map.length]//鍒濆鍖栧垪琛�
- pixiStaMap = new Map();//閲嶇疆
- objectsContainer.removeChildren()
- map.forEach((item, index) => {
- pixiStageList[index] = [item.length]
- for (let idx = 0; idx < item.length; idx++) {
- let val = item[idx]
+ pixiStageList = [map.length]//鍒濆鍖栧垪琛�
+ pixiStaMap = new Map();//閲嶇疆
+ objectsContainer.removeChildren()
- // 璺宠繃鍚堝苟鍗曞厓鏍肩殑鍗犱綅绗�
- if (val.type === 'merge') {
- continue;
- }
-
- if (val.type == undefined || val.type === 'none') {
- continue;
- }
-
- // 璁$畻鍚堝苟鍗曞厓鏍肩殑瀹為檯瀹介珮
- let cellWidth = val.colSpan ? val.colSpan * width : width;
- let cellHeight = val.rowSpan ? val.rowSpan * height : height;
-
- let sprite = getSpriteWithSize(val.value, idx * width, index * height, cellWidth, cellHeight, val, (e) => {
- // if (val.value == 4) {
- // //绔欑偣
- // this.openDrawerSta(val)
- // } else if (val.value == 67) {
- // //鎻愬崌鏈�
- // this.openDrawerLift(val)
- // } else {
- // //搴撲綅
- // this.rightEvent(index, idx, e);
- // updateColor(sprite, 0x9900ff);
- // }
- });
-
- if (sprite == null) {
- continue;
- }
-
- // if (val.value == 4) {
- // // 鍒涘缓鏂囨湰瀵硅薄
- // const style = new PIXI.TextStyle({
- // fontFamily: 'Arial',
- // fontSize: 10,
- // fill: '#000000',
- // });
- // const text = new PIXI.Text(val.data, style);
- // text.anchor.set(0.5); // 璁剧疆鏂囨湰閿氱偣涓轰腑蹇冪偣
- // text.position.set(sprite.width / 2, sprite.height / 2); // 灏嗘枃鏈綅缃缃负Graphics瀵硅薄鐨勪腑蹇冪偣
- // // 灏嗘枃鏈璞℃坊鍔犲埌Graphics瀵硅薄涓�
- // sprite.addChild(text);
- // sprite.textObj = text;
- // pixiStaMap.set(parseInt(val.data), sprite);//绔欑偣鏁版嵁娣诲姞鍒癿ap涓�
- // }else if (val.value == 67) {
- // // 鍒涘缓鎻愬崌鏈烘枃鏈璞�
- // const style = new PIXI.TextStyle({
- // fontFamily: 'Arial',
- // fontSize: 10,
- // fill: '#000000',
- // });
- // const text = new PIXI.Text(val.data, style);
- // text.anchor.set(0.5); // 璁剧疆鏂囨湰閿氱偣涓轰腑蹇冪偣
- // text.position.set(sprite.width / 2, sprite.height / 2); // 灏嗘枃鏈綅缃缃负Graphics瀵硅薄鐨勪腑蹇冪偣
- // // 灏嗘枃鏈璞℃坊鍔犲埌Graphics瀵硅薄涓�
- // sprite.addChild(text);
- // sprite.textObj = text;
- // pixiStaMap.set(parseInt(val.data), sprite);//绔欑偣鏁版嵁娣诲姞鍒癿ap涓�
- // }
-
- objectsContainer.addChild(sprite);
- pixiStageList[index][idx] = sprite
+ let bayWidthList = this.initWidth(map)
+ map.forEach((item, index) => {
+ for(let idx = 0;idx < item.length;idx++){
+ let val = item[idx];
+ if(val.cellWidth == undefined || val.cellWidth === ''){
+ val.cellWidth = bayWidthList[idx];
}
- });
+ }
+ })
- //瑙嗚灞呬腑
- let containerWidth = (pixiApp.view.width - objectsContainer.width) / 2;
- let containerHeight = (pixiApp.view.height - objectsContainer.height) / 2;
- pixiApp.stage.position.set(containerWidth, containerHeight);
- } else {
- let diff = this.findDiffList(this.map, map);
- diff.forEach((item, index) => {
- //鑾峰彇old鍏冪礌
- let oldSprite = pixiStageList[item.x][item.y]
- if (!oldSprite) return; // 璺宠繃涓嶅瓨鍦ㄧ殑鍏冪礌
+ let bayHeightList = this.initHeight(map);
+ map.forEach((item, index) => {
+ for(let idx = 0;idx < item.length;idx++){
+ let val = item[idx];
+ if(val.cellHeight == undefined || val.cellHeight === ''){
+ val.cellHeight = bayHeightList[index];
+ }
+ }
+ })
- //绉婚櫎old鍏冪礌
- objectsContainer.removeChild(oldSprite);
-
+ map.forEach((item, index) => {
+ for(let idx = 0;idx < item.length;idx++){
+ let val = item[idx];
// 璁$畻鍚堝苟鍗曞厓鏍肩殑瀹為檯瀹介珮
- let cellWidth = item.colSpan ? item.colSpan * width : width;
- let cellHeight = item.rowSpan ? item.rowSpan * height : height;
+ let cellWidth = val.cellWidth / 40;
+ let cellHeight = val.cellHeight / 8;
- let sprite = getSpriteWithSize(item.data, item.y * width, item.x * height, cellWidth, cellHeight, item, (e) => {
- this.rightEvent(item.x, item.y, e);
- updateColor(sprite, 0x9900ff);
+ val.width = cellWidth;
+ val.height = cellHeight;
+
+ val.posX = idx * cellWidth;
+ val.posY = index * cellHeight;
+ }
+ })
+
+ map.forEach((item, index) => {
+ pixiStageList[index] = [item.length]
+ for (let idx = 0; idx < item.length; idx++) {
+ let val = item[idx]
+
+ // 璺宠繃鍚堝苟鍗曞厓鏍肩殑鍗犱綅绗�
+ if (val.type === 'merge') {
+ continue;
+ }
+
+ if (val.type == undefined || val.type === 'none') {
+ continue;
+ }
+
+ let sprite = getSprite(val, (e) => {
+ // if (val.value == 4) {
+ // //绔欑偣
+ // this.openDrawerSta(val)
+ // } else {
+ // //搴撲綅
+ // this.rightEvent(index, idx, e);
+ // updateColor(sprite, 0x9900ff);
+ // }
});
- //娣诲姞鍏冪礌
- objectsContainer.addChild(sprite);
+ if (sprite == null) {
+ continue;
+ }
- //淇濆瓨鏂板厓绱�
- pixiStageList[item.x][item.y] = sprite
- });
- }
+ objectsContainer.addChild(sprite);
+ pixiStageList[index][idx] = sprite
+ }
+ });
+
+
+
+ //瑙嗚灞呬腑
+ let containerWidth = (pixiApp.view.width - objectsContainer.width) / 2;
+ let containerHeight = (pixiApp.view.height - objectsContainer.height) / 2;
+ pixiApp.stage.position.set(containerWidth, containerHeight);
this.map = map;
+ },
+ initWidth(map) {
+ let maxRow = map.length;
+ let maxBay = map[0].length;
+
+ let bayWidthList = [];
+ for(let bay = 0;bay < maxBay;bay++){
+ let bayWidth = -1;
+ for(let row = 0;row < maxRow;row++){
+ let val = map[row][bay];
+ if (val.cellWidth == undefined || val.cellWidth === '') {
+ continue;
+ }
+ bayWidth = Math.max(bayWidth, val.cellWidth);
+ break;
+ }
+ bayWidthList.push(bayWidth);
+ }
+ return bayWidthList;
+ },
+ initHeight(map) {
+ let maxRow = map.length;
+ let maxBay = map[0].length;
+
+ let bayHeightList = [];
+ for(let row = 0;row < maxRow;row++){
+ let bayHeight = -1;
+ for(let bay = 0;bay < maxBay;bay++){
+ let val = map[row][bay];
+ if (val.cellHeight == undefined || val.cellHeight === '') {
+ continue;
+ }
+ bayHeight = Math.max(bayHeight, val.cellHeight);
+ break;
+ }
+ bayHeightList.push(bayHeight);
+ }
+ return bayHeightList;
},
rightEvent(x, y, e) {
this.drawerLocNo = true
@@ -473,76 +456,6 @@
x: x, y: y, z: this.currentLev, locNo: this.map[x][y].locNo,
locSts: this.map[x][y].locSts, row: this.map[x][y].row, bay: this.map[x][y].bay, lev: this.currentLev
};
- },
- findDiffList(arr1, arr2) {
- let diff = []
- arr1.forEach((item, index) => {
- item.forEach((val, idx) => {
- if (val.value != arr2[index][idx].value) {
- diff.push({
- x: index,
- y: idx,
- data: arr2[index][idx].value,
- originData: val.value,
- locSts: val.locSts
- })
- }
- })
- })
-
- return diff;
- },
- findShuttleDiffList(list1, list2) {
- //妫�娴嬮泦鍚�1閲岄潰鐨勫皬杞︽槸鍚﹀湪闆嗗悎2涓湁鍙樺姩
- if (list1.length == 0) {
- return false;//闆嗗悎涓虹┖
- }
- if (list1.length != list2.length) {
- return false;//涓や釜闆嗗悎闀垮害涓嶄竴鑷�
- }
-
- let flag = false;
- list1.forEach((item, index) => {
- for (var i = 0; i < list2.length; i++) {
- if (item.shuttleNo == list2[i].shuttleNo) {
- flag = true;
- break;
- }
- }
- });
-
- return flag;
- },
- findShuttlePathDiffList(list1, list2) {
- //妫�娴嬮泦鍚�1閲岄潰鐨勫皬杞﹂璁¤矾寰勬槸鍚﹀湪闆嗗悎2涓湁鍙樺姩
- if (list1.length == 0) {
- return false;//闆嗗悎涓虹┖
- }
- if (list1.length != list2.length) {
- return false;//涓や釜闆嗗悎闀垮害涓嶄竴鑷�
- }
-
- for (var index = 0; index < list1.length; index++) {
- let item = list1[index];
- for (var i = 0; i < list2.length; i++) {
- if (item.shuttleNo != list2[i].shuttleNo) {
- continue;//鎵句笉鍒板皬杞﹀彿
- }
-
- if (item.moveAdvancePath == null) {
- item.moveAdvancePath = [];
- }
-
- if (list2[i].moveAdvancePath == null) {
- list2[i].moveAdvancePath = [];
- }
-
- if (!(item.moveAdvancePath.length == list2[i].moveAdvancePath.length)) {
- return false;//灏忚溅棰勮璺緞闀垮害涓嶄竴鑷�
- }
- }
- }
- return true;
},
checkStaInListDiff(sta, list) {
//妫�娴嬬珯鐐规槸鍚﹀湪闆嗗悎涓湁鍙樺姩
@@ -736,111 +649,27 @@
}
})
},
- openDrawerLift(data) {
- this.drawerLift = true;
- this.drawerLiftData = parseInt(data.data)
- },
- getLiftStateInfo() {
- // 鎻愬崌鏈轰俊鎭〃鑾峰彇
- this.sendWs(JSON.stringify({
- "url": "/lift/table/lift/state",
- "data": {}
- }))
- },
- setLiftStateInfo(res) {
- // 鎻愬崌鏈轰俊鎭〃鑾峰彇
- if (res.code == 200) {
- this.liftList = res.data
- }
- },
- addMoveAdvancePath(moveAdvancePath, shuttleNo) {//娣诲姞棰勮璺緞
- let that = this;
- moveAdvancePath.forEach((path, idx) => {
- let locNo = this.map[path.x, path.y];
- if (!pixiShuttleMoveAdvancePathMap.has(locNo)) {
- let graphics = getGraphics(0x9966ff, width, height, path.y * width, (path.x - 1) * height);
- let shuttleNos = [shuttleNo];
- // 鍒涘缓鏂囨湰瀵硅薄
- const style = new PIXI.TextStyle({
- fontFamily: 'Arial',
- fontSize: 10,
- fill: '#000000',
- });
- const text = new PIXI.Text(JSON.stringify(shuttleNos), style);
- text.anchor.set(0.5); // 璁剧疆鏂囨湰閿氱偣涓轰腑蹇冪偣
- text.position.set(graphics.width / 2, graphics.height / 2); // 灏嗘枃鏈綅缃缃负Graphics瀵硅薄鐨勪腑蹇冪偣
- // 灏嗘枃鏈璞℃坊鍔犲埌Graphics瀵硅薄涓�
- graphics.addChild(text);
- graphics.textObj = text;
- objectsContainer2.addChild(graphics)
- pixiShuttleMoveAdvancePathMap.set(locNo, {
- path: path,
- sprite: graphics,
- textObj: text,
- shuttleNos: shuttleNos
- })
-
- if (pixiShuttleMoveAdvancePathList[shuttleNo] == null) {
- let locNos = new Set()
- locNos.add(locNo);
- pixiShuttleMoveAdvancePathList[shuttleNo] = locNos;
- } else {
- pixiShuttleMoveAdvancePathList[shuttleNo].add(locNo);
- }
- } else {
- let pathMap = pixiShuttleMoveAdvancePathMap.get(locNo)
- let shuttleNos = pathMap.shuttleNos;
- shuttleNos.push(shuttleNo);
- pathMap.textObj.text = JSON.stringify(shuttleNos);
- pixiShuttleMoveAdvancePathMap.set(locNo, pathMap);
- if (pixiShuttleMoveAdvancePathList[shuttleNo] == null) {
- let locNos = new Set()
- locNos.add(locNo);
- pixiShuttleMoveAdvancePathList[shuttleNo] = locNos;
- } else {
- pixiShuttleMoveAdvancePathList[shuttleNo].add(locNo);
- }
- }
- });
- },
- removeMoveAdvancePath(shuttleNo) {//鍒犻櫎棰勮璺緞
- let locNos = pixiShuttleMoveAdvancePathList[shuttleNo];
- if (locNos != null) {
- locNos.forEach((locNo, index) => {
- let pathMap = pixiShuttleMoveAdvancePathMap.get(locNo);
- if (pathMap != null) {
- let shuttleNos = pathMap.shuttleNos;
- let shuttleNosNew = [];
- shuttleNos.forEach((shuttle, idx) => {
- if (shuttle != shuttleNo) {
- shuttleNosNew.push(shuttle);
- }
- });
-
- if (shuttleNosNew.length === 0) {
- //棰勮璺緞娌℃湁灏忚溅锛岀洿鎺ュ垹闄よ矾寰�
- objectsContainer2.removeChild(pathMap.sprite);
- pixiShuttleMoveAdvancePathMap.delete(locNo)
- } else {
- //棰勮璺緞瀛樺湪鍏朵粬灏忚溅锛屾洿鏂版枃瀛椾俊鎭�
- pathMap.textObj.text = JSON.stringify(shuttleNosNew);
- pathMap.shuttleNos = shuttleNosNew;
- pixiShuttleMoveAdvancePathMap.set(locNo, pathMap);
- }
- }
- })
- }
- },
}
})
- function getContainer(type) {
+ function createShelfSprite(width, height) {
+ let idx = width + "-" + height;
+ let texture = pixiShelfMap.get(idx);
+ if (texture == undefined) {
+ let graphics = getContainer('shelf', width, height);
+ texture = pixiApp.renderer.generateTexture(graphics);
+ pixiShelfMap.set(idx, texture);
+ }
+ return new PIXI.Sprite(texture);
+ }
+
+ function getContainer(type, width, height) {
let graphics = new PIXI.Graphics();
let drawBorder = true;
if (type == 'shelf') {
graphics.beginFill(0x55aaff);
} else if (type == 'devp') {
- graphics.beginFill(0xffff00);
+ graphics.beginFill(0x00ff7f);
graphics.visible = true;
} else if (type == 'crn') {
graphics.beginFill(0xaaffff);
@@ -854,7 +683,7 @@
return graphics;
}
- function createTrackTexture() {
+ function createTrackTexture(width, height) {
const g = new PIXI.Graphics();
const t = Math.max(2, Math.round(height * 0.08));
const gap = Math.round(height * 0.30);
@@ -881,7 +710,7 @@
return rt;
}
- function createCrnTexture() {
+ function createCrnTexture(width, height) {
const g = new PIXI.Graphics();
const yTop = Math.round(height * 0.1);
let deviceWidth = width * 2;
@@ -919,35 +748,6 @@
return rt;
}
- function getContainerWithSize(value, w, h) {
- let graphics = new PIXI.Graphics();
- if (value === 0) {
- graphics.beginFill(0x55aaff);
- } else if (value === 3) {//姣嶈建閬�
- graphics.beginFill(0x00ff7f);
- graphics.visible = true;
- } else if (value === 4) {//绔欑偣
- graphics.beginFill(0xffff00);
- graphics.visible = true;
- } else if (value === 5) {//鍏呯數妗�
- graphics.beginFill(0xffaa7f);
- graphics.visible = true;
- } else if (value === 9) {//杞ㄨ抗
- graphics.beginFill(0xff0000);
- } else if (value === 67) {//鎻愬崌鏈�
- graphics.beginFill(0xaaffff);
- } else if (value === -999) {//璺緞閿佸畾
- graphics.beginFill(0xf83333);
- } else if (value === 1000) {//婊″簱浣�
- graphics.beginFill(0xf83333);
- }
- graphics.lineStyle(1, 0xffffff, 1);
- graphics.drawRect(0, 0, w, h);
- graphics.endFill();
-
- return graphics;
- }
-
function getGraphics(color, width, height, x, y) {
let graphics = new PIXI.Graphics();
graphics.beginFill(color);
@@ -958,13 +758,28 @@
return graphics;
}
- function getSprite(value, x, y, item, pointerDownEvent) {
+ function getSprite(item, pointerDownEvent) {
let sprite;
- console.log(item.type);
+ let value = item.value;
if (item.type == 'shelf') {
- sprite = new PIXI.Sprite(graphicsShelf);
+ sprite = createShelfSprite(item.width, item.height);
} else if (item.type == 'devp') {
- sprite = new PIXI.Sprite(graphicsDevp);
+ const graphics = getContainer('devp', item.width, item.height);
+ const texture = pixiApp.renderer.generateTexture(graphics);
+ sprite = new PIXI.Sprite(texture);
+ let siteId = getStationId(value);
+ if (siteId === -1) {
+ siteId = item.data;
+ }
+ const style = new PIXI.TextStyle({ fontFamily: 'Arial', fontSize: 10, fill: '#ffffff', stroke: '#000000', strokeThickness: 2 });
+ const text = new PIXI.Text(String(siteId), style);
+ text.anchor.set(0.5);
+ text.position.set(sprite.width / 2, sprite.height / 2);
+ sprite.addChild(text);
+ sprite.textObj = text;
+ if (siteId != null && siteId !== -1) {
+ pixiStaMap.set(parseInt(siteId), sprite);
+ }
} else if (item.type == 'crn') {
if (getDeviceNo(value) == -1) {
sprite = new PIXI.Sprite(graphicsCrnTrack);
@@ -986,33 +801,10 @@
} else {
return null;
}
- sprite.position.set(x, y);
+
+ sprite.position.set(item.posX, item.posY);
sprite.interactive = true; // 蹇呴』瑕佽缃墠鑳芥帴鏀朵簨浠�
sprite.buttonMode = true; // 璁╁厜鏍囧湪hover鏃跺彉涓烘墜鍨嬫寚閽�
-
- sprite.on('pointerdown', (e) => {
- pointerDownEvent(e)
- })
-
- return sprite;
- }
-
- function getSpriteWithSize(value, x, y, w, h, item, pointerDownEvent) {
- let sprite;
-
- // 濡傛灉鏄爣鍑嗗昂瀵革紝浣跨敤缂撳瓨鐨勭汗鐞�
- if (w === width && h === height) {
- return getSprite(value, x, y, item, pointerDownEvent);
- }
-
- // 鍚堝苟鍗曞厓鏍奸渶瑕佸姩鎬佸垱寤虹汗鐞�
- let graphics = getContainerWithSize(value, w, h);
- let texture = pixiApp.renderer.generateTexture(graphics);
- sprite = new PIXI.Sprite(texture);
-
- sprite.position.set(x, y);
- sprite.interactive = true;
- sprite.buttonMode = true;
sprite.on('pointerdown', (e) => {
pointerDownEvent(e)
--
Gitblit v1.9.1