From c6c02813c92ef2307be856626d4ce5feff272912 Mon Sep 17 00:00:00 2001 From: yinq Date: Thu, 7 Mar 2024 17:53:00 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E5=8E=9F=E6=9D=90=E6=96=99?= =?UTF-8?q?=E6=9D=A1=E7=A0=81=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/mes/api/domain/MesBaseBarcodeInfo.java | 12 + hw-api/hw-api-printer/pom.xml | 2 +- .../hw/printer/api/RemotePrinterService.java | 29 +++ .../factory/RemotePrinterFallbackFactory.java | 32 +++ ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../core/constant/ServiceNameConstants.java | 5 + hw-modules/hw-mes/pom.xml | 6 + .../MesBaseBarcodeInfoController.java | 11 +- .../service/IMesBaseBarcodeInfoService.java | 8 + .../impl/MesBaseBarcodeInfoServiceImpl.java | 45 ++++ .../mapper/mes/MesBaseBarcodeInfoMapper.xml | 125 +++++----- hw-modules/hw-printer/pom.xml | 70 +++++- .../hw-printer/src/main/java/com/hw/Main.java | 19 -- .../hw/printer/RuoYiPrinterApplication.java | 31 +++ .../printer/controller/PrinterController.java | 42 ++++ .../hw/printer/service/IPrinterService.java | 19 ++ .../printer/service/PrinterServiceImpl.java | 61 +++++ .../com/hw/printer/utils/HwPrintUtil.java | 215 ++++++++++++++++++ .../hw-printer/src/main/resources/banner.txt | 12 +- .../src/main/resources/files/Template.pdf | Bin 0 -> 10982 bytes .../src/main/resources/files/generatefile.pdf | Bin 0 -> 5569 bytes hw-ui/src/views/mes/barcode/index.vue | 7 +- 22 files changed, 657 insertions(+), 95 deletions(-) create mode 100644 hw-api/hw-api-printer/src/main/java/com/hw/printer/api/RemotePrinterService.java create mode 100644 hw-api/hw-api-printer/src/main/java/com/hw/printer/api/factory/RemotePrinterFallbackFactory.java create mode 100644 hw-api/hw-api-printer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hw-modules/hw-printer/src/main/java/com/hw/Main.java create mode 100644 hw-modules/hw-printer/src/main/java/com/hw/printer/RuoYiPrinterApplication.java create mode 100644 hw-modules/hw-printer/src/main/java/com/hw/printer/controller/PrinterController.java create mode 100644 hw-modules/hw-printer/src/main/java/com/hw/printer/service/IPrinterService.java create mode 100644 hw-modules/hw-printer/src/main/java/com/hw/printer/service/PrinterServiceImpl.java create mode 100644 hw-modules/hw-printer/src/main/java/com/hw/printer/utils/HwPrintUtil.java create mode 100644 hw-modules/hw-printer/src/main/resources/files/Template.pdf create mode 100644 hw-modules/hw-printer/src/main/resources/files/generatefile.pdf diff --git a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java index cb234d51..ece11aa0 100644 --- a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java +++ b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseBarcodeInfo.java @@ -59,6 +59,10 @@ public class MesBaseBarcodeInfo extends BaseEntity @Excel(name = "物料ID") private Long materialId; + /** 物料名称 */ + @Excel(name = "物料ID") + private String materialName; + /** 供应商ID */ @Excel(name = "供应商ID") private Long manufacturerId; @@ -131,6 +135,14 @@ public class MesBaseBarcodeInfo extends BaseEntity @Excel(name = "绑定托盘时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date bindTime; + public String getMaterialName() { + return materialName; + } + + public void setMaterialName(String materialName) { + this.materialName = materialName; + } + public String getPrintFlag() { return printFlag; } diff --git a/hw-api/hw-api-printer/pom.xml b/hw-api/hw-api-printer/pom.xml index c6d1b0cc..0c7ba419 100644 --- a/hw-api/hw-api-printer/pom.xml +++ b/hw-api/hw-api-printer/pom.xml @@ -20,7 +20,7 @@ com.hw - hw-common-core + hw-api-mes diff --git a/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/RemotePrinterService.java b/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/RemotePrinterService.java new file mode 100644 index 00000000..e01f6340 --- /dev/null +++ b/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/RemotePrinterService.java @@ -0,0 +1,29 @@ +package com.hw.printer.api; + +import com.hw.common.core.constant.SecurityConstants; +import com.hw.common.core.constant.ServiceNameConstants; +import com.hw.common.core.domain.R; +import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.printer.api.factory.RemotePrinterFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + + +@FeignClient(contextId = "remotePrinterService", value = ServiceNameConstants.PRINTER_SERVICE, fallbackFactory = RemotePrinterFallbackFactory.class) +public interface RemotePrinterService { + + /** + * 通过条码查询条码信息 + * + * @param barcodeInfo 条码信息 + * @param source 请求来源 + * @return 结果 + */ + @PostMapping("/printService/printBarCode") + public MesBaseBarcodeInfo printBarCode(@RequestBody MesBaseBarcodeInfo barcodeInfo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + + + + + +} diff --git a/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/factory/RemotePrinterFallbackFactory.java b/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/factory/RemotePrinterFallbackFactory.java new file mode 100644 index 00000000..2946547a --- /dev/null +++ b/hw-api/hw-api-printer/src/main/java/com/hw/printer/api/factory/RemotePrinterFallbackFactory.java @@ -0,0 +1,32 @@ +package com.hw.printer.api.factory; + +import com.hw.common.core.domain.R; + +import com.hw.common.core.exception.ServiceException; +import com.hw.printer.api.RemotePrinterService; +import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +/** + * 打印机服务降级处理 + * + * @author ruoyi + */ +@Component +public class RemotePrinterFallbackFactory implements FallbackFactory { + private static final Logger log = LoggerFactory.getLogger(RemotePrinterFallbackFactory.class); + + @Override + public RemotePrinterService create(final Throwable throwable) { + log.error("打印条码服务调用失败:{}", throwable.getMessage()); + return new RemotePrinterService() { + @Override + public MesBaseBarcodeInfo printBarCode(MesBaseBarcodeInfo barcodeInfo, String source) { + throw new ServiceException("打印条码服务调用异常:" + throwable.getMessage()); + } + }; + } +} diff --git a/hw-api/hw-api-printer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hw-api/hw-api-printer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..88431601 --- /dev/null +++ b/hw-api/hw-api-printer/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.hw.mes.api.factory.RemoteMesFallbackFactory diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java index 0c0b5234..60006cf9 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java @@ -47,4 +47,9 @@ public class ServiceNameConstants * System下common服务的serviceid * */ public static final String SYS_COMMON_SERVICE = "hw-system"; + + /** + * 打印机服务的serviceid + * */ + public static final String PRINTER_SERVICE = "hw-printer"; } diff --git a/hw-modules/hw-mes/pom.xml b/hw-modules/hw-mes/pom.xml index 551fb952..eef78e25 100644 --- a/hw-modules/hw-mes/pom.xml +++ b/hw-modules/hw-mes/pom.xml @@ -81,6 +81,12 @@ com.hw hw-api-mes + + com.hw + hw-api-printer + 3.6.3 + compile + diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java index fa96b2e3..9e0c7d4f 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java @@ -92,7 +92,6 @@ public class MesBaseBarcodeInfoController extends BaseController @PutMapping public AjaxResult edit(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) { - mesBaseBarcodeInfo.setUpdateBy(SecurityUtils.getLoginUser().getUsername()); return toAjax(mesBaseBarcodeInfoService.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo)); } @@ -108,6 +107,16 @@ public class MesBaseBarcodeInfoController extends BaseController } + /** + * 打印条码 + * @param barcodeIds + * @return + */ + @GetMapping(value = "/printBarCode/{barcodeIds}") + public AjaxResult printBarCode(@PathVariable Long[] barcodeIds) + { + return success(mesBaseBarcodeInfoService.printBarCode(barcodeIds)); + } /** diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java index d4a70c3d..ba73a4bf 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java @@ -68,4 +68,12 @@ public interface IMesBaseBarcodeInfoService * @return 结果 */ public int deleteMesBaseBarcodeInfoByBarcodeId(Long barcodeId); + + /** + * 打印条码 + * @param barcodeIds + * @return + */ + public int printBarCode(Long[] barcodeIds); + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java index e852306c..499c2a16 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java @@ -4,9 +4,15 @@ import java.math.BigDecimal; import java.util.List; import com.hw.common.core.constant.MesConstants; +import com.hw.common.core.constant.SecurityConstants; +import com.hw.common.core.domain.R; +import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; +import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.uuid.Seq; +import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.printer.api.RemotePrinterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; @@ -23,6 +29,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService @Autowired private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper; + @Autowired + private RemotePrinterService remotePrinterService; + /** * 查询条码信息 * @@ -94,6 +103,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService */ @Override public int updateMesBaseBarcodeInfo(MesBaseBarcodeInfo mesBaseBarcodeInfo) { + mesBaseBarcodeInfo.setUpdateBy(SecurityUtils.getUsername()); mesBaseBarcodeInfo.setUpdateTime(DateUtils.getNowDate()); return mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo); } @@ -119,4 +129,39 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService public int deleteMesBaseBarcodeInfoByBarcodeId(Long barcodeId) { return mesBaseBarcodeInfoMapper.deleteMesBaseBarcodeInfoByBarcodeId(barcodeId); } + + /** + * 打印条码 + * + * @param barcodeIds + * @return + */ + @Override + public int printBarCode(Long[] barcodeIds) { + StringBuilder buffer = new StringBuilder(); + //获取条码List + for (Long barcodeId : barcodeIds) { + MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeId(barcodeId); + try { + //调用的打印接口 + MesBaseBarcodeInfo barCodeInfo = remotePrinterService.printBarCode(mesBaseBarcodeInfo, SecurityConstants.INNER); + MesBaseBarcodeInfo baseBarcodeInfo = new MesBaseBarcodeInfo(); + baseBarcodeInfo.setBarcodeId(barcodeId); + baseBarcodeInfo.setMachineName(barCodeInfo.getMachineName()); + baseBarcodeInfo.setPrintTime(DateUtils.getNowDate()); + baseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername()); + baseBarcodeInfo.setPrintFlag("1"); + baseBarcodeInfo.setPrintNumber(StringUtils.isNull(baseBarcodeInfo.getPrintNumber()) ? 1 : baseBarcodeInfo.getPrintNumber() + 1); + baseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate()); + this.updateMesBaseBarcodeInfo(baseBarcodeInfo); + } catch (Exception e) { + buffer.append("打印条码报错——条码内容:").append(mesBaseBarcodeInfo.getBarcodeInfo()).append(e.getMessage()); + } + } + if (buffer.length() == 0) { + return 1; + } else { + throw new ServiceException(buffer.toString()); + } + } } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml index c65137a7..408dfb33 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml @@ -35,81 +35,84 @@ + - select barcode_id, - print_time, - print_person, - batch_flag, - barcode_type, - barcode_info, - batch_code, - pallet_info_code, - material_id, - manufacturer_id, - amount, - machine_name, - print_number, - po_no, - production_date, - accepted_date, - last_outstock_date, - plan_code, - plan_detail_code, - sale_order_id, - saleorder_code, - project_no, - print_flag, - serial_number, - remark, - bind_status, - bind_by, - bind_time, - update_by, - update_time - from mes_base_barcode_info + select bbi.barcode_id, + bbi.print_time, + bbi.print_person, + bbi.batch_flag, + bbi.barcode_type, + bbi.barcode_info, + bbi.batch_code, + bbi.pallet_info_code, + bbi.material_id, + bmi.material_name, + bbi.manufacturer_id, + bbi.amount, + bbi.machine_name, + bbi.print_number, + bbi.po_no, + bbi.production_date, + bbi.accepted_date, + bbi.last_outstock_date, + bbi.plan_code, + bbi.plan_detail_code, + bbi.sale_order_id, + bbi.saleorder_code, + bbi.project_no, + bbi.print_flag, + bbi.serial_number, + bbi.remark, + bbi.bind_status, + bbi.bind_by, + bbi.bind_time, + bbi.update_by, + bbi.update_time + from mes_base_barcode_info bbi + left join mes_base_material_info bmi on bmi.material_id = bbi.material_id - where barcode_info = #{barcodeInfo} limit 1 + where bbi.barcode_info = #{barcodeInfo} limit 1 \ No newline at end of file diff --git a/hw-modules/hw-printer/pom.xml b/hw-modules/hw-printer/pom.xml index f8152bb8..c129ee68 100644 --- a/hw-modules/hw-printer/pom.xml +++ b/hw-modules/hw-printer/pom.xml @@ -41,8 +41,76 @@ spring-boot-starter-actuator - + + + com.hw + hw-api-mes + + + + org.apache.pdfbox + pdfbox + 2.0.1 + + + org.apache.pdfbox + fontbox + 2.0.0 + + + org.apache.pdfbox + jempbox + 1.8.11 + + + org.apache.pdfbox + xmpbox + 2.0.0 + + + org.apache.pdfbox + preflight + 2.0.0 + + + org.apache.pdfbox + pdfbox-tools + 2.0.0 + + + + + com.itextpdf + itextpdf + 5.5.5 + + + + com.itextpdf + itext-asian + 5.2.0 + + + + com.hw + hw-common-swagger + + + + + com.google.zxing + core + 3.5.1 + + + + com.google.zxing + javase + 3.5.1 + + + ${project.artifactId} diff --git a/hw-modules/hw-printer/src/main/java/com/hw/Main.java b/hw-modules/hw-printer/src/main/java/com/hw/Main.java deleted file mode 100644 index 0dcc1da8..00000000 --- a/hw-modules/hw-printer/src/main/java/com/hw/Main.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.hw; - -// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`, -// then press Enter. You can now see whitespace characters in your code. -public class Main { - public static void main(String[] args) { - // Press Alt+Enter with your caret at the highlighted text to see how - // IntelliJ IDEA suggests fixing it. - System.out.printf("Hello and welcome!"); - - // Press Shift+F10 or click the green arrow button in the gutter to run the code. - for (int i = 1; i <= 5; i++) { - - // Press Shift+F9 to start debugging your code. We have set one breakpoint - // for you, but you can always add more by pressing Ctrl+F8. - System.out.println("i = " + i); - } - } -} \ No newline at end of file diff --git a/hw-modules/hw-printer/src/main/java/com/hw/printer/RuoYiPrinterApplication.java b/hw-modules/hw-printer/src/main/java/com/hw/printer/RuoYiPrinterApplication.java new file mode 100644 index 00000000..0e0da931 --- /dev/null +++ b/hw-modules/hw-printer/src/main/java/com/hw/printer/RuoYiPrinterApplication.java @@ -0,0 +1,31 @@ +package com.hw.printer; + +import com.hw.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +/** + * 文件服务 + * + * @author ruoyi + */ +@EnableCustomSwagger2 +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) +public class RuoYiPrinterApplication +{ + public static void main(String[] args) + { + SpringApplication.run(RuoYiPrinterApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 文件服务模块启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \n" + + " | | \\ `' /| `-' / \n" + + " | | \\ / \\ / \n" + + " ''-' `'-' `-..-' "); + } +} diff --git a/hw-modules/hw-printer/src/main/java/com/hw/printer/controller/PrinterController.java b/hw-modules/hw-printer/src/main/java/com/hw/printer/controller/PrinterController.java new file mode 100644 index 00000000..24230840 --- /dev/null +++ b/hw-modules/hw-printer/src/main/java/com/hw/printer/controller/PrinterController.java @@ -0,0 +1,42 @@ +package com.hw.printer.controller; + +import com.hw.common.core.domain.R; +import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.printer.service.IPrinterService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 打印机请求处理 + * + * @author Yinq + */ +@RestController +@RequestMapping("/printService") +public class PrinterController { + private static final Logger log = LoggerFactory.getLogger(PrinterController.class); + + @Autowired + private IPrinterService printerService; + + /** + * 打印条码接口 + * @param barcodeInfo + * @return + */ + @PostMapping("/printBarCode") + public R printBarCode(@RequestBody MesBaseBarcodeInfo barcodeInfo) { + try { + return R.ok(printerService.printBarCode(barcodeInfo)); + } catch (Exception e) { + log.error("打印条码失败", e); + return R.fail(e.getMessage()); + } + } + +} \ No newline at end of file diff --git a/hw-modules/hw-printer/src/main/java/com/hw/printer/service/IPrinterService.java b/hw-modules/hw-printer/src/main/java/com/hw/printer/service/IPrinterService.java new file mode 100644 index 00000000..4c242b05 --- /dev/null +++ b/hw-modules/hw-printer/src/main/java/com/hw/printer/service/IPrinterService.java @@ -0,0 +1,19 @@ +package com.hw.printer.service; + +import com.hw.mes.api.domain.MesBaseBarcodeInfo; + +/** + * 打印机服务接口 + * + * @author Yinq + */ +public interface IPrinterService { + + /** + * 打印条码接口 + * @param barcodeInfo + * @return + * @throws Exception + */ + MesBaseBarcodeInfo printBarCode(MesBaseBarcodeInfo barcodeInfo) throws Exception; +} diff --git a/hw-modules/hw-printer/src/main/java/com/hw/printer/service/PrinterServiceImpl.java b/hw-modules/hw-printer/src/main/java/com/hw/printer/service/PrinterServiceImpl.java new file mode 100644 index 00000000..a2119296 --- /dev/null +++ b/hw-modules/hw-printer/src/main/java/com/hw/printer/service/PrinterServiceImpl.java @@ -0,0 +1,61 @@ +package com.hw.printer.service; + +import com.hw.common.core.utils.DateUtils; +import com.hw.common.core.utils.StringUtils; +import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.printer.utils.HwPrintUtil; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Value; + +import java.util.HashMap; + +/** + * 打印机服务Service + * + * @author Yinq + */ +@Service +public class PrinterServiceImpl implements IPrinterService { + + /** + * 打印机映射路径 + */ + @Value("${print.path}") + public String localPrintPath; + + /** + * PDF模板路径 + */ + @Value("${print.pdfTemplatePath}") + public String pdfTemplatePath; + + /** + * 生成PDF文件路径 + */ + @Value("${print.generatePath}") + public String generatePath; + + /** + * 打印条码接口 + * + * @param barcodeInfo + * @return + * @throws Exception + */ + @Override + public MesBaseBarcodeInfo printBarCode(MesBaseBarcodeInfo barcodeInfo) throws Exception { + HashMap params = new HashMap<>(); + params.put("localPrintPath", localPrintPath); + params.put("pdfTemplatePath", pdfTemplatePath); + params.put("generatePath", generatePath); + params.put("barcodeInfo", barcodeInfo.getBarcodeInfo()); + params.put("batchCode", barcodeInfo.getBatchCode()); + params.put("materialName", barcodeInfo.getMaterialName()); + params.put("date", DateUtils.getDate()); + String machineName = HwPrintUtil.printBarCode(params); + barcodeInfo.setMaterialName(machineName); + return barcodeInfo; + } + + +} diff --git a/hw-modules/hw-printer/src/main/java/com/hw/printer/utils/HwPrintUtil.java b/hw-modules/hw-printer/src/main/java/com/hw/printer/utils/HwPrintUtil.java new file mode 100644 index 00000000..891dfb7d --- /dev/null +++ b/hw-modules/hw-printer/src/main/java/com/hw/printer/utils/HwPrintUtil.java @@ -0,0 +1,215 @@ +package com.hw.printer.utils; + +import com.hw.common.core.exception.ServiceException; +import com.itextpdf.text.Document; +import com.itextpdf.text.Image; +import com.itextpdf.text.pdf.*; +import org.apache.pdfbox.pdmodel.PDDocument; + +import org.apache.pdfbox.printing.PDFPrintable; +import org.apache.pdfbox.printing.Scaling; + +import javax.annotation.PostConstruct; +import javax.print.*; + +import java.awt.print.*; +import java.io.*; +import java.util.HashMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + + +/** + * @author wanghao + * @date 2022/4/24 14:52 + */ +@Component +public class HwPrintUtil { + + private static final Logger log = LoggerFactory.getLogger(HwPrintUtil.class); + + /** + * 打印机映射路径 + */ + public static String localPrintPath; + + /** + * PDF模板路径 + */ + public static String pdfTemplatePath; + + /** + * 生成PDF文件路径 + */ + public static String generatePath; + + /** + * 打印机List + */ + private static PrintService[] printServices; + + /** + * 打印机服务 + */ + private static PrintService printService = null; + + /** + * 项目启动时,初始化打印机参数 + */ + @PostConstruct + public static void findPrinters() { + printServices = PrintServiceLookup.lookupPrintServices(null, null); + System.out.println("Bean已初始化,执行@PostConstruct注解的方法"); + } + + /** + * 打印方法 + * + * @param params + * @return + */ + public static String printBarCode(HashMap params) { + //解析参数生成打印图片 + localPrintPath = params.get("localPrintPath"); + pdfTemplatePath = params.get("pdfTemplatePath"); + generatePath = params.get("generatePath"); + String barcodeInfo = params.get("barcodeInfo"); + String batchCode = params.get("batchCode"); + String materialName = params.get("materialName"); + String date = params.get("date"); + initPrintService(); + File outputFile = printBarCode(barcodeInfo, batchCode, materialName, date); + try { + printPdf(outputFile); + log.info("打印条码printBarCode方法,条码内容:" + barcodeInfo); + return localPrintPath; + } catch (Exception e) { + log.error("打印条码printPdf异常:" + e); + throw new ServiceException("打印条码printPdf异常:" + e); + } + } + + + public static File printBarCode(String barcodeInfo, String batchCode, String materialName, String date) { + try { + // 生成PDF文件 + File generateFile = new File(generatePath); + FileOutputStream out = new FileOutputStream(generateFile); + // 打印模板PDF + PdfReader reader = new PdfReader(pdfTemplatePath); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + // 修改PDF文档的PdfStamper实例,将修改后的内容输出到内存中的字节数组 + PdfStamper stamper = new PdfStamper(reader, bos); + // 动态地将变量的值填充到PDF表单相应字段 + AcroFields form = stamper.getAcroFields(); + form.setField("code", barcodeInfo); + form.setField("name", materialName); + form.setField("spe", batchCode); + form.setField("data", date); + //获取位置(左上右下) + AcroFields.FieldPosition fieldPosition = form.getFieldPositions("qrcode").get(0); + // 绘制二维码 + float width = fieldPosition.position.getRight() - fieldPosition.position.getLeft(); + BarcodeQRCode pdf417 = new BarcodeQRCode(barcodeInfo, (int) width, (int) width, null); + // 生成二维码图像 + Image image128 = pdf417.getImage(); + // 条码位置 + image128.setAbsolutePosition(fieldPosition.position.getLeft(), fieldPosition.position.getBottom()); + // 获取PDF的第一页 + PdfContentByte cb = stamper.getOverContent(1); + cb.addImage(image128); + // 设置表单不可编辑(即将表单字段内容固定到PDF中) + stamper.setFormFlattening(true); + // 关闭PdfStamper + stamper.close(); + // 创建一个新的文档对象 + Document doc = new Document(); + // 创建 PdfCopy 对象,关联到输出流 + PdfCopy copy = new PdfCopy(doc, out); + // 打开文档 + doc.open(); + // 从内存中的字节数组创建一个 PdfImportedPage 对象 + PdfImportedPage importPage = copy.getImportedPage(new PdfReader(bos.toByteArray()), 1); + // 将导入的页面添加到新文档中 + copy.addPage(importPage); + // 关闭文档 + doc.close(); + return generateFile; + } catch (Exception e) { + log.error("打印条码生成PDF异常:" + e); + } + return null; + } + + + /** + * 打印PDF + * + * @param pdfFile 要打印的PDF文件 + * @throws IOException 如果PDF加载或打印失败 + */ + private static void printPdf(File pdfFile) throws IOException { + PDDocument document = null; + try { + document = PDDocument.load(pdfFile); + //打印的页面的大小和方向 + PageFormat pageFormat = new PageFormat(); + //设置打印方向 PORTRAIT 竖向 REVERSE_LANDSCAPE 横向 + pageFormat.setOrientation(PageFormat.PORTRAIT); + Paper paper = new Paper(); + // 纸的大小 + paper.setSize(221, 200); + // Print 区域 + paper.setImageableArea(2, -15, 221, 200); + pageFormat.setPaper(paper); + Book book = new Book(); + PDFPrintable printable = new PDFPrintable(document, Scaling.SCALE_TO_FIT); + book.append(printable, pageFormat, document.getNumberOfPages()); + PrinterJob job = PrinterJob.getPrinterJob(); + job.setPrintService(printService); + job.setPageable(book); + job.defaultPage(); + try { + job.print(); + } catch (PrinterException e) { + throw new IOException("PDF打印失败:", e); + } + } catch (PrinterException e) { + throw new ServiceException("打印机服务错误:" + e); + } finally { + if (document != null) { + try { + document.close(); + } catch (IOException e) { + // 处理关闭文档时可能出现的异常 + e.printStackTrace(); + } + } + } + } + + /** + * 导出为金山PDF + * 导出为WPS PDF + * 发送至 OneNote 2013 + * Microsoft XPS Document Writer + * Microsoft Print to PDF + * Fax + * \\10.11.43.159\HP LaserJet MFP M129-M134 + * \\10.11.43.159\HP Laser NS 1020 + */ + public static void initPrintService() { + for (PrintService service : printServices) { + System.out.println(service.getName()); + if (service.getName().contains(localPrintPath)) { + printService = service; + break; + } + } + if (printService == null) { + throw new ServiceException("打印机配置错误!"); + } + } +} diff --git a/hw-modules/hw-printer/src/main/resources/banner.txt b/hw-modules/hw-printer/src/main/resources/banner.txt index fbd45f53..8eeae464 100644 --- a/hw-modules/hw-printer/src/main/resources/banner.txt +++ b/hw-modules/hw-printer/src/main/resources/banner.txt @@ -1,10 +1,6 @@ Spring Boot Version: ${spring-boot.version} Spring Application Name: ${spring.application.name} - _ _ - (_) | | - _ __ _ _ ___ _ _ _ ______ ___ _ _ ___ | |_ ___ _ __ ___ -| '__|| | | | / _ \ | | | || ||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \ -| | | |_| || (_) || |_| || | \__ \| |_| |\__ \| |_ | __/| | | | | | -|_| \__,_| \___/ \__, ||_| |___/ \__, ||___/ \__| \___||_| |_| |_| - __/ | __/ | - |___/ |___/ \ No newline at end of file + / __ ___ __ ( ) __ __ ___ ___ __ + // ) ) // / / / / ____ // ) ) // ) ) / / // ) ) / / //___) ) // ) ) + // / / // / / / / //___/ / // / / // / / / / // // +// / / ((__( (__/ / // // / / // / / / / ((____ // \ No newline at end of file diff --git a/hw-modules/hw-printer/src/main/resources/files/Template.pdf b/hw-modules/hw-printer/src/main/resources/files/Template.pdf new file mode 100644 index 0000000000000000000000000000000000000000..fad1ab7e59ab5524eeca974224ce6dd3397b5316 GIT binary patch literal 10982 zcmeHNc|6qJ_n(oaMz%r}^~n~(?95oRt8CfV7&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0^r?d-E=s{iURo%pV?OFDKPfsg8<>n`3p_gJM<`F56p=9a2mx6wTF&gQ*Q zZ$Db6^Yr8;F6DTx6{2{uD!O{HWi4?&vAgDo^wypa(88VHWVdGKAX{zN%PFCRQ-qh6 zaS~@kAwj5+Tb)=oD?>tx6Kr$(?pT#wvR)yhdkH<)vU3S%@xog33M+Sxq#-}fV40qR z7N#%rxS4NQe3jU3mvv?LedRG7l4YjH-4%|*?pb?cLpk@ZIw&u78MLl1Zua=|zBh?q z&8j|Uw^3YEcJfxCLcG_3VikK^Rr#LtN8X9#Ue^+IBy`KIusjeb1qd z@#2mt{`%#I?zjtfjMO`qbe%I;Pto*_EYQG!ib58rZuua*9|(i+ zQa6k}7STiTx<|X^nM^!*RRabdc;N@Sp2=1o(D6YCUR&YxP^p+3j>+R-FqZ*i4+j{RkHGe1L_HKFi4n znTk*l2FjozG{gmQTZ$k{oxpZ6j$9xX{r)O&6udMpCUq1dXt#kD94-Iln$D}eKd!3WkY(*i(l8Cr#iGW%2g6K3Fg$5--8XA@2 z2961TL85UQg5an4E{zHH`VI|c0x-TqqtL-wzeA(qSeZ&g5y~_g0_Jb;u0!0I0QOUP z5e9X-EmRr+);sHHpkRE5hEmAW^rG|`)-mz%$W(b`VBj_ZitpVxs)SF#iaOPR6Q^vgZ1G01^Pg7?i?ByOZ) literal 0 HcmV?d00001 diff --git a/hw-ui/src/views/mes/barcode/index.vue b/hw-ui/src/views/mes/barcode/index.vue index 0c862c5e..88b2c68a 100644 --- a/hw-ui/src/views/mes/barcode/index.vue +++ b/hw-ui/src/views/mes/barcode/index.vue @@ -103,7 +103,7 @@ - + @@ -542,9 +542,8 @@ export default { /** 打印条码按钮操作 */ handlePrintBarCode(row) { - const barcodeId = row.barcodeId || this.ids - printBarCode(barcodeId).then(response => { - + const barcodeIds = row.barcodeId || this.ids; + printBarCode(barcodeIds).then(response => { this.$modal.msgSuccess("打印条码成功"); }).catch(() => {