仓库相关-基本功能完成
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="input-box">
|
||||
<!-- <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)"/>
|
||||
<input type="text" v-model.trim="search" @confirm="getInfo($event)" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -11,7 +11,7 @@ export default {
|
||||
name: 'pda-scan-input',
|
||||
props: {
|
||||
type: {
|
||||
// 1-仓库扫码 2-成品满箱扫码
|
||||
// 1-仓库扫码 2-成品满箱扫码 3-扫出库单 4-退库
|
||||
default: 1,
|
||||
type: Number
|
||||
}
|
||||
@@ -50,6 +50,7 @@ export default {
|
||||
emitInputChange(data, type) {
|
||||
this.$emit('getInfo', data, type);
|
||||
},
|
||||
// 获取扫码信息
|
||||
async getInfo(e) {
|
||||
const text = e.target.value;
|
||||
const type = this.type;
|
||||
@@ -58,100 +59,158 @@ export default {
|
||||
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);
|
||||
this.handleScanWareHouseCode(text);
|
||||
} 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);
|
||||
}
|
||||
this.handleScanGoodsCode(text);
|
||||
} else if (type === 3) {
|
||||
this.handleScanDeliveryOrderCode(text);
|
||||
} else if (type === 4) {
|
||||
this.handleScanStockReturnCode(text);
|
||||
}
|
||||
},
|
||||
// type = 1 入库扫仓库编码
|
||||
async handleScanWareHouseCode(text) {
|
||||
// 是否为库位码
|
||||
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);
|
||||
},
|
||||
// type = 2 入库扫货物编码
|
||||
async handleScanGoodsCode(text) {
|
||||
let package_code = text;
|
||||
// 成品满箱扫码
|
||||
let 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;
|
||||
}
|
||||
let 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);
|
||||
}
|
||||
},
|
||||
// type = 3 扫出货单
|
||||
async handleScanDeliveryOrderCode(text) {
|
||||
let id = text;
|
||||
const getWmOutOrderRes = await WarehoseApi.getWmOutOrder(id);
|
||||
if(getWmOutOrderRes.code != 200){
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '出库单号异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.emitInputChange(getWmOutOrderRes.data, 3);
|
||||
},
|
||||
// type = 4 退货扫货物编码
|
||||
async handleScanStockReturnCode(text) {
|
||||
const checkData = {
|
||||
originalCode: text
|
||||
};
|
||||
// 判断是否仓库中有记录
|
||||
const checkRes = await WarehoseApi.isExistedWarehouse(checkData);
|
||||
if (!checkRes.data) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '该编码不在仓库记录中:' + checkRes.msg,
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
const resolutionData = {
|
||||
code: text
|
||||
};
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user