From 1efa8ceb2c474192691271f192e69a4f2fdfee8f Mon Sep 17 00:00:00 2001 From: xiangxy Date: Thu, 28 Aug 2025 16:42:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E7=BA=BF=E4=B8=8B=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/ftdl/line-down-mater.vue | 59 ++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/pages/ftdl/line-down-mater.vue b/pages/ftdl/line-down-mater.vue index 811f05b..478264c 100644 --- a/pages/ftdl/line-down-mater.vue +++ b/pages/ftdl/line-down-mater.vue @@ -23,15 +23,18 @@ - + + + - + - + - + @@ -164,12 +167,56 @@ url: '/pages/ftdl/mater-list0?title=查询物料' }) }, + toScanAdd () { + uni.scanCode({ + success: (res) => { + // console.log('扫码成功:', res.result); + // uni.showToast({ + // title: res.result, + // icon: 'none' + // }) + const parts = res.result.split(';') + if (parts.length !== 5) { + uni.showToast({ + title: '二维码格式不正确,请扫描符合格式的二维码', + icon: 'none' + }) + return + } + let currObj = { + mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9), + container_code: parts[0], + material_code: parts[1], + material_name: parts[2], + qty: parts[3], + measure_unit_id: parts[4], + } + // 检查是否已存在相同卷号 + const exists = this.dataList.some(item => item.container_code === currObj.container_code) + if (exists) { + uni.showToast({ + title: '已存在', + icon: 'none' + }) + return + } + this.dataList.push(currObj) + }, + fail: (err) => { + console.log('扫码失败:', err) + // uni.showToast({ + // title: err + '扫码失败', + // icon: 'none' + // }) + } + }) + }, toAdd () { let currObj = { mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9), container_code: '', - material_name: '物料', - pscn: '', + material_code: '编码', + material_name: '名称', qty: '1', measure_unit_id: '单位' }