打印格式调整

This commit is contained in:
张松
2025-03-11 14:52:08 +08:00
parent 52b928abbf
commit 278b3930ce
3 changed files with 9 additions and 7 deletions

View File

@@ -48,7 +48,6 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
private final PrintSignLabel printSignLabel = new PrintSignLabel()
.setBr("<BR>")
.setCut("")
.setF(new String[]{"<F>", "</F>"})
.setL(new String[]{"<L>", "</L>"})

View File

@@ -266,7 +266,7 @@ public abstract class PrinterHandler {
item.setProductName("【临】" + item.getProductName());
}
}
boolean isGift = item.getPackAmount().compareTo(BigDecimal.ZERO) == 0;
boolean isGift = item.getIsGift() != null && item.getIsGift() == 1;
if (isGift && !item.getProductName().contains("【赠】")) {
item.setProductName("【赠】" + item.getProductName());
}
@@ -335,7 +335,7 @@ public abstract class PrinterHandler {
it.setProductName("【临】%s".formatted(it.getProductName()));
}
it.setPackAmount(it.getPackAmount() == null ? BigDecimal.ZERO : it.getPackAmount());
boolean isGift = it.getPackAmount().compareTo(BigDecimal.ZERO) == 0;
boolean isGift = it.getIsGift() != null && it.getIsGift() == 1;
if (isGift) {
it.setProductName("【赠】%s".formatted(it.getProductName()));
}

View File

@@ -170,7 +170,8 @@ public interface PrinterImpl {
data.append(signLabelInfo.br);
// data.append("<OUT:15>");
// data.append("<BR>");
data.append(getFormatLabel("品名 数量 小计", signLabelInfo.s))
// 18个空格 12
data.append(getFormatLabel("品名 数量 小计", signLabelInfo.s))
.append(signLabelInfo.br);
// data.append("<S>品名 数量 小计</S><BR>");
data.append(getFormatLabel("--------------------------------", signLabelInfo.s))
@@ -178,7 +179,8 @@ public interface PrinterImpl {
// data.append("<S>--------------------------------</S><BR>");
for (OrderDetail detail : detailList) {
String number = detail.getNum().stripTrailingZeros().toPlainString();
String row = getRow(detail.getProductName(), "", number, toPlainStr(detail.getPayAmount().stripTrailingZeros().toPlainString()), 20, 0, 3, 6);
String row = getRow(detail.getProductName(), "", number,
toPlainStr(detail.getPayAmount().stripTrailingZeros().toPlainString()), 23, 0, 5, 4);
data.append(row);
if (StrUtil.isNotBlank(detail.getSkuName())) {
data.append(getFormatLabel(StrUtil.format("规格:{}", detail.getSkuName()), signLabelInfo.s))
@@ -301,10 +303,11 @@ public interface PrinterImpl {
// builder.append("<CS:32>").append(skuName).append(" </CS><BR>");
}
} else {
builder.append(getFormatLabel(StrUtil.format("{} x ", productName), signLabelInfo.bold));
builder.append(getFormatLabel(StrUtil.format("{} x {}", productName, number.stripTrailingZeros().toPlainString()), signLabelInfo.l))
.append(signLabelInfo.br);
// builder.append("<B>").append(productName).append(" x ").append(number).append("</B><BR>");
if (StrUtil.isNotBlank(skuName)) {
builder.append(getFormatLabel(skuName, signLabelInfo.bold))
builder.append(getFormatLabel(skuName, signLabelInfo.l))
.append(signLabelInfo.br);
// builder.append("<B>").append(skuName).append(" </B><BR>");
}