feat: 新增物料图标和优化UI组件
fix(入库页面): 修复重复箱检测和批次检查逻辑 refactor(请求模块): 优化错误处理和防抖机制 style(全局字体): 更改默认字体为数黑体 perf(扫码组件): 添加防抖处理避免重复提交 feat(卡片组件): 增加删除功能并优化样式 docs(工具函数): 添加入库工具函数文档 chore: 更新依赖和配置文件
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<view class="package-card-box">
|
||||
<view class="package-card-header">
|
||||
<view class="package-card-title">工单号:{{ packageInfo.workoderID }}</view>
|
||||
<view class="delete-btn" @click="handleDelete">×</view>
|
||||
</view>
|
||||
<view class="package-card-body">
|
||||
<view class="package-card-describe">
|
||||
@@ -11,8 +12,8 @@
|
||||
</view>
|
||||
<view class="package-card-time">
|
||||
<view class="package-card-quantity">数量:{{ packageInfo.quantity }}</view>
|
||||
<view>生产日期</view>
|
||||
<view>{{ packageInfo.productionTime }}</view>
|
||||
<view class="package-card-patch">生产批次</view>
|
||||
<view class="package-card-patch">{{ packageInfo.productionTime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -24,7 +25,8 @@ export default {
|
||||
name: 'package-card',
|
||||
props: {
|
||||
packageInfo: {
|
||||
default: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
id:-1,
|
||||
// 工单号
|
||||
workoderID:'',
|
||||
@@ -40,63 +42,85 @@ export default {
|
||||
quantity: 0,
|
||||
// 货物内部编号
|
||||
originalCode:''
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
handleDelete() {
|
||||
this.$emit('delete', this.packageInfo);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.package-card-box {
|
||||
width: 100%;
|
||||
height: 260px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
margin-top: 10px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
border-radius: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
.package-card-header {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
width: 100%;
|
||||
height: 30%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #ebebeb;
|
||||
}
|
||||
.package-card-body {
|
||||
width: 100%;
|
||||
height: 70%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.package-card-describe {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
width: 70%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.package-card-quantity{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.package-card-time {
|
||||
color: rgba(0, 9, 0, 0.7);
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
width: 30%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
.package-card-box {
|
||||
position: relative;
|
||||
padding: 10rpx;
|
||||
margin: 5rpx;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 10rpx;
|
||||
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.package-card-header {
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.package-card-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
text-align: center;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #ff4d4f;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.package-card-body {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.package-card-describe {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.package-card-describe view {
|
||||
margin-bottom: 10rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.package-card-time {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.package-card-quantity {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
.package-card-patch {
|
||||
font-size: 38rpx;
|
||||
color: #333333;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
isFocus: true,
|
||||
// search: 'A1-01',
|
||||
search: '',
|
||||
time: null
|
||||
time: null,
|
||||
debounceTimer: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -70,23 +71,27 @@
|
||||
}
|
||||
},
|
||||
// 获取扫码信息
|
||||
async getInfo(e) {
|
||||
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);
|
||||
getInfo(e) {
|
||||
// 防抖处理
|
||||
if (this.debounceTimer) {
|
||||
clearTimeout(this.debounceTimer);
|
||||
}
|
||||
setTimeout(() => {
|
||||
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);
|
||||
}
|
||||
this.$nextTick(function() {
|
||||
this.search = '';
|
||||
});
|
||||
}, 300);
|
||||
}, 300); // 300ms防抖延迟
|
||||
},
|
||||
// type = 1 入库扫仓库编码
|
||||
async handleScanWareHouseCode(text) {
|
||||
@@ -94,35 +99,48 @@
|
||||
const locationCheckData = {
|
||||
production_location_code: text
|
||||
};
|
||||
const checkRes = await WarehoseApi.isProductionLocation(locationCheckData);
|
||||
if (checkRes.code !== 200 || !checkRes.data) {
|
||||
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) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '仓库编号异常!',
|
||||
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: '确定'
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 待返回的结果数据
|
||||
let emitData = {
|
||||
warehoseInfo: WarehoseRes.data
|
||||
};
|
||||
this.emitInputChange(emitData, 1);
|
||||
},
|
||||
// type = 2 入库扫货物编码
|
||||
async handleScanGoodsCode(text) {
|
||||
@@ -130,87 +148,83 @@
|
||||
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: '确定'
|
||||
});
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
this.emitInputChange(emitRes.data, 2);
|
||||
return;
|
||||
// 临时库处理
|
||||
// let _warehouseInfo = this.warehouseInfo;
|
||||
// if (_warehouseInfo != null && _warehouseInfo != undefined) {
|
||||
// if (_warehouseInfo.remark === '临时' || _warehouseInfo.locaiton === 'LS1-01') {
|
||||
// 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);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// 成品库处理
|
||||
// 成品满箱扫码
|
||||
let locationCheckData = {
|
||||
package_code
|
||||
};
|
||||
// 判断是否是箱号
|
||||
const checkRes = await WarehoseApi.isProductionPackage(locationCheckData);
|
||||
console.log(checkRes);
|
||||
if (checkRes.code !== 200) {
|
||||
},
|
||||
// type = 3 扫出货单
|
||||
async handleScanDeliveryOrderCode(text) {
|
||||
let id = text;
|
||||
try {
|
||||
const getWmOutOrderRes = await WarehoseApi.getWmOutOrder(id);
|
||||
if (getWmOutOrderRes.code != 200) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '成品箱号异常!',
|
||||
content: '出库单号异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
return;
|
||||
}
|
||||
if (checkRes.data === 0) {
|
||||
this.emitInputChange(getWmOutOrderRes.data, 3);
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '出库单号解析异常!',
|
||||
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) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: checkRes.msg,
|
||||
content: '仓库记录查询异常!',
|
||||
showCancel: false,
|
||||
confirmText: '确定'
|
||||
});
|
||||
this.search = '';
|
||||
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 resolutionData = {
|
||||
code: text
|
||||
};
|
||||
try {
|
||||
const emitRes = await WarehoseApi.resolutionPackage(resolutionData);
|
||||
if (emitRes.code !== 200 || emitRes.data === null) {
|
||||
uni.showModal({
|
||||
@@ -221,54 +235,16 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.emitInputChange(emitRes.data, 2);
|
||||
}
|
||||
},
|
||||
// type = 3 扫出货单
|
||||
async handleScanDeliveryOrderCode(text) {
|
||||
let id = text;
|
||||
const getWmOutOrderRes = await WarehoseApi.getWmOutOrder(id);
|
||||
if (getWmOutOrderRes.code != 200) {
|
||||
this.emitInputChange(emitRes.data, 4);
|
||||
} catch (error) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '出库单号异常!',
|
||||
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