diff --git a/pages/ftdl/line-down-mater.vue b/pages/ftdl/line-down-mater.vue index 478264c..9fa0489 100644 --- a/pages/ftdl/line-down-mater.vue +++ b/pages/ftdl/line-down-mater.vue @@ -55,7 +55,7 @@ {{i+1}} - + {{e.material_code}} {{e.material_name}} @@ -171,10 +171,6 @@ 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({ diff --git a/pages/ftdl/man-load-goods.vue b/pages/ftdl/man-load-goods.vue index 2ff7437..d7f1544 100644 --- a/pages/ftdl/man-load-goods.vue +++ b/pages/ftdl/man-load-goods.vue @@ -15,15 +15,18 @@ - + + + - + - + - + @@ -44,7 +47,7 @@ {{i+1}} - + {{e.material_code}} {{e.material_name}} @@ -137,6 +140,46 @@ url: '/pages/ftdl/mater-list0?title=查询物料' }) }, + toScanAdd () { + uni.scanCode({ + success: (res) => { + // console.log('扫码成功:', res.result); + 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),