版本更新 AGV全点位操作功能完善

This commit is contained in:
2024-07-02 15:19:04 +08:00
parent 00123ea0bc
commit d4b87a05a5
2 changed files with 129 additions and 27 deletions

View File

@@ -1,25 +1,31 @@
<template>
<view class="common-nav-container">
<view class="box-container">
<!-- 功能筛选区 -->
<uni-card :is-shadow="false" is-full>
<uni-card :is-shadow="false">
<uni-forms label-width="100">
<!-- 选择小车 -->
<uni-forms-item label="AGV小车">
<uni-data-select v-model="agvCode" :localdata="agvChouseOptions" :clear="false"></uni-data-select>
</uni-forms-item>
<!-- 点位筛选 -->
<uni-forms-item label="点筛选">
<uni-data-select v-model="areaCode" :localdata="areaOptions" :clear="false"
@change="getDict"></uni-data-select>
<uni-forms-item label="点筛选">
<uni-data-select v-model="startAreaCode" :localdata="areaOptions" :clear="false"
@change="getStartLocationDict()"></uni-data-select>
</uni-forms-item>
<!-- 起始点位 -->
<uni-forms-item label="起始点位">
<uni-data-select v-model="start_point" :localdata="locationOptions"
<uni-data-select v-model="start_point" :localdata="startLocationOptions"
:clear="false"></uni-data-select>
</uni-forms-item>
<!-- 点位筛选 -->
<uni-forms-item label="终点筛选">
<uni-data-select v-model="endAreaCode" :localdata="areaOptions" :clear="false"
@change="getEndLocationDict()"></uni-data-select>
</uni-forms-item>
<!-- 结束点位 -->
<uni-forms-item label="结束点位">
<uni-data-select v-model="end_point" :localdata="locationOptions" :clear="false"></uni-data-select>
<uni-data-select v-model="end_point" :localdata="endLocationOptions"
:clear="false"></uni-data-select>
</uni-forms-item>
<!-- 任务状态 -->
<uni-forms-item label="当前任务">
@@ -33,14 +39,17 @@
<!-- 按钮区域 -->
<u-row customStyle="margin-bottom: 10px" :gutter="40">
<u-col span="6">
<u-button :disabled="loading" :loading="loading" shape="circle" type="success" text="执行任务" @click="doStartAgv"></u-button>
<u-button :disabled="loading" :loading="loading" shape="circle" type="success" text="执行任务"
@click="doStartAgv"></u-button>
</u-col>
<u-col span="6">
<u-button :disabled="loading" :loading="loading" shape="circle" type="error" text="取消任务" @click="doStopAgv"></u-button>
<u-button :disabled="loading" :loading="loading" shape="circle" type="error" text="取消任务"
@click="doStopAgv"></u-button>
</u-col>
</u-row>
<view style="margin-top: 60px;">
<u-button :disabled="loading" :loading="loading" shape="circle" type="info" text="清空任务记录" @click="clearTask"></u-button>
<u-button :disabled="loading" :loading="loading" shape="circle" type="info" text="清空任务记录"
@click="clearTask"></u-button>
</view>
</uni-forms>
</uni-card>
@@ -51,7 +60,7 @@
<script>
import {
go_workshop,
emergency_doStopAgv
emergency_stop_agv
} from '@/api/materialManagement/MaterialRequsition.js';
import {
queryMmAgvLocation
@@ -61,26 +70,47 @@
return {
loading: false,
// 区域区分
areaCode: 0,
startAreaCode: 0,
endAreaCode: 0,
areaOptions: [{
value: 0,
text: '全部'
},
{
value: 2,
text: '毛坯'
text: '毛坯上料起点'
},
{
value: 3,
text: '成品'
text: '毛坯上料终点'
},
{
value: 4,
text: '一楼'
text: '成品下线起点'
},
{
value: 5,
text: '二楼'
text: '成品下线终点'
},
{
value: 6,
text: '成品下线区二楼终点'
},
{
value: 7,
text: '一楼成品仓库交接区'
},
{
value: 8,
text: '二楼成品仓库交接区'
},
{
value: 9,
text: '外箱上料起点'
},
{
value: 10,
text: '外箱上料终点'
},
],
// 开始点位
@@ -88,7 +118,8 @@
// 结束点位
end_point: '',
// AGV点位地址
locationOptions: [],
startLocationOptions: [],
endLocationOptions: [],
// 任务code
reqCode: '',
// AGV小车选择列表
@@ -121,10 +152,15 @@
this.loading = false;
},
getDict() {
this.getAreaOptions();
this.getStartLocationDict();
this.getEndLocationDict();
},
getAreaOptions() {
const query = {
pageNum: 1,
pageSize: 1000,
areaCode: this.areaCode
areaCode: 0
}
queryMmAgvLocation(query).then((res) => {
const {
@@ -132,12 +168,74 @@
data
} = res;
if (code === 200) {
this.locationOptions = this.formatDict(data.result);
if (this.start_point === '' && this.locationOptions.length > 0) {
this.start_point = this.locationOptions[0].value;
let options = [{
value: 0,
text: '全部'
}];
this.areaOptions = options.concat(this.formatAreaDict(data.result));
}
});
},
formatAreaDict(list) {
try {
const newList = list.map(item => {
return {
value: item.areaCode,
text: item.area
}
if (this.end_point === '' && this.locationOptions.length > 0) {
this.end_point = this.locationOptions[0].value;
})
const _newList = newList
.filter((item, index) => newList
.findIndex(i => i.value === item.value) ===
index);
return _newList;
} catch (e) {
this.$refs.uToast.show({
type: 'error',
message: '字典数据解析异常!' + e.message
});
return [];
}
},
getStartLocationDict() {
const query = {
pageNum: 1,
pageSize: 1000,
areaCode: this.startAreaCode
}
queryMmAgvLocation(query).then((res) => {
const {
code,
data
} = res;
if (code === 200) {
this.startLocationOptions = this.formatDict(data.result);
if (this.startLocationOptions.length > 0) {
this.start_point = this.startLocationOptions[0].value;
} else {
this.start_point = '';
}
}
});
},
getEndLocationDict() {
const query = {
pageNum: 1,
pageSize: 1000,
areaCode: this.endAreaCode
}
queryMmAgvLocation(query).then((res) => {
const {
code,
data
} = res;
if (code === 200) {
this.endLocationOptions = this.formatDict(data.result);
if (this.endLocationOptions.length > 0) {
this.end_point = this.endLocationOptions[0].value;
} else {
this.end_point = '';
}
}
});
@@ -219,7 +317,7 @@
setTimeout(() => {
this.loading = false;
}, 30000);
emergency_doStopAgv(query).then((res) => {
emergency_stop_agv(query).then((res) => {
if (res.code == 200) {
this.reqCode = '';
this.$refs.uToast.show({
@@ -261,7 +359,7 @@
},
// 清空任务缓存
cancelTaskStorage() {
uni.removeStorageSync('taskData');
uni.removeStorageSync('AGVRemoteControlTaskData');
},
// 清空任务记录
clearTask() {
@@ -273,4 +371,8 @@
</script>
<style scoped>
.box-container{
background-color: white;
height: 644px;
}
</style>