产线下料
This commit is contained in:
@@ -23,15 +23,18 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-row">
|
<view class="zd-row">
|
||||||
<view class="zd-col-11">
|
<!-- <view class="zd-col-1">
|
||||||
|
</view> -->
|
||||||
|
<view class="zd-col-6" style="width: 27%;">
|
||||||
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toScanAdd">扫码插入</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-col-4">
|
<view class="zd-col-6" style="width: 22%;">
|
||||||
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toAdd">插入行</button>
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toAdd">插入行</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-col-4">
|
<view class="zd-col-6" style="width: 22%;">
|
||||||
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toDel">删除行</button>
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toDel">删除行</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="zd-col-4">
|
<view class="zd-col-6" style="width: 22%;">
|
||||||
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toCopy">复制行</button>
|
<button class="mini-btn" size="mini" style="display: block; margin-top: 9px; width: 103%;" type="primary" @tap="toCopy">复制行</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -164,12 +167,56 @@
|
|||||||
url: '/pages/ftdl/mater-list0?title=查询物料'
|
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 () {
|
toAdd () {
|
||||||
let currObj = {
|
let currObj = {
|
||||||
mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9),
|
mid: 'mid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9),
|
||||||
container_code: '',
|
container_code: '',
|
||||||
material_name: '物料',
|
material_code: '编码',
|
||||||
pscn: '',
|
material_name: '名称',
|
||||||
qty: '1',
|
qty: '1',
|
||||||
measure_unit_id: '单位'
|
measure_unit_id: '单位'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user