diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRecordMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRecordMain/index.vue index 5d137d630..5ee108742 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRecordMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRecordMain/index.vue @@ -149,6 +149,7 @@ import { formatDate } from '@/utils/formatTime' import { usePageLoading } from '@/hooks/web/usePageLoading' import * as SupplierdeliverRequestMainApi from '@/api/wms/supplierdeliverRequestMain' import { SupplierdeliverRequestMainRules } from '../supplierdeliverRequestMain/supplierdeliverRequestMain.data' +import { log } from 'console' const { loadStart, loadDone } = usePageLoading() // 供应商发货记录主 defineOptions({ name: 'SupplierdeliverRecordMain' }) @@ -236,8 +237,10 @@ const buttonTableClick = async (val, row) => { if (val == 'generateApplication') { handlerCreatePurchasereceiptRequest(row.number) } else if (val == 'documentPrint') { + console.log('ye',); + // 单据打印 - handleDocumentPrint(row.masterId) + handleDocumentPrint(row.masterId, row.supplierCode, row.deliNo) } } @@ -256,41 +259,88 @@ const handlerCreatePurchasereceiptRequest = async (number: string) => { } // 单据打印 -const BASE_URL = getJmreportBaseUrl() +// const BASE_URL = getJmreportBaseUrl() // 品番状态是“补给品”和其余状态 的发货单模版 -const documentSrc = ref(BASE_URL + '/jmreport/view/1019060741381099520?token=' + getAccessToken()) +// const documentSrc = ref(BASE_URL + '/jmreport/view/1019060741381099520?token=' + getAccessToken()) // 品番状态是号试显示生准订单的发货单模版 -const documentSrc2 = ref(BASE_URL + '/jmreport/view/1019406772438372352?token=' + getAccessToken()) +// const documentSrc2 = ref(BASE_URL + '/jmreport/view/1019406772438372352?token=' + getAccessToken()) -const handleDocumentPrint = async (id) => { +const handleDocumentPrint = async (id, supplierCode, deliNo) => { + console.log('wolaile ') + console.log(supplierCode) + console.log(deliNo) await SupplierdeliverRecordMainApi.getPoLineType(id).then(async (res) => { if (res.isM && res.haveNOM == false) { //号试(生准订单)模板 - window.open(documentSrc2.value + '&id=' + id + '&type=' + 'M') + // window.open(documentSrc2.value + '&id=' + id + '&type=' + 'M') + supplierdeliverJasperExportPS(id, 'M', supplierCode, deliNo) } if (res.isM && res.haveNOM && res.noMAndItemStatus == '生准订单') { //号试(生准订单)模板 - window.open(documentSrc2.value + '&id=' + id ) + // window.open(documentSrc2.value + '&id=' + id ) + supplierdeliverJasperExportPS(id, '', supplierCode, deliNo) } if (res.isM && res.haveNOM && res.noMAndItemStatus != '生准订单') { //(生准订单)模板 M型物料 - window.open(documentSrc.value + '&id=' + id+ '&type=' + 'M') - //(补给品订单)模板 - window.open(documentSrc.value + '&id=' + id+ '&type=' + 'noM') + //window.open(documentSrc.value + '&id=' + id+ '&type=' + 'M') + supplierdeliverJasperExport(id, 'M', supplierCode, deliNo) + //(补给品订单)模板 + //window.open(documentSrc.value + '&id=' + id+ '&type=' + 'noM') + supplierdeliverJasperExport(id, 'noM', supplierCode, deliNo) } if (res.isM == false) { await SupplierdeliverRecordMainApi.getItemStatus(id).then(async (res) => { if (res) { //号试(生准订单)模板 - window.open(documentSrc2.value + '&id=' + id) + //window.open(documentSrc2.value + '&id=' + id) + supplierdeliverJasperExportPS(id, '', supplierCode, deliNo) } else { - window.open(documentSrc.value + '&id=' + id) + //window.open(documentSrc.value + '&id=' + id) + supplierdeliverJasperExport(id, '', supplierCode, deliNo) } }) } }) } +const supplierdeliverJasperExport = async (id, type, supplierCode, deliNo) => { + try { + // 发起导出导出明细 + let params = { + id: id, + type: type, + pageNo: 1, + pageSize: 99999999 + } + const data = await PackageApi.supplierdeliverJasperExport(params) + download.excel( + data, + `【${supplierCode}】【${formatDate(new Date(), 'YYYY-MM-DD')}】【${deliNo}】.pdf` + ) + } catch { + } finally { + } +} + +const supplierdeliverJasperExportPS = async (id, type, supplierCode, deliNo) => { + try { + // 发起导出导出明细 + let params = { + id: id, + type: type, + pageNo: 1, + pageSize: 99999999 + } + const data = await PackageApi.supplierdeliverJasperExportPS(params) + download.excel( + data, + `【${supplierCode}】【${formatDate(new Date(), 'YYYY-MM-DD')}】【${deliNo}】.pdf` + ) + } catch { + } finally { + } +} + // 子包装数据 const detailParenPackingRef = ref() const { tableObject: detatableData, tableMethods: detatableMethods } = useTable({ diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue index 1f22a9284..e0d35b698 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/index.vue @@ -1116,7 +1116,7 @@ const genRecords = async (id: number) => { getLoading?.close() // 单据打印 - await handleDocumentPrint(res,id) + await handleDocumentPrint(res) }) .catch((err) => { getLoading?.close() @@ -1383,47 +1383,93 @@ const print = async () => { window.open(src.value + '&number=' + detatableData.tableList[0].number) } -// 单据打印 -// 品番状态是“补给品”和其余状态 的发货单模版 -const documentSrc = ref(BASE_URL + '/jmreport/view/1019060741381099520?token=' + getAccessToken()) -// 品番状态是号试显示生准订单的发货单模版 -const documentSrc2 = ref(BASE_URL + '/jmreport/view/1019406772438372352?token=' + getAccessToken()) -const handleDocumentPrint = async (id, stausId) => { - // await SupplierdeliverRequestMainApi.getItemStatus(stausId).then(async (res) => { - // if (res) { - // //号试(生准订单)模板 - // window.open(documentSrc2.value + '&id=' + id) - // } else { - // window.open(documentSrc.value + '&id=' + id) - // } - // }) +const handleDocumentPrint = async (id) => { await SupplierdeliverRecordMainApi.getPoLineType(id).then(async (res) => { if (res.isM && res.haveNOM == false) { //号试(生准订单)模板 - window.open(documentSrc2.value + '&id=' + id + '&type=' + 'M') + // window.open(documentSrc2.value + '&id=' + id + '&type=' + 'M') + supplierdeliverJasperExportPS(id, 'M') } if (res.isM && res.haveNOM && res.noMAndItemStatus == '生准订单') { //号试(生准订单)模板 - window.open(documentSrc2.value + '&id=' + id ) + // window.open(documentSrc2.value + '&id=' + id ) + supplierdeliverJasperExportPS(id, '') } if (res.isM && res.haveNOM && res.noMAndItemStatus != '生准订单') { //(生准订单)模板 M型物料 - window.open(documentSrc.value + '&id=' + id+ '&type=' + 'M') - //(补给品订单)模板 - window.open(documentSrc.value + '&id=' + id) + //window.open(documentSrc.value + '&id=' + id+ '&type=' + 'M') + supplierdeliverJasperExport(id, 'M') + //(补给品订单)模板 + //window.open(documentSrc.value + '&id=' + id+ '&type=' + 'noM') + supplierdeliverJasperExport(id, 'noM') } if (res.isM == false) { await SupplierdeliverRecordMainApi.getItemStatus(id).then(async (res) => { if (res) { //号试(生准订单)模板 - window.open(documentSrc2.value + '&id=' + id) + //window.open(documentSrc2.value + '&id=' + id) + supplierdeliverJasperExportPS(id, '') } else { - window.open(documentSrc.value + '&id=' + id) + //window.open(documentSrc.value + '&id=' + id) + supplierdeliverJasperExport(id, '') } }) } }) +} + +const supplierdeliverJasperExport = async (id, type) => { + try { + // 发起导出导出明细 + let params = { + id: id, + type: type, + pageNo: 1, + pageSize: 99999999 + } + let supplierCode='' ; + let deliNo ='' ; + await SupplierdeliverRecordMainApi.getSupplierdeliverRecordMain(id).then(async (res) => { + if (res) { + supplierCode = res.supplierCode; + deliNo = res.deliNo; + } + }) + const data = await PackageApi.supplierdeliverJasperExport(params) + download.excel( + data, + `【${supplierCode}】【${formatDate(new Date(), 'YYYY-MM-DD')}】【${deliNo}】.pdf` + ) + } catch { + } finally { + } +} +const supplierdeliverJasperExportPS = async (id, type) => { + try { + // 发起导出导出明细 + let params = { + id: id, + type: type, + pageNo: 1, + pageSize: 99999999 + } + let supplierCode='' ; + let deliNo ='' ; + await SupplierdeliverRecordMainApi.getSupplierdeliverRecordMain(id).then(async (res) => { + if (res) { + supplierCode = res.supplierCode; + deliNo = res.deliNo; + } + }) + const data = await PackageApi.supplierdeliverJasperExportPS(params) + download.excel( + data, + `【${supplierCode}】【${formatDate(new Date(), 'YYYY-MM-DD')}】【${deliNo}】.pdf` + ) + } catch { + } finally { + } } /**