Commit 3bfce9c3 authored by 李驰骋's avatar 李驰骋

扫码到货供应商唯一性验证修复

parent 755018cb
...@@ -140,6 +140,15 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -140,6 +140,15 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
// 接收扫码页面返回的数据 // 接收扫码页面返回的数据
updateGoodsList(newGoodsList) { updateGoodsList(newGoodsList) {
if (newGoodsList && newGoodsList.length > 0) { if (newGoodsList && newGoodsList.length > 0) {
// 先验证供应商是否一致
if (this.goodsList.length > 0 && newGoodsList[0] && newGoodsList[0].supplierNo) {
const currentSupplier = this.goodsList[0].supplierNo;
if (currentSupplier && currentSupplier !== newGoodsList[0].supplierNo) {
this.$u.toast(i18n.t('一个到货单无法录入两个供应商订单'));
return;
}
}
// 智能合并数据,避免重复累加 // 智能合并数据,避免重复累加
newGoodsList.forEach(newItem => { newGoodsList.forEach(newItem => {
const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel); const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel);
...@@ -156,9 +165,6 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -156,9 +165,6 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
if (newGoodsList[0] && newGoodsList[0].supplierNo) { if (newGoodsList[0] && newGoodsList[0].supplierNo) {
if (!this.daohuoForm.supplierNo) { if (!this.daohuoForm.supplierNo) {
this.daohuoForm.supplierNo = newGoodsList[0].supplierNo; this.daohuoForm.supplierNo = newGoodsList[0].supplierNo;
} else if (this.daohuoForm.supplierNo !== newGoodsList[0].supplierNo) {
this.$u.toast(i18n.t('一个到货单无法录入两个供应商订单'));
return;
} }
} }
} }
......
...@@ -115,6 +115,16 @@ export default { ...@@ -115,6 +115,16 @@ export default {
if (index > -1) { if (index > -1) {
this.goodsList[index]['arrivalQuantity'] = Number(this.goodsList[index]['arrivalQuantity']) + Number(arr[5]) this.goodsList[index]['arrivalQuantity'] = Number(this.goodsList[index]['arrivalQuantity']) + Number(arr[5])
} else { } else {
// 检查供应商是否一致
if (this.goodsList.length > 0) {
const firstSupplier = this.goodsList[0].supplierNo;
if (firstSupplier && firstSupplier !== arr[0]) {
this.$u.toast(i18n.t('一个到货单无法录入两个供应商订单'));
this.input = '';
return;
}
}
const data1 = await this.$u.api const data1 = await this.$u.api
.getforinvmbinfo({ .getforinvmbinfo({
mb001: arr[4] mb001: arr[4]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment