收货入库

This commit is contained in:
2026-01-16 18:18:07 +08:00
parent 368c10c0ed
commit 626a9359e3
6 changed files with 48 additions and 37 deletions

View File

@@ -103,7 +103,6 @@
bagCode: '',
num: null,
dataList: [],
// dataList: [{material_code: 'm001', qty: 100, checked: false, initialQty: 100}, {material_code: 'm002', qty: 200, checked: false, initialQty: 200}],
disabled: false
};
},
@@ -149,11 +148,18 @@
async _getPalletAssemblyOK () {
try {
let res = await getPalletAssemblyOK(this.bagCode)
if (res && res.data.length > 0) {
this.dataList = [...res.data]
if (res) {
const existingItem = this.dataList.find(item => item.bag_code === res.data.bag_code)
if (!existingItem) {
this.dataList.push(res.data)
} else {
uni.showToast({
title: '袋码已存在,不能重复插入',
icon: 'none'
})
}
this.num = this.dataList.reduce((sum, item) => sum + Number(item.qty), 0)
} else {
this.dataList = []
}
} catch (e) {
this.dataList = []