From 7e08a2086d3049a3af51e460d19c56aa7380048f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=AE=8F=E6=96=8C?= <2164406372@qq.com> Date: Fri, 15 Aug 2025 10:10:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=BF=94=E5=B7=A5=E8=BF=94?= =?UTF-8?q?=E4=BF=AE=E6=8A=A5=E5=B7=A5=20=20=E6=A0=87=E7=AD=BE=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../print/printPackageLabelNoPreview2.js | 124 ++++++++++++++++++ src/views/modules/production/reworkRecord.vue | 13 +- 2 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 src/views/modules/print/printPackageLabelNoPreview2.js diff --git a/src/views/modules/print/printPackageLabelNoPreview2.js b/src/views/modules/print/printPackageLabelNoPreview2.js new file mode 100644 index 0000000..a0512d2 --- /dev/null +++ b/src/views/modules/print/printPackageLabelNoPreview2.js @@ -0,0 +1,124 @@ +/*调用js打印标签*/ +import getLodop from '@/utils/LodopFuncs.js' +/*打印材料卷标签*/ +export function printPackageLabelNoPreview2(printList) { + const LODOP = getLodop() + if (LODOP) { + //LODOP.SET_LICENSES("", "AF8A5800B84BCC5218BCF67B92627BEA", "", ""); + LODOP.SET_LICENSES("", "AF8A5800B823CC8E18BCF67B925E7BF0", "", ""); + // LODOP.SET_PRINTER_INDEXA("小标签打印机"); + //循环调用打印机 + for(let i = 0; i < printList.length; i++){ + let printData = printList[i]; + LODOP.NewPage(); + LODOP.SET_PRINT_PAGESIZE(0,1000,700,""); + // LODOP.ADD_PRINT_BARCODE(133,286,130,88,"QRCode",printData.partSpec); + LODOP.ADD_PRINT_BARCODE(133,286,130,88,"QRCode",`${printData.site};${printData.partNo};${printData.unitQty};${printData.seqNo};${printData.printId};${isNaN(printData.tcpValue)?'':printData.tcpValue}`); + LODOP.ADD_PRINT_TEXT(93,18,123,25,"Product No:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(94,141,241,25,printData.partSpec); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(153,18,128,24,"Cust.P/O:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(153,141,145,25,printData.orderRef4); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(115,18,123,25,"FQC:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(115,141,111,25,printData.inspector); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(175,18,125,25,"MFG Lot:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(175,141,142,25,printData.batchNo); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(67,18,121,25,"Product Desc:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(67,141,243,24,printData.partDesc); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",10); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.SET_PRINT_STYLEA(0,"LineSpacing",-5); + LODOP.ADD_PRINT_TEXT(197,18,128,25,"R-work Date:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(197,141,144,25,printData.receiveDate); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(216,18,191,19,"Manufactured by "+printData.keyInfoStr2); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",7); + LODOP.ADD_PRINT_TEXT(24,212,149,20,"IATF:16949 Certified"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",7); + LODOP.SET_PRINT_STYLEA(0,"Alignment",3); + LODOP.ADD_PRINT_TEXT(135,18,58,25,"Q.T.Y:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",11); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_LINE(37,12,36,364,0,1); + LODOP.ADD_PRINT_LINE(216,12,215,364,0,1); + LODOP.ADD_PRINT_TEXT(135,141,120,25,printData.unitQty + printData.umid); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(217,243,130,20,"Vendor I.D.:"+printData.siteName); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",7); + LODOP.ADD_PRINT_TEXT(228,18,348,30,printData.siteAdress); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",7); + LODOP.ADD_PRINT_TEXT(250,18,351,20,printData.sitePhone); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",7); + LODOP.ADD_PRINT_TEXT(41,18,143,25,"Product Code:"); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + LODOP.ADD_PRINT_TEXT(113,229,144,26,"Job No:"+printData.seqNo); + LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + LODOP.SET_PRINT_STYLEA(0,"Alignment",3); + LODOP.SET_PRINT_STYLEA(0,"Bold",1); + // LODOP.ADD_PRINT_TEXT(92,274,99,25,"BAG:"+printData.tcpValue+"g"); + // LODOP.SET_PRINT_STYLEA(0,"FontName","Arial"); + // LODOP.SET_PRINT_STYLEA(0,"FontSize",12); + // LODOP.SET_PRINT_STYLEA(0,"Alignment",3); + // LODOP.SET_PRINT_STYLEA(0,"Bold",1); + if(printData.code==='CODE128') { + LODOP.ADD_PRINT_BARCODE(40,143,236,23, "128A",printData.partSpec); + }else { + LODOP.ADD_PRINT_BARCODE(40,143,236,23, "Code39",printData.partSpec); + } + LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0); + // LODOP.ADD_PRINT_IMAGE(4,18,114,31,""); + LODOP.ADD_PRINT_IMAGE(4,18,114,31,``); + // LODOP.ADD_PRINT_IMAGE(4,18,114,31,``); + LODOP.SET_PRINT_STYLEA(0,"Stretch",1); + } + + // LODOP.PRINT_DESIGN(); + // LODOP.PREVIEW(); + LODOP.PRINT(); + // console.log("操作成功!") + } +} + diff --git a/src/views/modules/production/reworkRecord.vue b/src/views/modules/production/reworkRecord.vue index 05be58d..6134c57 100644 --- a/src/views/modules/production/reworkRecord.vue +++ b/src/views/modules/production/reworkRecord.vue @@ -16,7 +16,9 @@ import { import dayjs from 'dayjs' import decimal, {Decimal} from 'decimal.js' import {printPackageLabelNoPreview} from "../print/print_package_label-NOOREVIEW"; +import {printPackageLabelNoPreview2} from "../print/printPackageLabelNoPreview2"; import {format} from "nightwatch/lib/util/utils"; +import {formatDate} from "element-ui/src/utils/date-util"; export default { components:{ chooseList, @@ -136,14 +138,13 @@ export default { }) }, printLabel2(row){ - // this.$message.success(row) row.printQty = row.qualifiedQty packagePrintDataList(row).then(({data}) => { if (data && data.code === 0) { data.rows[0].tcpValue = 0 data.rows[0].inspector = row.operatorId - // data.rows[0].receiveDate = row.createTime - printPackageLabelNoPreview(data.rows) + data.rows[0].receiveDate = row.reportingTime.toString().substring(0, 10) + printPackageLabelNoPreview2(data.rows) } else { this.$message.warning(data.msg) } @@ -235,7 +236,7 @@ export default { console.log("***"+this.saveRework.seqNo) //打印功能 this.unitQty = this.saveRework.qualifiedQty - this.createTime2 = this.saveRework.createTime2 + this.createTime2 = this.saveRework.reworkEndDate this.operatorId = this.saveRework.operatorId this.getSOScheduleRoutingData(this.saveRework.seqNo) this.selectRework(); @@ -331,13 +332,13 @@ export default { getPackagePrintDataList(params).then(({data}) => { this.printDataList = data.rows this.printDataList.forEach(item => { - item.receiveDate = this.createTime2 + item.receiveDate = formatDate(this.createTime2, 'yyyy-MM-dd') item.inspector = this.operatorId item.unitQty = this.unitQty item.tcpValue = 0 }) if (data && data.code === 0) { - printPackageLabelNoPreview(this.printDataList); + printPackageLabelNoPreview2(this.printDataList); } else { this.$message.warning(data.msg) }