<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" v-model="stationcode" placeholder="请扫瞄缓存点编号" ref='midInput'
|
:focus="addressFocus" />
|
</uni-forms-item>
|
<uni-forms-item label="物料类型">
|
<uni-easyinput type="text" v-model="PalletCode" placeholder="请扫描物料类型" ref='midInput'
|
:focus="addressFocus" />
|
</uni-forms-item>
|
<uni-forms-item label="缓存点状态">
|
<uni-data-checkbox v-model="value" :localdata="range" @change="change"></uni-data-checkbox>
|
</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>
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
const innerAudioContext = uni.createInnerAudioContext();
|
export default {
|
data() {
|
return {
|
items: ['缓存架状态修改'],
|
current: 0,
|
matTotal: [],
|
matInfos: [],
|
orderNo: "",
|
label: "",
|
orderDetail: [],
|
focus: false,
|
barcode: "",
|
materSn: "",
|
sns: [],
|
addressFocus: false,
|
PalletCode: "",
|
stationcode: "", // 缓存点编号
|
address: "",
|
check: true,
|
value: "",
|
values: "",
|
range: [
|
{ value: 0, text: "空闲" },
|
{ value: 1, text: "锁定" },
|
{ value: 2, text: "有货" } // 假设接口返回的状态值为 2,表示占用
|
],
|
code: [],
|
}
|
},
|
onShow() {},
|
onLoad(res) {
|
this.focus = false;
|
this.addressFocus = false;
|
this.orderNo = res.orderNo;
|
this.label = "单据编号:" + this.orderNo;
|
this.getData();
|
},
|
watch: {
|
// 监听 stationcode 的变化
|
stationcode(newVal, oldVal) {
|
if (newVal && newVal !== oldVal) {
|
this.getEndLocations(); // 自动调用接口
|
}
|
}
|
},
|
methods: {
|
voiceSpeech(src) {
|
innerAudioContext.src = src;
|
innerAudioContext.play();
|
},
|
updateFocus() {
|
this.$nextTick(() => {
|
this.materSn = '';
|
if (!this.focus) {
|
this.focus = true;
|
}
|
});
|
},
|
barcodeFocus() {
|
this.barcode = '';
|
if (this.focus) {
|
this.focus = false;
|
}
|
},
|
getData() {
|
var postData = this.orderNo;
|
this.$u.post('/api/InboundOrder/GetInboundOrderDetail', postData).then((res) => {
|
if (res.status) {
|
this.orderDetail = res.data;
|
if (this.orderDetail.length > 3) {
|
this.loadVisible = true;
|
}
|
}
|
})
|
},
|
onClickItem(e) {
|
this.focus = false;
|
this.addressFocus = false;
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
if (this.current == 2) {
|
this.getData();
|
}
|
}
|
},
|
barcodeInput() {
|
this.$nextTick(function(x) {
|
if (this.barcode.length > 0) {
|
this.focus = true;
|
}
|
})
|
},
|
inbound() {
|
var postData = {
|
MainData: {
|
"stationcode": this.stationcode,
|
"palletCode": this.PalletCode,
|
"toaddress": this.value,
|
}
|
}
|
this.$u.post('/api/CachePoint/UpdateHCJStaue', postData).then(res => {
|
if (res.status) {
|
uni.$showMsg("修改缓存架信息成功");
|
this.stationcode = "";
|
this.PalletCode = "";
|
this.value = "";
|
setTimeout(() => {
|
// this.materialtype = false;
|
}, 200);
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
inputChangebarcode() {
|
this.addressFocus = false;
|
this.$nextTick(function(x) {
|
if (this.stationcode != '') {
|
this.addressFocus = true;
|
}
|
})
|
},
|
// getEndLocations() {
|
// var stationcode=this.stationcode;
|
// this.$u.post('/api/CachePoint/GetHCJStaue?stationcode=' + stationcode, {}).then(res => {
|
// if (res.status) {
|
// this.value = 2;
|
// console.log(res.data);
|
// console.log(res.data.materialtype);
|
// this.PalletCode=res.data.materialtype;
|
// this.range.value=2;
|
// } else {
|
// this.$refs.uToast.show({
|
// title: res.message,
|
// type: "error"
|
// })
|
// }
|
// })
|
// }
|
getEndLocations() {
|
var stationcode = this.stationcode;
|
this.$u.post('/api/CachePoint/GetHCJStaue?stationcode=' + stationcode, {}).then(res => {
|
if (res.status) {
|
// 假设接口返回的数据结构为 { status: true, data: { state: 1, materialtype: 'A' } }
|
const responseData = res.data;
|
|
// 更新缓存点状态
|
this.value = responseData.pointStatus; // 假设 state 是缓存点状态的值
|
|
// 更新物料类型
|
this.PalletCode = responseData.materialtype; // 假设 materialtype 是物料类型
|
|
// 如果需要更新 range 的选项
|
this.range = [
|
{ value: 0, text: "空闲" },
|
{ value: 1, text: "锁定" },
|
{ value: 2, text: "有货" } // 假设接口返回的状态值为 2,表示占用
|
];
|
|
// 如果需要根据状态值动态设置 range 的默认值
|
this.range.forEach(item => {
|
if (item.value === responseData.state) {
|
this.value = item.value; // 设置默认选中项
|
}
|
});
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
});
|
}
|
}).catch(err => {
|
this.$refs.uToast.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: 30px;
|
margin-left: 5%;
|
}
|
|
.headerstyle {
|
width: 90%;
|
}
|
</style>
|