From 20aa51767d2bcc0baf30e1eee5ccce05ace9a6fe Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 09 十一月 2024 14:07:25 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/http.js | 84 +++++++++++++++++++++++++++++++++++++++-- 1 files changed, 79 insertions(+), 5 deletions(-) diff --git a/zy-acs-flow/src/map/http.js b/zy-acs-flow/src/map/http.js index c6d34e1..dfc2940 100644 --- a/zy-acs-flow/src/map/http.js +++ b/zy-acs-flow/src/map/http.js @@ -14,16 +14,20 @@ mapContainer = param; } -export const fetchMapData = (zoneId) => { +export const fetchMapData = (zoneId, setRcsStatus) => { Tool.clearMapData(); return request.post('/map/data/fetch', { zoneId: zoneId }, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then((res) => { - const { code, msg, data: { common, point } } = res.data; + const { code, msg, data: { rcsStatus, common, point } } = res.data; if (code === 200) { - const mapItemList = [...eval(common), ...eval(point)]; + setRcsStatus(rcsStatus); + 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); @@ -45,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 @@ -74,7 +78,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, @@ -106,6 +110,23 @@ notify.error(error.message); console.error(error.message); }) +} + +export const startupOrShutdown = async (callback) => { + try { + const res = await request.post('/map/startupOrShutdown'); + const { code, msg, data } = res.data; + if (code === 200) { + if (callback) { + callback(); + } + } else { + notify.error(msg); + } + } catch (error) { + notify.error(error.message); + console.error(error.message); + } } export const getLocGroup = async (row, bay, callback) => { @@ -145,6 +166,43 @@ }) } +export const getPointInfo = async (point, callback) => { + await request.post('/map/point/info', { + codeData: point, + }, { + 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 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, { headers: { @@ -186,3 +244,19 @@ console.error(error.message); }) } + +export const getFakeSign = async (param, callback) => { + await request.get('/fake/sign').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); + }) +} -- Gitblit v1.9.1