diff --git a/src/views/inventory/count/InvCountOrderModify.vue b/src/views/inventory/count/InvCountOrderModify.vue index 6420033b..b1d3c9b0 100644 --- a/src/views/inventory/count/InvCountOrderModify.vue +++ b/src/views/inventory/count/InvCountOrderModify.vue @@ -361,6 +361,7 @@ import {getInvListByUser} from "@/api/system/invWarehouse"; import invCountCodes from "@/views/inventory/count/InvCountCodes.vue"; import {updateBizProduct} from "@/api/inout/orderDetailCode"; + export default { props: { countOrder: { @@ -381,6 +382,7 @@ export default { } }, + data() { return { formData: { @@ -679,36 +681,40 @@ export default { this.$message.warning("请选择产品"); return; } + let existsMsg = "" + let exists = this.multiProduct.some(product => { + if (this.countProductList.total != 0) { + return this.countProductList.some(item => { + existsMsg = product.nameCode + return item && item.productId == product.relIdFk && item.batchNo == product.batchNo; + }); + } + }); + + if (exists){ + this.$message.error("当前产品【"+ existsMsg + "】不能重复选入!"); + return; + } //添加第一个产品,先保存单据,再添加单据详情 this.multiProduct.forEach(product => { - - if (this.countProductList.length != 0) { - this.countProductList.some(item => { - if (item.product && item.product.relIdFk == product.relIdFk && - item.product.batchNo == product.batchNo ){ - this.$message.error("当前产品【"+ product.nameCode + "】不能重复选入!"); - return; - } - }); - } - - let detailData = { - orderIdFk: this.formData.orderId, - productId: product.relIdFk, - nameCode: product.nameCode, - batchNo: product.batchNo, - produceDate: product.productionDate, - expireDate: product.expireDate, - invCode: this.formData.invStorageCode, - invSpaceCode: this.formData.invSpaceCode, - invNum: product.reCount, - supId: product.supId - }; - this.countProductList.push(detailData); + let detailData = { + orderIdFk: this.formData.orderId, + productId: product.relIdFk, + nameCode: product.nameCode, + batchNo: product.batchNo, + produceDate: product.productionDate, + expireDate: product.expireDate, + invCode: this.formData.invStorageCode, + invSpaceCode: this.formData.invSpaceCode, + invNum: product.reCount, + supId: product.supId + }; + this.countProductList.push(detailData); }); - this.saveOrder(1); - this.selectInvProductVisible = false; + + this.saveOrder(1); + this.selectInvProductVisible = false; }, getRowKeys(row) { return row.id;