feat(毛坯入库): 新增毛坯入库功能及相关组件
实现毛坯入库功能,包括: 1. 新增毛坯入库页面及路由配置 2. 添加毛坯相关API接口 3. 实现入库通用工具方法 4. 扩展PDA扫码组件支持毛坯扫码 5. 新增毛坯入库主页面及交互逻辑 6. 实现数量修改弹窗功能
This commit is contained in:
@@ -1,176 +1,186 @@
|
||||
<template>
|
||||
<view class="input-box">
|
||||
<input :adjust-position="false" :focus="isFocus" type="text" v-model.trim="search" @confirm="getInfo" @blur="handlerBlur" />
|
||||
|
||||
|
||||
<!-- <input type="text" v-model.trim="search" @confirm="getInfo($event)" /> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as WarehoseApi from '@/api/warehouse/warehose.js';
|
||||
export default {
|
||||
name: 'pda-scan-input',
|
||||
props: {
|
||||
hasFocus: {
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
type: {
|
||||
// 1-仓库扫码 2-成品满箱扫码 3-扫出库单 4-退库
|
||||
default: 1,
|
||||
type: Number
|
||||
},
|
||||
warehouseInfo: {
|
||||
default: null
|
||||
}
|
||||
import * as WarehoseApi from '@/api/warehouse/warehose.js';
|
||||
import * as BlankApi from '@/api/blank/blank.js';
|
||||
export default {
|
||||
name: 'pda-scan-input',
|
||||
props: {
|
||||
hasFocus: {
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFocus: true,
|
||||
// search: 'A1-01',
|
||||
search: '',
|
||||
time: null,
|
||||
debounceTimer: null
|
||||
};
|
||||
type: {
|
||||
// 1-仓库扫码 2-成品满箱扫码 3-扫出库单 4-退库 5-扫毛坯
|
||||
default: 1,
|
||||
type: Number
|
||||
},
|
||||
watch: {
|
||||
isFocus(n) {}
|
||||
warehouseInfo: {
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isFocus: true,
|
||||
// search: 'A1-01',
|
||||
search: '',
|
||||
time: null,
|
||||
debounceTimer: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
isFocus(n) {}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.time) {
|
||||
clearInterval(this.time);
|
||||
this.time = null;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
// this.time = setInterval(() => {
|
||||
// if (!this.isFocus) {
|
||||
// this.$nextTick(function () {
|
||||
// this.isFocus = false;
|
||||
// });
|
||||
// }
|
||||
// }, 60);
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
// 传输数据
|
||||
emitInputChange(data, type) {
|
||||
this.$emit('getInfo', data, type);
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.time) {
|
||||
clearInterval(this.time);
|
||||
this.time = null;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
// this.time = setInterval(() => {
|
||||
// if (!this.isFocus) {
|
||||
// this.$nextTick(function () {
|
||||
// this.isFocus = false;
|
||||
// });
|
||||
// }
|
||||
// }, 60);
|
||||
},
|
||||
// 传输数据
|
||||
emitInputChange(data, type) {
|
||||
this.$emit('getInfo', data, type);
|
||||
},
|
||||
handlerBlur() {
|
||||
if (this.hasFocus) {
|
||||
this.isFocus = false;
|
||||
setTimeout(() => {
|
||||
this.$nextTick(function() {
|
||||
this.isFocus = true;
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
// 获取扫码信息
|
||||
getInfo(e) {
|
||||
// 防抖处理
|
||||
if (this.debounceTimer) {
|
||||
clearTimeout(this.debounceTimer);
|
||||
}
|
||||
this.debounceTimer = setTimeout(async () => {
|
||||
const text = e.target.value;
|
||||
const type = this.type;
|
||||
if (type === 1) {
|
||||
await this.handleScanWareHouseCode(text);
|
||||
} else if (type === 2) {
|
||||
await this.handleScanGoodsCode(text);
|
||||
} else if (type === 3) {
|
||||
await this.handleScanDeliveryOrderCode(text);
|
||||
} else if (type === 4) {
|
||||
await this.handleScanStockReturnCode(text);
|
||||
} else{
|
||||
this.emitInputChange(text, 0);
|
||||
}
|
||||
this.$nextTick(function() {
|
||||
this.search = '';
|
||||
handlerBlur() {
|
||||
if (this.hasFocus) {
|
||||
this.isFocus = false;
|
||||
setTimeout(() => {
|
||||
this.$nextTick(function () {
|
||||
this.isFocus = true;
|
||||
});
|
||||
}, 300); // 300ms防抖延迟
|
||||
},
|
||||
// type = 1 入库扫仓库编码
|
||||
async handleScanWareHouseCode(text) {
|
||||
// 是否为库位码
|
||||
const locationCheckData = {
|
||||
production_location_code: text
|
||||
};
|
||||
try {
|
||||
const checkRes = await WarehoseApi.isProductionLocation(locationCheckData);
|
||||
if (checkRes.code !== 200 || !checkRes.data) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '仓库编号异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
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: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
// 待返回的结果数据
|
||||
let emitData = {
|
||||
warehoseInfo: WarehoseRes.data
|
||||
};
|
||||
this.emitInputChange(emitData, 1);
|
||||
} catch (error) {
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
// 获取扫码信息
|
||||
getInfo(e) {
|
||||
// 防抖处理
|
||||
if (this.debounceTimer) {
|
||||
clearTimeout(this.debounceTimer);
|
||||
}
|
||||
this.debounceTimer = setTimeout(async () => {
|
||||
const text = e.target.value;
|
||||
const type = this.type;
|
||||
if (type === 1) {
|
||||
await this.handleScanWareHouseCode(text);
|
||||
} else if (type === 2) {
|
||||
await this.handleScanGoodsCode(text);
|
||||
} else if (type === 3) {
|
||||
await this.handleScanDeliveryOrderCode(text);
|
||||
} else if (type === 4) {
|
||||
await this.handleScanStockReturnCode(text);
|
||||
} else if (type === 5) {
|
||||
await this.handleScanBlankCode(text);
|
||||
} else {
|
||||
// 为0时直接返回原始数据
|
||||
this.emitInputChange(text, 0);
|
||||
}
|
||||
this.$nextTick(function () {
|
||||
this.search = '';
|
||||
});
|
||||
}, 100); // 300ms防抖延迟
|
||||
},
|
||||
// type = 1 入库扫仓库编码
|
||||
async handleScanWareHouseCode(text) {
|
||||
// 是否为库位码
|
||||
const locationCheckData = {
|
||||
production_location_code: text
|
||||
};
|
||||
try {
|
||||
const checkRes = await WarehoseApi.isProductionLocation(locationCheckData);
|
||||
if (checkRes.code !== 200 || !checkRes.data) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '仓库扫码解析异常!',
|
||||
content: '仓库编号异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
},
|
||||
// type = 2 入库扫货物编码
|
||||
async handleScanGoodsCode(text) {
|
||||
let package_code = text;
|
||||
let resolutionData = {
|
||||
code: package_code
|
||||
const getProductLocationData = {
|
||||
locationcode: locationCheckData.production_location_code,
|
||||
warehouse_num: 1
|
||||
};
|
||||
try {
|
||||
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
|
||||
if (emitRes.code !== 200 || emitRes.data === null) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该箱号数据解析异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
this.emitInputChange(emitRes.data, 2);
|
||||
} catch (error) {
|
||||
const WarehoseRes = await WarehoseApi.getProductLocationInfo(getProductLocationData);
|
||||
if (WarehoseRes.code !== 200 || !WarehoseRes.data) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '获取仓库信息异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
// 待返回的结果数据
|
||||
let emitData = {
|
||||
warehoseInfo: WarehoseRes.data
|
||||
};
|
||||
this.emitInputChange(emitData, 1);
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '仓库扫码解析异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
},
|
||||
// type = 3 扫出货单
|
||||
async handleScanDeliveryOrderCode(text) {
|
||||
let id = text;
|
||||
}
|
||||
},
|
||||
// type = 2 入库扫货物编码
|
||||
async handleScanGoodsCode(text) {
|
||||
let package_code = text;
|
||||
let resolutionData = {
|
||||
code: package_code
|
||||
};
|
||||
try {
|
||||
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
|
||||
if (emitRes.code !== 200 || emitRes.data === null) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该箱号数据解析异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
this.emitInputChange(emitRes.data, 2);
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '外箱标签解析异常!' + error,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
return;
|
||||
},
|
||||
// type = 3 扫出货单
|
||||
async handleScanDeliveryOrderCode(text) {
|
||||
let id = text;
|
||||
try {
|
||||
const getWmOutOrderRes = await WarehoseApi.getWmOutOrder(id);
|
||||
if (getWmOutOrderRes.code != 200) {
|
||||
@@ -187,89 +197,115 @@
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '出库单号解析异常!',
|
||||
content: '出库单号解析异常!'+ error,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
},
|
||||
// type = 4 退货扫货物编码
|
||||
async handleScanStockReturnCode(text) {
|
||||
const checkData = {
|
||||
originalCode: text
|
||||
};
|
||||
// 判断是否仓库中有记录
|
||||
try {
|
||||
const checkRes = await WarehoseApi.isExistedWarehouse(checkData);
|
||||
if (!checkRes.data) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该编码不在仓库记录中:' + checkRes.msg,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
},
|
||||
// type = 4 退货扫货物编码
|
||||
async handleScanStockReturnCode(text) {
|
||||
const checkData = {
|
||||
originalCode: text
|
||||
};
|
||||
// 判断是否仓库中有记录
|
||||
try {
|
||||
const checkRes = await WarehoseApi.isExistedWarehouse(checkData);
|
||||
if (!checkRes.data) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '仓库记录查询异常!',
|
||||
content: '该编码不在仓库记录中:' + checkRes.msg,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
const resolutionData = {
|
||||
code: text
|
||||
};
|
||||
try {
|
||||
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, 4);
|
||||
} catch (error) {
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '仓库记录查询异常!'+ error,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
const resolutionData = {
|
||||
code: text
|
||||
};
|
||||
try {
|
||||
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
|
||||
if (emitRes.code !== 200 || emitRes.data === null) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '外箱标签解析异常!',
|
||||
content: '该箱号数据解析异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.emitInputChange(emitRes.data, 4);
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '外箱标签解析异常!'+ error,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
// type = 5 毛坯扫码
|
||||
async handleScanBlankCode(text) {
|
||||
const resolutionData = {
|
||||
code: text
|
||||
};
|
||||
try {
|
||||
const emitRes = await BlankApi.PDABlankResolutionPackage(resolutionData);
|
||||
if (emitRes.code !== 200 || emitRes.data === null) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该箱号数据解析异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.emitInputChange(emitRes.data, 5);
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '外箱标签解析异常!' + error,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.input-box {
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
/* width: 100%;
|
||||
.input-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
/* width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0; */
|
||||
/* height: 0px; */
|
||||
/* opacity: 0; */
|
||||
/* visibility: hidden; */
|
||||
/* display:none; */
|
||||
}
|
||||
.input-box input{
|
||||
width: 100%;
|
||||
background-color: #e6e6e6;
|
||||
border: 1px solid #d3d3d3;
|
||||
font-size: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
</style>
|
||||
/* height: 0px; */
|
||||
/* opacity: 0; */
|
||||
/* visibility: hidden; */
|
||||
/* display:none; */
|
||||
}
|
||||
.input-box input {
|
||||
width: 100%;
|
||||
background-color: #e6e6e6;
|
||||
border: 1px solid #d3d3d3;
|
||||
font-size: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user