Files
pad-nl-three-uni/pages/management/hcxcheck.vue
2024-02-20 16:29:38 +08:00

380 lines
11 KiB
Vue

<template>
<view class="content">
<nav-bar title="缓存线盘点"></nav-bar>
<view class="search-confirm-wrap">
<view class="search-wrap search-wrap_1">
<view class="search-item">
<label class="search-label">生产区域</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<view class="search-item">
<label class="search-label">缓存线</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
<view class="search-item flexend">
<button class="confirm-button" :disabled="disabled4" @tap="_cacheLineHandCheck">盘点开始</button>
<button class="confirm-button" :disabled="disabled5" @tap="_cacheLineHandCheckEnd">盘点结束</button>
<button class="confirm-button" @tap="toSearch()">刷新</button>
</view>
</view>
</view>
<view class="material-wrap">
<view class="status-wrap">
<view class="status-item">
<text class="status-icon bg-gray"></text>
<text class="status-txt">空位</text>
</view>
<view class="status-item">
<text class="status-icon bg-green"></text>
<text class="status-txt">空箱</text>
</view>
<view class="status-item">
<text class="status-icon bg-yellow"></text>
<text class="status-txt">满箱</text>
</view>
<view class="status-item">
<text class="status-icon bg-red"></text>
<text class="status-txt">异常</text>
</view>
</view>
<view class="material-item-wrap">
<view v-if="Number(e.vehicle_status) !== 5" class="material-item" v-for="(e, i) in dataList" :key="i" :class="['bg-gray', 'bg-green', 'bg-yellow','bg-red'][Number(e.vehicle_status) - 1]" @tap="toInfo(e)">
<view class="material-title">{{e.vehicle_code}}</view>
<view class="material-spec">{{e.material_spec}}</view>
<!-- <view v-show="e.layer_num === 1 && (e.seat_order_num === 1 || e.seat_order_num === 2)" class="badge__content">{{['准备位', '对接位'][Number(e.seat_order_num) - 1]}}</view> -->
</view>
</view>
</view>
<view class="popup-bottom-wrap" :class="active === true ? 'addHeight' : 'delHeight'">
<view class="search-confirm-wrap">
<view class="search-wrap">
<view class="search-item">
<label class="search-label">料箱码</label>
<view class="filter_input_wraper">
<search-box
v-model="val1"
/>
</view>
</view>
<view class="search-item">
<label class="search-label">物料</label>
<view class="filter_input_wraper" @tap="searchMater">
<input type="text" class="search-input-l" v-model="val2">
</view>
</view>
<view class="search-item">
<label class="search-label">名称</label>
<view class="filter_input_wraper">
<input type="text" class="search-input-l" v-model="val3" disabled="disabled">
</view>
</view>
<view class="search-item">
<label class="search-label">规格</label>
<view class="filter_input_wraper">
<input type="text" class="search-input-l" v-model="val4" disabled="disabled">
</view>
</view>
<view class="search-item">
<label class="search-label">数量</label>
<view class="filter_input_wraper">
<input type="number" class="search-input-l" v-model="val6">
</view>
</view>
<view class="search-item">
<label class="search-label">重量</label>
<view class="filter_input_wraper">
<input type="number" class="search-input-l" v-model="val7">
</view>
</view>
<view class="search-item">
<label class="search-label"></label>
<view class="filter_input_wraper">
<input type="number" class="search-input-l" v-model="obj.layer_num" disabled>
</view>
</view>
<view class="search-item">
<label class="search-label">位置</label>
<view class="filter_input_wraper">
<input type="text" class="search-input-l" v-model="obj.seat_order_num" disabled>
</view>
</view>
<view class="search-item">
<label class="search-label">工序</label>
<view class="filter_input_wraper">
<uni-data-select v-model="index3" :localdata="options3" :selectUp="true" @change="selectChange3"></uni-data-select>
</view>
</view>
</view>
<view class="confirm-button-wrap">
<button class="confirm-button" :class="{'confirm-button_disabled': !val1 || !val6 || !val7}" :disabled="disabled1" @tap="_setfullBox">设为满框</button>
<button class="confirm-button" :class="{'confirm-button_disabled': !val1}" :disabled="disabled2" @tap="_setEmptyBox">设为空框</button>
<button class="confirm-button" :class="{'confirm-button_disabled': !val1}" :disabled="disabled3" @tap="_deleteBox">删除</button>
</view>
</view>
</view>
<view v-show="active" class="overlay" @tap="closePop"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getCacheLine, workprocedureQuery, getCacheLineMaterialInfo, setfullBox, setEmptyBox, deleteBox, cacheLineHandCheck, cacheLineHandCheckEnd} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
options1: [{text: 'A1', value: 'A1'}, {text: 'A2', value: 'A2'}],
index1: 'A1',
options2: [],
index2: '',
options3: [],
index3: '',
val1: '',
val2: '',
val3: '',
val4: '',
val5: '',
val6: '',
val7: '',
dataList: [],
active: false,
obj: {},
disabled1: false,
disabled2: false,
disabled3: false,
disabled4: false,
disabled5: false
};
},
created () {
this._getCacheLine('A1')
this._workprocedureQuery()
},
destroyed () {
this.$store.dispatch('setPublicObj', '')
},
onShow () {
if (this.$store.getters.publicObj !== '') {
this.val2 = this.$store.getters.publicObj.material_code
this.val3 = this.$store.getters.publicObj.material_name
this.val4 = this.$store.getters.publicObj.material_spec
this.val5 = this.$store.getters.publicObj.material_uuid
}
},
methods: {
/** 选择器1 */
selectChange1(e) {
this.index1 = e
if (this.index1) {
this._getCacheLine(e)
this.index2 = ''
}
},
/** 选择器2 */
selectChange2(e) {
this.index2 = e
if (this.index2) {
this._getCacheLineMaterialInfo()
}
},
/** 缓存线 */
async _getCacheLine (id) {
let res = await getCacheLine(id)
this.options2 = [...res]
},
async _getCacheLineMaterialInfo () {
let res = await getCacheLineMaterialInfo(this.index1, this.index2)
this.dataList = [...res]
},
/** 选择器3 */
selectChange3(e) {
this.index3 = e
},
/** 工序 */
async _workprocedureQuery () {
let res = await workprocedureQuery()
this.options3 = [...res]
this.options3.map(el => {
this.$set(el, 'text', el.workprocedure_name)
this.$set(el, 'value', el.workprocedure_code)
})
},
toSearch () {
this.val1 = ''
this.index3 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.val5 = ''
this.val6 = ''
this.val7 = ''
this.obj = {}
this.active = false
this.$store.dispatch('setPublicObj', '')
this._getCacheLineMaterialInfo()
},
toInfo(e) {
this.active = true
this.obj = e
this.val1 = this.obj.vehicle_code
this.options3.map(el => {
if (el.workprocedure_code === e.workprocedure_code) {
this.index3 = el.value
}
})
this.val2 = this.obj.material_code
this.val3 = this.obj.material_name
this.val4 = this.obj.material_spec
this.val5 = this.obj.material_uuid
this.val6 = this.obj.quantity
this.val7 = this.obj.weight
},
searchMater () {
this.$store.dispatch('setPublicObj', '')
uni.navigateTo({
url: '/pages/management/searchMater'
})
},
closePop () {
this.active = false
},
async _setfullBox () {
this.disabled1 = true
if (!this.val1 || !this.val6 || !this.val7) {
this.disabled1 = false
return
}
try {
let obj = {}
this.$set(obj, 'position_code', this.obj.position_code)
this.$set(obj, 'vehicle_code', this.val1)
this.$set(obj, 'material_uuid', this.val5)
this.$set(obj, 'workprocedure_code', this.index3)
this.$set(obj, 'wcsdevice_code', this.obj.wcsdevice_code)
this.$set(obj, 'quantity', this.val6)
this.$set(obj, 'weight', this.val7)
let res = await setfullBox(obj)
this.disabled1 = false
this.toSearch()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
async _setEmptyBox () {
this.disabled2 = true
if (!this.val1) {
this.disabled2 = false
return
}
try {
let obj = {}
this.$set(obj, 'vehicle_code', this.val1)
this.$set(obj, 'wcsdevice_code', this.obj.wcsdevice_code)
this.$set(obj, 'position_code', this.obj.position_code)
let res = await setEmptyBox(obj)
this.disabled2 = false
this.toSearch()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
}
},
async _deleteBox () {
this.disabled3 = true
if (!this.val1) {
this.disabled3 = false
return
}
try {
let obj = {}
this.$set(obj, 'vehicle_code', this.val1)
this.$set(obj, 'position_code', this.obj.position_code)
let res = await deleteBox(obj)
this.disabled3 = false
this.toSearch()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled3 = false
}
},
async _cacheLineHandCheck () {
this.disabled4 = true
try {
let res = await cacheLineHandCheck('0', this.index2)
this.disabled4 = false
uni.showToast({
title: res.msg,
icon: 'none'
})
} catch (e) {
this.disabled4 = false
}
},
async _cacheLineHandCheckEnd () {
this.disabled5 = true
try {
let res = await cacheLineHandCheckEnd('1', this.index2)
this.disabled5 = false
uni.showToast({
title: res.msg,
icon: 'none'
})
} catch (e) {
this.disabled5 = false
}
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.popup-bottom-wrap
position fixed
bottom 0
left 0
width 100%
height 0
z-index 100
background-color #fff
_fj()
.overlay
position fixed
bottom 0
left 0
_wh(100%, 100%)
background-color rgba(0,0,0,.7)
z-index 99
.addHeight
transition height .2s linear
height 215px /** 35*4+ 15*5 */
.delHeight
transition height .2s linear
height 0
.search-wrap_1
.search-item
&:nth-child(1),&:nth-child(2)
width 30%
&:nth-child(3)
width 36%
</style>