添加AGV全点位移动
This commit is contained in:
12
api/materialManagement/MmAgvLocation.js
Normal file
12
api/materialManagement/MmAgvLocation.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import request from '@/utils/request'
|
||||
import upload from '@/utils/upload'
|
||||
|
||||
// 查询AGV点位 areaCode = 0 查全部
|
||||
export function queryMmAgvLocation(params) {
|
||||
return request({
|
||||
url: '/mes/mm/MmAgvLocation/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -248,6 +248,13 @@
|
||||
"navigationBarTitleText" : "车间进料",
|
||||
"enablePullDownRefresh" : false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/materialManagement/AGVRemoteControl/AGVRemoteControl",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "AGV全点位移动"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
276
pages/materialManagement/AGVRemoteControl/AGVRemoteControl.vue
Normal file
276
pages/materialManagement/AGVRemoteControl/AGVRemoteControl.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<template>
|
||||
<view class="common-nav-container">
|
||||
<!-- 功能筛选区 -->
|
||||
<uni-card :is-shadow="false" is-full>
|
||||
<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>
|
||||
<!-- 起始点位 -->
|
||||
<uni-forms-item label="起始点位">
|
||||
<uni-data-select v-model="start_point" :localdata="locationOptions"
|
||||
:clear="false"></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-forms-item>
|
||||
<!-- 任务状态 -->
|
||||
<uni-forms-item label="当前任务">
|
||||
<view v-if="reqCode === ''">
|
||||
<u-tag text="无任务" size="large" type="info"></u-tag>
|
||||
</view>
|
||||
<view v-else>
|
||||
<u-tag :text="reqCode" size="large" type="primary"></u-tag>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<!-- 按钮区域 -->
|
||||
<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-col>
|
||||
<u-col span="6">
|
||||
<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>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</uni-card>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
go_workshop,
|
||||
emergency_doStopAgv
|
||||
} from '@/api/materialManagement/MaterialRequsition.js';
|
||||
import {
|
||||
queryMmAgvLocation
|
||||
} from '@/api/materialManagement/MmAgvLocation.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
// 区域区分
|
||||
areaCode: 0,
|
||||
areaOptions: [{
|
||||
value: 0,
|
||||
text: '全部'
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
text: '毛坯'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
text: '成品'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
text: '一楼'
|
||||
},
|
||||
{
|
||||
value: 5,
|
||||
text: '二楼'
|
||||
},
|
||||
],
|
||||
// 开始点位
|
||||
start_point: '',
|
||||
// 结束点位
|
||||
end_point: '',
|
||||
// AGV点位地址
|
||||
locationOptions: [],
|
||||
// 任务code
|
||||
reqCode: '',
|
||||
// AGV小车选择列表
|
||||
agvChouseOptions: [{
|
||||
value: '1743',
|
||||
text: '涂装1号AGV'
|
||||
},
|
||||
{
|
||||
value: '1744',
|
||||
text: '涂装2号AGV'
|
||||
}
|
||||
],
|
||||
// AGV小车选择
|
||||
agvCode: '1743'
|
||||
};
|
||||
},
|
||||
watch: {},
|
||||
filters: {},
|
||||
mounted() {
|
||||
// this.init();
|
||||
},
|
||||
onShow() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.loading = true;
|
||||
this.getDict();
|
||||
this.getTaskStorage();
|
||||
this.loading = false;
|
||||
},
|
||||
getDict() {
|
||||
const query = {
|
||||
pageNum: 1,
|
||||
pageSize: 1000,
|
||||
areaCode: this.areaCode
|
||||
}
|
||||
queryMmAgvLocation(query).then((res) => {
|
||||
const {
|
||||
code,
|
||||
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;
|
||||
}
|
||||
if (this.end_point === '' && this.locationOptions.length > 0) {
|
||||
this.end_point = this.locationOptions[0].value;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
formatDict(list) {
|
||||
try {
|
||||
const newList = list.map(item => {
|
||||
return {
|
||||
value: item.coordinate,
|
||||
text: item.coordinate
|
||||
}
|
||||
})
|
||||
return newList;
|
||||
} catch (e) {
|
||||
this.$refs.uToast.show({
|
||||
type: 'error',
|
||||
message: '字典数据解析异常!' + e.message
|
||||
});
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 任务启动
|
||||
doStartAgv() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
if (this.start_point == '' || this.end_point == '') {
|
||||
this.$refs.uToast.show({
|
||||
type: 'error',
|
||||
message: '起点或者终点不能为空'
|
||||
});
|
||||
return;
|
||||
}
|
||||
const query = {
|
||||
start_point: this.start_point,
|
||||
end_point: this.end_point,
|
||||
agvCode: this.agvCode
|
||||
};
|
||||
this.loading = true;
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
}, 30000);
|
||||
go_workshop(query).then((res) => {
|
||||
if (res.code == 200) {
|
||||
try {
|
||||
let json = JSON.parse(res.data);
|
||||
this.reqCode = json.data;
|
||||
this.$refs.uToast.show({
|
||||
type: 'success',
|
||||
message: 'agv起动成功' + this.reqCode
|
||||
});
|
||||
this.saveTaskStorage();
|
||||
} catch (e) {
|
||||
this.$refs.uToast.show({
|
||||
type: 'error',
|
||||
message: 'agv起动失败:' + this.reqCode
|
||||
});
|
||||
}
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消任务
|
||||
doStopAgv() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
if (this.reqCode === '') {
|
||||
this.$refs.uToast.show({
|
||||
type: 'error',
|
||||
message: '无任务编号,无法取消!'
|
||||
});
|
||||
return;
|
||||
}
|
||||
const query = {
|
||||
reqCode: this.reqCode
|
||||
};
|
||||
this.loading = true;
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
}, 30000);
|
||||
emergency_doStopAgv(query).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.reqCode = '';
|
||||
this.$refs.uToast.show({
|
||||
type: 'success',
|
||||
message: '成功取消任务:' + res.data
|
||||
});
|
||||
this.cancelTaskStorage();
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 保存任务缓存
|
||||
saveTaskStorage() {
|
||||
try {
|
||||
const data = {
|
||||
start_point: this.start_point,
|
||||
end_point: this.end_point,
|
||||
agvCode: this.agvCode,
|
||||
reqCode: this.reqCode
|
||||
}
|
||||
uni.setStorageSync('AGVRemoteControlTaskData', JSON.stringify(data))
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
},
|
||||
// 获取任务缓存
|
||||
getTaskStorage() {
|
||||
try {
|
||||
const data = JSON.parse(uni.getStorageSync('AGVRemoteControlTaskData'));
|
||||
if (data != null) {
|
||||
this.start_point = data.start_point;
|
||||
this.end_point = data.end_point;
|
||||
this.agvCode = data.agvCode;
|
||||
this.reqCode = data.reqCode;
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
},
|
||||
// 清空任务缓存
|
||||
cancelTaskStorage() {
|
||||
uni.removeStorageSync('taskData');
|
||||
},
|
||||
// 清空任务记录
|
||||
clearTask() {
|
||||
this.cancelTaskStorage();
|
||||
this.reqCode = '';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@@ -1,5 +1,9 @@
|
||||
.home-container {
|
||||
width: 360px;
|
||||
height: 594px;
|
||||
padding: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
.u-grid-style{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="home-container">
|
||||
<u--text text="生产投料" size="36" bold></u--text>
|
||||
<u-grid :border="true" @click="gridCheck" col="4">
|
||||
<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
|
||||
<u-grid-item v-if="item.type === 1" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
|
||||
<u-icon color="#ff9900" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
|
||||
<text class="grid-text">{{item.name}}</text>
|
||||
@@ -9,20 +9,26 @@
|
||||
</u-grid>
|
||||
|
||||
<u--text text="成品入库" size="36" bold></u--text>
|
||||
<u-grid :border="true" @click="gridCheck" col="4">
|
||||
<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
|
||||
<u-grid-item v-if="item.type === 2" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
|
||||
<u-icon color="#2979ff" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
|
||||
<text class="grid-text">{{item.name}}</text>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
<u--text text="包装箱" size="36" bold></u--text>
|
||||
<u-grid :border="true" @click="gridCheck" col="4">
|
||||
<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
|
||||
<u-grid-item v-if="item.type === 3" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
|
||||
<u-icon color="#00ff00" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
|
||||
<text class="grid-text">{{item.name}}</text>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
|
||||
<u--text text="AGV控制" size="36" bold></u--text>
|
||||
<u-grid :border="false" @click="gridCheck" col="4" class="u-grid-style">
|
||||
<u-grid-item v-if="item.type === 4" v-for="(item,index) in gridItemList" :key="index" :name="item.url">
|
||||
<u-icon color="#ff5500" :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="128"></u-icon>
|
||||
<text class="grid-text">{{item.name}}</text>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -61,6 +67,12 @@
|
||||
url: '/pages/materialManagement/package/package',
|
||||
type: 3,
|
||||
},
|
||||
{
|
||||
name: '全点位移动',
|
||||
icon: 'coupon-fill',
|
||||
url: '/pages/materialManagement/AGVRemoteControl/AGVRemoteControl',
|
||||
type: 4,
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user