add_QRCode #11
|
@ -7,7 +7,7 @@ public enum BarcodeStickerSize {
|
|||
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_4_X_7( 7f * 72, 4f * 72, 200, 10, 40, 6, 50, 40, 125, 125, 14, 9, 7),
|
||||
SIZE_1_X_2( 67.69f, 125.73f ,10 , 10, 20, 6, 60, 60, 125, 125, 4, 9, 7);
|
||||
SIZE_1_X_2( 67.69f, 128.73f ,10 , 10, 20, 6, 60, 60, 125, 125, 4, 9, 7);
|
||||
|
||||
private final float width;
|
||||
private final float height;
|
||||
|
|
|
@ -217,6 +217,10 @@ public class BarcodeService {
|
|||
String concatenatedIds = bundles.stream()
|
||||
.map(bundle -> String.valueOf(bundle.getId()))
|
||||
.collect(Collectors.joining("\\"));
|
||||
int totalWrappedQuantity = bundles.stream()
|
||||
.mapToInt(e->e.getWrapQuantity().intValue())
|
||||
.sum();
|
||||
this.drawCenteredText(g2d, "Total-Pieces: " + totalWrappedQuantity, detailFont, x, y, pageWidth, cols, stickerSize.getMarginTop() + 270, stickerSize.getMarginLeft());
|
||||
this.drawCenteredText(g2d, "Sub-Bundles: " + concatenatedIds, detailFont, x, y, pageWidth, cols, stickerSize.getMarginTop() + 290, stickerSize.getMarginLeft());
|
||||
}
|
||||
|
||||
|
@ -283,7 +287,6 @@ public class BarcodeService {
|
|||
g2d.drawString(text, adjustedX, adjustedY);
|
||||
}
|
||||
|
||||
|
||||
public void getBarcodeImagesForStitchItems(List<? extends InventoryArtifact> artifacts,
|
||||
BarcodeStickerSize stickerSize) throws Exception {
|
||||
|
||||
|
@ -309,7 +312,7 @@ public class BarcodeService {
|
|||
float qrY =stickerSize.getMarginLeft()+50 ;
|
||||
float qrX = stickerSize.getMarginTop();
|
||||
|
||||
qrCodeImage.setFixedPosition(qrX - 16, qrY-47);
|
||||
qrCodeImage.setFixedPosition(qrX - 16, qrY-40);
|
||||
document.add(qrCodeImage);
|
||||
|
||||
float textX = stickerSize.getMarginLeft() + 40;
|
||||
|
@ -322,7 +325,7 @@ public class BarcodeService {
|
|||
|
||||
int maxLength = 14;
|
||||
List<String> lines = new ArrayList<>();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int start = i * maxLength;
|
||||
if (start < combinedText.length()) {
|
||||
String part = combinedText.substring(start, Math.min(start + maxLength, combinedText.length())).replaceAll("\\s+", "");
|
||||
|
@ -332,7 +335,7 @@ public class BarcodeService {
|
|||
|
||||
float labelWidth = 67.69f;
|
||||
float textBoxWidth = 220;
|
||||
float textY1 = textY-30;
|
||||
float textY1 = textY-23;
|
||||
float textXCenter = textX + (labelWidth / 2) - (textBoxWidth / 2)-50;
|
||||
|
||||
for (String line : lines) {
|
||||
|
@ -350,13 +353,13 @@ public class BarcodeService {
|
|||
String id = String.valueOf(artifact.getId());
|
||||
document.add(new Paragraph(id)
|
||||
.setFont(font)
|
||||
.setFontColor(ColorConstants.BLACK)
|
||||
.setBold()
|
||||
.setFontColor(ColorConstants.BLACK)
|
||||
.setFontSize(stickerSize.getTextSize() + 8)
|
||||
.setTextAlignment(TextAlignment.LEFT)
|
||||
.setFixedPosition(textX - 25, textY + 8, 140));
|
||||
.setFixedPosition(textX - 25, textY + 13, 100));
|
||||
|
||||
float dottedLine = textY - 60;
|
||||
float dottedLine = textY - 65;
|
||||
for(int i= 0 ;i<16;i++){
|
||||
document.add(new Paragraph("|")
|
||||
.setFontSize(stickerSize.getTextSize())
|
||||
|
@ -364,12 +367,12 @@ public class BarcodeService {
|
|||
.setBold()
|
||||
.setRotationAngle(-Math.PI / 2)
|
||||
.setTextAlignment(TextAlignment.LEFT)
|
||||
.setFixedPosition(dottedLine,textX+40, 100));
|
||||
.setFixedPosition(dottedLine,textX+45, 100));
|
||||
|
||||
dottedLine += 7;
|
||||
}
|
||||
|
||||
float dottedLine2 = textY - 60;
|
||||
float dottedLine2 = textY - 65;
|
||||
for(int i= 0 ;i<16;i++){
|
||||
document.add(new Paragraph("|")
|
||||
.setFontSize(stickerSize.getTextSize())
|
||||
|
@ -377,7 +380,7 @@ public class BarcodeService {
|
|||
.setBold()
|
||||
.setRotationAngle(-Math.PI / 2)
|
||||
.setTextAlignment(TextAlignment.LEFT)
|
||||
.setFixedPosition(dottedLine2,textX+75, 100));
|
||||
.setFixedPosition(dottedLine2,textX+80, 100));
|
||||
|
||||
dottedLine2 += 7;
|
||||
}
|
||||
|
@ -430,38 +433,9 @@ public class BarcodeService {
|
|||
public void printLabel(BufferedImage bufferedImage) throws Exception {
|
||||
Connection connection = new TcpConnection(ipAddress, port);
|
||||
connection.open();
|
||||
|
||||
ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);
|
||||
|
||||
//Reset Printer Settings
|
||||
String resetSettings = "^XA^JUS^XZ";
|
||||
printer.sendCommand(resetSettings);
|
||||
|
||||
//Force Label Length & Disable Auto Feed
|
||||
String lengthFix = "^XA^LL555^PON^XZ"; // **Reduce Length (880) & Disable Auto Feed
|
||||
printer.sendCommand(lengthFix);
|
||||
|
||||
//Apply New Settings
|
||||
String settings = "^XA" +
|
||||
"^MMT" + // Continuous Mode
|
||||
"^MTT" + // Thermal Transfer Mode
|
||||
"^LH0,0" + // Home Position
|
||||
"^PR6" + // Print Speed (~120mm/sec)
|
||||
"^MD25" + // Darkness Level
|
||||
"^PW541" + // Label Width (67.69mm for 203 DPI)
|
||||
"^LL550" + // Reduced Label Length (fix gap)
|
||||
"^PN0" + // No Extra Page Feed
|
||||
"^PON" + // Disable Printer's Auto Feed Mode
|
||||
"^XZ";
|
||||
|
||||
printer.sendCommand(settings);
|
||||
|
||||
// Convert BufferedImage to ZebraImage
|
||||
ZebraImage zebraImage = new ZebraImage(bufferedImage);
|
||||
|
||||
// Print image
|
||||
printer.printImage(zebraImage, 0, 0, 0, 0, false);
|
||||
|
||||
connection.close();
|
||||
}
|
||||
}
|
|
@ -3445,9 +3445,6 @@ if ( typeof Vue !== 'undefined' ) {
|
|||
},
|
||||
filter : {
|
||||
default : true
|
||||
},
|
||||
inputMode: {
|
||||
default : 'none'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue