This commit is contained in:
2025-10-17 14:27:22 +08:00
parent 1258f85322
commit 8d645fdada
29 changed files with 123 additions and 80 deletions

View File

@@ -39,7 +39,7 @@
<!-- <th>序号</th>
<th>卷号</th>
<th>物料编码</th>
<th>物料名称</th>
<th>物料品种</th>
<th>数量</th>
<th>单位</th> -->
<th>{{$t('grid.number')}}</th>
@@ -161,32 +161,53 @@
uni.scanCode({
success: (res) => {
// console.log('扫码成功:', res.result);
const parts = res.result.split(';')
if (parts.length !== 5) {
uni.showToast({
title: '二维码格式不正确,请扫描符合格式的二维码',
icon: 'none'
})
return
if (res.result.includes(';')) {
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)
} else {
let currObj = {
mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9),
container_code: res.result,
material_code: '',
material_name: '',
qty: '',
measure_unit_id: ''
}
// 检查是否已存在相同卷号
const exists = this.dataList.some(item => item.container_code === currObj.container_code)
if (exists) {
uni.showToast({
title: '已存在',
icon: 'none'
})
return
}
this.dataList.push(currObj)
}
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)