opt:西门子车辆状态显示报警信息
This commit is contained in:
29
lms/nladmin-ui/src/api/agv_alarm.js
Normal file
29
lms/nladmin-ui/src/api/agv_alarm.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 调用 LMS 后端的 API,由 LMS 后端调用 ACS 后端
|
||||
|
||||
// 获取 AGV 状态
|
||||
export function getAgvStatus() {
|
||||
return request({
|
||||
url: '/api/acs/alarm/status',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取 AGV 报警信息
|
||||
export function getAgvAlarms(deviceCode) {
|
||||
return request({
|
||||
url: '/api/acs/alarm/alarms',
|
||||
method: 'get',
|
||||
params: { deviceCode }
|
||||
})
|
||||
}
|
||||
|
||||
// 获取最新报警信息
|
||||
export function getLatestAlarms(limit = 10) {
|
||||
return request({
|
||||
url: '/api/acs/alarm/alarms/latest',
|
||||
method: 'get',
|
||||
params: { limit }
|
||||
})
|
||||
}
|
||||
@@ -396,6 +396,7 @@
|
||||
|
||||
<script>
|
||||
import crudProduceScreen from './produceScreen'
|
||||
import {getAgvStatus} from '@/api/agv_alarm'
|
||||
// import crudProduceScreen from './mork'
|
||||
export default {
|
||||
data() {
|
||||
@@ -631,15 +632,15 @@ export default {
|
||||
searchOrder() {
|
||||
crudProduceScreen.regionOrder(this.popData.device_code, this.searchKey).then(res => {
|
||||
let data = [...res.content]
|
||||
|
||||
|
||||
// 提取去重后的工序列表
|
||||
this.processList = [...new Set(data.map(item => item.region_code).filter(Boolean))]
|
||||
|
||||
|
||||
// 根据选中的工序进行筛选
|
||||
if (this.selectedProcess) {
|
||||
data = data.filter(item => item.region_code === this.selectedProcess)
|
||||
}
|
||||
|
||||
|
||||
this.popList = data
|
||||
this.show = true
|
||||
})
|
||||
@@ -660,26 +661,46 @@ export default {
|
||||
},
|
||||
// 检查异常信息
|
||||
checkErrors() {
|
||||
// 从后端获取异常信息
|
||||
if (this.screenData && this.screenData.device_code) {
|
||||
crudProduceScreen.getExceptionMessage(this.screenData.device_code).then(res => {
|
||||
// 处理接口返回的异常信息
|
||||
if (res && res.content) {
|
||||
this.errorDetails = res.content
|
||||
this.hasError = res.content.length > 0
|
||||
} else {
|
||||
this.errorDetails = []
|
||||
this.hasError = false
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取异常信息失败:', error)
|
||||
// 从 LMS 后端获取 AGV 报警信息
|
||||
getAgvStatus().then(res => {
|
||||
if (res && res.length > 0) {
|
||||
// 转换报警信息格式:先过滤再映射,避免undefined
|
||||
this.errorDetails = res
|
||||
.filter(status => status.isActive === '1') // 先过滤出激活的报警
|
||||
.map(status => { // 再映射成目标格式
|
||||
return {
|
||||
type: 'AGV报警',
|
||||
message: `${status.deviceName || status.deviceCode}: ${status.status}`,
|
||||
time: new Date(status.updateTime).toLocaleString('zh-CN')
|
||||
}
|
||||
})
|
||||
this.hasError = this.errorDetails.length > 0
|
||||
} else {
|
||||
this.errorDetails = []
|
||||
this.hasError = false
|
||||
})
|
||||
} else {
|
||||
this.errorDetails = []
|
||||
this.hasError = false
|
||||
}
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取AGV报警信息失败:', error)
|
||||
// 如果从 LMS 后端获取失败,尝试从 LMS 系统获取
|
||||
if (this.screenData && this.screenData.device_code) {
|
||||
crudProduceScreen.getExceptionMessage(this.screenData.device_code).then(res => {
|
||||
if (res && res.content) {
|
||||
this.errorDetails = res.content
|
||||
this.hasError = res.content.length > 0
|
||||
} else {
|
||||
this.errorDetails = []
|
||||
this.hasError = false
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('获取异常信息失败:', error)
|
||||
this.errorDetails = []
|
||||
this.hasError = false
|
||||
})
|
||||
} else {
|
||||
this.errorDetails = []
|
||||
this.hasError = false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 定时检查异常
|
||||
startErrorCheck() {
|
||||
|
||||
Reference in New Issue
Block a user