<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view v-if="current === 0" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="180">
|
<uni-forms-item label="托盘条码:">
|
<uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="!focus"
|
v-model="barcode" @input="barcodeInput" @focus="barcodeFocus" />
|
</uni-forms-item>
|
<uni-forms-item label="内箱标签:">
|
<uni-easyinput type="text" placeholder="请扫描内箱标签" ref='midInput' :focus="focus" v-model="materSn"
|
@input="snInput" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="submit" type="primary" size="default" style="margin-top: 2%;">组盘</button>
|
</uni-forms-item>
|
</uni-forms>
|
<uni-list class="footer">
|
<uni-list-item direction="column" v-for="item in matTotal" :key="item.matCode">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">物料编码:{{item.matCode}}</view>
|
<view class="uni-title-sub uni-ellipsis-2">数量:{{item.matQuantity}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
<uni-list-item direction="column" v-for="item in matInfos" :key="item.orderNo">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
|
@click="deleteList(item.orderNo)">
|
</uni-icons>
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">订单号:{{item.orderNo}}</view>
|
<view class="uni-note">物料编码:{{item.matCode}}</view>
|
<view class="uni-note">生产日期:{{item.matProductionDate}}</view>
|
<view class="uni-note">数量:{{item.matQty}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</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="!bindbarcodefocus" v-model="locationNo" placeholder="请输入货位编号"
|
ref='midInput' @input="locationNoinputChange" />
|
</uni-forms-item>
|
<uni-forms-item label="托盘条码">
|
<uni-easyinput type="text" :focus="bindbarcodefocus" v-model="bindbarcode" placeholder="请扫描托盘条码" ref='midInput'/>
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="bindstock" type="primary" size="default" style="margin-top: 2%;">库存绑定</button>
|
</uni-forms-item>
|
</uni-forms>
|
</view>
|
</view>
|
<view v-if="current === 2" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms class="customcss" label-width="120">
|
<uni-forms-item label="内箱标签">
|
<uni-easyinput type="text" @input="inputChange()" v-model="materialsns" placeholder="请扫描内箱标签"
|
ref='midInput' :focus="istrue" />
|
</uni-forms-item>
|
<uni-forms-item label="产线编号">
|
<uni-easyinput type="text" v-model="line" placeholder="请输入产线编号" ref='midInput' :focus="!istrue" />
|
</uni-forms-item>
|
|
<uni-forms-item>
|
<button @click="submit" type="primary" size="default" style="margin-top: 2%;">叫料</button>
|
</uni-forms-item>
|
</uni-forms>
|
<uni-list class="footer">
|
<uni-list-item direction="column" v-if="innersn">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
|
@click="deleteList(innersn.matCode)">
|
</uni-icons>
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">物料编码:{{innersn.matCode}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</view>
|
</view>
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
items: ['C区组盘', 'C区库存绑定', 'C区叫料'],
|
current: 0,
|
matTotal: [],
|
matInfos: [],
|
orderNo: "",
|
label: "",
|
orderInfo: [],
|
focus: false,
|
barcode: "",
|
materSn: "",
|
sns: [],
|
addressFocus: false,
|
inboundBarcode: "",
|
locationNo: "",
|
bindbarcode: '',
|
bindbarcodefocus: false,
|
}
|
},
|
onLoad(res) {},
|
methods: {
|
onClickItem(e) {
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
},
|
updateFocus() {
|
this.materSn = '';
|
if (!this.focus) {
|
this.focus = true;
|
}
|
},
|
barcodeFocus() {},
|
onClickItem(e) {
|
if (this.barcode == "") {
|
this.focus = false;
|
this.addressFocus = false;
|
} else {
|
this.focus = true;
|
this.addressFocus = true;
|
}
|
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
},
|
barcodeInput() {
|
this.focus = false;
|
this.$nextTick(function(x) {
|
if (this.barcode != '') {
|
this.focus = true;
|
}
|
})
|
},
|
snInput() {
|
this.$nextTick(() => {
|
if (this.materSn != "") {
|
// this.focus = false;
|
var matInfo = this.materSn.split('|');
|
if (matInfo.length == 7) {
|
var matObj = {
|
matCode: matInfo[1],
|
matProductionDate: matInfo[3],
|
matQty: matInfo[5],
|
orderNo: matInfo[6],
|
sn: this.materSn
|
}
|
var orderInfo = matObj.orderNo.split('.');
|
var temp = this.matInfos.find(x => x.orderNo == matObj.orderNo);
|
if (!temp) {
|
var tmp = this.matTotal.find(x => x.matCode == matObj.matCode);
|
if (!tmp) {
|
this.matTotal.push({
|
matCode: matObj.matCode,
|
matQuantity: parseInt(matObj.matQty)
|
})
|
} else {
|
tmp.matQuantity += parseInt(matObj.matQty);
|
}
|
this.sns.push(this.materSn);
|
this.matInfos.push(matObj);
|
// setTimeout(this.updateFocus, 200);
|
} else {
|
this.$refs.uToast.show({
|
title: "扫码重复",
|
type: "error"
|
})
|
// setTimeout(this.updateFocus, 200);
|
}
|
} else {
|
this.$refs.uToast.show({
|
title: "扫码错误,请扫描正确内箱码",
|
type: "error"
|
})
|
// setTimeout(this.updateFocus, 200);
|
}
|
}
|
this.materSn = '';
|
})
|
},
|
bindstock() {
|
if (this.locationNo == "") {
|
this.$refs.uToast.show({
|
title: "货位号不能为空",
|
type: "error"
|
});
|
return;
|
}
|
if (this.bindbarcode == "") {
|
this.$refs.uToast.show({
|
title: "托盘号不能为空",
|
type: "error"
|
});
|
return;
|
}
|
var postData = {
|
MainData: {
|
"locationNo": this.locationNo,
|
"barcode": this.bindbarcode
|
},
|
}
|
this.$u.post('/api/StockOperate/BindStock', postData).then(res => {
|
if (res.status) {
|
uni.$showMsg(res.message);
|
this.inboundBarcode = "";
|
this.address = "";
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
locationNoinputChange() {
|
this.barcodefocus = false;
|
this.$nextTick(function(x) {
|
if (this.locationNo != '') {
|
this.barcodefocus = true;
|
}
|
})
|
},
|
submit() {
|
if (this.barcode == "") {
|
this.$refs.uToast.show({
|
title: "请扫描托盘条码",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.sns.length == 0) {
|
this.$refs.uToast.show({
|
title: "请扫描内箱标签",
|
type: 'error'
|
})
|
return;
|
}
|
this.$u.post('/api/Bill_group_stock/OtherBoxing', {
|
MainData: {
|
"pallet_barcode": this.barcode,
|
"orderNo": this.orderNo
|
},
|
DetailData: this.matInfos,
|
DelKeys: this.sns
|
}).then(res => {
|
if (res.status) {
|
uni.$showMsg('组盘成功!')
|
this.barcode = "";
|
this.matInfos = [];
|
this.sns = [];
|
this.matTotal = [];
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
uni.showToast.show({
|
title: err.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: 20px;
|
margin-left: 5%;
|
}
|
|
.headerstyle {
|
width: 90%;
|
}
|
</style>
|