diff --git a/src/pages/package/job/overPackageJob.vue b/src/pages/package/job/overPackageJob.vue index a1c1154d..48179e15 100644 --- a/src/pages/package/job/overPackageJob.vue +++ b/src/pages/package/job/overPackageJob.vue @@ -1,7 +1,9 @@ diff --git a/src/pages/package/job/overPackageJobDetail.vue b/src/pages/package/job/overPackageJobDetail.vue index bd61977f..83242f45 100644 --- a/src/pages/package/job/overPackageJobDetail.vue +++ b/src/pages/package/job/overPackageJobDetail.vue @@ -22,7 +22,7 @@ - + @@ -100,11 +100,15 @@ const comMessageRef = ref() const comOverPackJobDetailCardRef = ref() const managementList = ref([]) const printService = ref() +const scanMessage = ref('') +const fromLocationCode = ref('') onLoad((option) => { uni.setNavigationBarTitle({ title: `${option.title}详情` }) id.value = option.id + fromLocationCode.value = option.fromLocationCode; + scanMessage.value = option.scanMessage || ''; if (id.value != undefined) { // 新建的任务自动接收 if (option.status == '1') { @@ -173,6 +177,11 @@ const getDetail = () => { jobStatus.value = res.data.status subList.value = res.data.subList detailSource.value = getDataSource(detailSource.value, subList.value) + if (scanMessage.value) { + openScanPopupSimulate(scanMessage.value); + }else { + openScanDetailPopup() + } nextTick(() => { // if (uni.getStorageSync('overPackageJobDetailPointParams')) { // const overPackageJobDetailPointParams = uni.getStorageSync('overPackageJobDetailPointParams') @@ -195,6 +204,9 @@ const getDetail = () => { showErrorMessage(error) }) } +const openScanPopupSimulate = (scanMessage)=> { + comScanPackagePackRef.value.openScanPopupForJobSimulate(detailSource.value, jobContent.value, scanMessage); +} const closeScan = () => { resizeCollapse() } @@ -233,20 +245,43 @@ const submit = () => { // } } const checkSubmit = () => { - const tempHandleQty = detailSource.value[0].Items[0].Locations[0].Batchs[0].handleQty - const tempQty = detailSource.value[0].Items[0].Locations[0].Batchs[0].qty - const { toPackQty } = detailSource.value[0].Items[0].Locations[0].Batchs[0] - if (tempHandleQty == 0) { - showErrorMessage("实际数量为0,请先扫描数据") - return - } - if (tempHandleQty > tempQty) { - // 大于需求数量 - showCommitMessage(`实际数量【${tempHandleQty}】大于需求数量` + `【${tempQty}】, 是否提交?`, tempHandleQty, toPackQty) - } else if (tempHandleQty < tempQty) { - showCommitMessage(`实际数量【${tempHandleQty}】小于需求数量` + `【${tempQty}】, 是否提交?`, tempHandleQty, toPackQty) - } else { - packageHint(tempHandleQty, toPackQty) + let str="" + detailSource.value.forEach(detail => { + detail.Items.forEach(item => { + let taskQty = 0; + item.taskQty = calc.add(taskQty,item.qty) + let totalQty = 0; + item.Locations.forEach(lco => { + lco.Batchs.forEach(batch => { + batch.Records.forEach(record => { + if(record){ + let hanleQty =record.qty?record.qty:0 + totalQty = calc.add(totalQty,hanleQty) + } + + }) + }) + }) + //实际扫描的数量 + item.totalQty =totalQty + }) + }) + + //如果允许部分提交任务有扫描记录就可以直接提交;如果不允许部分执行,任务数量和提交数量不一致给出提示 + detailSource.value.forEach(detail=>{ + detail.Items.forEach(item=>{ + if(item.taskQty!=item.totalQty){ + str += `物料号【${item.itemCode}】实际提交数量【${item.totalQty}】与任务数量【${item.taskQty}】与不一致\n` + } + }) + }) + let toPackQty = detailSource.value[0].Items[0].qty + let commitHandleQty = detailSource.value[0].Items[0].totalQty + if(str){ + str ="是否提交\n"+str + showCommitMessage(str,commitHandleQty,toPackQty) + }else { + packageHint(commitHandleQty, toPackQty) } } const packageHint = (tempHandleQty, toPackQty) => { @@ -299,7 +334,7 @@ const submitJob = () => { barcodeBase64: '', }) }) - showCommitSuccessMessage("提交成功
生成翻包记录
", list) + showCommitSuccessMessage("提交成功\n生成翻包记录\n", list) } else { showErrorMessage("提交失败[" + res.msg + "]") @@ -354,6 +389,12 @@ const setParams = () => { }) subList.push(deepCopyData(subItem)) } + let itemInfo = subList.find(r => r.itemCode == subItem.itemCode&& r.fromLocationCode == subItem.fromLocationCode); + if(itemInfo){ + itemInfo.recordList.push(...subItem.recordList) + }else { + subList.push(deepCopyData(subItem)); + } } }) }) @@ -452,6 +493,9 @@ const showCommitSuccess = () => { const showCommitSuccessMessage = (hint, pointData) => { comMessageRef.value.showSuccessMessage(hint, (res) => { if (pointData.length > 0) { + pointData.forEach(item=>{ + item.fromLocationCode = fromLocationCode.value + }) uni.redirectTo({ url: `/pages/point/index?points=${JSON.stringify(pointData)}` })