<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view class="content">
|
<view v-if="current === 0" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="180">
|
<uni-forms-item label="物料编码">
|
<uni-easyinput type="text" v-model="materialCode" placeholder="请输入物料编码" ref='midInput' />
|
</uni-forms-item>
|
<uni-forms-item label="物料幅宽:">
|
<uni-easyinput type="text" v-model="wide" placeholder="请输入物料幅宽" ref='midInput'/>
|
</uni-forms-item>
|
<uni-forms-item label="物料数量:">
|
<uni-easyinput type="text" v-model="qty" placeholder="请输入物料数量" ref='midInput'/>
|
</uni-forms-item>
|
<uni-forms-item label="出库点位">
|
<uni-data-select placeholder="请选择" v-model="address"
|
:localdata="startPointRange"></uni-data-select>
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="OutEmpty" type="primary" size="default" style="margin-top: 2%;">出库</button>
|
</uni-forms-item>
|
</uni-forms>
|
</view>
|
</view>
|
</view>
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
const innerAudioContext = uni.createInnerAudioContext();
|
export default {
|
data() {
|
return {
|
items: ['印刷出库'],
|
current: 0,
|
focus: false,
|
wide: "",
|
materialCode: "",
|
WarehouseId: 0,
|
qty: "",
|
address: "",
|
barcode: "",
|
startPointRange: []
|
}
|
},
|
onShow() {},
|
onLoad(res) {
|
this.WarehouseId = res.warehouseId;
|
this.focus = false;
|
this.getDictionary();
|
},
|
methods: {
|
// voiceSpeech(src) {
|
// innerAudioContext.src = src; // '../../static/success.mp3';
|
// innerAudioContext.play();
|
// },
|
onClickItem(e) {
|
this.barcodeFo = true;
|
this.focus = false;
|
this.addressFocus = false;
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
},
|
barcodeInput() {
|
// this.$nextTick(function(x) {
|
// if (this.barcode.length > 0) {
|
// this.focus = true;
|
// }
|
// })
|
},
|
getDictionary() {
|
var param = ["printAreaEnum"];
|
this.$u.post('api/Sys_Dictionary/GetVueDictionary', param).then(res => {
|
//将res.data中的value改成text,key改成value
|
res[0].data.forEach(item => {
|
var obj = {
|
value: item.key,
|
text: item.value
|
}
|
this.startPointRange.push(obj);
|
})
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
OutEmpty() {
|
if (this.materialCode == "") {
|
this.$refs.uToast.show({
|
title: "请输入物料编码",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.wide == "") {
|
this.$refs.uToast.show({
|
title: "请输入物料幅宽",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.qty == "") {
|
this.$refs.uToast.show({
|
title: "请输入数量",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.address == "") {
|
this.$refs.uToast.show({
|
title: "请选择出库点位",
|
type: 'error'
|
})
|
return;
|
}
|
|
|
//this.qty 验证为整数
|
if (!/^\d+$/.test(this.qty)) {
|
this.$refs.uToast.show({
|
title: "数量必须为整数",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.qty < 1) {
|
this.$refs.uToast.show({
|
title: "数量不能小于1",
|
type: 'error'
|
})
|
return;
|
}
|
//this.materialCode 去除空格
|
this.materialCode = this.materialCode.replace(/\s+/g, "");
|
var postData = {
|
"materialCode": this.materialCode,
|
"count": this.qty,
|
"address": this.address,
|
"wide": this.wide,
|
}
|
this.$u.post('/api/Task/RequestYLWMSTaskOut',postData).then(
|
res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "成功",
|
type: "success"
|
})
|
this.materialCode = "";
|
this.qty = "";
|
this.address = "";
|
this.wide = "";
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/common/uni-ui.scss';
|
|
.content {
|
display: flex;
|
height: 150px;
|
}
|
|
.content-text {
|
font-size: 14px;
|
color: #666;
|
}
|
|
.itemstyle {
|
margin-top: 30px;
|
margin-left: 5%;
|
}
|
|
.headerstyle {
|
width: 90%;
|
}
|
</style>
|