From 7fd4327861ee2b36af01ff526742b0704f713ccc Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 26 十一月 2024 15:00:42 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/http.js | 90 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/zy-acs-flow/src/map/http.js b/zy-acs-flow/src/map/http.js
index 5fa8812..3a66580 100644
--- a/zy-acs-flow/src/map/http.js
+++ b/zy-acs-flow/src/map/http.js
@@ -14,7 +14,7 @@
mapContainer = param;
}
-export const fetchMapData = (zoneId, setRcsStatus) => {
+export const fetchMapData = (zoneId, setRcsStatus, setCurSprite) => {
Tool.clearMapData();
return request.post('/map/data/fetch', {
zoneId: zoneId
@@ -24,7 +24,10 @@
const { code, msg, data: { rcsStatus, common, point } } = res.data;
if (code === 200) {
setRcsStatus(rcsStatus);
- const mapItemList = [...eval(common), ...eval(point)];
+ const commonList = common ? eval(common) : [];
+ const pointList = point ? eval(point) : [];
+ const mapItemList = [...commonList, ...pointList];
+
mapItemList.forEach(item => {
if (item.type !== DEVICE_TYPE.AGV) {
const sprite = Tool.generateSprite(item.type);
@@ -46,7 +49,7 @@
// support
switch (item.type) {
case DEVICE_TYPE.POINT:
- sprite.scale.set(0.65, 0.65);
+ sprite.scale.set(0.85, 0.85);
break
default:
break
@@ -54,6 +57,7 @@
// }, 50);
mapContainer.addChild(sprite);
+ Tool.beInsight(sprite, setCurSprite);
}
}
})
@@ -75,7 +79,7 @@
mapContainer.children.forEach(child => {
if (child.data?.uuid) {
const { type, uuid, no, ...property } = child.data;
- if (type !== DEVICE_TYPE.AGV && type !== DEVICE_TYPE.POINT) {
+ if (type !== DEVICE_TYPE.AGV && type !== DEVICE_TYPE.POINT && type !== DEVICE_TYPE.ROUTE) {
sprites.push({
// graph
positionX: child.position.x,
@@ -181,6 +185,24 @@
})
}
+export const getRouteList = async (zoneId, callback) => {
+ await request.post('/map/route/list', {
+ zoneId: zoneId,
+ }, {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ }).then((res) => {
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ callback(data)
+ } else {
+ notify.error(msg);
+ }
+ }).catch((error) => {
+ notify.error(error.message);
+ console.error(error.message);
+ })
+}
+
export const handleControlAgv = async (param, callback) => {
await request.post('/handler/control/agv', param, {
@@ -223,3 +245,63 @@
console.error(error.message);
})
}
+
+export const getFakeSign = async (param, callback) => {
+ await request.get('/fake/sign/get').then((res) => {
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ if (callback) {
+ callback(data)
+ }
+ } else {
+ notify.error(msg);
+ }
+ }).catch((error) => {
+ notify.error(error.message);
+ console.error(error.message);
+ })
+}
+
+export const setFakeSign = async (param, callback) => {
+ await request.post('/fake/sign/set', {
+ sign: param,
+ }, {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ }).then((res) => {
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ if (data) {
+ notify.success(msg);
+ }
+ if (callback) {
+ callback(data)
+ }
+ } else {
+ notify.error(msg);
+ }
+ }).catch((error) => {
+ notify.error(error.message);
+ console.error(error.message);
+ })
+}
+
+export const handleAgvPatrol = async (param) => {
+ try {
+ const res = await request.post('/handler/agv/patrol', param, {
+ headers: {
+ 'appKey': HANDLE_APP_KEY
+ }
+ });
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ notify.success(msg);
+ return true;
+ } else {
+ notify.error(msg);
+ }
+ } catch (error) {
+ notify.error(error.message);
+ console.error(error.message);
+ }
+ return false;
+}
\ No newline at end of file
--
Gitblit v1.9.1