From 7eece6e49dc33db66dc65cf8bb8f6aec8b45bdd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BF=97=E5=9B=BD?= <854933521@qq.com> Date: Wed, 30 Oct 2024 09:49:38 +0800 Subject: [PATCH] =?UTF-8?q?page/deliver/job=20=E6=96=87=E4=BB=B6=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=208/8-10/25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/deliver/job/deliverDetail.vue | 99 +++- src/pages/deliver/job/deliverDetailBatch.vue | 479 +++++++++++++++++++ src/pages/deliver/job/deliverJob.vue | 19 +- 3 files changed, 571 insertions(+), 26 deletions(-) create mode 100644 src/pages/deliver/job/deliverDetailBatch.vue diff --git a/src/pages/deliver/job/deliverDetail.vue b/src/pages/deliver/job/deliverDetail.vue index e8b9fbc1..b0753619 100644 --- a/src/pages/deliver/job/deliverDetail.vue +++ b/src/pages/deliver/job/deliverDetail.vue @@ -13,7 +13,7 @@ 发货类型 - {{ jobContent.deliverType }} + {{ jobContent.deliverType }} @@ -31,18 +31,20 @@ - + - + -
- - + + + + + -
+
@@ -56,7 +58,7 @@ import { getDeliverDetail, takeDeliverJob, cancleTakeDeliverJob, deliverJobSubmi import { calc } from '@/common/calc.js' -import { goHome, navigateBack, getRemoveOption, getCurrDateTime, getPackingNumberAndBatch } from '@/common/basic.js' +import { goHome, navigateBack, getRemoveOption, getCurrDateTime, getPackingNumberAndBatch,deepCopyData } from '@/common/basic.js' import { getDataSource } from '@/pages/issue/js/issue.js' @@ -142,21 +144,15 @@ const getDetail = () => { getDeliverDetail(id.value) .then((res) => { uni.hideLoading() - if (res.data == null) { - showMessage('未获取到详情') - } else if (res.data.subList.length > 0) { + if (res.data && res.data.subList.length > 0) { jobContent.value = res.data jobStatus.value = res.data.status subList.value = res.data.subList detailSource.value = getDataSource(detailSource.value, subList.value) toLocationCode.value = subList.value[0].toLocationCode - setTimeout((r) => { - resizeCollapse() - }, 100) - - uni.hideLoading() + resizeCollapse() } else { - showMessage('列表数据为0') + showMessage('未获取到详情') } }) .catch((error) => { @@ -202,6 +198,57 @@ const submit = () => { }) } } + +const checkCount = ()=>{ + let str = "" + detailSource.value.forEach(detail => { + detail.Items.forEach(item => { + let taskQty = 0; + item.taskQty = calc.add(taskQty, item.qty) + let totalQty = 0; + item.Locations.forEach(lco => { + lco.Batchs.forEach(batch => { + batch.Records.forEach(record => { + // if (batch.qty != record.qty) { + // var tempHandleQty = 0 + // if (record.qty) { + // tempHandleQty = record.qty + // } else { + // tempHandleQty = 0 + // } + // if (batch.qty != 0) { + // str += + // `包装号【${record.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${batch.qty}】不一致\n` + // } + // } + if (record) { + let hanleQty = record.qty ? record.qty : 0 + totalQty = calc.add(totalQty, hanleQty) + } + }) + }) + }) + //实际扫描的数量 + item.totalQty = totalQty + }) + }) + //如果允许部分提交任务有扫描记录就可以直接提交;如果不允许部分执行,任务数量和提交数量不一致给出提示 + detailSource.value.forEach(detail => { + detail.Items.forEach(item => { + if (jobContent.value.allowPartialComplete == "FALSE") { + if (item.taskQty != item.totalQty) { + str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n` + } + } + }) + }) + if (str) { + str = '不允许提交\n' + str + showErrorMessage(str) + } + return str ? false : true +} + const submitJob = () => { const params = setParams() if (params.subList.length == 0) { @@ -209,11 +256,15 @@ const submitJob = () => { comMessageRef.value.showConfirmMessageModal('请扫描箱码') return } + if(!checkCount()){ + uni.hideLoading() + return; + } deliverJobSubmit(params) .then((res) => { uni.hideLoading() if (res.data) { - showCommitSuccessMessage(`提交成功
生成发货记录
${res.data}`) + showCommitSuccessMessage(`提交成功\n生成发货记录\n${res.data}`) } else { showErrorMessage(`提交失败[${res.msg}]`) } @@ -237,9 +288,11 @@ const setParams = () => { batch.Records.forEach((r) => { const record = {} record.handleQty = r.qty + record.fromPackingNumber = r.packingNumber; record.toContainerNumber = r.ContainerNumber record.toInventoryStatus = r.inventoryStatus - record.toLocationCode = subItem.toLocationCode + // record.toLocationCode = subItem.toLocationCode + record.toLocationCode = toLocationCode.value; record.supplierCode = r.supplierCode // 使用在途库不改变管理模式 @@ -251,10 +304,11 @@ const setParams = () => { record.toPackingNumber = info.packingNumber record.toBatch = info.batch } - record.fromPackingNumber = r.packingNumber + record.fromParentPackingNumber = r.parentPackingNumber + subItem.toLocationCode = toLocationCode.value subItem.recordList.push(record) }) - subList.push(subItem) + subList.push(deepCopyData(subItem)) } }) }) @@ -326,9 +380,6 @@ const showErrorMessage = (message) => { afterCloseMessage() }) } -const showScanMessage = (message) => { - comMessageRef.value.showScanMessage(message) -} const showCommitSuccess = () => { comMessageRef.value.showCommitSuccess() } diff --git a/src/pages/deliver/job/deliverDetailBatch.vue b/src/pages/deliver/job/deliverDetailBatch.vue new file mode 100644 index 00000000..ef0be975 --- /dev/null +++ b/src/pages/deliver/job/deliverDetailBatch.vue @@ -0,0 +1,479 @@ + + + + + \ No newline at end of file diff --git a/src/pages/deliver/job/deliverJob.vue b/src/pages/deliver/job/deliverJob.vue index bceb91cf..87ef6586 100644 --- a/src/pages/deliver/job/deliverJob.vue +++ b/src/pages/deliver/job/deliverJob.vue @@ -23,7 +23,7 @@ import { getDeliverJobList, cancleTakeDeliverJob } from '@/api/request2.js' import { goHome, updateTitle } from '@/common/basic.js' import { getDetailOption, getDetailGiveupOption } from '@/common/array.js' - +import {getManagementPrecisions} from '@/common/balance.js'; import comEmptyView from '@/mycomponents/common/comEmptyView.vue' import jobFilter from '@/mycomponents/job/jobFilter.vue' import comDeliverJobCard from '@/pages/deliver/coms/comDeliverJobCard.vue' @@ -160,7 +160,22 @@ const getList = (type) => { }) } const openJobDetail = (item) => { - proxy.$tab.navigateTo(`./deliverDetail?id=${item.masterId}&status=${item.status}&title=${title.value}`) + getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => { + if (ret.success) { + let managementList, + managementType + managementList = ret.list; + managementType = managementList.some(cur => cur.ManagementPrecision == 'BY_BATCH') ? + 'BY_BATCH' : '' + if (managementType == 'BY_BATCH') { + proxy.$tab.navigateTo({ + url: './deliverDetailBatch?id=' + item.masterId + '&status=' + item.status+'&title='+this.title + }); + } else { + proxy.$tab.navigateTo(`./deliverDetail?id=${item.masterId}&status=${item.status}&title=${title.value}`) + } + } + }) } const selectedItem = (item) => { openJobDetail(item)