Web验收拍照识别 + 修上传失败
① Web 验收拍照/拖入后自动 AI 识别(复用库存入库识别,预填 规格/生产日期/保质期/产地,只补空、切单丢弃过期响应,零新增文案)。 ② 修「拍照后上传失败」:根因是照片 dataURL 内联在提交体,而全局 express.json 仅 2mb 且照片不降尺寸/质量 0.92 ⇒ 大图必 413。 甲:照片先降尺寸再画水印(≤1600px / q0.8,对齐小程序); 丙:仅把 /api/workflow/inspection/submit 体上限放宽到 20mb。 ③ 小程序逐张上传单张失败不中断整批 + 汇总提示。 新增契约测试;门禁与全量回归对基线。
This commit is contained in:
@@ -932,8 +932,18 @@ Component({
|
||||
wx.showLoading({ title: '上传中…', mask: true });
|
||||
try {
|
||||
let latestScan = null;
|
||||
// 单张失败不中断其余(弱网常见):继续传下一张,最后汇总提示
|
||||
let failed = 0;
|
||||
for (const filePath of paths) {
|
||||
latestScan = await this.uploadPhoto(id, filePath);
|
||||
try {
|
||||
latestScan = await this.uploadPhoto(id, filePath);
|
||||
} catch (err) {
|
||||
failed += 1;
|
||||
}
|
||||
}
|
||||
if (failed && failed === paths.length) {
|
||||
wx.showToast({ title: '照片上传失败,请重试', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (latestScan && latestScan.label_matched === false) {
|
||||
const hints = [];
|
||||
@@ -958,6 +968,10 @@ Component({
|
||||
} else if (!(latestScan && latestScan.label_matched === false)) {
|
||||
wx.showToast({ title: '拍照验收已上传', icon: 'success' });
|
||||
}
|
||||
// 有失败张:最后再提示一次(覆盖上一条 toast,失败更该被看见)
|
||||
if (failed) {
|
||||
wx.showToast({ title: `${failed} 张未上传,请重试`, icon: 'none', duration: 3000 });
|
||||
}
|
||||
} catch (err) {
|
||||
wx.showToast({ title: err.message || '上传失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user