From d01ccb291d0a891ff1357265eccfbfcc2ae21a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BF=97=E5=9B=BD?= <854933521@qq.com> Date: Tue, 12 Nov 2024 18:20:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20src\pages\productReceipt=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=BF=AE=E6=94=B9=20Vue2=E5=8D=87=E7=BA=A7Vue3=2010/2?= =?UTF-8?q?5-11-11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coms/comProductDetailCardBatch.vue | 136 +++++++--------- .../coms/comProductRecordBatch.vue | 151 ++++++++++++++++++ .../job/ccProductReceiptJob.vue | 18 +-- .../productReceipt/job/completeReceiveJob.vue | 16 +- .../job/productReceiptDetail.vue | 69 ++++++-- .../productReceipt/job/productReceiptJob.vue | 4 +- 6 files changed, 282 insertions(+), 112 deletions(-) create mode 100644 src/pages/productReceipt/coms/comProductRecordBatch.vue diff --git a/src/pages/productReceipt/coms/comProductDetailCardBatch.vue b/src/pages/productReceipt/coms/comProductDetailCardBatch.vue index 783670a4..b718ad03 100644 --- a/src/pages/productReceipt/coms/comProductDetailCardBatch.vue +++ b/src/pages/productReceipt/coms/comProductDetailCardBatch.vue @@ -1,51 +1,52 @@ diff --git a/src/pages/productReceipt/job/ccProductReceiptJob.vue b/src/pages/productReceipt/job/ccProductReceiptJob.vue index 5b50b0ec..2b842c8c 100644 --- a/src/pages/productReceipt/job/ccProductReceiptJob.vue +++ b/src/pages/productReceipt/job/ccProductReceiptJob.vue @@ -4,20 +4,16 @@ - - - - - - - - - + + + + + - diff --git a/src/pages/productReceipt/job/completeReceiveJob.vue b/src/pages/productReceipt/job/completeReceiveJob.vue index a35a570c..79fc405a 100644 --- a/src/pages/productReceipt/job/completeReceiveJob.vue +++ b/src/pages/productReceipt/job/completeReceiveJob.vue @@ -4,17 +4,15 @@ - - - - - - - - + + + + + - diff --git a/src/pages/productReceipt/job/productReceiptDetail.vue b/src/pages/productReceipt/job/productReceiptDetail.vue index 5e0edbc3..68d81e0c 100644 --- a/src/pages/productReceipt/job/productReceiptDetail.vue +++ b/src/pages/productReceipt/job/productReceiptDetail.vue @@ -237,15 +237,17 @@ const getScanResult = (result) => { if (itemDetail == undefined) { showErrorMessage(`批次[${batch}]不在任务列表中`) } else if (itemDetail.scaned) { - showErrorMessage(`批次[${batch}]已经扫描`) + itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty); } else { itemDetail.scaned = true itemDetail.handleQty = Number(result.label.qty) - itemDetail.toLocationCode = toLocationCode.value + // itemDetail.toLocationCode = toLocationCode.value itemDetail.labelQty = Number(result.label.qty) - calcHandleQty(detailSource.value) + + continueScan() } + calcHandleQty(detailSource.value) } } @@ -301,7 +303,7 @@ const showMessageHint = (hint, callback) => { }) } -const commit = () => { +const commit = async () => { scanCount.value = getScanCount(subList.value) if (scanCount.value == 0) { showErrorMessage('扫描数为0,请先扫描') @@ -316,18 +318,40 @@ const commit = () => { }else{ toLocationCode.value = jobToLocationCode.value } - + //获取管理模式,封装参数 + let itemCodes = [] + detailSource.value.forEach(item => { + itemCodes.push(item.itemCode) + }) + await getManagementPrecisions(itemCodes, toLocationCode.value, res => { + if (res.success) { + managementList.value = res.list; + managementType.value = managementList.value && managementList.value[0] && managementList.value[0].ManagementPrecision ? managementList.value[0].ManagementPrecision : 'BY_PACKAGING' + } + }) // 扫描数量和任务数量相等,直接提交 if (scanCount.value == subList.value.length) { - if (checkCount()) { - submitJob() + if(managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY'){ + if (checkCountBatch()) { + submitJob(); + } + }else{ + if (checkCount()) { + submitJob(); + } } } else if (scanCount.value < subList.value.length) { // 扫描数量小于任务数量,判断是否允许部分提交 if (jobContent.value.allowPartialComplete == 'TRUE') { // 提交 - if (checkCount()) { - submitJob() + if(managementType.value == 'BY_BATCH' || managementType.value == 'BY_QUANTITY'){ + if (checkCountBatch()) { + submitJob(); + } + }else{ + if (checkCount()) { + submitJob(); + } } } else { // 不允许部分提交,提示 @@ -361,6 +385,33 @@ const checkCount = () => { return isCheck } +const checkCountBatch = ()=> { + let isCheck = true; + let hint = "" + for (let i = 0; i < detailSource.value.length; i++) { + const item = detailSource.value[i]; + for (let j = 0; j < item.subList.length; j++) { + const 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) { + showQuestMessage(hint, res => { + if (res) { + submitJob(); + } + }) + } + return isCheck; +} + const submitJob = () => { proxy.$modal.loading('提交中....') const itemCodes = [] diff --git a/src/pages/productReceipt/job/productReceiptJob.vue b/src/pages/productReceipt/job/productReceiptJob.vue index 0a28475f..0f547459 100644 --- a/src/pages/productReceipt/job/productReceiptJob.vue +++ b/src/pages/productReceipt/job/productReceiptJob.vue @@ -12,7 +12,7 @@ - + @@ -71,6 +71,8 @@ const jobListPopupRef = ref() const scanPopup = ref() const jobListRef = ref() const timer = ref(null) +const manageModel = import.meta.env.VITE_MANAGE_MODEL + onMounted(() => { detailOptions.value = getDetailOption() detailGiveupOptions.value = getDetailGiveupOption()