feat: 新增物料图标和优化UI组件

fix(入库页面): 修复重复箱检测和批次检查逻辑

refactor(请求模块): 优化错误处理和防抖机制

style(全局字体): 更改默认字体为数黑体

perf(扫码组件): 添加防抖处理避免重复提交

feat(卡片组件): 增加删除功能并优化样式

docs(工具函数): 添加入库工具函数文档

chore: 更新依赖和配置文件
This commit is contained in:
2025-08-22 18:28:25 +08:00
parent 684ad6f152
commit a48ea6f110
29 changed files with 1830 additions and 1068 deletions

View File

@@ -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);
}
}
};