<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view v-show="current === 0">
|
<view style="padding: 5%;">
|
<uni-forms label-width="120">
|
<uni-forms-item label="托盘编码">
|
<uni-easyinput type="text" :focus="!istrue" v-model="PalletCode1" placeholder="请输入托盘编码"
|
ref='midInput' />
|
</uni-forms-item>
|
<uni-forms-item label="入库起点">
|
<uni-easyinput type="text" :focus="istrue" v-model="SourceAddress" placeholder="请输入入库起点"
|
ref='midInput' />
|
</uni-forms-item>
|
<uni-forms-item label="入库终点">
|
<uni-easyinput type="text" :focus="istrue" v-model="TargetAddress" placeholder="请输入入库终点"
|
ref='midInput' />
|
</uni-forms-item>
|
<uni-forms-item label="终 点 区 域">
|
<uni-data-select :focus="!istrue" v-model="AreaId" :localdata="range"
|
placeholder="请输选择入库终点区域"></uni-data-select>
|
</uni-forms-item>
|
</uni-forms>
|
<button @click="InboundTask" type="primary" size="default" style="margin-top: 2%;">入库</button>
|
<u-toast ref="InboundTaskluToast" />
|
</view>
|
</view>
|
<view v-show="current === 1">
|
<view style="padding: 5%;">
|
<uni-forms label-width="120">
|
<uni-forms-item label="托盘编码">
|
<uni-easyinput type="text" :focus="barcodefocus" @input="inputChangebarcode"
|
v-model="PalletCode2" placeholder="请输入托盘编码" ref='midInput' />
|
</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-list>
|
<!-- <uni-list-item direction="column" v-for="item in InBoundOrder" :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.orderNo}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item> -->
|
<uni-list-item direction="column" v-for="(item,index) in InBoundOrder" :key="item.sn">
|
<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>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</uni-forms>
|
<button @click="OutboundTask" type="primary" size="default" style="margin-top: 2%;">组盘</button>
|
<u-toast ref="OutboundTaskluToast" />
|
</view>
|
</view>
|
<view v-show="current === 2">
|
<view style="padding: 5%;">
|
<uni-forms label-width="120">
|
<uni-forms-item label="托盘编码">
|
<uni-easyinput type="text" :focus="barcodefocus" @input="inputChange" v-model="PalletCode3"
|
placeholder="请输入托盘编码" ref='midInput' />
|
</uni-forms-item>
|
</uni-forms>
|
<button @click="OutboundTask" type="primary" size="default" style="margin-top: 2%;">解盘</button>
|
<u-toast ref="OutboundTaskluToast" />
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
config
|
} from '../../common/config';
|
const innerAudioContext = uni.createInnerAudioContext();
|
export default {
|
data() {
|
return {
|
istrue: false,
|
barcodefocus: false,
|
range: [],
|
AreaId: "",
|
SourceAddress: "",
|
TargetAddress: "",
|
PalletCode1: "",
|
PalletCode2: "",
|
PalletCode3: "",
|
materSn: "",
|
InBoundOrder: [],
|
items: ['入库', '组盘', '解盘'],
|
current: 0
|
}
|
},
|
onLoad(res) {
|
this.range = config.AreaId;
|
},
|
methods: {
|
onClickItem(e) {
|
if (this.current != e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
},
|
InboundTask() {
|
if (this.PalletCode.length <= 0 && this.Point.length) {
|
this.$refs.InboundTaskluToast.show({
|
title: "托盘编码跟绑定货位不能为空",
|
type: "error"
|
})
|
return;
|
}
|
var param = {
|
"PalletCode": this.PalletCode,
|
"Position": this.SourceAddress,
|
"TargetAddress": this.TargetAddress
|
}
|
console.log(param);
|
this.$u.post('/api/Task/RequestTaskAsync', param).then(res => {
|
if (res.status) {
|
this.$refs.InboundTaskluToast.show({
|
title: res.message,
|
type: "success"
|
})
|
this.PalletCode = "";
|
this.SourceAddress = "";
|
this.TargetAddress = "";
|
this.istrue = false;
|
} else {
|
this.$refs.InboundTaskluToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
OutboundTask() {
|
if (this.EndAddress.length <= 0 && this.Barcode.length) {
|
this.$refs.OutboundTaskluToast.show({
|
title: "请输入起点站台",
|
type: "error"
|
})
|
return;
|
}
|
var param = {
|
"PalletCode": this.Barcode,
|
"Position": this.StartAddress,
|
"TargetAddress": this.EndAddress
|
}
|
this.$u.post('/api/Task/RequestOutTaskAsync', param).then(res => {
|
if (res.status) {
|
this.$refs.OutboundTaskluToast.show({
|
title: res.message,
|
type: "success"
|
})
|
this.Barcode = "";
|
this.EndAddress = "";
|
this.StartAddress = "";
|
this.barcodefocus = false;
|
} else {
|
this.$refs.OutboundTaskluToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
snInput() {
|
this.$nextTick(() => {
|
var matObj = {
|
orderNo: this.materSn,
|
}
|
var temp = this.InBoundOrder.find(x => x.orderNo == matObj.orderNo);
|
console.log(temp)
|
if (!temp) {
|
this.InBoundOrder.push(matObj);
|
setTimeout(this.updateFocus, 200);
|
setTimeout(() => {
|
this.voiceSpeech('../../static/success.mp3');
|
}, 100);
|
} else {
|
this.$refs.uToast.show({
|
title: "扫码重复",
|
type: "error"
|
})
|
setTimeout(this.updateFocus, 200);
|
setTimeout(() => {
|
this.voiceSpeech('../../static/fail.mp3');
|
}, 100);
|
}
|
|
})
|
},
|
// deleteList(res) {
|
// this.matInfos.map((item, index) => {
|
// if (item.orderNo == res) {
|
// this.matInfos.splice(index, 1);
|
|
// }
|
// })
|
// this.orderNo.map((item, index) => {
|
// if (item == res) {
|
// this.orderNo.splice(index, 1);
|
// }
|
// })
|
// },
|
deleteList(res) {
|
// 删除matInfos中orderNo匹配项
|
this.matInfos = this.matInfos.filter(item => item.orderNo !== res);
|
|
// 删除orderNo中匹配项
|
this.orderNo = this.orderNo.filter(item => item !== res);
|
|
// 可选:添加删除反馈
|
this.$refs.uToast.show({
|
title: `已删除: ${res}`,
|
type: "success"
|
});
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/common/uni-ui.scss';
|
|
page {
|
display: flex;
|
flex-direction: column;
|
box-sizing: border-box;
|
background-color: #efeff4;
|
min-height: 100%;
|
height: auto;
|
}
|
|
.tips {
|
color: #67c23a;
|
font-size: 14px;
|
line-height: 40px;
|
text-align: center;
|
background-color: #f0f9eb;
|
height: 0;
|
opacity: 0;
|
transform: translateY(-100%);
|
transition: all 0.3s;
|
}
|
|
.tips-ani {
|
transform: translateY(0);
|
height: 40px;
|
opacity: 1;
|
}
|
|
.content {
|
width: 100%;
|
display: flex;
|
}
|
|
.list-picture {
|
width: 100%;
|
height: 145px;
|
}
|
|
.thumb-image {
|
width: 100%;
|
height: 100%;
|
}
|
|
.ellipsis {
|
display: flex;
|
overflow: hidden;
|
}
|
|
.uni-ellipsis-1 {
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
}
|
|
.uni-ellipsis-2 {
|
overflow: hidden;
|
text-overflow: ellipsis;
|
display: -webkit-box;
|
-webkit-line-clamp: 2;
|
-webkit-box-orient: vertical;
|
}
|
</style>
|