Commit ffe3a3cb authored by 李驰骋's avatar 李驰骋

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

parent c5797f81
...@@ -212,6 +212,13 @@ ...@@ -212,6 +212,13 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path": "pages/dhd/scanning",
"style": {
"navigationBarTitleText": "扫码到货",
"enablePullDownRefresh": false
}
},
{ {
"path": "pages/saleck/Main", "path": "pages/saleck/Main",
"style": { "style": {
......
...@@ -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);
...@@ -152,19 +161,18 @@ import BottomBtn from "@/components/BottomBtn/index.vue"; ...@@ -152,19 +161,18 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
} }
}); });
// 更新供应商信息 // 更新供应商信息(只有在验证通过后才更新)
if (newGoodsList[0] && newGoodsList[0].supplierNo) { if (newSupplierNo && !currentSupplierNo) {
if (!this.daohuoForm.supplierNo) { this.daohuoForm.supplierNo = newSupplierNo;
this.daohuoForm.supplierNo = newGoodsList[0].supplierNo;
} else if (this.daohuoForm.supplierNo !== newGoodsList[0].supplierNo) {
this.$u.toast(i18n.t('一个到货单无法录入两个供应商订单'));
return;
}
} }
} }
}, },
deleGonds(idx) { deleGonds(idx) {
this.goodsList.splice(idx, 1); this.goodsList.splice(idx, 1);
// 如果删除了所有商品,清空供应商信息
if (this.goodsList.length === 0) {
this.daohuoForm.supplierNo = '';
}
}, },
goSubmit(){ goSubmit(){
if (!this.goodsList.length) return; if (!this.goodsList.length) 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