From 91c322fb5ba415341f43cc8b6addb6c91aa9de7a 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:38:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20src\pages\productRecycle=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 --- .../productRecycle/coms/comRecycleJobCard.vue | 8 +- .../productRecycle/job/productRecycleJob.vue | 5 +- .../job/productRecycleJobDetail.vue | 170 +++++++++++++++++- 3 files changed, 172 insertions(+), 11 deletions(-) diff --git a/src/pages/productRecycle/coms/comRecycleJobCard.vue b/src/pages/productRecycle/coms/comRecycleJobCard.vue index 109c7daa..c0fb7f77 100644 --- a/src/pages/productRecycle/coms/comRecycleJobCard.vue +++ b/src/pages/productRecycle/coms/comRecycleJobCard.vue @@ -1,6 +1,6 @@ @@ -12,7 +12,11 @@ const props = defineProps({ dataContent: { type: Object, default: {} - } + }, + isShowToLocation: { + type: Boolean, + default: true + }, }) diff --git a/src/pages/productRecycle/job/productRecycleJob.vue b/src/pages/productRecycle/job/productRecycleJob.vue index fd81005d..c40bb3b2 100644 --- a/src/pages/productRecycle/job/productRecycleJob.vue +++ b/src/pages/productRecycle/job/productRecycleJob.vue @@ -4,7 +4,7 @@ - + @@ -128,6 +128,9 @@ const getList = (type) => { if (type === 'refresh') { uni.stopPullDownRefresh() } + res.data.list.forEach(item=>{ + item.fromLocationCode = item.toLocationCode + }) const { list } = res.data totalCount.value = res.data.total updateTitle(`${title.value}(${totalCount.value})`) diff --git a/src/pages/productRecycle/job/productRecycleJobDetail.vue b/src/pages/productRecycle/job/productRecycleJobDetail.vue index 682a8afc..a3232c58 100644 --- a/src/pages/productRecycle/job/productRecycleJobDetail.vue +++ b/src/pages/productRecycle/job/productRecycleJobDetail.vue @@ -46,7 +46,9 @@ import { getProductRecycleDetail, productRecycleJobsubmit, cancleTakeProductRecy import { goHome, getCurrDateTime, getPackingNumberAndBatch, navigateBack } from '@/common/basic.js' import { getInventoryStatusName } from '@/common/directory.js' - +import { + calc +} from '@/common/calc' import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js' import { getManagementPrecisions } from '@/common/balance.js' @@ -76,6 +78,7 @@ const comMessageRef = ref() const jobDetailPopup = ref() const fromLocationCode = ref() const toLocationAreaTypeList = ref([]) +const labelInfo = ref({}) onLoad((option) => { uni.setNavigationBarTitle({ title: `${option.title}详情` @@ -162,8 +165,9 @@ const getDetail = () => { getManagementPrecisions(itemCodes, fromLocationCode.value, res => { if (res.success) { managementList.value = res.list; - managementType.value = managementList.value.some(item => item.ManagementPrecision == - 'BY_BATCH') ? 'BY_BATCH' : '' + managementType.value = managementList.value && + managementList.value[0] && + managementList.value[0].ManagementPrecision?managementList.value[0].ManagementPrecision:'BY_PACKAGING' } }) } else { @@ -202,8 +206,16 @@ const calcScanCount = (closeScan) => { const updateData = () => { calcHandleQty1() } - -const getScanResult = (result) => { +const getScanResult = (result)=> { + console.log(result.label) + labelInfo.value = result.label + if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){ + getScanResultAfterBatch(result) + }else{ + getScanResultAfter(result) + } +} +const getScanResultAfter = (result) => { try { const { packingNumber } = result.label const { batch } = result.label @@ -275,6 +287,105 @@ const getScanResult = (result) => { showErrorMessage(e.message) } } +const getScanResultAfterBatch = (result)=> { + try { + const packingNumber = result.label.packingNumber; + const batch = result.label.batch; + const qty = result.label.qty; + const itemCode = result.label.itemCode; + let itemDetail = undefined; + const detail = detailSource.value.find(r => r.itemCode == itemCode); + if (detail == undefined) { + showMessage("物料号【" + itemCode + "】不在列表中") + } else { + detail.scaned = true + let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus); + //箱码、批次、库位、状态 都相等 + itemDetail = detail.subList.find(r => { + return r.batch == batch && + r.fromLocationCode == result.fromLocationCode && + r.inventoryStatus == result.balance.inventoryStatus + }) + if (itemDetail) { + // 箱码、批次、库位、状态一致 + if (itemDetail.scaned) { + // this.showErrorMessage("\n批次【" + batch + "】\n库位【" + result + // .fromLocationCode + "】\n状态【" + balanceStatus + "】\n已经扫描") + itemDetail.handleQty = calc.add(itemDetail.handleQty,Number(result.label.qty)); + itemDetail.balanceQty = Number(result.label.qty); + } else { + itemDetail.scaned = true; + itemDetail.handleQty = Number(result.label.qty); + itemDetail.balanceQty = Number(result.label.qty); + itemDetail.toInventoryStatus = result.balance.inventoryStatus; + itemDetail.inventoryStatus = result.balance.inventoryStatus; + itemDetail.balance = result.balance; + itemDetail.balance.balanceQty = Number(result.balance.qty); + itemDetail.balance.packQty = Number(result.package.packQty) + itemDetail.balance.packUnit = result.package.packUnit + } + calcHandleQty(); + } else { + //箱码、批次、库位相等 + itemDetail = detail.subList.find(r => { + return r.batch == batch && + r.fromLocationCode == result.fromLocationCode + }) + + if (itemDetail) { + let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus); + //箱码、批次、库位相等,状态不相等 + if(balanceStatus!=itemStatus){ + if (jobContent.value.allowModifyInventoryStatus == "TRUE") { + showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus + + ']不一致,是否继续回收?', res => { + if (res) { + itemDetail.scaned = true; + itemDetail.handleQty = itemDetail.handleQty ? calc.add(itemDetail.handleQty,Number(result.label.qty)) : Number(result.label.qty); + itemDetail.toInventoryStatus = result.balance.inventoryStatus; + itemDetail.inventoryStatus = result.balance.inventoryStatus; + itemDetail.balance = result.balance; + itemDetail.balance.balanceQty = result.balance.qty; + itemDetail.balance.packQty = result.package.packQty + itemDetail.balance.packUnit = result.package.packUnit + calcHandleQty(); + } else { + scanPopupGetFocus(); + } + }); + } else { + showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' + + itemStatus + + ']不一致,不允许回收!', res => { + scanPopupGetFocus(); + }); + } + //箱码、批次、库位相等,状态相等 + }else{ + itemDetail.scaned = true; + itemDetail.handleQty = itemDetail.handleQty ? calc.add(itemDetail.handleQty,Number(result.label.qty)) : Number(result.label.qty); + itemDetail.toInventoryStatus = result.balance.inventoryStatus; + itemDetail.inventoryStatus = result.balance.inventoryStatus; + itemDetail.balance = result.balance; + itemDetail.balance.balanceQty = result.balance.qty; + itemDetail.balance.packQty = result.package.packQty + itemDetail.balance.packUnit = result.package.packUnit + calcHandleQty(); + } + + } else { + showErrorMessage("\n批次【" + batch + "】\n库位【" + result + .fromLocationCode + "】\n状态【" + balanceStatus + "】\n不在任务列表中") + } + + } + + } + scanPopupGetFocus(); + } catch (e) { + showErrorMessage(e.message); + } +} const commit = () => { scanCount.value = getScanCount(subList.value) if (scanCount.value == 0) { @@ -284,12 +395,20 @@ const commit = () => { // //允许部分提交 // //扫描数量和任务数量相等,直接提交 if (scanCount.value == subList.value.length) { - checkCount(); + if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){ + checkCountBatch() + }else{ + checkCount(); + } } else if (scanCount.value < subList.value.length) { //扫描数量小于任务数量,判断是否允许部分提交 if (jobContent.value.allowPartialComplete == "TRUE") { //提交 - checkCount(); + if(managementType.value == 'BY_BATCH' ||managementType.value == "BY_QUANTITY" ){ + checkCountBatch() + }else{ + checkCount(); + } } else { //不允许部分提交,提示 comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { @@ -327,6 +446,41 @@ const checkCount = ()=>{ submitJob() } } +const checkCountBatch = ()=> { + // 提交的数量和任务数量不一致提示 + let str = '' + let str1 = '' + detailSource.value.forEach((item) => { + item.subList.forEach(cur => { + if (cur.qty != cur.handleQty) { + let tempHandleQty = 0 + if(cur.handleQty){ + tempHandleQty=cur.handleQty + }else { + tempHandleQty =0 + } + str += `物料号【${item.itemCode}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致` + } + if(cur.handleQty > cur.balance.qty){ + str1 += `物料号【${item.itemCode}】提交数量【${cur.handleQty}】不可以大于库存数量【${cur.balance.qty}】` + } + }) + }) + if (str1) { + comMessageRef.value.showMessage(str1); + return + } + if (str) { + str = '任务明细未全部完成,是否提交?\n'+ str + comMessageRef.value.showQuestionMessage1(str, 'red', res => { + if (res) { + this.submitJob() + } + }); + } else { + submitJob() + } +} const submitJob = () => { proxy.$modal.loading('提交中...') let itemCodes = [] @@ -368,7 +522,7 @@ const setParams = () => { let info = getPackingNumberAndBatch(this.managementList, detail.itemCode, detail.packingNumber, detail.batch); detail.toPackingNumber = info.packingNumber; detail.packingNumber = info.packingNumber; - detail.fromPackingNumber = info.packingNumber; + detail.fromPackingNumber = labelInfo.value.packingNumber; subList.push(detail) } })