From 366ba040d2447bacd3455299425e3166f1f992bb Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期四, 20 十一月 2025 14:38:32 +0800
Subject: [PATCH] 添加大车、大理片笼以及多设备串行/并行执行写入基础逻辑
---
mes-web/src/api/device/deviceManagement.js | 111 ++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 97 insertions(+), 14 deletions(-)
diff --git a/mes-web/src/api/device/deviceManagement.js b/mes-web/src/api/device/deviceManagement.js
index 13dd443..4d87dfb 100644
--- a/mes-web/src/api/device/deviceManagement.js
+++ b/mes-web/src/api/device/deviceManagement.js
@@ -200,33 +200,38 @@
/**
* 鍒涘缓璁惧缁勯厤缃�
*/
- create(data) {
+ create(config) {
return request({
url: '/api/plcSend/device/group/create',
method: 'post',
- data
+ data: {
+ groupConfig: config
+ }
})
},
/**
* 鏇存柊璁惧缁勯厤缃�
*/
- update(data) {
+ update(id, config) {
return request({
url: '/api/plcSend/device/group/update',
method: 'post',
- data
+ data: {
+ groupId: id,
+ groupConfig: config
+ }
})
},
/**
* 鍒犻櫎璁惧缁勯厤缃�
*/
- delete(data) {
+ delete(id) {
return request({
url: '/api/plcSend/device/group/delete',
method: 'post',
- data
+ data: { groupId: id }
})
},
@@ -263,44 +268,44 @@
/**
* 鍚敤璁惧缁�
*/
- enable(data) {
+ enable(id) {
return request({
url: '/api/plcSend/device/group/enable',
method: 'post',
- data
+ data: { groupId: id }
})
},
/**
* 绂佺敤璁惧缁�
*/
- disable(data) {
+ disable(id) {
return request({
url: '/api/plcSend/device/group/disable',
method: 'post',
- data
+ data: { groupId: id }
})
},
/**
* 鎵归噺鍚敤璁惧缁�
*/
- batchEnable(data) {
+ batchEnable(groupIds) {
return request({
url: '/api/plcSend/device/group/batch-enable',
method: 'post',
- data
+ data: { groupIds }
})
},
/**
* 鎵归噺绂佺敤璁惧缁�
*/
- batchDisable(data) {
+ batchDisable(groupIds) {
return request({
url: '/api/plcSend/device/group/batch-disable',
method: 'post',
- data
+ data: { groupIds }
})
},
@@ -526,6 +531,82 @@
}
}
+// 璁惧浜や簰鎿嶄綔API
+export const deviceInteractionApi = {
+ /**
+ * 鎵ц璁惧閫昏緫鎿嶄綔
+ * @param {Object} data - { deviceId, operation, params }
+ */
+ executeOperation(data) {
+ return request({
+ url: '/api/plcSend/device/interaction/execute',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鐜荤拑涓婃枡鍐欏叆
+ */
+ feedGlass(data) {
+ return request({
+ url: '/api/plcSend/device/interaction/glass-feed',
+ method: 'post',
+ data
+ })
+ }
+}
+
+// 璁惧鐘舵�佺鐞咥PI
+export const deviceStatusApi = {
+ /**
+ * 鏇存柊璁惧鍦ㄧ嚎鐘舵��
+ * @param {Object} data - { deviceId, status }
+ */
+ updateDeviceOnlineStatus(data) {
+ return request({
+ url: '/api/plcSend/device/status/update',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鎵归噺鏇存柊璁惧鍦ㄧ嚎鐘舵��
+ * @param {Object} data - { deviceIds, status }
+ */
+ batchUpdateDeviceOnlineStatus(data) {
+ return request({
+ url: '/api/plcSend/device/status/batch-update',
+ method: 'post',
+ data
+ })
+ },
+
+ /**
+ * 鑾峰彇璁惧鏈�鏂扮姸鎬�
+ * @param {Number} deviceId - 璁惧閰嶇疆ID
+ */
+ getLatestStatus(deviceId) {
+ return request({
+ url: `/api/plcSend/device/status/latest/${deviceId}`,
+ method: 'get'
+ })
+ },
+
+ /**
+ * 璁板綍璁惧蹇冭烦
+ * @param {Object} data - { deviceId, status }
+ */
+ recordHeartbeat(data) {
+ return request({
+ url: '/api/plcSend/device/status/heartbeat',
+ method: 'post',
+ data
+ })
+ }
+}
+
// 缁熻API
export const getDeviceStatistics = (data) => {
return request({
@@ -547,6 +628,8 @@
deviceConfigApi,
deviceGroupApi,
devicePlcApi,
+ deviceInteractionApi,
+ deviceStatusApi,
getDeviceStatistics,
getDeviceGroupStatistics
}
\ No newline at end of file
--
Gitblit v1.8.0