From f537251010e0a457da43fc717d39babdb4ec153b Mon Sep 17 00:00:00 2001 From: linfso Date: Fri, 7 Jun 2024 10:26:05 +0800 Subject: [PATCH] md --- src/utils/TanexPrinterSdk.js | 37 +++++----- .../emis/EmisBaseTools/TanexPrinterPanel.vue | 67 ++++++++++++++----- .../emis/emisWaybill/A4WaybillIPrinted.vue | 10 +-- .../emis/emisWaybill/waybillIsPrinted.vue | 12 ++-- src/views/emis/emisWaybill/waybillRecord.vue | 2 +- 5 files changed, 86 insertions(+), 42 deletions(-) diff --git a/src/utils/TanexPrinterSdk.js b/src/utils/TanexPrinterSdk.js index 6894cf7e..5411f53d 100644 --- a/src/utils/TanexPrinterSdk.js +++ b/src/utils/TanexPrinterSdk.js @@ -159,12 +159,12 @@ class TanexPrinterSdk { } // 批量获取PDF文件 - batchGetPDF(tplCode,printerName,orderList,callback){ + batchGetPDF(tplCode,printerName,orderList,printManCode,callback){ if(tplCode&&printerName&&orderList&&orderList.length>0){ this.setOnBatchGetPDF(callback); // 超时计算 let that = this; - this.sendBatchGetPDFCMD(tplCode,printerName,orderList); + this.sendBatchGetPDFCMD(tplCode,printerName,orderList,printManCode); // this.recievePdfFileTimer = setTimeout(function(){ // if(that.onBatchGetPDFCallback!=null){ @@ -177,7 +177,7 @@ class TanexPrinterSdk { } } - batchGetPDFAdv(printDataList,billCount,callback){ + batchGetPDFAdv(printDataList,billCount,printManCode,callback){ if(printDataList&&printDataList.length>0){ if(callback){ this.setOnBatchGetPDF(callback); @@ -185,7 +185,7 @@ class TanexPrinterSdk { let that=this; - this.sendBatchGetPDFAdvCMD(printDataList,billCount); + this.sendBatchGetPDFAdvCMD(printDataList,billCount,printManCode); // this.recievePdfFileTimer = setTimeout(function(){ // if(that.onBatchGetPDFCallback!=null){ @@ -199,16 +199,16 @@ class TanexPrinterSdk { } // 批量打印 - batchPrint(tplCode,printerName,orderList){ + batchPrint(tplCode,printerName,orderList,printManCode){ if(tplCode&&printerName&&orderList&&orderList.length>0){ - this.sendBatchPrintCMD(tplCode,printerName,orderList); + this.sendBatchPrintCMD(tplCode,printerName,orderList,printManCode); } } // 高级打印接口,多个模版 - batchPrintAdv(printDataList){ + batchPrintAdv(printDataList,printManCode){ if(printDataList&&printDataList.length>0){ - this.sendBatchPrintAdvCMD(printDataList); + this.sendBatchPrintAdvCMD(printDataList,printManCode); } } @@ -238,13 +238,16 @@ class TanexPrinterSdk { - sendBatchPrintAdvCMD(printDataList){ + sendBatchPrintAdvCMD(printDataList,printManCode){ // {"CMD":"batchPrint","status":"1","Data":["DT20210901001","DT20210901002"]} var printCmd={}; printCmd['RequestId']=this.getRequestId(); printCmd['CMD']="batchPrint"; printCmd['Status']="1"; if(printDataList && printDataList.length>0){ + printDataList.forEach(item=>{ + item["printManCode"]=printManCode; + }); printCmd['Data']=printDataList this.send(JSON.stringify(printCmd),null); } @@ -270,13 +273,17 @@ class TanexPrinterSdk { // } } - sendBatchGetPDFAdvCMD(printDataList,billCount){ + sendBatchGetPDFAdvCMD(printDataList,billCount,printManCode){ // {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]} var printCmd={}; printCmd['RequestId']=this.getRequestId(); printCmd['CMD']="batchGetPDF"; printCmd['Status']="1"; if(printDataList && printDataList.length>0){ + printDataList.forEach(item=>{ + item["printManCode"]=printManCode; + }); + printCmd['Data']=printDataList this.recievePdfFileList = []; this.pdfFileReceiveMap=new Map(); @@ -286,7 +293,7 @@ class TanexPrinterSdk { } - sendBatchPrintCMD(tplCode,printerName,orderList){ + sendBatchPrintCMD(tplCode,printerName,orderList,printManCode){ // {"CMD":"batchPrint","status":"1","Data":["DT20210901001","DT20210901002"]} var printCmd={}; printCmd['RequestId']=this.getRequestId(); @@ -296,16 +303,16 @@ class TanexPrinterSdk { let printData=[{ "tplCode":tplCode, "printerName":printerName, - "printManCode":this.$store.getters.empCode, + "printManCode":printManCode, "orderList":orderList.toString() }] printCmd['Data']=printData - // console.log(JSON.stringify(printCmd)); + console.log(JSON.stringify(printCmd)); this.send(JSON.stringify(printCmd),null); } } - sendBatchGetPDFCMD(tplCode,printerName,orderList){ + sendBatchGetPDFCMD(tplCode,printerName,orderList,printManCode){ // {"CMD":"batchGetPDF","status":"1","Data":["DT20210901001","DT20210901002"]} var printCmd={}; printCmd['RequestId']=this.getRequestId(); @@ -315,7 +322,7 @@ class TanexPrinterSdk { let printData=[{ "tplCode":tplCode, "printerName":printerName, - "printManCode":this.$store.getters.empCode, + "printManCode":printManCode, "orderList":orderList.toString() }] diff --git a/src/views/emis/EmisBaseTools/TanexPrinterPanel.vue b/src/views/emis/EmisBaseTools/TanexPrinterPanel.vue index 7cf282ac..6f69e8a3 100644 --- a/src/views/emis/EmisBaseTools/TanexPrinterPanel.vue +++ b/src/views/emis/EmisBaseTools/TanexPrinterPanel.vue @@ -103,11 +103,6 @@ required: false, default: false }, - isInitA4:{ - type: [Boolean], - required: false, - default: false - }, }, data() { return { @@ -116,6 +111,9 @@ subBillEnd:null, openPdfView:false, + isInitA4:false, + printManCode:this.$store.getters.empCode, + // 计数器 showCounter:0, @@ -242,16 +240,22 @@ return; } - this.tanexPrinter.batchPrintAdv(printDataList); + this.isInitA4=false; + + this.tanexPrinter.batchPrintAdv(printDataList,this.printManCode); }, - batchPrint(orderList,tplCode){ + batchPrint(orderList,tplCode,isA4){ if(this.printerStatus !=1){ this.$modal.msgError("打印机未连接"); return; } + if(isA4){ + this.isInitA4=isA4; + } + let that = this; let newOrderList=[]; if(orderList){ @@ -262,9 +266,33 @@ this.selTplCode=tplCode } - newOrderList=[...orderList]; + // 打印子单 + if(this.selTplCode=="TAN-GC-130"){ + for(let i=0;i0){ + subBillStart=this.subBillStart; + } - that.tanexPrinter.batchPrint(that.selTplCode,that.selPrinterName,newOrderList) + let subBillEnd=50; + if(this.subBillEnd){ + subBillEnd = this.subBillEnd; + } + // 循环子单范围 + for(let i=subBillStart;i<=subBillEnd;i++){ + let subBillCode = billCode+""+this.lpadZero(i,4); + newOrderList.push(subBillCode); + } + + } + }else{ + newOrderList=[...orderList]; + } + + // newOrderList=[...orderList]; + + that.tanexPrinter.batchPrint(that.selTplCode,that.selPrinterName,newOrderList,this.printManCode) }, printPreviewAdv(printDataList,billCount){ @@ -274,6 +302,8 @@ return; } + this.isInitA4=false; + let that = this; const loadingInstance = this.$loading({ text: '正在生成预览...' @@ -281,7 +311,7 @@ that.pdfList=[]; that.showCounter=0; - this.tanexPrinter.batchGetPDFAdv(printDataList,billCount,async function(code,msg,data){ + this.tanexPrinter.batchGetPDFAdv(printDataList,billCount,this.printManCode,async function(code,msg,data){ if(code == 500){ that.$modal.msgError("打印出错:"+msg); } @@ -312,13 +342,17 @@ }); }, - printPreview(orderList){ + printPreview(orderList,isA4){ if(this.printerStatus !=1){ this.$modal.msgError("打印机未连接"); return; } + if(isA4){ + this.isInitA4=isA4; + } + let that = this; let newOrderList=[]; if(orderList){ @@ -355,14 +389,14 @@ that.pdfList=[]; that.showCounter=0; - this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,async function(code,msg,data){ + this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,async function(code,msg,data){ if(code == 500){ that.$modal.msgError("打印出错:"+msg); } else if(code == 200){ console.log("===获取到数据====>"); loadingInstance.close(); - + const pdfData=deepClone(data); let pdfInfo={ "billCode":pdfData.ydSn, @@ -386,13 +420,16 @@ } }); }, - downPDF(orderList){ + downPDF(orderList,isA4){ if(this.printerStatus !=1){ this.$modal.msgError("打印机未连接"); return; } + if(isA4){ + this.isInitA4=isA4; + } let that = this; let newOrderList=[]; @@ -427,7 +464,7 @@ const loadingInstance = this.$loading({ text: '正在下载...' }) - this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,function(code,msg,data){ + this.tanexPrinter.batchGetPDF(this.selTplCode,this.selPrinterName,newOrderList,this.printManCode,function(code,msg,data){ loadingInstance.close(); if(code == 500){ diff --git a/src/views/emis/emisWaybill/A4WaybillIPrinted.vue b/src/views/emis/emisWaybill/A4WaybillIPrinted.vue index 4bab2c40..50ea230f 100644 --- a/src/views/emis/emisWaybill/A4WaybillIPrinted.vue +++ b/src/views/emis/emisWaybill/A4WaybillIPrinted.vue @@ -138,10 +138,10 @@ - + - + @@ -626,7 +626,7 @@ export default { this.currentSelection.forEach(item=>{ orderList.push(item.billCode); }); - this.$refs.tanexPrinter.batchPrint(orderList); + this.$refs.tanexPrinter.batchPrint(orderList,null,true); }).catch(() => {}); }, @@ -635,14 +635,14 @@ export default { this.currentSelection.forEach(item=>{ orderList.push(item.billCode); }); - this.$refs.tanexPrinter.printPreview(orderList); + this.$refs.tanexPrinter.printPreview(orderList,true); }, handleDownPDF(){ let orderList=[]; this.currentSelection.forEach(item=>{ orderList.push(item.billCode); }); - this.$refs.tanexPrinter.downPDF(orderList); + this.$refs.tanexPrinter.downPDF(orderList,true); }, /** 查询运单列表列表 */ getList() { diff --git a/src/views/emis/emisWaybill/waybillIsPrinted.vue b/src/views/emis/emisWaybill/waybillIsPrinted.vue index b685170c..8497a2eb 100644 --- a/src/views/emis/emisWaybill/waybillIsPrinted.vue +++ b/src/views/emis/emisWaybill/waybillIsPrinted.vue @@ -45,7 +45,7 @@ /> --> -