From a24be13bec2d7da5e0632242468c6122a0161a35 Mon Sep 17 00:00:00 2001 From: youjianchi Date: Fri, 9 Feb 2024 10:03:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=88=86=E6=94=AF=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 4 +- ruoyi-admin/src/main/resources/logback.xml | 3 +- ruoyi-common/pom.xml | 4 +- .../ruoyi/common/utils/BartenderUtils.java | 192 +++++++++--------- 4 files changed, 102 insertions(+), 101 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 73fdc014..6bb42118 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -9,8 +9,8 @@ ruoyi: # 实例演示开关 demoEnabled: false # 文件路径 示例( Windows配置c:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) -# profile: /Users/xiguniang/Documents/ruoyi/uploadPath - profile: /home/ruoyi/uploadPath + profile: /Users/xiguniang/Documents/ruoyi/uploadPath +# profile: /home/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback.xml index 5c5c6f8f..fdbcdcdb 100644 --- a/ruoyi-admin/src/main/resources/logback.xml +++ b/ruoyi-admin/src/main/resources/logback.xml @@ -1,7 +1,8 @@ - + + diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 5c0cb2bd..dd6050e7 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -24,11 +24,11 @@ - + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/BartenderUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/BartenderUtils.java index 0ad4a4b0..7c89fc05 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/BartenderUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/BartenderUtils.java @@ -1,96 +1,96 @@ -package com.ruoyi.common.utils; - -import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; -import com.jacob.com.Dispatch; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.lang.reflect.Field; -import java.util.List; - -@Component -public class BartenderUtils { - - public BartenderUtils() { - // TODO Auto-generated constructor stub - } - - public static int printQRcodeLabel(List valueArray) { - int result=1; - // 要运行COM组件,需要先将jacob-1.19-x64.dll放到jdk的bin目录下,不然会报错。如果是32位jdk放入32位的dll文件 - ComThread.InitSTA(); - // 加载Bartender进程,需要先安装Bartender,我安装的是BT2019R4版本。 - ActiveXComponent btApp = new ActiveXComponent("BarTender.Application"); - System.out.println(valueArray); - - // 加载Bartender模板控件 - Dispatch btFormats = btApp.getProperty("Formats").toDispatch(); - /** - * format方法: 1、 Print方法:这个就是最常用的打印方法,里面可设置打印的任务名,是否等待打印完成,等待超时时间,打印过程输出的信息。 2、 - * PrintOut方法:如果你需要在打印时出现打印设置对话框和状态框,你可以选择这个方法来实现。 3、Save方法:保存对Format的更改。 - * 4、SetNamedSubStringValue方法:设置某个特定的SubString的值,这里就可以作为一个动态改变打印内容的方法。 - * 5、SetPromt方法:跟SetNamedSubStringValue方法类似,不过他设置的是打印提示的值,某些标签通过设置可以在打印的时候弹出对话框,输入某些变量的值来改变打印内容,这个方法就是动态设置这些变量的。不过在集成中比较少用。 - * 6、IdenticalCopiesOfLabel属性:这个是设置打印时要打印多少份相同的标签的,默认为标签设置。 - * 7、NumberSerializedLabels属性:这个是序列化打印时使用的,当你的标签启动了序列化后,这个属性代表的就是打印的份数,譬如你的序列化初始数据是1,增量为1,NumberSerializedLabels设置为5,那么就会打印出1、2、3、4、5,五个标签出来。 - * 8、Printer属性:指定要使用的打印机,默认为软件指定的默认打印机。 - * 9、PrintToFile属性:标示是马上用打印机打印出实物,还是生成一个打印文件。 - */ - - try { - //File file = ResourceUtils.getFile("classpath:static/ruiyi/code.btw"); -// File file = ResourceUtils.getFile("classpath:static/ruiyi/code2.btw"); -// ClassPathResource classPathResource = new ClassPathResource("static/ruiyi/code2.btw"); - File file=new File("D:\\work\\code2.btw"); - if(file.exists()) { - // 调用模板 - - Dispatch btFormat = Dispatch.call(btFormats, "Open", - file.getPath(), false, "") - .toDispatch(); - List codeList= (List) valueArray.get(0); - - for(int i=0;i valueArray) { +// int result=1; +// // 要运行COM组件,需要先将jacob-1.19-x64.dll放到jdk的bin目录下,不然会报错。如果是32位jdk放入32位的dll文件 +// ComThread.InitSTA(); +// // 加载Bartender进程,需要先安装Bartender,我安装的是BT2019R4版本。 +// ActiveXComponent btApp = new ActiveXComponent("BarTender.Application"); +// System.out.println(valueArray); +// +// // 加载Bartender模板控件 +// Dispatch btFormats = btApp.getProperty("Formats").toDispatch(); +// /** +// * format方法: 1、 Print方法:这个就是最常用的打印方法,里面可设置打印的任务名,是否等待打印完成,等待超时时间,打印过程输出的信息。 2、 +// * PrintOut方法:如果你需要在打印时出现打印设置对话框和状态框,你可以选择这个方法来实现。 3、Save方法:保存对Format的更改。 +// * 4、SetNamedSubStringValue方法:设置某个特定的SubString的值,这里就可以作为一个动态改变打印内容的方法。 +// * 5、SetPromt方法:跟SetNamedSubStringValue方法类似,不过他设置的是打印提示的值,某些标签通过设置可以在打印的时候弹出对话框,输入某些变量的值来改变打印内容,这个方法就是动态设置这些变量的。不过在集成中比较少用。 +// * 6、IdenticalCopiesOfLabel属性:这个是设置打印时要打印多少份相同的标签的,默认为标签设置。 +// * 7、NumberSerializedLabels属性:这个是序列化打印时使用的,当你的标签启动了序列化后,这个属性代表的就是打印的份数,譬如你的序列化初始数据是1,增量为1,NumberSerializedLabels设置为5,那么就会打印出1、2、3、4、5,五个标签出来。 +// * 8、Printer属性:指定要使用的打印机,默认为软件指定的默认打印机。 +// * 9、PrintToFile属性:标示是马上用打印机打印出实物,还是生成一个打印文件。 +// */ +// +// try { +// //File file = ResourceUtils.getFile("classpath:static/ruiyi/code.btw"); +//// File file = ResourceUtils.getFile("classpath:static/ruiyi/code2.btw"); +//// ClassPathResource classPathResource = new ClassPathResource("static/ruiyi/code2.btw"); +// File file=new File("D:\\work\\code2.btw"); +// if(file.exists()) { +// // 调用模板 +// +// Dispatch btFormat = Dispatch.call(btFormats, "Open", +// file.getPath(), false, "") +// .toDispatch(); +// List codeList= (List) valueArray.get(0); +// +// for(int i=0;i