diff --git a/src/pages/unPlanned/job/issueJobDetail.vue b/src/pages/unPlanned/job/issueJobDetail.vue index de845c1d..add77875 100644 --- a/src/pages/unPlanned/job/issueJobDetail.vue +++ b/src/pages/unPlanned/job/issueJobDetail.vue @@ -5,6 +5,12 @@ + + + 目的地 + {{jobContent.destination}} + + @@ -14,7 +20,12 @@ - + + + + @@ -43,11 +54,18 @@ import { getManagementPrecisions } from '@/common/balance.js' import { getUnPlannedIssueJobDetail, takeUnPlannedIssueJob, cancleTakeUnPlannedIssueJob, unPlannedIssueJobSubmit } from '@/api/request2.js' import { goHome, navigateBack, getPackingNumberAndBatch, getDirectoryItemArray, getInventoryStatusName } from '@/common/basic.js' -import { getDataSource, createRecordInfo, calcHandleQty, getScanCount } from '@/common/detail.js' +import { getDataSource, createRecordInfo, calcHandleQty, getScanCount,calcHandleNewQty } from '@/common/detail.js' +import { + calc +} from '@/common/calc' +import { + Decimal +} from 'decimal.js'; //引入 import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' -import comDetailCard from '@/mycomponents/detail/comDetailCard.vue' +import comRecommendDetailCard from "@/mycomponents/detail/comRecommendDetailCard.vue" +import comRecommendDetailCardBatch from "@/mycomponents/detail/comRecommendDetailCardBatch.vue" import detailInfoPopup from '@/pages/unPlanned/coms/detailInfoPopup.vue' import jobTop from '@/mycomponents/job/jobTop.vue' import { useCountStore } from '@/store' @@ -61,11 +79,13 @@ const subList = ref([]) // 接口返回的任务subList const detailSource = ref([]) // 绑定在页面上的数据源 const businessTypeInfo = ref({}) const managementList = ref([]) +const managementType = ref('') const jobStatus = ref('') const scanPopup = ref() const comScanLocation = ref() const detailInfoPopupRef = ref() const comMessageRef = ref() +const fromLocationCode = ref('') onLoad((option) => { uni.setNavigationBarTitle({ title: `${option.title}详情` @@ -129,7 +149,7 @@ const receive = (callback) => { const getDetail = () => { proxy.$modal.loading('加载中...') getUnPlannedIssueJobDetail(id.value) - .then((res) => { + .then(async (res) => { uni.hideLoading() if (res.data == null) { showMessage('未获取到详情') @@ -137,7 +157,24 @@ const getDetail = () => { jobContent.value = res.data jobStatus.value = res.data.status subList.value = res.data.subList - detailSource.value = getDataSource(subList.value) + subList.value.forEach(item=>{ + item.isRecommend = true + }) + detailSource.value = await getDataSource(subList.value) + //获取管理模式,封装参数 + let itemCodes = [] + detailSource.value.forEach(item => { + itemCodes.push(item.itemCode) + item.scaned = false + }) + fromLocationCode.value = subList.value[0].fromLocationCode + await 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') } @@ -157,10 +194,20 @@ const continueScan = () => { } } const calcHandleQty1 = () => { - calcHandleQty(detailSource.value) + calcHandleNewQty(detailSource.value) continueScan() } const updateData = () => { + //删除新添加的 + for (let i = 0; i < detailSource.value.length; i++) { + let item = detailSource.value[i] + for (let j = 0; j < item.subList.length; j++) { + var sub = item.subList[j] + if(!sub.isRecommend&&!sub.scaned){ + item.subList.splice(j,1) + } + } + } calcHandleQty1() } const openDetail = (item) => { @@ -181,45 +228,32 @@ const getScanResult = (result) => { showErrorMessage(`物料号【${itemCode}】不在列表中`) } else { const itemDetail = detail.subList.find((r) => { - return r.packingNumber == packingNumber && r.batch == batch && r.fromLocationCode == result.fromLocationCode + return r.packingNumber == packingNumber && r.batch == batch && r.fromLocationCode == result.fromLocationCode && r.isRecommend==false }) if (itemDetail == undefined) { - showErrorMessage(`箱码【${packingNumber}】,批次【${batch}】库位【${result.fromLocationCode}】不在列表中`) - } else if (itemDetail.scaned) { - showErrorMessage(`箱码【${packingNumber}】,批次【${batch}】库位【${result.fromLocationCode}】已经扫描`) + let newAdd = { + itemCode:itemCode, + packingNumber:packingNumber, + batch:batch, + handleQty:detail.qty { - if (res) { - itemDetail.scaned = true - itemDetail.handleQty = Number(result.balance.qty) - itemDetail.toInventoryStatus = 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 - calcHandleQty1() - } else { - scanPopupGetFocus() - } - }) - } else { - showQuestionMessage(`任务中不允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,不允许转移!`, (res) => { - scanPopupGetFocus() - }) - } - } else { - itemDetail.scaned = true - itemDetail.handleQty = Number(result.balance.qty) - itemDetail.toInventoryStatus = 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 - calcHandleQty1() + if (itemDetail.scaned) { + showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result + .fromLocationCode + "】已经扫描") } } } @@ -228,11 +262,21 @@ const getScanResult = (result) => { } } const commit = () => { - scanCount.value = getScanCount(subList.value) - if (scanCount.value == 0) { + let scanCount = 0; + detailSource.value.forEach((item) => { + item.subList.forEach(cur => { + if (cur.scaned) { + scanCount++; + } + }) + }) + if (scanCount == 0) { showErrorMessage('扫描数为0,请先扫描') return } + checkCount() +} +const checkCount = ()=>{ // 提交的数量和任务数量不一致提示 let str = '' detailSource.value.forEach((item) => { @@ -243,7 +287,7 @@ const commit = () => { }) }) if (str) { - str += ',是否确认提交?' + str = str+'\n是否提交?' comMessageRef.value.showQuestionMessage1(str, 'red', res => { if (res) { submitJob() @@ -252,41 +296,37 @@ const commit = () => { } else { submitJob() } - // // 允许部分提交 - // // 扫描数量和任务数量相等,直接提交 - // if (scanCount.value == subList.value.length) { - // submitJob() - // } else if (scanCount.value < subList.value.length) { - // // 扫描数量小于任务数量,判断是否允许部分提交 - // if (jobContent.value.allowPartialComplete == 'TRUE') { - // // 提交 - // submitJob() - // } else { - // // 不允许部分提交,提示 - // comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交
' + `已经扫描[${scanCount.value}]箱总共[${subList.value.length}]箱`, (res) => { - // if (res) { - // openScanPopup() - // } - // }) - // } - // } } const submitJob = () => { proxy.$modal.loading('提交中...') - const params = setParams() - unPlannedIssueJobSubmit(params) - .then((res) => { - uni.hideLoading() - if (res.data) { - showCommitSuccessMessage(`提交成功
生成计划外出库记录
${res.data}`) - } else { - showErrorMessage(`提交失败[${res.msg}]`) - } - }) - .catch((error) => { - uni.hideLoading() - showErrorMessage(error) - }) + let itemCodes = [] + this.detailSource.forEach(item => { + itemCodes.push(item.itemCode) + item.scaned = false + }) + getManagementPrecisions(itemCodes, fromLocationCode.value, res => { + if (res.success) { + managementList.value = res.list; + //没有目标库位,不查询管理模式 + const params = setParams() + unPlannedIssueJobSubmit(params) + .then((res) => { + uni.hideLoading() + if (res.data) { + showCommitSuccessMessage(`提交成功\n生成计划外出库记录\n${res.data}`) + } else { + showErrorMessage(`提交失败[${res.msg}]`) + } + }) + .catch((error) => { + uni.hideLoading() + showErrorMessage(error) + }) + } else { + uni.hideLoading(); + showErrorMessage(res.message); + } + }); } const setParams = () => { const subList = [] @@ -294,10 +334,14 @@ const setParams = () => { detailSource.value.forEach((item) => { item.subList.forEach((detail) => { - if (detail.scaned) { + if (detail.scaned && !detail.isRecommend) { detail.toPackingNumber = detail.packingNumber detail.toContainerNumber = '' detail.toBatch = detail.batch + let info = getPackingNumberAndBatch(managementList.value, detail.itemCode,detail.packingNumber, detail.batch); + detail.toPackingNumber = info.packingNumber; + detail.packingNumber = info.packingNumber; + detail.fromPackingNumber = info.packingNumber; subList.push(detail) } }) diff --git a/src/pages/unPlanned/job/receiptJobDetail.vue b/src/pages/unPlanned/job/receiptJobDetail.vue index 01e112ea..2911e5c4 100644 --- a/src/pages/unPlanned/job/receiptJobDetail.vue +++ b/src/pages/unPlanned/job/receiptJobDetail.vue @@ -14,7 +14,14 @@ - + + + + @@ -53,6 +60,7 @@ import winScanPack from '@/mycomponents/scan/winScanPack.vue' import locationCompare from '@/mycomponents/location/locationCompare.vue' import comReceiptDetailCard from '@/pages/unPlanned/coms/comReceiptDetailCard.vue' import jobTop from '@/mycomponents/job/jobTop.vue' +import comReceiptDetailCardBatch from '@/pages/unPlanned/coms/comReceiptDetailCardBatch.vue' import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() @@ -67,6 +75,7 @@ const toLocationCode = ref('') const toLocationInfo = ref({}) const businessTypeInfo = ref({}) const managementList = ref([]) +const managementType = ref('') const jobStatus = ref('') const jobToLocationCode = ref('') const scanPopup = ref() @@ -137,7 +146,7 @@ const receive = (callback) => { const getDetail = () => { proxy.$modal.loading('加载中....') getUnPlannedReceiptJobDetail(id.value) - .then((res) => { + .then(async (res) => { uni.hideLoading() if (res.data == null) { showMessage('未获取到详情') @@ -147,7 +156,19 @@ const getDetail = () => { subList.value = res.data.subList detailSource.value = getDataSource(subList.value) jobToLocationCode.value = subList.value[0].toLocationCode - toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes) + toLocationAreaTypeList.value = await getDirectoryItemArray(jobContent.value.toAreaTypes) + //获取管理模式,封装参数 + let itemCodes = [] + detailSource.value.forEach(item => { + itemCodes.push(item.itemCode) + item.scaned = false + }) + getManagementPrecisions(itemCodes, jobToLocationCode.value, res => { + if (res.success) { + managementList.value = res.list; + managementType.value = managementList.value.some(item => item.ManagementPrecision == 'BY_BATCH') ? 'BY_BATCH' : '' + } + }) } else { showErrorMessage('列表数据为0') } @@ -228,10 +249,15 @@ const commit = () => { // 扫描数量小于任务数量,判断是否允许部分提交 if (jobContent.value.allowPartialComplete == 'TRUE') { // 提交 + comMessageRef.value.showErrorMessage1("任务明细未全部完成,是否提交?", 'red', res => { + if (res) { + submitJob() + } + }) submitJob() } else { // 不允许部分提交,提示 - comMessageRef.value.showErrorMessage('请完成扫描后,再进行提交
' + `已经扫描[${scanCount.value}]箱总共[${subList.value.length}]箱`, (res) => { + comMessageRef.value.showErrorMessage(`任务明细未全部完成,不允许部分提交!`, (res) => { if (res) { openScanPopup() } @@ -275,7 +301,7 @@ const submitJob = () => { .then((res) => { uni.hideLoading() if (res.data) { - showCommitSuccessMessage(`提交成功
生成计划外入库记录
${res.data}`) + showCommitSuccessMessage(`提交成功\n生成计划外入库记录\n${res.data}`) } else { showErrorMessage(`提交失败[${res.msg}]`) } @@ -300,6 +326,8 @@ const setParams = () => { if (detail.scaned) { const info = getPackingNumberAndBatch(managementList.value, detail.itemCode, detail.packingNumber, detail.batch) detail.toPackingNumber = info.packingNumber + detail.packingNumber = info.packingNumber; + detail.fromPackingNumber = info.packingNumber; detail.toBatch = info.batch detail.toLocationCode = toLocationCode.value detail.toContainerNumber = ''