定点作业、出库确认、作业管理

This commit is contained in:
2024-03-13 15:42:17 +08:00
parent 6fdce408c4
commit f895730977
13 changed files with 864 additions and 263 deletions

View File

@@ -0,0 +1,146 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起点区域</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index1" filterable :localdata="options1" @change="selectChange1"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起点点位</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index2" filterable :localdata="options2"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">终点区域</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index3" filterable :localdata="options3" @change="selectChange3"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">终点点位</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index4" filterable :localdata="options4"></zxz-uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-default" @tap="clearUp">清空</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !index2 || !index4}" :disabled="disabled" @tap="_taskConfirm">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryDevice, taskConfirm} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
options1: [],
index1: '',
options2: [],
index2: '',
options3: [],
index3: '',
options4: [],
index4: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._queryDevice()
},
methods: {
/** 点位下拉框 */
async _queryDevice () {
let res = await queryDevice()
res.map(el => {
this.$set(el, 'value', el.region_code)
this.$set(el, 'text', el.region_name)
})
this.options1 = [...res]
this.options3 = [...res]
},
selectChange1 (e) {
this.options2 = []
this.options1.map(el => {
if (el.value === e) {
this.options2 = [...el.deviceArr]
}
})
if (this.options2.length > 0) {
this.options2.map(ele => {
this.$set(ele, 'value', ele.point_code)
this.$set(ele, 'text', ele.point_name)
})
}
},
selectChange3 (e) {
this.options4 = []
this.options3.map(el => {
if (el.value === e) {
this.options4 = [...el.deviceArr]
}
})
if (this.options4.length > 0) {
this.options4.map(ele => {
this.$set(ele, 'value', ele.point_code)
this.$set(ele, 'text', ele.point_name)
})
}
},
async _taskConfirm () {
this.disabled = true
if (!this.index2 || this.index4 === '') {
this.disabled = false
return
}
try {
let res = await taskConfirm(this.index2, this.index4)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.index1 = ''
this.index2 = ''
this.index3 = ''
this.index4 = ''
this.options2 = []
this.options4 = []
this.disabled = false
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,174 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val1"
@handleChange="handleChange"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">出库点位</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.material_code" disabled>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">物料名称</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.material_name" disabled>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">配盘批次</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.pcsn" disabled>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">物料数量</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.material_qty" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">出库数量</span>
</view>
<view class="zd-col-19">
<input type="number" class="filter_input" v-model="val3">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">剩余数量</span>
</view>
<view class="zd-col-19">
<input type="number" class="filter_input" v-model="val4">
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap="clearUp">清空</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !val1 || !val2 ||!val4}" :disabled="disabled1" @tap="_emptyInStore">出库确认</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !val1 || !val2 ||!val4}" :disabled="disabled2" @tap="_emptyInStore">回库</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryGroupInfoByVehicle, fullVehicleOutConfirm, vehicleGoBack} from '@/utils/getData2.js'
import {accSubtract} from '@/utils/utils.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
val2: '',
val3: '',
data: {},
title: '',
disabled1: false,
disabled2: false
};
},
computed: {
val4 () {
let res = ''
if (JSON.stringify(this.data) !== '{}') {
res = accSubtract(this.data.material_qty, this.val3)
}
return res
}
},
onLoad (options) {
this.title = options.title
},
methods: {
handleChange (e) {
this._queryGroupInfoByVehicle(e)
},
async _queryGroupInfoByVehicle (e) {
let res = await queryGroupInfoByVehicle(e)
this.data = res
this.val2 = this.data.point_code
},
async _fullVehicleOutConfirm () {
this.disabled1 = true
if (!this.val1 || !this.val2 || !this.val4) {
this.disabled1 = false
return
}
try {
let res = await fullVehicleOutConfirm(this.val2, this.val1, this.val4)
this.disabled1 = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
async _vehicleGoBack () {
this.disabled2 = true
if (!this.val1 || !this.val2 || !this.val4) {
this.disabled2 = false
return
}
try {
let res = await vehicleGoBack(this.val2, this.val1, this.val4)
this.disabled2 = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
}
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.data = {}
this.disabled1 = false
this.disabled2 = false
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,185 @@
<template>
<view class="zd_container">
<nav-bar :title="title" :searchActive="true" @toSearch="toSearch"></nav-bar>
<view class="zd_content pdt0">
<view class="filter_wrapper">
<view class="zd-row">
<view class="zd-col-8 font-style-1" v-for="e in state" :key="e.id" @tap="changeTab(e)">
<view class="font-style-1" :class="{'font-style-2': e.id === tab}">{{e.text}}</view>
<view class="tab-line" :class="{'tab-line_active': e.id === tab}"></view>
</view>
</view>
</view>
<view class="item-wrapper">
<view class="item-wrap" v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)" :class="{isChecked: pkId === e.inst_uuid}">
<view class="zd-row mgb10">
<view class="item-font-1">{{e.task_no}}&nbsp;&#124;&nbsp;{{['就绪', '执行中', '完成'][Number(e.inst_status)]}}</view>
</view>
<view class="zd-row">
<view class="zd-col-16">
<view class="item-font-2 mgb10">{{e.create_time}}&nbsp;&#124;&nbsp;{{['请求取货', '取货完成', '请求放货', '放货完成'][Number(e.inst_step) - 1]}}</view>
<view class="zd-row mgb10">
<view class="item-font-3">载具号</view>
<view class="item-font-4">{{e.carrier}}</view>
</view>
<view class="zd-row mgb10">
<view class="item-font-3">指令号</view>
<view class="item-font-4">{{e.instruction_code}}</view>
</view>
<view class="zd-row mgb10">
<view class="item-font-3">车号</view>
<view class="item-font-4">{{e.carno}}</view>
</view>
</view>
<view class="zd-col-8">
<view class="item-font-5">{{e.priority}}</view>
<view class="item-font-8">优先级</view>
</view>
</view>
<view class="zd-row">
<view class="item-font-3">设备</view>
<view class="item-font-6">{{e.start_devicecode}}</view>
<view class="item-font-7">&ndash;</view>
<view class="item-font-6">{{e.next_devicecode}}</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('1')">指令撤销</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('2')">重新下发</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('3')">强制完成</button>
</view>
<view class="zd_content msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_content">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="val1">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起始设备</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">目标设备</span>
</view>
<view class="zd-col-19 filter_select">
<search-box
v-model="val3"
/>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap.stop="show = false">取消</button>
<button class="zd-col-7 button-default" @tap.stop="clearUp">清空</button>
<button class="zd-col-7 button-primary" @tap="_pdaInsts">查询</button>
</view>
</view>
<view v-if="show" class="msg_mask"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {pdaInsts, pdaInst} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
show: false,
state: [{id:'-1', text: '全部'}, {id:'0', text: '就绪'}, {id:'1', text: '执行中'}, {id:'2', text: '完成'}],
tab: '-1',
title: '',
val1: '',
val2: '',
val3: '',
data: [],
dataList: [],
pkId: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._pdaInsts()
},
methods: {
toSearch () {
this.show = true
this.tab = '-1'
},
async _pdaInsts () {
this.show = false
let res = await pdaInsts(this.val1, this.val2, this.val3)
if (res.code === '1') {
this.data = [...res.result]
this.dataList = [...this.data]
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
changeTab (e) {
this.tab = e.id
if (e.id !== '-1') {
let arr = this.data.filter(el => {return el.inst_status === e.id})
this.dataList = [...arr]
} else {
this.dataList = [...this.data]
}
},
async _pdaInst (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await pdaInst(type, this.pkId)
this.disabled = false
this.tab = '-1'
this._pdaInsts()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.pkId = ''
this.disabled = false
},
toCheck (e) {
this.pkId = this.pkId === e.inst_uuid ? '' : e.inst_uuid
}
}
}
</script>
<style lang="stylus">
</style>