huang
2025-11-20 366ba040d2447bacd3455299425e3166f1f992bb
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
    })
  }
}
// 设备状态管理API
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
}