<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" v-if="warehouseId==1">
|
<uni-forms label-width="180">
|
<uni-forms-item label="条码:">
|
<uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus"
|
v-model="barcode" @confirm="barcodeInput" />
|
</uni-forms-item>
|
<uni-forms-item label="物料:">
|
<uni-easyinput type="text" placeholder="请输入物料" ref='midInput' v-model="materSn" />
|
</uni-forms-item>
|
<uni-forms-item label="直径:">
|
<uni-easyinput type="text" placeholder="请输入直径(mm)" ref='midInput' v-model="thickness" />
|
</uni-forms-item>
|
<uni-forms-item label="幅宽:">
|
<uni-easyinput type="text" placeholder="请输入幅宽(mm)" ref='midInput' v-model="wide" />
|
</uni-forms-item>
|
<uni-forms-item label="重量:">
|
<uni-easyinput type="text" trim="all" placeholder="请输入重量(kg)" ref='midInput'
|
v-model="weight" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
|
</uni-forms-item>
|
</uni-forms>
|
</view>
|
<view class="itemstyle" v-else>
|
<uni-forms label-width="120">
|
<uni-forms-item label="托盘条码">
|
<uni-easyinput type="text" :focus="!addressEmptyFocus" v-model="inboundCode"
|
placeholder="请扫描托盘条码" ref='midInput' @confirm="inputChangeemptyCode" />
|
</uni-forms-item>
|
<uni-forms-item label="地址条码">
|
<uni-easyinput type="text" v-model="address" placeholder="请扫描地址条码" ref='midInput'
|
:focus="addressEmptyFocus" />
|
</uni-forms-item>
|
<uni-forms-item label="物料编码">
|
<uni-easyinput type="text" v-model="matCode" placeholder="请输入物料编码" ref='midInput' />
|
</uni-forms-item>
|
<uni-forms-item label="物料数量">
|
<uni-easyinput type="number" v-model="matCount" placeholder="请输入物料数量" ref='midInput' />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="inbound" type="primary" size="default" style="margin-top: 2%;">入库确认</button>
|
</uni-forms-item>
|
</uni-forms>
|
</view>
|
</view>
|
<view v-if="current === 1" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120">
|
<uni-forms-item label="托盘条码">
|
<uni-easyinput type="text" :focus="!addressEmptyFocus" v-model="emptyCode"
|
placeholder="请扫描托盘条码" ref='midInput' @confirm="inputChangeemptyCode" />
|
</uni-forms-item>
|
<uni-forms-item label="地址条码">
|
<uni-easyinput type="text" v-model="addressEmpty" placeholder="请扫描地址条码" ref='midInput'
|
:focus="addressEmptyFocus" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="inEmpty" 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: ['组盘'], //, '单据信息', '解盘'
|
materSn: "",
|
wide: "",
|
weight: "",
|
thickness: "",
|
barcode: "",
|
focus: false,
|
inboundBarcode: "",
|
address: "",
|
addressdisabled: true,
|
addressFocus: false,
|
current: 0,
|
inboundCode: "",
|
orderNo: "",
|
warehouseId: "",
|
Test: false,
|
emptyCode: "",
|
matCount: 0,
|
matCode: "", //物料编码
|
addressEmpty: "",
|
addressEmptyFocus: false,
|
}
|
},
|
onShow() {},
|
onLoad(res) {
|
this.focus = false;
|
this.addressFocus = false;
|
this.Test=false;
|
this.warehouseId = res.warehouseId;
|
if (this.warehouseId == 1) {
|
this.items = ['组盘'];
|
}
|
if (this.warehouseId == 2) {
|
//仅显示uni-segmented-control为1和2的值
|
this.items.push('辅料入库');
|
this.items.push('空托入库');
|
//this.items移除组盘
|
this.items.splice(0,1);
|
}
|
},
|
methods: {
|
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;
|
}
|
})
|
},
|
inputChangeemptyCode() {
|
if (this.emptyCode.length > 0) {
|
this.addressEmptyFocus = true;
|
} else {
|
this.addressEmptyFocus = false;
|
}
|
|
if(this.inboundCode){
|
this.addressEmptyFocus = true;
|
}else {
|
this.addressEmptyFocus = false;
|
}
|
},
|
inEmpty() {
|
if (this.emptyCode == "") {
|
this.$refs.uToast.show({
|
title: "请扫描托盘条码",
|
type: "error"
|
})
|
return;
|
}
|
if (this.addressEmpty == "") {
|
this.$refs.uToast.show({
|
title: "请扫描地址条码",
|
type: "error"
|
})
|
return;
|
}
|
var url = "?barCode=" + this.emptyCode + "&startPoint=" + this.addressEmpty;
|
this.$u.post('/api/Task/EmptyBackTask' + url, {}).then(res => {
|
if (res.status) {
|
this.emptyCode = "";
|
this.addressEmpty = "";
|
//获取总数量
|
setTimeout(() => {
|
this.addressEmptyFocus = false;
|
this.$refs.uToast.show({
|
title: "成功",
|
type: "success"
|
})
|
}, 200);
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
inbound() {
|
if (this.matCount <= 0) {
|
this.$refs.uToast.show({
|
title: "请输入物料数量",
|
type: "error"
|
})
|
return;
|
}
|
if(!this.Test){
|
this.$refs.uToast.show({
|
title: "请确认物料数量"+this.matCount,
|
type: "info"
|
})
|
this.Test=true;
|
return;
|
}
|
if (this.inboundCode == "") {
|
this.$refs.uToast.show({
|
title: "请扫描托盘条码",
|
type: "error"
|
})
|
return;
|
}
|
if (this.address== "") {
|
this.$refs.uToast.show({
|
title: "请扫描地址条码",
|
type: "error"
|
})
|
return;
|
}
|
if (this.matCode == "") {
|
this.$refs.uToast.show({
|
title: "请输入物料编码",
|
type: "error"
|
})
|
return;
|
}
|
|
var url = "?barCode=" + this.inboundCode + "&startPoint=" + this.address + "&matCode=" + this
|
.matCode + "&matCount=" + this.matCount;
|
this.$u.post('/api/Task/InboundFLTask' + url, {}).then(res => {
|
if (res.status) {
|
this.inboundCode = "";
|
this.address = "";
|
this.matCode = "";
|
this.matCount = 0;
|
this.Test=false;
|
//获取总数量
|
setTimeout(() => {
|
this.addressEmptyFocus = false;
|
this.$refs.uToast.show({
|
title: "成功",
|
type: "success"
|
})
|
}, 200);
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
this.Test=false;
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
submit() {
|
if (this.barcode == "") {
|
this.$refs.uToast.show({
|
title: "请扫描条码",
|
type: 'error'
|
})
|
return;
|
}
|
this.$u.post('/api/StockInfo/ManualMaterielGroup', {
|
MainData: {
|
"palletCode": this.barcode,
|
"thickness": this.thickness,
|
"weight": this.weight,
|
"wide": this.wide,
|
"materSn": this.materSn,
|
// "isFull": this.check
|
"warehouseId": this.warehouseId
|
},
|
}).then(res => {
|
this.Testcheck = false;
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "组盘成功",
|
type: "success"
|
})
|
this.focus = false;
|
this.barcode = "";
|
this.materSn = "";
|
this.wide = "";
|
this.weight = "";
|
this.thickness = "";
|
} 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>
|