任务管理

This commit is contained in:
2024-04-23 13:59:56 +08:00
parent 04bd6e7c36
commit 9cabbe7f47
8 changed files with 462 additions and 2 deletions

View File

@@ -73,6 +73,20 @@
"navigationStyle": "custom"
}
}
,{
"path" : "pages/modules/zlmanage",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/modules/taskmanage",
"style" :
{
"navigationStyle": "custom"
}
}
],
"globalStyle": {
// "pageOrientation": "landscape",

View File

@@ -38,7 +38,9 @@
{id: '1', name: '原材料入库', icon: 'RF03', path: '/pages/modules/rawmater-instore'},
{id: '2', name: '原材料出库', icon: 'RF07', path: '/pages/modules/rawmater-outstore'},
{id: '3', name: '搬运任务', icon: 'RF01', path: '/pages/modules/carry-task'},
{id: '4', name: '组盘解绑', icon: 'RF04', path: '/pages/modules/zupan-unbind'}
{id: '4', name: '组盘解绑', icon: 'RF04', path: '/pages/modules/zupan-unbind'},
{id: '5', name: '指令管理', icon: 'RF02', path: '/pages/modules/zlmanage'},
{id: '6', name: '任务管理', icon: 'RF09', path: '/pages/modules/taskmanage'}
]
};
},

View File

@@ -8,6 +8,12 @@
<input type="text" class="setup-input" placeholder="请输入服务器地址" v-model="addrip">
</view>
</view>
<view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label">acs服务器地址</view>
<input type="text" class="setup-input" placeholder="请输入服务器地址" v-model="acsip">
</view>
</view>
<!-- <view class="zd_wrapper">
<view class="input-wrap">
<view class="input-label">刷新时间(s)</view>
@@ -32,6 +38,7 @@
options: [],
index: '',
addrip: this.$store.getters.baseUrl,
acsip: this.$store.getters.acsUrl,
setTime: this.$store.getters.setTime / 1000
};
},
@@ -49,6 +56,13 @@
})
return
}
if (this.acsip === '') {
uni.showToast({
title: 'acs服务器地址',
icon: 'none'
})
return
}
if (this.setTime === '') {
uni.showToast({
title: '请填写刷新时间',
@@ -57,7 +71,7 @@
return
}
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, setTime: this.setTime * 1000, setPrintName: this.index})
this.$store.dispatch('setConfig',{baseUrl: this.addrip, acsUrl: this.acsip, setTime: this.setTime * 1000, setPrintName: this.index})
uni.redirectTo({
url: '/pages/login/login'
})

View File

@@ -0,0 +1,120 @@
<template>
<view class="zd_container">
<nav-bar title="任务管理"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>任务号</th>
<th>起点</th>
<th>终点</th>
<th>状态</th>
<th>托盘号</th>
<th>优先级</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.task_uuid === pkId}">
<td>{{e.task_no}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.task_status_name}}</td>
<td>{{e.carrier}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure1('1')">重新生成</button>
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure2('2')">强制完成</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {handTasks, handTaskoperation} from '@/utils/getData02.js'
export default {
components: {
NavBar
},
data() {
return {
keyword: '',
startPoint: '',
endPoint: '',
data: [],
dataList: [],
disabled: false,
pkId: ''
};
},
created () {
this._handTasks()
},
methods: {
async _handTasks () {
this.show = false
try {
let res = await handTasks(this.val1, this.val2, this.val3)
this.data = [...res.data]
this.dataList = [...this.data]
} catch (e) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
},
async _handTaskoperation (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await handTaskoperation(type, this.pkId)
this.disabled = false
this.pkId = ''
this._handTasks()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
},
toSure1 (type) {
this.disabled1 = true
if (!this.pkId) {
this.disabled1 = false
return
}
this._handTaskoperation(type)
},
toSure2 (type) {
this.disabled2 = true
if (!this.pkId) {
this.disabled2 = false
return
}
this._handTaskoperation(type)
}
}
}
</script>
<style lang="stylus">
</style>

135
pages/modules/zlmanage.vue Normal file
View File

@@ -0,0 +1,135 @@
<template>
<view class="zd_container">
<nav-bar title="指令管理"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>任务号</th>
<th>指令号</th>
<th>起点</th>
<th>终点</th>
<th>状态</th>
<th>执行步骤</th>
<th>载具号</th>
<th>优先级</th>
<th>时间</th>
<th>agv车号</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.inst_uuid === pkId}">
<td>{{e.task_no}}</td>
<td>{{e.instruction_code}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.inst_status_name}}</td>
<td>{{e.inst_step}}</td>
<td>{{e.carrier}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
<td>{{e.carno}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure1('1')">指令撤销</button>
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure2('2')">重新下发</button>
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure3('3')">强制完成</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {handInsts, handInst} from '@/utils/getData02.js'
export default {
components: {
NavBar
},
data() {
return {
val1: '',
val2: '',
val3: '',
data: [],
dataList: [],
disabled: false,
pkId: ''
};
},
created () {
this._handInsts(this.val1, this.val2, this.val3)
},
methods: {
async _handInsts () {
this.show = false
try {
let res = await handInsts(this.val1, this.val2, this.val3)
this.data = [...res.data]
this.dataList = [...this.data]
} catch (e) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
},
async _handInst (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await handInst(type, this.pkId)
this.disabled = false
this.pkId = ''
this._handInsts()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.inst_uuid ? '' : e.inst_uuid
},
toSure1 (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
this._handInst(type)
},
toSure2 (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
this._handInst(type)
},
toSure3 (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
this._handInst(type)
}
}
}
</script>
<style lang="stylus">
</style>

43
utils/getData02.js Normal file
View File

@@ -0,0 +1,43 @@
import request from './request02.js'
/**
* 指令管理
*/
// 1.1 查询未完成指令(生成任务号为-开头)
export const handInsts = (key, scode, ncode) => request({
url:'api/hand/insts',
data: {
keyword: key,
start_devicecode: scode,
next_devicecode: ncode
}
})
// 1.2 指令操作
export const handInst = (type, id) => request({
url:'api/hand/inst',
data: {
type: type,
inst_uuid: id
}
})
/**
* 任务管理
*/
// 1.1 1.1 查询无指令的任务(任务号为-开头)
export const handTasks = (key, scode, ncode) => request({
url:'api/hand/tasks',
data: {
keyword: key,
start_devicecode: scode,
next_devicecode: ncode
}
})
// 1.2 任务操作
export const handTaskoperation = (type, id) => request({
url:'api/hand/taskoperation',
data: {
type: type,
task_uuid: id
}
})

127
utils/request02.js Normal file
View File

@@ -0,0 +1,127 @@
// import qs from 'qs' // 处理data
import store from '@/vuex/store'
const request = (params) => {
let _self = this;
let url = params.url;
let method = params.method || 'POST';
let data = params.data || {};
// data.token = "default-access_token"
// if (!params.token) {
// let token = uni.getStorageSync('token');
// if (!token) {
// uni.navigateTo({
// url: '/pages/login/login'
// });
// } else {
// data.token = '179509245-9c91827e0224bdc18d0b118b8be1b5af';
// }
// }
let token = ''
if (store.getters.saveToken !== '') {
token = store.getters.saveToken
}
let defaultOpot = {
// 'Content-Type': 'application/x-www-form-urlencoded',
'Terminal-Type': 'innerH5',
'Content-Type': 'application/json;charset=UTF-8',
}
let header = {}
method = method.toUpperCase()
if (method == 'POST') {
header = {
'Content-Type': 'application/json;charset=UTF-8',
'Authorization': token
}
// data = qs.stringify(data)
}
const requestUrl = `${store.getters.acsUrl}/` + url;
uni.showLoading({
title: '加载中...'
});
return new Promise((resolve, reject) => {
uni.request({
url: requestUrl,
method: method,
header: Object.assign({}, defaultOpot, header),
data: data,
dataType: 'json',
})
.then(res => { // 成功
if (res.length === 1) {
uni.showModal({
content: 'request:fail',
showCancel: false
})
reject('request:fail')
} else if (res[1] && res[1].statusCode === 400) {
uni.showModal({
content: res[1].data.message,
showCancel: false
})
reject(res[1].data.message)
} else if (res[1] && res[1].statusCode === 401) {
uni.showModal({
content: res[1].data.message,
showCancel: false
})
store.dispatch('delUserInfo', '')
uni.redirectTo({
url: '/pages/login/login'
})
} else if (res[1] && res[1].statusCode === 200) {
let {
data: dataType
} = res[1]
resolve(dataType)
// switch (dataType.code * 1) { // 拦截返回参数
// case 0:
// resolve(dataType)
// break;
// case 1003:
// uni.showModal({
// title: '登录已过期',
// content: '很抱歉,登录已过期,请重新登录',
// confirmText: '重新登录',
// success: function(res) {
// if (res.confirm) {
// uni.navigateTo({
// // 切记这儿需要哈pages.json保持一致不能有.vue后缀
// url: '/pages/login/login'
// });
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// })
// break;
// case -1:
// uni.showModal({
// title: '请求数据失败',
// content: '获取数据失败!',
// confirmText: '确定',
// showCancel: false,
// success: function(res) {
// if (res.confirm) {} else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// })
// break
// }
}else {
uni.showModal({
content: res[1].data.message,
showCancel: false
})
reject(res[1].data.message)
}
})
.catch(err => { // 错误
reject(err)
})
.finally(() => {
uni.hideLoading();
})
})
}
export default request

View File

@@ -1,8 +1,10 @@
import * as types from '../types'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://10.1.3.90:8010' : 'http://10.1.3.90:8010'
const acsUrl = process.env.NODE_ENV === 'development' ? 'http://10.1.3.90:8010' : 'http://10.1.3.90:8010'
const state = {
baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
acsUrl: uni.getStorageSync('acsUrl') || acsUrl,
setTime: uni.getStorageSync('setTime') || 5000,
setPrintName: uni.getStorageSync('setPrintName') || '',
loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '',
@@ -11,6 +13,7 @@ const state = {
}
const getters = {
baseUrl: state => state.baseUrl,
acsUrl: state => state.acsUrl,
setTime: state => state.setTime,
setPrintName: state => state.setPrintName,
loginName: state => state.loginName,
@@ -20,6 +23,7 @@ const getters = {
const actions = {
setConfig ({commit}, res) {
uni.setStorageSync('baseUrl', res.baseUrl)
uni.setStorageSync('acsUrl', res.acsUrl)
uni.setStorageSync('setTime', res.setTime)
uni.setStorageSync('setPrintName', res.setPrintName)
commit(types.COM_CONFIG, res)
@@ -49,6 +53,7 @@ const actions = {
const mutations = {
[types.COM_CONFIG] (state, res) {
state.baseUrl = res.baseUrl
state.acsUrl = res.acsUrl
state.setTime = res.setTime
state.setPrintName = res.setPrintName
},