diff --git a/src/pages/scrap/coms/comScrapDetailCardBatch.vue b/src/pages/scrap/coms/comScrapDetailCardBatch.vue new file mode 100644 index 00000000..dabf09e5 --- /dev/null +++ b/src/pages/scrap/coms/comScrapDetailCardBatch.vue @@ -0,0 +1,158 @@ + + + + + + diff --git a/src/pages/scrap/job/scrapJobDetail.vue b/src/pages/scrap/job/scrapJobDetail.vue index 115577ec..a2c2d996 100644 --- a/src/pages/scrap/job/scrapJobDetail.vue +++ b/src/pages/scrap/job/scrapJobDetail.vue @@ -14,7 +14,12 @@ - + + + + @@ -51,6 +56,7 @@ import winScanPack from '@/mycomponents/scan/winScanPack.vue' import comScrapDetailCard from '@/pages/scrap/coms/comScrapDetailCard.vue' import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' import jobTop from '@/mycomponents/job/jobTop.vue' +import comScrapDetailCardBatch from '@/pages/scrap/coms/comScrapDetailCardBatch.vue' import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() @@ -67,6 +73,9 @@ const businessTypeInfo = ref({}) const jobStatus = ref('') const comMessageRef = ref() const scanPopup = ref() +const managementType = ref('') +const jobStatus = ref('') +const fromLocationCode = ref('') onLoad((option) => { uni.setNavigationBarTitle({ title: `${option.title}详情` @@ -133,7 +142,7 @@ const receive = (callback) => { const getDetail = () => { proxy.$modal.loading('加载中...') getScrapJobDetail(id.value) - .then((res) => { + .then(async (res) => { uni.hideLoading() if (res.data == null) { showMessage('未获取到详情') @@ -141,7 +150,21 @@ const getDetail = () => { jobContent.value = res.data jobStatus.value = res.data.status subList.value = res.data.subList - detailSource.value = getDataSource(subList.value) + 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) { + this.managementList = res.list; + this.managementType = this.managementList.some(item => item.ManagementPrecision == + 'BY_BATCH') ? 'BY_BATCH' : '' + } + }) } else { showMessage('列表数据为0') } @@ -177,6 +200,7 @@ const getScanResult = (result) => { const itemStatus = getInventoryStatusName(itemDetail.inventoryStatus) if (itemDetail.inventoryStatus != result.balance.inventoryStatus) { if (jobContent.value.allowModifyInventoryStatus == 'TRUE') { + scanPopupLoseFocus() showQuestionMessage(`任务中允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,是否继续出库?`, (res) => { if (res) { itemDetail.scaned = true @@ -192,6 +216,7 @@ const getScanResult = (result) => { } }) } else { + scanPopupLoseFocus() showQuestionMessage(`任务中不允许修改库存状态,实际库存状态[${balanceStatus}]与推荐库存状态[${itemStatus}]不一致,不允许转移!`, (res) => { scanPopupGetFocus() }) @@ -238,17 +263,42 @@ 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) { + let tempHandleQty + if (cur.handleQty) { + tempHandleQty = cur.handleQty + } else { + tempHandleQty = 0 + } str += `包装号【${cur.packingNumber}】提交数量【${cur.handleQty}】与任务物料数量【${cur.qty}】不一致` } }) }) if (str) { - str += ',是否确认提交?' + str = '任务明细未全部完成,是否提交?\n'+str comMessageRef.value.showQuestionMessage1(str, 'red', res => { if (res) { submitJob() @@ -257,42 +307,35 @@ 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 = () => { +const submitJob = async () => { proxy.$modal.loading('提交中...') - // 没有目标库位,不查询管理模式 - const params = setParams() - scrapJobSubmit(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) + item.scaned = false + }) + await getManagementPrecisions(itemCodes, fromLocationCode.value, res => { + if (res.success) { + managementList.value = res.list; + // 没有目标库位,不查询管理模式 + const params = setParams() + scrapJobSubmit(params) + .then((res) => { + uni.hideLoading() + if (res.data) { + showCommitSuccessMessage(`提交成功
生成报废出库记录
${res.data}`) + } else { + showErrorMessage(`提交失败[${res.msg}]`) + } + }) + .catch((error) => { + uni.hideLoading() + showErrorMessage(error) + }) + } + }) } const setParams = () => { @@ -306,6 +349,10 @@ const setParams = () => { detail.toInventoryStatus = '' detail.toLocationCode = '' 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/scrap/record/scrapRecord.vue b/src/pages/scrap/record/scrapRecord.vue index 3323d750..aaf5f607 100644 --- a/src/pages/scrap/record/scrapRecord.vue +++ b/src/pages/scrap/record/scrapRecord.vue @@ -10,14 +10,11 @@ class='uni-data-picker' placeholder="请选择原因" popup-title="选择报废原因" :localdata="reasonList" @change="reasonChange"> --> - - - {{ reasonText }} - - + + - + @@ -76,7 +73,6 @@ const outInventoryStatus = ref('') // 来源出库库存状态 const businessType = ref({}) const reasonList = ref([]) const reasonText = ref('请选择') -const reasonCode = ref('') const comMessageRef = ref() const scanPopup = ref() const scanLocationCode = ref() @@ -130,13 +126,13 @@ const getScanResult = (result) => { const newDetail = createDetailInfo(balance, pack) item.subList.push(newDetail) } else if (detail.scaned == true) { - showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]已经在列表中`) + showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]重复扫描`) } } handleCalcHandleQty() } const showErrorMessage = (message) => { - comMessageRef.value.showErrorMessage(scanResult.message, (res) => { + comMessageRef.value.showErrorMessage(message, (res) => { if (res) { } }) @@ -185,18 +181,13 @@ const scanPopupGetFocus = () => { } const commit = () => { - if (reasonText.value == '') { - showErrorMessage('请先选择报废原因') - return - } - proxy.$modal.loading('提交中....') const params = setParams() scrapRecordSubmit(params) .then((res) => { uni.hideLoading() if (res.data) { - showCommitSuccessMessage(`提交成功
生成报废出库记录
${res.data}`) + showCommitSuccessMessage(`提交成功\n生成报废出库记录\n${res.data}`) } else { showErrorMessage(`提交失败[${res.msg}]`) } @@ -233,7 +224,7 @@ const setParams = () => { submitItem.fromLocationCode = detail.locationCode submitItem.toLocationCode = '' - submitItem.reason = reasonCode.value + submitItem.reason = reasonText.value submitItem.qty = detail.handleQty submitItem.package = '' subList.push(submitItem) @@ -287,17 +278,6 @@ const updateData = () => { } } } - -const reasonChange = (e) => { - console.log(e) - if (e.length == 0) { - reasonCode.value = '' - reasonText.value = '' - } else { - reasonCode.value = e[0].value - reasonText.value = e[0].label - } -}