修改wcs首页,修改堆垛机调度 堆垛机读取线程

This commit is contained in:
liuhanqing
2025-10-30 11:18:34 +08:00
parent 83e0bbe16f
commit ade737aab5
16 changed files with 2580 additions and 1442 deletions

View File

@@ -2,15 +2,16 @@
<div class="app-container">
<!-- 统计卡片 -->
<el-row :gutter="20" class="stats-row">
<el-col :span="5" >
<el-col :span="5">
<el-card class="stats-card">
<div class="stats-content">
<div class="stats-icon agv-icon">
<i class="el-icon-truck"></i>
<div class="stats-icon ddj-icon">
<i class="el-icon-cpu"></i>
</div>
<div class="stats-info">
<div class="stats-number">{{ deviceStats.agvCount }}</div>
<div class="stats-label">{{ $t('index.agvDeviceTotal') }}</div> <!-- AGV设备总数 -->
<div class="stats-number">{{ deviceStats.ddjCount }}</div>
<div class="stats-label">堆垛机设备总数</div>
</div>
</div>
</el-card>
@@ -22,8 +23,8 @@
<i class="el-icon-s-grid"></i>
</div>
<div class="stats-info">
<div class="stats-number">{{ deviceStats.ctuCount }}</div>
<div class="stats-label">{{ $t('index.ctuDeviceTotal') }}</div> <!-- CTU设备总数 -->
<div class="stats-number">{{ deviceStats.ssjCount }}</div>
<div class="stats-label">输送机设备总数</div>
</div>
</div>
</el-card>
@@ -36,7 +37,7 @@
</div>
<div class="stats-info">
<div class="stats-number">{{ taskStats.pendingCount }}</div>
<div class="stats-label">{{ $t('index.pendingTasks') }}</div> <!-- 待执行任务 -->
<div class="stats-label">待执行任务</div> <!-- 待执行任务 -->
</div>
</div>
</el-card>
@@ -49,7 +50,7 @@
</div>
<div class="stats-info">
<div class="stats-number">{{ taskStats.runningCount }}</div>
<div class="stats-label">{{ $t('index.runningTasks') }}</div> <!-- 执行中任务 -->
<div class="stats-label">执行中任务</div> <!-- 执行中任务 -->
</div>
</div>
</el-card>
@@ -62,7 +63,7 @@
</div>
<div class="stats-info">
<div class="stats-number">{{ taskStats.finishedCount }}</div>
<div class="stats-label">{{ $t('index.completedTasks') }}</div> <!-- 已完成任务 -->
<div class="stats-label">已完成任务</div> <!-- 已完成任务 -->
</div>
</div>
</el-card>
@@ -74,7 +75,7 @@
<el-col :span="12">
<el-card class="chart-card">
<div slot="header" class="card-header">
<span>{{ $t('index.taskTypeDistribution') }}</span> <!-- 任务类型分布 -->
<span>任务类型分布</span> <!-- 任务类型分布 -->
</div>
<div id="taskTypeChart" style="height: 300px;"></div>
</el-card>
@@ -82,7 +83,7 @@
<el-col :span="12">
<el-card class="chart-card">
<div slot="header" class="card-header">
<span>{{ $t('index.deviceStatusDistribution') }}</span> <!-- 设备状态分布 -->
<span>设备状态分布</span> <!-- 设备状态分布 -->
</div>
<div id="deviceStatusChart" style="height: 300px;"></div>
</el-card>
@@ -94,31 +95,34 @@
<el-col :span="12">
<el-card class="task-card">
<div slot="header" class="card-header">
<span>{{ $t('index.currentTaskQueue') }}</span> <!-- 当前任务队列 -->
<el-button type="text" @click="refreshTasks">{{ $t('index.refresh') }}</el-button> <!-- 刷新 -->
<span>正执行作业列表</span> <!-- 当前任务队列 -->
<el-button type="text" @click="refreshTasks">刷新</el-button> <!-- 刷新 -->
</div>
<el-table
:data="currentTasks"
style="width: 100%"
height="300"
v-loading="loading.tasks">
<el-table-column prop="reqCode" :label="$t('index.requestCode')" width="120"/> <!-- 请求编号 -->
<el-table-column prop="wmsTaskType" :label="$t('index.taskType')" width="100"> <!-- 任务类型 -->
<el-table-column prop="inOrOut" label="作业类型" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.wms_task_type" :value="scope.row.wmsTaskType"/>
<dict-tag :options="dict.type.in_or_out" :value="scope.row.inOrOut"/>
</template>
</el-table-column>
<el-table-column prop="positionCode1" :label="$t('index.startPoint')" width="80"/> <!-- 起点 -->
<el-table-column prop="positionCode2" :label="$t('index.endPoint')" width="80"/> <!-- 终点 -->
<el-table-column prop="priority" :label="$t('index.priority')" width="80"/> <!-- 优先级 -->
<el-table-column prop="status" :label="$t('index.status')" width="100"> <!-- 状态 -->
<el-table-column prop="jobId" label="作业ID" width="80"/>
<el-table-column prop="taskNo" label="任务号" width="80"/>
<el-table-column prop="executionPhase" label="执行阶段" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.job_ep" :value="scope.row.executionPhase"/>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('index.status')" width="100">
<template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.status)">
<dict-tag :options="dict.type.task_status" :value="scope.row.status"/>
</el-tag>
</template>
</el-table-column>
<el-table-column prop="reqTime" :label="$t('index.requestTime')" show-overflow-tooltip/> <!-- 请求时间 -->
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip/>
</el-table>
</el-card>
</el-col>
@@ -150,11 +154,18 @@
<script>
import * as echarts from 'echarts'
import { getDeviceStats, getTaskStats, getCurrentTasks, getDeviceList, getTaskTypeChart, getDeviceStatusChart } from '@/api/index'
import {
getCurrentTasks,
getDeviceList,
getDeviceStats,
getDeviceStatusChart,
getTaskStats,
getTaskTypeChart
} from '@/api/index'
export default {
name: 'Index',
dicts: ['task_status', 'wms_task_type'],
dicts: ['task_status', 'wms_task_type', 'job_ep', 'in_or_out'],
data() {
return {
// 统计数据
@@ -391,110 +402,110 @@ export default {
}
},
// 初始化设备状态图表
async initDeviceStatusChart() {
const chartDom = document.getElementById('deviceStatusChart')
this.deviceStatusChart = echarts.init(chartDom)
async initDeviceStatusChart() {
const chartDom = document.getElementById('deviceStatusChart')
this.deviceStatusChart = echarts.init(chartDom)
try {
const response = await getDeviceStatusChart()
let runningData = [0, 0, 0]
let idleData = [0, 0, 0]
try {
const response = await getDeviceStatusChart()
let runningData = [0, 0]
let idleData = [0, 0]
if (response.code === 200) {
const statusData = response.data
if (response.code === 200) {
const statusData = response.data
// AGV数据
if (statusData.AGV) {
runningData[0] = statusData.AGV['运行'] || 0 // 运行
idleData[0] = statusData.AGV['其他'] || 0 // 其他
}
// CTU数据
if (statusData.CTU) {
runningData[1] = statusData.CTU['运行'] || 0 // 运行
idleData[1] = statusData.CTU['其他'] || 0 // 其他
}
// SSJ数据
if (statusData.SSJ) {
runningData[2] = statusData.SSJ['运行'] || 0 // 运行
idleData[2] = statusData.SSJ['其他'] || 0 // 其他
}
} else {
// 默认数据
runningData = [8, 4, 2]
idleData = [7, 4, 3]
}
// AGV数据
/*if (statusData.AGV) {
runningData[0] = statusData.AGV['运行'] || 0 // 运行
idleData[0] = statusData.AGV['其他'] || 0 // 其他
}*/
// CTU数据
if (statusData.DDJ) {
runningData[0] = statusData.DDJ['运行'] || 0 // 运行
idleData[0] = statusData.DDJ['其他'] || 0 // 其他
}
// SSJ数据
if (statusData.SSJ) {
runningData[1] = statusData.SSJ['运行'] || 0 // 运行
idleData[1] = statusData.SSJ['其他'] || 0 // 其他
}
} else {
// 默认数据
runningData = [4, 2]
idleData = [4, 3]
}
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: [this.$t('index.running'), this.$t('index.other')] // 运行, 其他
},
xAxis: {
type: 'category',
data: ['AGV', 'CTU', 'SSJ']
},
yAxis: {
type: 'value'
},
series: [
{
name: this.$t('index.running'), // 运行
type: 'bar',
data: runningData,
itemStyle: { color: '#67C23A' }
},
{
name: this.$t('index.other'), // 其他
type: 'bar',
data: idleData,
itemStyle: { color: '#909399' }
}
]
}
this.deviceStatusChart.setOption(option)
} catch (error) {
console.error('加载设备状态图表数据失败:', error) // 加载设备状态图表数据失败
// 使用默认数据
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: [this.$t('index.running'), this.$t('index.other')] // 运行, 其他
},
xAxis: {
type: 'category',
data: ['AGV', 'CTU', 'SSJ']
},
yAxis: {
type: 'value'
},
series: [
{
name: this.$t('index.running'), // 运行
type: 'bar',
data: [8, 4, 2],
itemStyle: { color: '#67C23A' }
},
{
name: this.$t('index.other'), // 其他
type: 'bar',
data: [7, 4, 3],
itemStyle: { color: '#909399' }
}
]
}
this.deviceStatusChart.setOption(option)
}
},
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: [this.$t('index.running'), this.$t('index.other')] // 运行, 其他
},
xAxis: {
type: 'category',
data: ['DDJ', 'SSJ']
},
yAxis: {
type: 'value'
},
series: [
{
name: this.$t('index.running'), // 运行
type: 'bar',
data: runningData,
itemStyle: {color: '#67C23A'}
},
{
name: this.$t('index.other'), // 其他
type: 'bar',
data: idleData,
itemStyle: {color: '#909399'}
}
]
}
this.deviceStatusChart.setOption(option)
} catch (error) {
console.error('加载设备状态图表数据失败:', error) // 加载设备状态图表数据失败
// 使用默认数据
const option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: [this.$t('index.running'), this.$t('index.other')] // 运行, 其他
},
xAxis: {
type: 'category',
data: ['AGV', 'DDJ', 'SSJ']
},
yAxis: {
type: 'value'
},
series: [
{
name: this.$t('index.running'), // 运行
type: 'bar',
data: [8, 4, 2],
itemStyle: {color: '#67C23A'}
},
{
name: this.$t('index.other'), // 其他
type: 'bar',
data: [7, 4, 3],
itemStyle: {color: '#909399'}
}
]
}
this.deviceStatusChart.setOption(option)
}
},
// 更新图表
async updateCharts() {
if (this.taskTypeChart) {
@@ -599,6 +610,10 @@ export default {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.ddj-icon {
background: linear-gradient(135deg, #dcb536 0%, #e5845b 100%);
}
.ctu-icon {
background: linear-gradient(135deg, #36d1dc 0%, #5b86e5 100%);
}