From 45ea5a4f8201d6f0e60ddac4a47452de1d6d4678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Mon, 15 May 2023 15:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E9=83=A8=E7=A0=81=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/itextpdf/itextpdf.js | 18 +++++ .../basic/business/stockOrderQRCodeDetail.vue | 76 +++++++++++++++++- src/views/inventory/inner/innerCodeDetail.vue | 79 ++++++++++++++++++- 3 files changed, 168 insertions(+), 5 deletions(-) diff --git a/src/api/itextpdf/itextpdf.js b/src/api/itextpdf/itextpdf.js index c45faa3a..d7e09b78 100644 --- a/src/api/itextpdf/itextpdf.js +++ b/src/api/itextpdf/itextpdf.js @@ -71,6 +71,24 @@ export function stockQRCodeTextPDFFromTemplateFile(query) { responseType: 'arraybuffer', //一定要设置响应类型,否则页面会是空白pdf }); } + +//---------打印码 +export function inspectionStockQRCodeTextPDFFromTemplateStatementFile(query) { + return axios({ + url: "/udiwms/pdf/template/inspection/stock/qrcode/text/statement/file", + method: "post", + data: query, + }); +} +export function stockQRCodeTextPDFFromTemplateStatementFile(query) { + return axios({ + url: "/udiwms/pdf/template/stock/qrcode/text/statement/file", + method: "post", + data: query, + headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}, + responseType: 'arraybuffer', //一定要设置响应类型,否则页面会是空白pdf + }); +} export function stockQRCodeTextPDFFromTemplateFileMax(query) { return axios({ url: "/udiwms/pdf/template/stock/qrcode/text/maxfile", diff --git a/src/views/basic/business/stockOrderQRCodeDetail.vue b/src/views/basic/business/stockOrderQRCodeDetail.vue index 4cd5601a..979b4400 100644 --- a/src/views/basic/business/stockOrderQRCodeDetail.vue +++ b/src/views/basic/business/stockOrderQRCodeDetail.vue @@ -76,6 +76,13 @@ >标签打印 + 报表打印 + @@ -158,7 +165,11 @@ import { filterTemp, inspectionOrderDetailPDFFromTemplateFile, inspectionStockQRCodeTextPDFFromTemplateFile, - orderDetailPDFFromTemplateFile, stockQRCodeTextPDFFromTemplateFile, stockQRCodeTextPDFFromTemplateFileMax + inspectionStockQRCodeTextPDFFromTemplateStatementFile, + orderDetailPDFFromTemplateFile, + stockQRCodeTextPDFFromTemplateFile, + stockQRCodeTextPDFFromTemplateFileMax, + stockQRCodeTextPDFFromTemplateStatementFile } from "@/api/itextpdf/itextpdf"; import {generateInCodeQRCodeText, generateInnerQRCodeText} from "@/api/inout/innerOrderQRCode"; @@ -392,6 +403,69 @@ export default { this.loading = false; }); }, + printStockOrderDetailStatementPDF(row) { + let tQuery = { + queryId: null, + orderId: null, + countList: [], + labelId: 5 + }; + if (row == null) { + tQuery.orderId = this.query.orderIdFk; + } else { + if (row.reCount <= 0) { + return this.$message.error('数量错误'); + } + tQuery.queryId = row.id; + } + this.loading = true; + inspectionStockQRCodeTextPDFFromTemplateStatementFile(tQuery).then((response) => { + if (response.code === 20000) { + if (row != null) { + tQuery.id = row.id; + tQuery.rowCount = row.reCount; + let data = { + queryId: row.id, + rowCount: row.count + } + tQuery.countList.push(data); + } else { + for (let i = 0; i < this.codeArray.length; i++) { + let data = { + queryId: this.codeArray[i].id, + rowCount: this.codeArray[i].count + } + tQuery.countList.push(data); + } + } + let count = 0; + for (let i = 0; i < tQuery.countList.length; i++) { + + count = count + tQuery.countList[i].rowCount; + console.log(count); + } + stockQRCodeTextPDFFromTemplateStatementFile(tQuery).then((response) => { + //将pdf文件转换为url。 + const binaryData = []; + binaryData.push(response); + //获取blob链接。 + let url = window.URL.createObjectURL( + new Blob(binaryData, {type: "application/pdf"}) + ); + this.loading = false; + window.open(url);//打开新标签页,预览pdf。 + this.getOrderQRCodeTextList(); + }).catch(() => { + this.loading = false; + }); + } else { + this.loading = false; + this.$message.error(response.message); + } + }).catch(() => { + this.loading = false; + }); + }, getBusType() { let query = { enabled: true, diff --git a/src/views/inventory/inner/innerCodeDetail.vue b/src/views/inventory/inner/innerCodeDetail.vue index c8e28584..3d92bcf0 100644 --- a/src/views/inventory/inner/innerCodeDetail.vue +++ b/src/views/inventory/inner/innerCodeDetail.vue @@ -87,6 +87,13 @@ >标签打印 + 报表打印 + @@ -164,8 +171,8 @@ import {stockQRCodeText, filterPrint, generateInnerQRCodeText} from "@/api/inout/innerOrderQRCode"; import draggable from "vuedraggable"; import { - filterTemp, inspectionStockQRCodeTextPDFFromTemplateFile, - stockQRCodeTextPDFFromTemplateFile, stockQRCodeTextPDFFromTemplateFileMax + filterTemp, inspectionStockQRCodeTextPDFFromTemplateFile, inspectionStockQRCodeTextPDFFromTemplateStatementFile, + stockQRCodeTextPDFFromTemplateFile, stockQRCodeTextPDFFromTemplateFileMax, stockQRCodeTextPDFFromTemplateStatementFile } from "@/api/itextpdf/itextpdf"; @@ -273,7 +280,7 @@ export default { getOrderQRCodeTextList() { this.loading = true; - filterPrint({sOrderId :this.query.sOrderId}) //查找该单号下的所有条码 + filterPrint({sOrderId: this.query.sOrderId}) //查找该单号下的所有条码 .then((response) => { console.log(response) this.codeArray = response.data.list || []; @@ -291,7 +298,7 @@ export default { queryId: null, orderId: null, countList: [], - labelId:1 + labelId: 1 }; if (row == null) { tQuery.orderId = this.query.orderIdFk; @@ -371,6 +378,70 @@ export default { }); }, + printStockOrderDetailStatementPDF(row) { + let tQuery = { + queryId: null, + orderId: null, + countList: [], + labelId: 5 + }; + if (row == null) { + tQuery.orderId = this.query.orderIdFk; + } else { + if (row.reCount <= 0) { + return this.$message.error('数量错误'); + } + tQuery.queryId = row.id; + } + this.loading = true; + inspectionStockQRCodeTextPDFFromTemplateStatementFile(tQuery).then((response) => { + if (response.code === 20000) { + if (row != null) { + tQuery.id = row.id; + tQuery.rowCount = row.reCount; + let data = { + queryId: row.id, + rowCount: row.count + } + tQuery.countList.push(data); + } else { + for (let i = 0; i < this.codeArray.length; i++) { + let data = { + queryId: this.codeArray[i].id, + rowCount: this.codeArray[i].count + } + tQuery.countList.push(data); + } + } + let count = 0; + for (let i = 0; i < tQuery.countList.length; i++) { + + count = count + tQuery.countList[i].rowCount; + console.log(count); + } + stockQRCodeTextPDFFromTemplateStatementFile(tQuery).then((response) => { + //将pdf文件转换为url。 + const binaryData = []; + binaryData.push(response); + //获取blob链接。 + let url = window.URL.createObjectURL( + new Blob(binaryData, {type: "application/pdf"}) + ); + this.loading = false; + window.open(url);//打开新标签页,预览pdf。 + this.getOrderQRCodeTextList(); + }).catch(() => { + this.loading = false; + }); + } else { + this.loading = false; + this.$message.error(response.message); + } + }).catch(() => { + this.loading = false; + }); + }, + generateQRCodeText() { this.$confirm("确定生成内部码?", "提示", { confirmButtonText: "确定",