入库功能完成

This commit is contained in:
赵正易
2024-03-15 17:56:22 +08:00
parent b58b954436
commit 0da532301b
15 changed files with 1116 additions and 273 deletions

View File

@@ -1,15 +1,17 @@
<template>
<view class="input-box">
<input :adjust-position="false" :focus="isFocus" type="text" v-model="search" @confirm="getInfo" @blur="isFocus = true" />
<!-- <input :adjust-position="false" :focus="isFocus" type="text" v-model="search" @confirm="getInfo" @blur="isFocus = true" /> -->
<input type="text" v-model.trim="search" @confirm="getInfo($event)"/>
</view>
</template>
<script>
import { getWareHouseProfile } from '@/api/warehouse/warehose.js';
import * as WarehoseApi from '@/api/warehouse/warehose.js';
export default {
name: 'pda-scan-input',
props: {
type: {
// 1-仓库扫码 2-成品满箱扫码
default: 1,
type: Number
}
@@ -17,9 +19,7 @@ export default {
data() {
return {
isFocus: true,
search: 'A-001',
// 扫码枪扫码后查询结果,获取信息
searchInfo: null,
search: 'A1-01',
time: null
};
},
@@ -38,39 +38,120 @@ export default {
methods: {
// 初始化
init() {
this.time = setInterval(() => {
if (!this.isFocus) {
this.$nextTick(function () {
this.isFocus = true;
});
}
}, 1);
// this.time = setInterval(() => {
// if (!this.isFocus) {
// this.$nextTick(function () {
// this.isFocus = true;
// });
// }
// }, 1);
},
// 传输数据
emitInputChange(data) {
emitInputChange(data, type) {
this.$emit('getInfo', data, type);
},
getInfo() {
if (type === 1) {
//TODO 获取仓库信息
const data = {
warehouse_num: this.search
};
getWareHouseProfile(data).then((res) => {
if (res.code !== 200) {
uni.showToast({ title: '获取仓库信息异常', icon: 'none' });
}
this.searchInfo = res.data;
this.emitInputChange(res.data);
});
} else if (type === 2) {
//TODO 获取物料信息
this.emitInputChange(res.data);
}
async getInfo(e) {
const text = e.target.value;
const type = this.type;
setTimeout(() => {
this.search = '';
this.isFocus = false;
}, 1000);
this.isFocus = true;
}, 1500);
if (type === 1) {
// 是否为库位码
const locationCheckData = {
production_location_code: text
};
const checkRes = await WarehoseApi.isProductionLocation(locationCheckData);
if (checkRes.code !== 200 || !checkRes.data) {
uni.showModal({
title: '提示',
content: '仓库编号异常!',
showCancel:false,
confirmText: '确定'
});
return;
}
const getProductLocationData = {
locationcode: locationCheckData.production_location_code,
warehouse_num: 1
};
const WarehoseRes = await WarehoseApi.getProductLocationInfo(getProductLocationData);
if (WarehoseRes.code !== 200 || !WarehoseRes.data) {
uni.showModal({
title: '提示',
content: '获取仓库信息异常!',
showCancel:false,
confirmText: '确定'
});
return;
}
// 待返回的结果数据
let emitData = {
warehoseInfo: WarehoseRes.data
};
this.emitInputChange(emitData, 1);
} else if (type === 2) {
const package_code = text;
// 成品满箱扫码
const locationCheckData = {
package_code
};
// 判断是否是箱号
const checkRes = await WarehoseApi.isProductionPackage(locationCheckData);
if (checkRes.code !== 200) {
uni.showModal({
title: '提示',
content: '成品箱号异常!',
showCancel:false,
confirmText: '确定'
});
return;
}
if (checkRes.data === 0) {
uni.showModal({
title: '提示',
content: checkRes.msg,
showCancel:false,
confirmText: '确定'
});
return;
} else if (checkRes.data === 2) {
uni.showModal({
title: '提示',
content: checkRes.msg,
showCancel:false,
confirmText: '确定'
});
return;
} else if (checkRes.data === 1) {
// 判断是否为满箱
const isFullRes = await WarehoseApi.isFullPackage(locationCheckData);
if (isFullRes.code !== 200 || !isFullRes.data) {
uni.showModal({
title: '提示',
content: '该标签不为满箱标签!',
showCancel:false,
confirmText: '确定'
});
return;
}
const resolutionData = {
code: package_code
};
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
if (emitRes.code !== 200 || emitRes.data === null) {
uni.showModal({
title: '提示',
content: '该箱号数据解析异常!',
showCancel:false,
confirmText: '确定'
});
return;
}
this.emitInputChange(emitRes.data, 2);
}
}
}
}
};
@@ -78,9 +159,10 @@ export default {
<style scoped>
.input-box {
width: 100%;
background-color: #e6e6e6;
/* width: 100%;
position: absolute;
bottom: 0;
bottom: 0; */
/* height: 0px; */
/* opacity: 0; */
/* visibility: hidden; */