diff --git a/src/pages/deliver/job/deliverDetailBatch.vue b/src/pages/deliver/job/deliverDetailBatch.vue index 17800ee6..4edbeb25 100644 --- a/src/pages/deliver/job/deliverDetailBatch.vue +++ b/src/pages/deliver/job/deliverDetailBatch.vue @@ -224,6 +224,8 @@ getManagementPrecisions(itemCodes, locationCode, res => { if (res.success) { this.managementList = res.list; + this.managementType = this.managementList && this.managementList[0] ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING' + this.submitJob(); } else { uni.hideLoading(); @@ -248,28 +250,67 @@ }, checkCount() { + let str="" + this.detailSource.forEach(detail => { + detail.Items.forEach(item => { + var taskQty =0; + item.taskQty =calc.add(taskQty,item.qty) + var totalQty =0; + item.Locations.forEach(lco => { + lco.Batchs.forEach(batch => { + batch.Records.forEach(record => { + if(record){ + var hanleQty =record.qty?record.qty:0 + totalQty = calc.add(totalQty,hanleQty) + } + + }) + }) + }) + //实际扫描的数量 + item.totalQty =totalQty + + }) + }) + //如果允许部分提交任务有扫描记录就可以直接提交;如果不允许部分执行,任务数量和提交数量不一致给出提示 + this.detailSource.forEach(detail=>{ + detail.Items.forEach(item=>{ + if(this.jobContent.allowPartialComplete=="FALSE"){ + if(item.taskQty!=item.totalQty){ + str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n` + } + } + }) + }) + + if(str){ + str = '不允许提交\n' + str + this.showErrorMessage(str) + } + + return str?false:true + }, + checkCountBatch() { let str = "" let str1 = "" - var taskQty = 0; - var totalQty = 0; this.detailSource.subList.forEach(item => { + var taskQty = 0; + var totalQty = 0; item.taskQty = calc.add(taskQty, item.qty) - var hanleQty = item.qty ? item.qty : 0 - totalQty = calc.add(totalQty, hanleQty) + totalQty = calc.add(totalQty, item.handleQty) //实际扫描的数量 item.totalQty = totalQty - }) //如果允许部分提交任务有扫描记录就可以直接提交;如果不允许部分执行,任务数量和提交数量不一致给出提示 this.detailSource.subList.forEach(detail => { if (this.jobContent.allowPartialComplete == "FALSE") { - if (taskQty != totalQty) { - str += `物料号【${detail.itemCode}】任务数量【${taskQty}】与实际提交数量【${totalQty}】不一致\n` + if (detail.taskQty != detail.totalQty) { + str += `物料号【${detail.itemCode}】任务数量【${detail.taskQty}】与实际提交数量【${detail.totalQty}】不一致\n` } } if (this.allowBiggerQty == 'FALSE') { - if (taskQty > totalQty) { - str1 += '数量[' + totalQty + ']不允许大于任务数量[' + taskQty + ']' + if ( detail.taskQty < detail.totalQty) { + str1 += '数量[' + detail.totalQty + ']不允许大于任务数量[' + detail.taskQty + ']' } } }) @@ -279,8 +320,8 @@ this.showErrorMessage(str) } if (str1) { - str = '不允许提交\n' + str - this.showErrorMessage(str) + str1 = '不允许提交\n' + str1 + this.showErrorMessage(str1) } return str || str1 ? false : true @@ -295,11 +336,18 @@ this.$refs.comMessage.showConfirmMessageModal('请扫描箱码') return } - - if (!this.checkCount()) { - uni.hideLoading() - return; + if(this.managementType == "BY_BATCH" ||this.managementType == "BY_QUANTITY" ){ + if (!this.checkCountBatch()) { + uni.hideLoading() + return; + } + }else{ + if (!this.checkCount()) { + uni.hideLoading() + return; + } } + deliverJobSubmit(params).then(res => { uni.hideLoading() if (res.data) {