Files
hht-xunbo/src/pages/proj/Check.vue

198 lines
5.2 KiB
Vue
Raw Normal View History

2023-06-19 14:10:36 +08:00
<template>
<section>
2023-06-19 17:23:25 +08:00
<nav-bar title="盘点"></nav-bar>
2023-06-19 14:10:36 +08:00
<section class="content">
<div class="filter-wraper">
<search-box
2024-03-13 17:01:16 +08:00
ref="myInput1"
2023-06-19 14:10:36 +08:00
label="托盘码"
v-model="val1"
@handleChange="handleChange1"
></search-box>
<search-box
2024-03-13 17:01:16 +08:00
ref="myInput2"
2023-06-19 14:10:36 +08:00
label="物料条码"
v-model="val2"
@handleChange="handleChange2"
></search-box>
</div>
<div class="grid-wraper">
<div class="left_fixed">
<table class="layout-t left_layout_t">
<tr>
<th>单据编号</th>
</tr>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.BillID}}</td>
</tr>
</table>
</div>
<div class="slide">
<table class="layout-t">
<tr>
<th>物料编码</th>
<th>物料名称</th>
<th>批次</th>
<th>库存数量</th>
2023-06-19 17:23:25 +08:00
<th>盘点数量</th>
2023-06-19 14:10:36 +08:00
</tr>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{e.MatCode}}</td>
<td>{{e.MatName}}</td>
<td>{{e.BatchNumber}}</td>
<td>{{e.MatNum}}</td>
2023-06-19 17:23:25 +08:00
<td>{{e.FactNumOut}}</td>
2023-06-19 14:10:36 +08:00
</tr>
</table>
</div>
</div>
</section>
<section class="submit-bar">
2023-06-19 17:23:25 +08:00
<button class="btn submit-button" :class="{'btn-disabled' : !val1 || !val2}" :disabled="disabled" @click="_RFStorageInventory">盘点</button>
2023-06-19 14:10:36 +08:00
<button class="btn submit-button" @click="toCancle">取消</button>
</section>
</section>
</template>
<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
2023-06-19 17:23:25 +08:00
import {RFReadTrayStateInventory, RFReadTrayStorageInventory, RFReadMatBarCodeStateInventory, RFStorageInventory} from '@config/getData1'
2023-06-19 14:10:36 +08:00
export default {
2023-06-19 17:23:25 +08:00
name: 'PickGoods',
2023-06-19 14:10:36 +08:00
components: {
NavBar,
SearchBox
},
data () {
return {
val1: '',
val2: '',
dataList: [],
disabled: false
}
},
2024-03-13 17:01:16 +08:00
mounted () {
this.$refs.myInput1.handleScan()
},
2023-06-19 14:10:36 +08:00
methods: {
/** 读取托盘码 */
2023-06-19 17:23:25 +08:00
async _RFReadTrayStateInventory (val) {
2023-06-19 14:10:36 +08:00
try {
2023-06-19 17:23:25 +08:00
let res = await RFReadTrayStateInventory(val)
2023-06-19 14:10:36 +08:00
if (res.ErrNO === '1') {
2023-06-19 17:23:25 +08:00
this._RFReadTrayStorageInventory()
2023-06-19 14:10:36 +08:00
} else {
this.toast(res.ErrMsg)
this.val1 = ''
2024-03-13 17:27:46 +08:00
this.$refs.myInput1.handleScan()
2023-06-19 14:10:36 +08:00
}
} catch (e) {
this.val1 = ''
2024-03-16 11:07:29 +08:00
this.$refs.myInput1.handleScan()
2023-06-19 14:10:36 +08:00
}
},
2023-06-19 17:23:25 +08:00
/** 托盘待盘点信息 */
async _RFReadTrayStorageInventory () {
let res = await RFReadTrayStorageInventory(this.val1)
2023-06-19 14:10:36 +08:00
if (res.ErrNO === '1') {
this.dataList = [...res.StorageList]
2024-03-21 17:46:38 +08:00
this.val2 = ''
this.$refs.myInput2.handleScan()
2023-06-19 14:10:36 +08:00
} else {
this.toast(res.ErrMsg)
2024-03-21 17:46:38 +08:00
this.val1 = ''
this.$refs.myInput1.handleScan()
2023-06-19 14:10:36 +08:00
}
},
/** 读取物料条码 */
2023-06-19 17:23:25 +08:00
async _RFReadMatBarCodeStateInventory (val) {
2023-06-19 14:10:36 +08:00
try {
2023-06-19 17:23:25 +08:00
let res = await RFReadMatBarCodeStateInventory(this.val1, val)
2023-06-19 14:10:36 +08:00
if (res.ErrNO === '1') {
2024-03-21 17:46:38 +08:00
this._RFStorageInventory()
2023-06-19 14:10:36 +08:00
} else {
this.toast(res.ErrMsg)
this.val2 = ''
2024-03-13 17:27:46 +08:00
this.$refs.myInput2.handleScan()
2023-06-19 14:10:36 +08:00
}
} catch (e) {
this.val2 = ''
2024-03-16 11:07:29 +08:00
this.$refs.myInput2.handleScan()
2023-06-19 14:10:36 +08:00
}
},
handleChange1 (e, type) {
2024-03-16 11:07:29 +08:00
if (type && e.substring(0, 2) !== 'ZD') {
2024-03-21 17:46:38 +08:00
this.$refs.myInput1.handleScan()
setTimeout(() => {
this.val1 = ''
}, 200)
2024-03-16 11:07:29 +08:00
return
}
2023-06-19 14:10:36 +08:00
if (type) {
2023-06-19 17:23:25 +08:00
this._RFReadTrayStateInventory(e)
2023-06-19 14:10:36 +08:00
}
},
handleChange2 (e, type) {
2024-03-16 11:07:29 +08:00
if (type && e.substring(0, 2) === 'ZD') {
this.val1 = e
2024-03-21 17:46:38 +08:00
setTimeout(() => {
this.val2 = ''
}, 200)
2024-03-16 11:07:29 +08:00
this._RFReadTrayStateInventory(this.val1)
return
}
2024-03-21 17:46:38 +08:00
if (type && this.val1 === '' && e.substring(0, 2) !== 'ZD') {
this.$refs.myInput1.handleScan()
setTimeout(() => {
this.val2 = ''
}, 200)
return
}
if (type && this.val1 !== '') {
2023-06-19 17:23:25 +08:00
this._RFReadMatBarCodeStateInventory(e)
2023-06-19 14:10:36 +08:00
}
},
2023-06-19 17:23:25 +08:00
/** 盘点 */
async _RFStorageInventory () {
2023-06-19 14:10:36 +08:00
this.disabled = true
if (!this.val1 || !this.val2) {
this.disabled = false
return
}
try {
let uid = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).UserPID : ''
2023-06-19 17:23:25 +08:00
let res = await RFStorageInventory(this.val1, this.val2, uid)
2023-06-19 14:10:36 +08:00
if (res.ErrNO === '1') {
this.toast(res.ErrMsg)
2024-03-16 11:07:29 +08:00
this._RFReadTrayStorageInventory()
2023-06-19 14:10:36 +08:00
} else {
this.Dialog(res.ErrMsg)
2024-03-21 17:46:38 +08:00
this.val2 = ''
this.$refs.myInput2.handleScan()
2023-06-19 14:10:36 +08:00
}
2024-03-16 11:07:29 +08:00
this.disabled = false
2023-06-19 14:10:36 +08:00
} catch (e) {
this.disabled = false
2024-03-21 17:46:38 +08:00
this.val2 = ''
this.$refs.myInput2.handleScan()
2023-06-19 14:10:36 +08:00
}
},
/** 取消 */
toCancle () {
this.val1 = ''
this.val2 = ''
this.dataList = []
this.disabled = false
2024-03-13 17:01:16 +08:00
this.$refs.myInput1.handleScan()
2023-06-19 14:10:36 +08:00
}
}
}
</script>
<style lang="stylus" scoped>
@import '~@style/mixin'
.grid-wraper
height calc(100% - 2.15rem)
</style>