<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="120">
|
<uni-forms-item label="托盘条码">
|
<uni-easyinput type="text" :focus="!istrue" v-model="barcode" placeholder="请扫描托盘条码"
|
ref='midInput' @confirm="inputChangebarcode" />
|
</uni-forms-item>
|
<uni-forms-item label="实盘数量">
|
<uni-easyinput type="number" v-model="num" placeholder="请输入实盘数量" ref='midInput' />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="picking" type="primary" style="margin-left: 0px;">盘点完成</button>
|
</uni-forms-item>
|
</uni-forms>
|
<view class="uni-content" v-if="takeStockObj">
|
<view class="uni-title-sub uni-ellipsis-2">盘点单号:{{orderNo}}</view>
|
<view class="uni-note">物料编码:{{takeStockObj.materielCode}}</view>
|
<view class="uni-note">物料批次:{{takeStockObj.batchNo}}</view>
|
<view class="uni-note">物料名称:{{takeStockObj.materielName}}</view>
|
<view class="uni-note">物料规格:{{takeStockObj.materielSpec}}</view>
|
<view class="uni-note">账面数量:{{takeStockObj.sysQty}}</view>
|
</view>
|
</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="!addressFocus" v-model="inboundBarcode"
|
placeholder="请扫描托盘条码" ref='midInput' @confirm="inputChangebarcode3" />
|
</uni-forms-item>
|
<uni-forms-item label="地址条码">
|
<uni-easyinput type="text" v-model="address" :disabled="addressdisabled" placeholder="请扫描地址条码" ref='midInput'
|
:focus="addressFocus" />
|
</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>
|
<uni-list>
|
<uni-list-item direction="column" v-if="inboundBarcode">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">组盘总数量:{{Summmary}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
<uni-list-item direction="column" v-for="(item,index) in stockInfoDetail" :key="index">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">物料编号:{{item.materielCode}}</view>
|
<view class="uni-note">物料名称:{{item.materielName}}</view>
|
<view class="uni-note">物料批次:{{item.batchNo}}</view>
|
<view class="uni-note">组盘数量:{{item.stockQuantity}}</view>
|
<view class="uni-note">生产日期:{{item.productionDate}}</view>
|
<view class="uni-note">有 效 期:{{item.effectiveDate}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</view>
|
</view>
|
</view>
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
items: ['盘点'],
|
current: 0,
|
istrue: false,
|
barcode: '',
|
num: null,
|
orderNo: "",
|
takeStockObj: null,
|
addressFocus: false,
|
inboundBarcode: "",
|
address: "",
|
addressdisabled: false,
|
warehouseId: "",
|
Summmary: 0,
|
stockInfoDetail: []
|
}
|
},
|
onLoad(res) {
|
this.warehouseId = res.warehouseId;
|
this.orderNo = res.orderNo;
|
if (this.warehouseId == 3) {
|
this.address = "1011";
|
this.addressdisabled = true;
|
}
|
},
|
methods: {
|
onClickItem(e) {
|
this.focus = false;
|
this.addressFocus = false;
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
},
|
inbound() {
|
var postData = {
|
MainData: {
|
"barcode": this.inboundBarcode,
|
"startPoint": this.address,
|
"warehouseId": this.warehouseId
|
}
|
}
|
this.$u.post('/api/Task/RequestInboundTask', postData).then(res => {
|
if (res.status) {
|
this.inboundBarcode = "";
|
if (this.warehouseId !== 3) {
|
this.address = "";
|
}
|
this.Summmary = 0;
|
this.stockInfoDetail = [];
|
this.$refs.uToast.show({
|
title: "成功",
|
type: "success"
|
})
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
inputChangebarcode3() {
|
this.addressFocus = false;
|
setTimeout(() => {
|
if (this.inboundBarcode) {
|
this.addressFocus = true;
|
var postData = {
|
MainData: {
|
"barcode": this.inboundBarcode,
|
"warehouseId": this.warehouseId,
|
}
|
};
|
this.$u.post('/api/StockInfo/StockQueryData', postData).then(res => {
|
this.stockInfoDetail = [];
|
this.Summmary = 0;
|
if (res.status) {
|
this.stockInfoDetail = res.data.details
|
this.stockInfoDetail.forEach(item => {
|
this.Summmary += item.stockQuantity;
|
});
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
}
|
}, 1000);
|
},
|
picking() {
|
if (!this.barcode) {
|
this.$refs.uToast.show({
|
title: "请扫描托盘条码",
|
type: "error"
|
})
|
return;
|
}
|
if (this.num == null || this.num == undefined) {
|
this.$refs.uToast.show({
|
title: "盘点数量不能为空(可填0—有效数字值)",
|
type: "error"
|
})
|
return;
|
}
|
if (!this.takeStockObj) {
|
this.$refs.uToast.show({
|
title: "盘点信息为空",
|
type: "error"
|
})
|
return;
|
}
|
var params = {
|
MainData: {
|
"num": this.num,
|
"id": this.takeStockObj.id
|
}
|
}
|
this.$u.post('/api/TakeStockOrder/MatPicking', params).then(res => {
|
if (res.status) {
|
this.barcode = "";
|
this.takeStockObj = null;
|
this.num = null;
|
this.$refs.uToast.show({
|
title: "盘点成功",
|
type: "success"
|
})
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
inputChangebarcode() {
|
this.istrue = false;
|
setTimeout(() => {
|
if (this.barcode) {
|
this.istrue = true;
|
var postData = {
|
MainData: {
|
"orderNo": this.orderNo,
|
"takePalletCode": this.barcode
|
}
|
};
|
this.$u.post('/api/TakeStockOrder/GetTakeDetailInfo', postData).then(res => {
|
if (res.status) {
|
this.takeStockObj = res.data;
|
} else {
|
this.barcode = "";
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
}
|
}, 1000);
|
}
|
}
|
}
|
</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>
|