From 29686c0dd0d0fd2bcfbb75d7366383378336b2a7 Mon Sep 17 00:00:00 2001 From: "usama.jameel" Date: Wed, 8 Jan 2025 15:52:46 +0500 Subject: [PATCH 1/3] fixed barcode transfer into printer --- .../controller/CuttingController.java | 17 ++- .../controller/StitchingController.java | 11 +- .../service/BarcodeService.java | 143 +++++++++--------- 3 files changed, 95 insertions(+), 76 deletions(-) diff --git a/src/main/java/com/utopiaindustries/controller/CuttingController.java b/src/main/java/com/utopiaindustries/controller/CuttingController.java index d608c7e..cc07476 100644 --- a/src/main/java/com/utopiaindustries/controller/CuttingController.java +++ b/src/main/java/com/utopiaindustries/controller/CuttingController.java @@ -5,6 +5,7 @@ import com.utopiaindustries.dao.ctp.BundleWrapper; import com.utopiaindustries.model.ctp.JobCardWrapper; import com.utopiaindustries.service.*; import com.utopiaindustries.util.StringUtils; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; @@ -155,7 +156,13 @@ public class CuttingController { redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." ); return "redirect:/cutting/bundles"; } - return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); + try { + barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); + return ResponseEntity.ok(); + }catch (Exception e){ + redirectAttributes.addFlashAttribute( "error", e ); + return "redirect:/cutting/bundles"; + } } @PostMapping( "/generate-master-barcodes" ) @@ -165,6 +172,12 @@ public class CuttingController { redirectAttributes.addFlashAttribute("error", "Please Select At least One CheckBox." ); return "redirect:/cutting/master-bundles"; } - return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); + try { + barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); + return ResponseEntity.ok(); + }catch (Exception e){ + redirectAttributes.addFlashAttribute( "error", e ); + return "redirect:/cutting/master-bundles"; + } } } diff --git a/src/main/java/com/utopiaindustries/controller/StitchingController.java b/src/main/java/com/utopiaindustries/controller/StitchingController.java index b96c5cd..0de9873 100644 --- a/src/main/java/com/utopiaindustries/controller/StitchingController.java +++ b/src/main/java/com/utopiaindustries/controller/StitchingController.java @@ -5,6 +5,7 @@ import com.utopiaindustries.model.ctp.JobCard; import com.utopiaindustries.model.ctp.StitchingOfflineItem; import com.utopiaindustries.service.*; import com.utopiaindustries.util.StringUtils; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; @@ -130,11 +131,17 @@ public class StitchingController { @PostMapping( "/generate-barcodes" ) public Object generateBarcode(@RequestParam( name = "ids" ,required = false) Long[] ids, - @RequestParam( name = "artifactType" ) String artifactType, RedirectAttributes redirectAttributes ) throws Exception { + @RequestParam( name = "artifactType" ) String artifactType, RedirectAttributes redirectAttributes ) throws Exception { if (ids == null){ redirectAttributes.addFlashAttribute( "error", "Select At least One CheckBox" ); return "redirect:/stitching/stitching-offline-items"; } - return barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); + try { + barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); + return ResponseEntity.ok(); + }catch (Exception e){ + redirectAttributes.addFlashAttribute( "error", e ); + return "redirect:/stitching/stitching-offline-items"; + } } } diff --git a/src/main/java/com/utopiaindustries/service/BarcodeService.java b/src/main/java/com/utopiaindustries/service/BarcodeService.java index d6fda35..dbb203b 100644 --- a/src/main/java/com/utopiaindustries/service/BarcodeService.java +++ b/src/main/java/com/utopiaindustries/service/BarcodeService.java @@ -4,6 +4,8 @@ import com.google.zxing.BarcodeFormat; import com.itextpdf.html2pdf.ConverterProperties; import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider; import com.itextpdf.text.*; +import com.itextpdf.text.Image; +import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.*; import com.utopiaindustries.dao.ctp.BundleDAO; import com.utopiaindustries.dao.ctp.FinishedItemDAO; @@ -12,6 +14,11 @@ import com.utopiaindustries.dao.ctp.StitchingOfflineItemDAO; import com.utopiaindustries.model.ctp.*; import com.utopiaindustries.util.BarcodeUtils; import com.utopiaindustries.util.StringUtils; +import com.zebra.sdk.comm.Connection; +import com.zebra.sdk.comm.TcpConnection; +import com.zebra.sdk.graphics.internal.ZebraImage; +import com.zebra.sdk.printer.ZebraPrinter; +import com.zebra.sdk.printer.ZebraPrinterFactory; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.ResourceLoader; @@ -20,6 +27,10 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.Font; +import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -44,7 +55,7 @@ public class BarcodeService { /* * generate barcodes here * */ - public ResponseEntity generateBarcodes(List ids, String artifactType) throws Exception { + public void generateBarcodes(List ids, String artifactType) throws Exception { String size = BarcodeStickerSize.SIZE_1_75_X_3_5.name(); BarcodeStickerSize stickerSize = BarcodeStickerSize.getSize(size); @@ -57,89 +68,77 @@ public class BarcodeService { list = stitchingOfflineItemDAO.findByIds(ids); } - // get input stream - ByteArrayInputStream inputStream = null; - // get input stream - inputStream = getInputStream(list, stickerSize, artifactType); - - String headerContentDispositionStr = String.format("%s; filename=%s.pdf", "attachment", artifactType); - // return response - return ResponseEntity - .ok() - .header(HttpHeaders.CONTENT_DISPOSITION, headerContentDispositionStr) - .contentType(MediaType.APPLICATION_PDF) - .body(new InputStreamResource(inputStream)); + getBarcodeImages(list, stickerSize, artifactType); } - private ByteArrayInputStream getInputStream(List artifacts, - BarcodeStickerSize stickerSize, - String artifactType) throws Exception { - // resource loader - ResourceLoader resourceLoader = new DefaultResourceLoader(); - // output stream - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - // converter properties - ConverterProperties properties = new ConverterProperties(); - properties.setFontProvider(new DefaultFontProvider(false, false, true)); - // generate pdf - Document document = new Document(new Rectangle(stickerSize.getWidth(), stickerSize.getHeight()), stickerSize.getMarginLeft(), stickerSize.getMarginRight(), stickerSize.getMarginTop(), stickerSize.getMarginBottom()); - PdfWriter.getInstance(document, outputStream); - document.open(); + public void getBarcodeImages(List artifacts, + BarcodeStickerSize stickerSize, + String artifactType) throws Exception { + for (InventoryArtifact artifact : artifacts) { - document.newPage(); - // add sku - Paragraph skuPara = new Paragraph(artifact.getSku(), new Font(Font.FontFamily.HELVETICA, stickerSize.getTextSizeSmall(), Font.BOLD)); - skuPara.setAlignment(Element.ALIGN_CENTER); - document.add(skuPara); + // Create a blank BufferedImage (an image with the size of the sticker) + BufferedImage stickerImage = new BufferedImage((int) stickerSize.getWidth(), (int) stickerSize.getHeight(), BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = stickerImage.createGraphics(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - // add barcode image + // Set background color (white for the sticker) + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, (int) stickerSize.getWidth(), (int) stickerSize.getHeight()); + + // Set font for SKU and barcode + Font font = new Font("Helvetica", Font.BOLD, stickerSize.getTextSizeSmall()); + g2d.setFont(font); + + // Add SKU to the image + String sku = artifact.getSku(); + FontMetrics fontMetrics = g2d.getFontMetrics(); + int textWidth = fontMetrics.stringWidth(sku); + int x = (int) ((stickerSize.getWidth() - textWidth) / 2); + g2d.setColor(Color.BLACK); + g2d.drawString(sku, x, stickerSize.getMarginTop() + fontMetrics.getAscent()); + + // Create the barcode image byte[] imgBytes = BarcodeUtils.getBarcodeImageByteArray(artifact.getBarcode(), BarcodeFormat.CODE_128, stickerSize.getImageWidthBarcode(), stickerSize.getImageHeightBarcode()); - Image image = Image.getInstance(imgBytes); - image.setAlignment(Element.ALIGN_CENTER); - document.add(image); + BufferedImage barcodeImage = ImageIO.read(new ByteArrayInputStream(imgBytes)); - Paragraph barcodePara = new Paragraph(artifact.getBarcode(), new Font(Font.FontFamily.HELVETICA, stickerSize.getTextSizeSmall(), Font.BOLD)); - barcodePara.setAlignment(Element.ALIGN_CENTER); - document.add(barcodePara); - // add Artifact mark B / M / F - if ( artifactType.equalsIgnoreCase( Bundle.class.getSimpleName()) ) { - Paragraph artifactPara = new Paragraph(String.format("%s : %d", artifact.getType(), artifact.getId() ), new Font(Font.FontFamily.HELVETICA, stickerSize.getTextSizeExtraSmall(), Font.NORMAL)); - artifactPara.setAlignment(Element.ALIGN_CENTER); + // Draw the barcode image on the sticker + int barcodeX =(int) (stickerSize.getWidth() - barcodeImage.getWidth()) / 2; + int barcodeY = stickerSize.getMarginTop() + fontMetrics.getAscent() + 10; // Add some margin + g2d.drawImage(barcodeImage, barcodeX, barcodeY, null); - Paragraph type = new Paragraph(String.valueOf(artifactType.toCharArray()[0]), new Font(Font.FontFamily.HELVETICA, stickerSize.getTextSize(), Font.BOLD)); - type.setAlignment(Element.ALIGN_CENTER); - - // Create a table with 2 columns - PdfPTable table = new PdfPTable(2); - table.setWidthPercentage(100); - table.setWidths(new int[]{55, 45}); // Adjust column widths as needed - - // Add cells to the table - PdfPCell artifactCell = new PdfPCell(artifactPara); - artifactCell.setBorder(Rectangle.NO_BORDER); - artifactCell.setHorizontalAlignment(Element.ALIGN_RIGHT); - artifactCell.setPaddingTop(5); - - PdfPCell typeCell = new PdfPCell(type); - typeCell.setBorder(Rectangle.NO_BORDER); - typeCell.setHorizontalAlignment(Element.ALIGN_LEFT); - - table.addCell(artifactCell); - table.addCell(typeCell); - // Add the table to the document - document.add(table); + // Add the barcode value below the barcode image + g2d.drawString(artifact.getBarcode(), (stickerSize.getWidth() - fontMetrics.stringWidth(artifact.getBarcode())) / 2, + barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent()); + // If artifactType is Bundle, add additional info + if (artifactType.equalsIgnoreCase(Bundle.class.getSimpleName())) { + String typeText = String.format("%s : %d", artifact.getType(), artifact.getId()); + g2d.drawString(typeText, (stickerSize.getWidth() - fontMetrics.stringWidth(typeText)) / 2, + barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent() + 20); } else { - Paragraph type = new Paragraph(String.valueOf(artifactType.toCharArray()[0]), new Font(Font.FontFamily.HELVETICA, stickerSize.getTextSize(), Font.BOLD)); - type.setAlignment(Element.ALIGN_CENTER); - document.add(type); + // Add first character of artifact type + String type = String.valueOf(artifactType.charAt(0)); + g2d.setFont(new Font("Helvetica", Font.BOLD, stickerSize.getTextSize())); + g2d.drawString(type, (stickerSize.getWidth() - fontMetrics.stringWidth(type)) / 2, + barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent() + 40); } + + // Finalize drawing + g2d.dispose(); + + printLabel(stickerImage); } - document.close(); - // input stream - return new ByteArrayInputStream(outputStream.toByteArray()); } - + public void printLabel( BufferedImage bufferedImage ) throws Exception { + String ipAddr = "192.168.90.18"; + int port = 9100; + Connection connection = new TcpConnection( ipAddr, port ); + connection.open(); + ZebraPrinter printer = ZebraPrinterFactory.getInstance( connection ); + ZebraImage zebraImage = new ZebraImage( bufferedImage ); + printer.printImage( zebraImage, 0, 0, 0, 0, false ); + connection.close(); + } } \ No newline at end of file -- 2.40.1 From 6749f6eca221ca58de74837299c71a4da1e84b9d Mon Sep 17 00:00:00 2001 From: "usama.jameel" Date: Fri, 10 Jan 2025 18:12:57 +0500 Subject: [PATCH 2/3] fixed barcode printer issue and add notification cut button --- .../controller/CuttingController.java | 6 ++- .../controller/StitchingController.java | 3 +- .../model/ctp/BarcodeStickerSize.java | 2 +- .../service/BarcodeService.java | 37 +++++++------------ src/main/resources/templates/_notices.html | 21 +++++++++-- 5 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/utopiaindustries/controller/CuttingController.java b/src/main/java/com/utopiaindustries/controller/CuttingController.java index cc07476..36111d6 100644 --- a/src/main/java/com/utopiaindustries/controller/CuttingController.java +++ b/src/main/java/com/utopiaindustries/controller/CuttingController.java @@ -158,7 +158,8 @@ public class CuttingController { } try { barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); - return ResponseEntity.ok(); + redirectAttributes.addFlashAttribute( "success", "Barcode generated successfully" ); + return "redirect:/cutting/bundles"; }catch (Exception e){ redirectAttributes.addFlashAttribute( "error", e ); return "redirect:/cutting/bundles"; @@ -174,7 +175,8 @@ public class CuttingController { } try { barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); - return ResponseEntity.ok(); + redirectAttributes.addFlashAttribute( "success", "Master barcode generated successfully" ); + return "redirect:/cutting/master-bundles"; }catch (Exception e){ redirectAttributes.addFlashAttribute( "error", e ); return "redirect:/cutting/master-bundles"; diff --git a/src/main/java/com/utopiaindustries/controller/StitchingController.java b/src/main/java/com/utopiaindustries/controller/StitchingController.java index 0de9873..58c83f7 100644 --- a/src/main/java/com/utopiaindustries/controller/StitchingController.java +++ b/src/main/java/com/utopiaindustries/controller/StitchingController.java @@ -138,7 +138,8 @@ public class StitchingController { } try { barcodeService.generateBarcodes( Arrays.asList( ids ), artifactType ); - return ResponseEntity.ok(); + redirectAttributes.addFlashAttribute( "success", "Barcode generated successfully" ); + return "redirect:/stitching/stitching-offline-items"; }catch (Exception e){ redirectAttributes.addFlashAttribute( "error", e ); return "redirect:/stitching/stitching-offline-items"; diff --git a/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java b/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java index c05db90..6cb8c17 100644 --- a/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java +++ b/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java @@ -5,7 +5,7 @@ public enum BarcodeStickerSize { SIZE_1_5_X_3( 3 * 72, 1.5f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7), SIZE_2_X_3( 3 * 72, 2 * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7), SIZE_4_X_4( 4 * 72, 4 * 72, 8, 8, 8, 8, 200, 100, 250, 250, 14, 9, 7), - SIZE_1_75_X_3_5( 3.5f * 72, 1.75f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7); + SIZE_1_75_X_3_5( 7f * 72, 4f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7); private final float width; diff --git a/src/main/java/com/utopiaindustries/service/BarcodeService.java b/src/main/java/com/utopiaindustries/service/BarcodeService.java index dbb203b..ccb7202 100644 --- a/src/main/java/com/utopiaindustries/service/BarcodeService.java +++ b/src/main/java/com/utopiaindustries/service/BarcodeService.java @@ -1,12 +1,6 @@ package com.utopiaindustries.service; import com.google.zxing.BarcodeFormat; -import com.itextpdf.html2pdf.ConverterProperties; -import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider; -import com.itextpdf.text.*; -import com.itextpdf.text.Image; -import com.itextpdf.text.Rectangle; -import com.itextpdf.text.pdf.*; import com.utopiaindustries.dao.ctp.BundleDAO; import com.utopiaindustries.dao.ctp.FinishedItemDAO; import com.utopiaindustries.dao.ctp.MasterBundleDAO; @@ -19,12 +13,6 @@ import com.zebra.sdk.comm.TcpConnection; import com.zebra.sdk.graphics.internal.ZebraImage; import com.zebra.sdk.printer.ZebraPrinter; import com.zebra.sdk.printer.ZebraPrinterFactory; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.InputStreamResource; -import org.springframework.core.io.ResourceLoader; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import javax.imageio.ImageIO; @@ -32,7 +20,6 @@ import java.awt.*; import java.awt.Font; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.util.ArrayList; import java.util.List; @@ -78,8 +65,9 @@ public class BarcodeService { for (InventoryArtifact artifact : artifacts) { // Create a blank BufferedImage (an image with the size of the sticker) - BufferedImage stickerImage = new BufferedImage((int) stickerSize.getWidth(), (int) stickerSize.getHeight(), BufferedImage.TYPE_INT_ARGB); + BufferedImage stickerImage = new BufferedImage((int) stickerSize.getWidth()*2, (int) stickerSize.getHeight()*2, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = stickerImage.createGraphics(); + g2d.scale(2,2); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Set background color (white for the sticker) @@ -87,7 +75,7 @@ public class BarcodeService { g2d.fillRect(0, 0, (int) stickerSize.getWidth(), (int) stickerSize.getHeight()); // Set font for SKU and barcode - Font font = new Font("Helvetica", Font.BOLD, stickerSize.getTextSizeSmall()); + Font font = new Font("Helvetica", Font.BOLD, stickerSize.getTextSize()+10); g2d.setFont(font); // Add SKU to the image @@ -96,15 +84,15 @@ public class BarcodeService { int textWidth = fontMetrics.stringWidth(sku); int x = (int) ((stickerSize.getWidth() - textWidth) / 2); g2d.setColor(Color.BLACK); - g2d.drawString(sku, x, stickerSize.getMarginTop() + fontMetrics.getAscent()); + g2d.drawString(sku, x, stickerSize.getMarginTop() + fontMetrics.getAscent()+20); // Create the barcode image - byte[] imgBytes = BarcodeUtils.getBarcodeImageByteArray(artifact.getBarcode(), BarcodeFormat.CODE_128, stickerSize.getImageWidthBarcode(), stickerSize.getImageHeightBarcode()); + byte[] imgBytes = BarcodeUtils.getBarcodeImageByteArray(artifact.getBarcode(), BarcodeFormat.CODE_128, stickerSize.getImageWidthBarcode()+500, stickerSize.getImageHeightBarcode()+30); BufferedImage barcodeImage = ImageIO.read(new ByteArrayInputStream(imgBytes)); // Draw the barcode image on the sticker int barcodeX =(int) (stickerSize.getWidth() - barcodeImage.getWidth()) / 2; - int barcodeY = stickerSize.getMarginTop() + fontMetrics.getAscent() + 10; // Add some margin + int barcodeY = stickerSize.getMarginTop() + fontMetrics.getAscent() + 30; // Add some margin g2d.drawImage(barcodeImage, barcodeX, barcodeY, null); // Add the barcode value below the barcode image @@ -115,24 +103,27 @@ public class BarcodeService { if (artifactType.equalsIgnoreCase(Bundle.class.getSimpleName())) { String typeText = String.format("%s : %d", artifact.getType(), artifact.getId()); g2d.drawString(typeText, (stickerSize.getWidth() - fontMetrics.stringWidth(typeText)) / 2, - barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent() + 20); + barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent() + 45); + + g2d.setFont(new Font("Helvetica", Font.BOLD, stickerSize.getTextSize()+20)); + g2d.drawString(String.valueOf(artifactType.toCharArray()[0]), (stickerSize.getWidth() - fontMetrics.stringWidth(String.valueOf(artifactType.toCharArray()[0]))) / 2, + barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent() + 77); } else { // Add first character of artifact type String type = String.valueOf(artifactType.charAt(0)); - g2d.setFont(new Font("Helvetica", Font.BOLD, stickerSize.getTextSize())); + g2d.setFont(new Font("Helvetica", Font.BOLD, stickerSize.getTextSize()+10)); g2d.drawString(type, (stickerSize.getWidth() - fontMetrics.stringWidth(type)) / 2, - barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent() + 40); + barcodeY + barcodeImage.getHeight() + fontMetrics.getAscent() + 45); } // Finalize drawing g2d.dispose(); - printLabel(stickerImage); } } public void printLabel( BufferedImage bufferedImage ) throws Exception { - String ipAddr = "192.168.90.18"; + String ipAddr = "192.168.90.160"; int port = 9100; Connection connection = new TcpConnection( ipAddr, port ); connection.open(); diff --git a/src/main/resources/templates/_notices.html b/src/main/resources/templates/_notices.html index 911e70f..af34bbd 100644 --- a/src/main/resources/templates/_notices.html +++ b/src/main/resources/templates/_notices.html @@ -6,14 +6,29 @@
-
+
+
+ + × +
+
-
-
+
+
+ + × +
+
+
+
+ + × +
+
\ No newline at end of file -- 2.40.1 From 910363a52e1803fac14068ed44df2c3e8e37b5c6 Mon Sep 17 00:00:00 2001 From: "usama.jameel" Date: Thu, 16 Jan 2025 09:55:33 +0500 Subject: [PATCH 3/3] fixed comments and update static path in properties file --- pom.xml | 1 + .../com/utopiaindustries/model/ctp/BarcodeStickerSize.java | 3 ++- .../java/com/utopiaindustries/service/BarcodeService.java | 2 +- src/main/resources/application.yaml | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4fdeda2..b002c17 100644 --- a/pom.xml +++ b/pom.xml @@ -361,6 +361,7 @@ + ctp-service org.springframework.boot diff --git a/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java b/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java index 6cb8c17..78a3d7a 100644 --- a/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java +++ b/src/main/java/com/utopiaindustries/model/ctp/BarcodeStickerSize.java @@ -5,7 +5,8 @@ public enum BarcodeStickerSize { SIZE_1_5_X_3( 3 * 72, 1.5f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7), SIZE_2_X_3( 3 * 72, 2 * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7), SIZE_4_X_4( 4 * 72, 4 * 72, 8, 8, 8, 8, 200, 100, 250, 250, 14, 9, 7), - SIZE_1_75_X_3_5( 7f * 72, 4f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7); + SIZE_1_75_X_3_5( 3.5f * 72, 1.75f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7), + SIZE_4_X_7( 7f * 72, 4f * 72, 10, 10, 6, 6, 50, 50, 125, 125, 14, 9, 7); private final float width; diff --git a/src/main/java/com/utopiaindustries/service/BarcodeService.java b/src/main/java/com/utopiaindustries/service/BarcodeService.java index ccb7202..b7ee32d 100644 --- a/src/main/java/com/utopiaindustries/service/BarcodeService.java +++ b/src/main/java/com/utopiaindustries/service/BarcodeService.java @@ -43,7 +43,7 @@ public class BarcodeService { * generate barcodes here * */ public void generateBarcodes(List ids, String artifactType) throws Exception { - String size = BarcodeStickerSize.SIZE_1_75_X_3_5.name(); + String size = BarcodeStickerSize.SIZE_4_X_7.name(); BarcodeStickerSize stickerSize = BarcodeStickerSize.getSize(size); List list = new ArrayList<>(); diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 85fee79..3d84f5b 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -14,11 +14,11 @@ spring: enabled: true cache: period: 0 - static-locations: file:./src/main/resources/static/ + static-locations: classpath:/static/ thymeleaf: check-template-location: true cache: false - prefix: file:./src/main/resources/templates/ + prefix: classpath:/templates/ uinddatasource: jdbcUrl: jdbc:mysql://192.168.90.108:3306/uind_vms username: utopia -- 2.40.1