diff --git a/src/pages/productReceipt/job/productReceiptDetail.vue b/src/pages/productReceipt/job/productReceiptDetail.vue index 2a34cef8..d6e62376 100644 --- a/src/pages/productReceipt/job/productReceiptDetail.vue +++ b/src/pages/productReceipt/job/productReceiptDetail.vue @@ -361,7 +361,7 @@ }); }, - commit() { + async commit() { this.scanCount = getScanCount(this.subList); if (this.scanCount == 0) { this.showErrorMessage("扫描数为0,请先扫描") @@ -376,18 +376,40 @@ }else{ this.toLocationCode = this.jobToLocationCode } + //获取管理模式,封装参数 + var itemCodes = [] + this.detailSource.forEach(item => { + itemCodes.push(item.itemCode) + }) + await getManagementPrecisions(itemCodes, this.toLocationCode, res => { + if (res.success) { + this.managementList = res.list; + this.managementType = this.managementList&& this.managementList[0]&& this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING' + } + }) //扫描数量和任务数量相等,直接提交 if (this.scanCount == this.subList.length) { - if (this.checkCount()) { - this.submitJob(); + if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){ + if (this.checkCountBatch()) { + this.submitJob(); + } + }else{ + if (this.checkCount()) { + this.submitJob(); + } } - } else if (this.scanCount < this.subList.length) { //扫描数量小于任务数量,判断是否允许部分提交 if (this.jobContent.allowPartialComplete == "TRUE") { //提交 - if (this.checkCount()) { - this.submitJob(); + if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){ + if (this.checkCountBatch()) { + this.submitJob(); + } + }else{ + if (this.checkCount()) { + this.submitJob(); + } } } else { //不允许部分提交,提示 @@ -425,7 +447,34 @@ return isCheck; }, - + checkCountBatch(){ + var isCheck = true; + var hint = "" + for (var i = 0; i < this.detailSource.length; i++) { + var item = this.detailSource[i]; + for (var j = 0; j < item.subList.length; j++) { + var subItem = item.subList[i] + console.log(calc.sub(subItem.handleQty, subItem.qty) ) + if (calc.sub(subItem.handleQty, subItem.qty) < 0 || calc.sub(subItem.handleQty, subItem.qty) > 0) { + isCheck = false; + hint = "批次【" + subItem.batch + "】实际收货数量:[" + subItem.handleQty + "]与包装数量[" + subItem.qty + + "]不相等,是否继续收货?" + break + } + + } + } + console.log(isCheck) + if (!isCheck) { + this.showQuestMessage(hint, res => { + if (res) { + this.submitJob(); + } + }) + } + + return isCheck; + }, submitJob() { uni.showLoading({ title: "提交中....", @@ -435,6 +484,7 @@ this.detailSource.forEach(item => { itemCodes.push(item.itemCode) }) + return getManagementPrecisions(itemCodes, this.toLocationCode, res => { if (res.success) { this.managementList = res.list;