作业管理

This commit is contained in:
2025-09-19 16:19:49 +08:00
parent e0c1c8c7e4
commit 68b082132a
4 changed files with 146 additions and 134 deletions

View File

@@ -1,6 +1,5 @@
# 注意事项
+ 原生APP云打包使用自有证书
+ 证书别名testalias
+ 接口在线地址:(https://apifox.com/apidoc/shared-e9d4798e-2db1-493d-a0cb-7a0e881c4bd6/api-160097540)
+ app图标为lms
+ 接口在线地址http://47.98.105.245:8001/project/21/interface/api/cat_122
+ 接口在线地址:(http://47.111.78.178:8014/)
+ app图标为lms

View File

@@ -1,6 +1,6 @@
<template>
<view class="zd_container">
<!-- 机台工单维护 -->
<!-- 历史查询 -->
<nav-bar :title="title" :inner="true"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
@@ -25,9 +25,9 @@
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-14">
<input type="text" placeholder="载具号/点位号/作业号" class="filter_input" v-model="keyword" @focus="handleFocus">
<input type="text" placeholder="载具号/起点/终点/任务号" class="filter_input" v-model="keyword" @focus="handleFocus">
</view>
<button class="mini-btn" type="primary" size="mini" @tap="searchList">查询</button>
<button class="mini-btn" type="primary" size="mini" @tap="_queryHistoryTask">查询</button>
</view>
</view>
<view class="zd_wrapper grid-wraper">
@@ -48,21 +48,23 @@
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.material_id === pkId}" @tap="toCheck(e)">
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.material_spec}}</td>
<td>{{e.unit_id}}</td>
<td>{{e.single_weight}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.create_time}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.point_code1}}</td>
<td>{{e.point_code2}}</td>
<td>{{['生成', '', '', '下发', '执行中', '完成'][Number(e.task_status)]}}</td>
<td>{{e.task_code}}</td>
<td>{{e.config_name}}</td>
<td>{{e.car_no}}</td>
<td>{{e.remark}}</td>
</tr>
</tbody>
</table>
</view>
</view>
<uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-24 button-primary" :class="{'button-info': !pkId}" @tap="toSure">确认</button>
<button class="zd-col-24 button-primary" @tap="toSure">返回</button>
</view>
</view>
</template>
@@ -71,7 +73,7 @@
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getDate} from '@/utils/utils.js'
import {groupMaterList} from '@/utils/getData2.js'
import {queryHistoryTask} from '@/utils/getData2.js'
export default {
components: {
NavBar,
@@ -86,19 +88,7 @@
keyword: null,
date1: currentDate,
date2: currentDate,
dataList: [],
pkId: '',
pkObj: {},
reload: false,
status: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
totalCount: 0,
pageNum: 1,
pageSize: 10
dataList: []
};
},
computed: {
@@ -111,6 +101,7 @@
},
onLoad (options) {
this.title = options.title
this._queryHistoryTask()
},
methods: {
handleFocus () {
@@ -122,48 +113,24 @@
bindDateChange2: function(e) {
this.date2 = e.detail.value
},
searchList () {
this.dataList = []
this.pageNum = 1
this._groupMaterList()
},
async _groupMaterList () {
let res = await groupMaterList(this.pageNum + '', this.pageSize + '', this.val1)
if (res.code === '200') {
this.totalCount = res.totalElements
if (res.totalElements > 0) {
const dataMap = res.content
this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap)
this.reload = false
async _queryHistoryTask () {
try {
let res = await queryHistoryTask(this.keyword, this.date1, this.date2)
if (res && res.data) {
this.dataList = [...res.data]
} else {
this.dataList = []
uni.showToast({
title: res.message,
icon: 'none'
})
}
if (this.totalCount == this.dataList.length) {
this.reload = false
this.status = 'noMore'
}
} catch (e) {
this.dataList = []
}
},
onReachBottom () {
if (this.totalCount > this.dataList.length) {
this.status = 'loading'
setTimeout(() => {
this.pageNum++
this._groupMaterList()
}, 1000)
} else { //停止加载
this.status = 'noMore'
}
},
toCheck (e) {
this.pkId = this.pkId === e.material_id ? '' : e.material_id
this.pkObj = this.pkId === e.material_id ? e : {}
},
toSure () {
if (this.pkId) {
this.$store.dispatch('setPublicObj', this.pkObj)
uni.navigateBack()
}
uni.navigateBack()
}
}
}

View File

@@ -1,32 +1,44 @@
<template>
<view class="zd_container">
<nav-bar title="任务管理"></nav-bar>
<!-- 任务管理 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-13">
<search-box v-model="keyword"/>
</view>
<button class="mini-btn" type="primary" size="mini" @tap="_queryTask">查询</button>
</view>
</view>
<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>作业</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>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.task_id === pkId}">
<td>{{e.vehicle_code}}</td>
<td>{{e.material_type_name}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
<td>{{e.point_code1}}</td>
<td>{{e.point_code2}}</td>
<td>{{['生成', '', '', '下发', '执行中', '完成'][Number(e.task_status)]}}</td>
<td>{{e.task_code}}</td>
<td>{{e.config_name}}</td>
<td>{{e.car_no}}</td>
<td>{{e.remark}}</td>
</tr>
</tbody>
</table>
@@ -34,89 +46,114 @@
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled1" @tap="toSure1('1')">重新生成</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled2" @tap="toSure2('2')">强制完成</button>
<button class="zd-col-8 button-primary" :class="{'button-info': !pkId}" :disabled="disabled1" @tap="_taskOperation">重新生成</button>
<button class="zd-col-8 button-primary" :class="{'button-info': !pkId}" :disabled="disabled2" @tap="_forceConfirmTask">强制完成</button>
<button class="zd-col-6 button-primary" @tap="toJump('operation?title=历史查询')">历史查询</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {queryTask, taskOperation} from '@/utils/getData2.js'
import SearchBox from '@/components/SearchBox.vue'
import {queryTask, taskOperation, forceConfirmTask} from '@/utils/getData2.js'
export default {
components: {
NavBar
NavBar,
SearchBox
},
data() {
return {
title: '',
keyword: '',
startPoint: '',
endPoint: '',
dataList: [],
disabled1: false,
disabled2: false,
disabled3: false,
pkId: ''
pkId: '',
pkObj: {}
};
},
created () {
this._queryTask(this.keyword, this.startPoint, this.endPoint)
},
onLoad (options) {
this.title = options.title
this._queryTask()
},
methods: {
toJump (name) {
uni.navigateTo({
url: `/pages/General/${name}`
})
},
async _queryTask () {
let res = await queryTask(this.keyword, this.startPoint, this.endPoint)
if (res.code === '1') {
this.dataList = [...res.result]
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
async _taskOperation (type) {
try {
let res = await taskOperation(this.pkId, type)
if (res.code === '1') {
this.disabled1 = false
this.disabled2 = false
this.pkId = ''
this._queryTask()
uni.showToast({
title: res.desc,
icon: 'none'
})
let res = await queryTask(this.keyword)
if (res && res.data) {
this.dataList = [...res.data]
} else {
this.dataList = []
uni.showToast({
title: res.desc,
title: res.message,
icon: 'none'
})
this.disabled1 = false
this.disabled2 = false
}
} catch (err) {
this.disabled1 = false
this.disabled2 = false
} catch (e) {
this.dataList = []
}
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
},
toSure1 (type) {
async _taskOperation () {
this.disabled1 = true
if (!this.pkId) {
this.disabled1 = false
return
}
this._taskOperation(type)
try {
let res = await taskOperation(this.pkObj)
if (res) {
this._queryTask()
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.disabled1 = false
this.disabled2 = false
this.pkId = ''
this.pkObj = {}
} catch (err) {
this.disabled1 = false
this.disabled2 = false
this.pkId = ''
this.pkObj = {}
}
},
toSure2 (type) {
async _forceConfirmTask () {
this.disabled2 = true
if (!this.pkId) {
this.disabled2 = false
return
}
this._taskOperation(type)
try {
let res = await forceConfirmTask(this.pkObj)
if (res) {
this._queryTask()
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.disabled1 = false
this.disabled2 = false
this.pkId = ''
this.pkObj = {}
} catch (err) {
this.disabled1 = false
this.disabled2 = false
this.pkId = ''
this.pkObj = {}
}
},
toCheck (e) {
this.pkId = this.pkId === e.task_id ? '' : e.task_id
this.pkObj = this.pkId === e.task_id ? e : {}
}
}
}

View File

@@ -153,20 +153,29 @@ export const clearMaterial = (code, scode) => request({
/**
* 任务管理
*/
// 1.1 查询未完成指令
export const queryTask = (keyword, scode, ncode) => request({
url:'api/hand/tasks',
// 查询
export const queryTask = (keyword) => request({
url:'api/pdaTask/queryTask',
data: {
keyword: keyword,
start_devicecode: scode,
next_devicecode: ncode
search: keyword
}
})
// 1.2 指令操作
export const taskOperation = (uuid, type) => request({
url:'api/hand/taskoperation',
// 历史查询
export const queryHistoryTask = (keyword, st, et) => request({
url:'api/pdaTask/queryHistoryTask',
data: {
inst_uuid: uuid,
type: type
search: keyword,
start_time: st,
end_time: et
}
})
// 重新下发
export const taskOperation = (data) => request({
url:'api/pdaTask/againSendTask',
data: data
})
// 强制完成任务
export const forceConfirmTask = (data) => request({
url:'api/pdaTask/forceConfirmTask',
data: data
})