diff --git a/src/pages/productRecycle/job/productRecycleJobDetail.vue b/src/pages/productRecycle/job/productRecycleJobDetail.vue index e9249a19..24b86a83 100644 --- a/src/pages/productRecycle/job/productRecycleJobDetail.vue +++ b/src/pages/productRecycle/job/productRecycleJobDetail.vue @@ -14,7 +14,13 @@ - + + + + @@ -50,6 +56,7 @@ import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.v import comDetailCard from '@/mycomponents/detail/comDetailCard.vue' import recycleDetailInfoPopup from '@/pages/productRecycle/coms/recycleDetailInfoPopup.vue' import jobTop from '@/mycomponents/job/jobTop.vue' +import comDetailCardBatch from "@/mycomponents/detail/comDetailCardBatch.vue" import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() @@ -61,11 +68,13 @@ const subList = ref([]) // 接口返回的任务subList const detailSource = ref([]) // 绑定在页面上的数据源 const businessTypeInfo = ref({}) const managementList = ref([]) +const managementType = ref('') const toLocationCode = ref() const jobStatus = ref('') const scanPopup = ref() const comMessageRef = ref() const jobDetailPopup = ref() +const fromLocationCode = ref() onLoad((option) => { uni.setNavigationBarTitle({ title: `${option.title}详情` @@ -129,7 +138,7 @@ const receive = (callback) => { const getDetail = () => { proxy.$modal.loading('加载中...') getProductRecycleDetail(id.value) - .then((res) => { + .then(async (res) => { uni.hideLoading() if (res.data == null) { showMessage('未获取到详情') @@ -141,7 +150,21 @@ const getDetail = () => { res.fromLocationCode = res.toLocationCode }) toLocationCode.value = res.data.toLocationCode - detailSource.value = getDataSource(subList.value) + detailSource.value = await getDataSource(subList.value); + //获取管理模式,封装参数 + let itemCodes = [] + this.detailSource.forEach(item => { + itemCodes.push(item.itemCode) + item.scaned = false + }) + fromLocationCode.value = subList.value[0].fromLocationCode + getManagementPrecisions(itemCodes, fromLocationCode.value, res => { + if (res.success) { + managementList.value = res.list; + managementType.value = managementList.value.some(item => item.ManagementPrecision == + 'BY_BATCH') ? 'BY_BATCH' : '' + } + }) } else { showMessage('列表数据为0') } @@ -190,6 +213,7 @@ const getScanResult = (result) => { if (detail == undefined) { showMessage(`物料号【${itemCode}】不在列表中`) } else { + detail.scaned = true const balanceStatus = getInventoryStatusName(result.balance.inventoryStatus) // 箱码、批次、库位、状态 都相等 itemDetail = detail.subList.find((r) => { @@ -199,7 +223,7 @@ const getScanResult = (result) => { const itemStatus = getInventoryStatusName(itemDetail.inventoryStatus) // 箱码、批次、库位、状态一致 if (itemDetail.scaned) { - showErrorMessage(`箱码【${packingNumber}】
批次【${batch}】
库位【${result.fromLocationCode}】
状态【${balanceStatus}】
已经扫描`) + showErrorMessage(`箱码【${packingNumber}】\n批次【${batch}】\n库位【${result.fromLocationCode}】\n状态【${balanceStatus}】\n已经扫描`) return } itemDetail.scaned = true @@ -241,7 +265,7 @@ const getScanResult = (result) => { }) } } else { - showErrorMessage(`箱码【${packingNumber}】
批次【${batch}】
库位【${result.fromLocationCode}】
状态【${balanceStatus}】
不在任务列表中`) + showErrorMessage(`箱码【${packingNumber}】\n批次【${batch}】\n库位【${result.fromLocationCode}】\n状态【${balanceStatus}】\n不在任务列表中`) } } } @@ -256,17 +280,43 @@ const commit = () => { showErrorMessage('扫描数为0,请先扫描') return } + // //允许部分提交 + // //扫描数量和任务数量相等,直接提交 + if (scanCount.value == subList.value.length) { + checkCount(); + } else if (scanCount.value < subList.value.length) { + //扫描数量小于任务数量,判断是否允许部分提交 + if (jobContent.value.allowPartialComplete == "TRUE") { + //提交 + checkCount(); + } else { + //不允许部分提交,提示 + comMessageRef.value.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => { + if (res) { + openScanPopup(); + } + }); + } + } +} +const checkCount = ()=>{ // 提交的数量和任务数量不一致提示 let str = '' detailSource.value.forEach((item) => { item.subList.forEach(cur => { if (cur.qty != cur.handleQty) { - str += `包装号【${cur.packingNumber}】提交数量【${cur.handleQty}】与任务物料数量【${cur.qty}】不一致` + let tempHandleQty = 0 + if(cur.handleQty){ + tempHandleQty = cur.handleQty + }else { + tempHandleQty = 0 + } + str += `包装号【${cur.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致` } }) }) if (str) { - str += ',是否确认提交?' + str = '任务明细未全部完成,是否提交?\n'+str comMessageRef.value.showQuestionMessage1(str, 'red', res => { if (res) { submitJob() @@ -276,23 +326,31 @@ const commit = () => { submitJob() } } - const submitJob = () => { proxy.$modal.loading('提交中...') - const params = setParams() - productRecycleJobsubmit(params) - .then((res) => { - uni.hideLoading() - if (res.data) { - showCommitSuccessMessage(res.data) - } else { - showErrorMessage(`提交失败[${res.msg}]`) - } - }) - .catch((error) => { - uni.hideLoading() - showErrorMessage(error) - }) + let itemCodes = [] + detailSource.value.forEach(item => { + itemCodes.push(item.itemCode) + }) + getManagementPrecisions(itemCodes, fromLocationCode.value, res => { + if (res.success) { + managementList.value = res.list; + const params = setParams() + productRecycleJobsubmit(params) + .then((res) => { + uni.hideLoading() + if (res.data) { + showCommitSuccessMessage(res.data) + } else { + showErrorMessage(`提交失败[${res.msg}]`) + } + }) + .catch((error) => { + uni.hideLoading() + showErrorMessage(error) + }) + } + }) } const setParams = () => { const subList = [] @@ -306,6 +364,10 @@ const setParams = () => { detail.toBatch = detail.batch detail.toLocationCode = detail.toLocationCode + let info = getPackingNumberAndBatch(this.managementList, detail.itemCode, detail.packingNumber, detail.batch); + detail.toPackingNumber = info.packingNumber; + detail.packingNumber = info.packingNumber; + detail.fromPackingNumber = info.packingNumber; subList.push(detail) } }) @@ -354,6 +416,7 @@ const openDetail = (item) => { } const showMessage = (message) => { + scanPopupLoseFocus() comMessageRef.value.showMessage(message, (res) => { if (res) { scanPopupGetFocus() @@ -362,6 +425,7 @@ const showMessage = (message) => { } const showErrorMessage = (message) => { + scanPopupLoseFocus() comMessageRef.value.showErrorMessage(message, (res) => { if (res) { scanPopupGetFocus() @@ -374,12 +438,14 @@ const showQuestionMessage = (message, callback) => { comMessageRef.value.showQuestionMessage(message, (res) => { if (res) { callback(res) + }else { + scanPopupGetFocus() } }) }) } const showCommitSuccessMessage = (hint) => { - comMessageRef.value.showSuccessMessage(`提交成功
生成制品回收记录
:${number}`, (res) => { + comMessageRef.value.showSuccessMessage(`提交成功\n生成制品回收记录\n:${number}`, (res) => { navigateBack(1) }) } diff --git a/src/pages/productRecycle/record/productRecycleRecord.vue b/src/pages/productRecycle/record/productRecycleRecord.vue index dcd0fe8c..9087fb86 100644 --- a/src/pages/productRecycle/record/productRecycleRecord.vue +++ b/src/pages/productRecycle/record/productRecycleRecord.vue @@ -154,7 +154,7 @@ const getDataSource = (result) => { const newDetail = createDetailInfo(balance, pack) item.subList.push(newDetail) } else { - showErrorMessage(`箱码[${balance.packingNumber}]已经在列表中`) + showErrorMessage(`箱码[${balance.packingNumber}]重复扫描`) } } calcHandleQty(detailSource.value) @@ -194,7 +194,7 @@ const commit = () => { .then((res) => { uni.hideLoading() if (res.data) { - showCommitSuccessMessage(`提交成功
生成采购退货记录
${res.data}`) + showCommitSuccessMessage(`提交成功\n生成采购退货记录\n${res.data}`) } else { showErrorMessage(`提交失败[${res.msg}]`) }