diff --git a/src/pages/inventoryMove/job/inventoryMoveDetail.vue b/src/pages/inventoryMove/job/inventoryMoveDetail.vue index 1b3324c1..c17ae97c 100644 --- a/src/pages/inventoryMove/job/inventoryMoveDetail.vue +++ b/src/pages/inventoryMove/job/inventoryMoveDetail.vue @@ -389,22 +389,41 @@ }, - commit() { + async commit() { this.scanCount = getScanCount(this.subList); if (this.scanCount == 0) { this.showErrorMessage("扫描数为0,请先扫描") return; } - +//查询管理模式 + this.managementList = []; + var precisionStrategParams = this.setPrecisionStrategParams() + await getPrecisionStrategyList(precisionStrategParams, 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' + } else { + uni.hideLoading(); + this.showErrorMessage(res.message); + } + }) //允许部分提交 //扫描数量和任务数量相等,直接提交 if (this.scanCount == this.subList.length) { - this.checkCount(); + if(this.managementType == 'BY_BATCH'){ + this.checkCount(); + }else{ + this.checkCountBatch(); + } } else if (this.scanCount < this.subList.length) { //扫描数量小于任务数量,判断是否允许部分提交 if (this.jobContent.allowPartialComplete == "TRUE") { //提交 - this.checkCount(); + if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY' ){ + this.checkCountBatch(); + }else{ + this.checkCount(); + } } else { //不允许部分提交,提示 this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { @@ -443,44 +462,56 @@ this.submitJob() } }, - + checkCountBatch(){ + // 提交的数量和任务数量不一致提示 + let str = '' + this.detailSource.forEach((item) => { + item.subList.forEach(cur => { + if (cur.qty != cur.handleQty) { + var tempHandleQty = 0 + if (cur.handleQty) { + tempHandleQty = cur.handleQty + } else { + tempHandleQty = 0 + } + str += + `提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致\n` + } + }) + }) + if (str) { + str = '任务明细未全部完成,是否提交?\n' + str + this.$refs.comMessage.showQuestionMessage1(str, 'red', res => { + if (res) { + this.submitJob() + } + }); + } else { + this.submitJob() + } + }, submitJob() { uni.showLoading({ title: "提交中....", mask: true }); - - //查询管理模式 - this.managementList = []; - var precisionStrategParams = this.setPrecisionStrategParams() - getPrecisionStrategyList(precisionStrategParams, res => { - if (res.success) { - this.managementList = res.list; - - var params = this.setParams() - console.log("提交" + JSON.stringify(params)) - inventoryMoveSubmit(params).then(res => { - uni.hideLoading() - if (res.data) { - let showTitle = this.title - if (this.title.indexOf('任务') == this.title.length - 2) { - showTitle = this.title.replace('任务', '') - } - this.showCommitSuccessMessage("提交成功\n生成" + showTitle + "记录\n" + res.data) - } else { - this.showErrorMessage("提交失败[" + res.msg + "]") - } - }).catch(error => { - uni.hideLoading() - this.showErrorMessage(error) - }) + var params = this.setParams() + console.log("提交" + JSON.stringify(params)) + inventoryMoveSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + let showTitle = this.title + if (this.title.indexOf('任务') == this.title.length - 2) { + showTitle = this.title.replace('任务', '') + } + this.showCommitSuccessMessage("提交成功\n生成" + showTitle + "记录\n" + res.data) } else { - uni.hideLoading(); - this.showErrorMessage(res.message); + this.showErrorMessage("提交失败[" + res.msg + "]") } - + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) }) - }, setPrecisionStrategParams() {