打印 过长问题

This commit is contained in:
2026-04-16 16:27:46 +08:00
parent 9b48d49904
commit 4239fba23e
2 changed files with 19 additions and 19 deletions

View File

@@ -538,7 +538,7 @@ public interface PrinterImpl {
// 入库时间
builder.append(getFormatLabel(StrUtil.format("IN".equals(record.getType()) ? "入库时间: {}" : "出库时间: {}", DateUtil.format(record.getInStockTime(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel(key4("耗材名称", "库存单位", "IN".equals(record.getType()) ? "入库数量" : "出库数量", "金额",
14, 6, 6), signLabelInfo.s)).append(signLabelInfo.br);
@@ -561,7 +561,7 @@ public interface PrinterImpl {
String totalLine = key4("总计", consCountStr, stockNumberCountStr, amountCountStr, 8, 8, 8);
builder.append(getFormatLabel(totalLine, signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
// 操作员、打印时间
builder.append(getFormatLabel(StrUtil.format("操作员: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br);
@@ -581,7 +581,7 @@ public interface PrinterImpl {
// 标题:店铺名称 + 经营日报(居中,和充值/入库单风格统一)
builder.append(getFormatLabel(record.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
builder.append(getFormatLabel("经营日报", signLabelInfo.centerBold)).append(signLabelInfo.br).append(signLabelInfo.br);
builder.append(getFormatLabel("经营日报", signLabelInfo.center)).append(signLabelInfo.br).append(signLabelInfo.br);
// 基础信息:打印时间、操作人、统计时间
builder.append(getFormatLabel(StrUtil.format("打印时间: {}", DateUtil.format(LocalDateTime.now(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br);
@@ -606,7 +606,7 @@ public interface PrinterImpl {
builder.append(getFormatLabel("非实际收款的支付方式", signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(leftRightAlign(" 挂账", turnover.getOwed().stripTrailingZeros().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(leftRightAlign(" 余额", turnover.getBalance().stripTrailingZeros().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
// 退款/退菜
String refundAmountStr = record.getRefundAmount().stripTrailingZeros().toPlainString();
@@ -615,13 +615,13 @@ public interface PrinterImpl {
builder.append(getFormatLabel("退款/退菜", signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(leftRightAlign(" 退款金额", refundAmountStr, 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(leftRightAlign(" 退菜数量", returnDishCount, 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
// 订单(数量/订单总额)
DayReportPrintDTO.OrderSts order = record.getOrder();
String orderInfo = order.getOrderCount() + "/" + order.getOrderAmount().stripTrailingZeros().toPlainString();
builder.append(getFormatLabel(leftRightAlign("订单(数量/订单总额)", orderInfo, 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
// 数据统计
DayReportPrintDTO.Sts sts = record.getSts();
@@ -649,7 +649,7 @@ public interface PrinterImpl {
// 标题:店铺名称 + 商品报表(居中,和之前的报表风格统一)
builder.append(getFormatLabel(record.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
builder.append(getFormatLabel("商品报表", signLabelInfo.centerBold)).append(signLabelInfo.br).append(signLabelInfo.br);
builder.append(getFormatLabel("商品报表", signLabelInfo.center)).append(signLabelInfo.br).append(signLabelInfo.br);
// 基础信息:打印时间、操作人、统计时间
builder.append(getFormatLabel(StrUtil.format("打印时间: {}", DateUtil.format(LocalDateTime.now(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br);
@@ -660,10 +660,10 @@ public interface PrinterImpl {
String totalCountStr = record.getTotalProductCount().stripTrailingZeros().toPlainString();
String totalActualStr = record.getTotalActualAmount().stripTrailingZeros().toPlainString();
builder.append(getFormatLabel(StrUtil.format("总计商品{}件,实收金额{}元", totalCountStr, totalActualStr), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br).append(signLabelInfo.br);
// 表头:商品、数量、实收、销售额(四列对齐,和示例图完全匹配)
String header = key4("商品", "数量", "实收", "销售额", 12, 8, 8);
String header = key4("商品", "数量", "实收", "销售额", 12, 6, 6);
builder.append(getFormatLabel(header, signLabelInfo.s)).append(signLabelInfo.br);
// 遍历分类+商品明细
@@ -685,7 +685,7 @@ public interface PrinterImpl {
String actualStr = pro.getActualAmount().stripTrailingZeros().toPlainString();
String salesStr = pro.getSalesAmount().stripTrailingZeros().toPlainString();
// 商品名称前加2个空格实现缩进效果
String productLine = key4(" " + pro.getProductName(), numStr, actualStr, salesStr, 12, 8, 8);
String productLine = key4(" " + pro.getProductName(), numStr, actualStr, salesStr, 12, 6, 6);
builder.append(getFormatLabel(productLine, signLabelInfo.s)).append(signLabelInfo.br);
}
}
@@ -703,15 +703,15 @@ public interface PrinterImpl {
PrintSignLabel signLabelInfo = getSignLabelInfo();
StringBuilder builder = new StringBuilder();
// 标题:店铺名称 + 充值凭证
builder.append(getFormatLabel(record.getShopName(), signLabelInfo.centerBold)).append(signLabelInfo.br);
builder.append(getFormatLabel("充值凭证", signLabelInfo.centerBold)).append(signLabelInfo.br);
builder.append(getFormatLabel(record.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
builder.append(getFormatLabel("充值凭证", signLabelInfo.center)).append(signLabelInfo.br);
// 用户信息
builder.append(getFormatLabel(StrUtil.format("充值用户: {}(id{})", record.getUserName(), record.getUserId()), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(StrUtil.format("手机号: {}", record.getUserPhone()), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(StrUtil.format("支付时间: {}", DateUtil.format(record.getPayTime(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br);
// 充值明细
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel(leftRightAlign(" 充值金额:", record.getRechargeAmount().stripTrailingZeros().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br);
if (record.getGiftAmount() != null && record.getGiftAmount().compareTo(BigDecimal.ZERO) > 0) {
builder.append(getFormatLabel(leftRightAlign(" 赠送金额:", record.getGiftAmount().stripTrailingZeros().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br);
@@ -723,11 +723,11 @@ public interface PrinterImpl {
builder.append(getFormatLabel(leftRightAlign(" 赠送优惠券:", record.getGiftCoupon() + "", 32), signLabelInfo.s)).append(signLabelInfo.br);
}
builder.append(getFormatLabel(leftRightAlign(" 充值后余额:", record.getBalance().stripTrailingZeros().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
// 支付信息
builder.append(getFormatLabel(leftRightAlign("已付金额:", record.getPayAmount().stripTrailingZeros().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(leftRightAlign("支付方式:", record.getPayType(), 32), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br);
builder.append(getFormatLabel(StrUtil.format("操作员: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(StrUtil.format("充值编号: {}", record.getRechargeId()), signLabelInfo.s)).append(signLabelInfo.br);
@@ -745,7 +745,7 @@ public interface PrinterImpl {
// 标题:店铺名称 + 盘点单(居中,和之前所有打印单风格统一)
builder.append(getFormatLabel(record.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
builder.append(getFormatLabel("盘点单", signLabelInfo.centerBold)).append(signLabelInfo.br).append(signLabelInfo.br);
builder.append(getFormatLabel("盘点单", signLabelInfo.center)).append(signLabelInfo.br).append(signLabelInfo.br);
// 表头耗材名称、单价、实际数、盈亏数四列对齐复用key4工具方法
String header = key4("耗材名称", "单价", "实际数", "盈亏数", 12, 10, 8);
@@ -764,7 +764,7 @@ public interface PrinterImpl {
}
}
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br).append(signLabelInfo.br);
// 账存数量、盈亏金额、备注
builder.append(getFormatLabel(StrUtil.format("账存数量: {}", record.getWinLossNumberCount()), signLabelInfo.s)).append(signLabelInfo.br);
@@ -772,7 +772,7 @@ public interface PrinterImpl {
builder.append(getFormatLabel(StrUtil.format("盈亏金额: {}", winLossAmountStr), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel(StrUtil.format("备注: {}", StrUtil.isBlank(record.getRemark()) ? "" : record.getRemark()), signLabelInfo.s)).append(signLabelInfo.br);
builder.append(getFormatLabel("----------------------------------------")).append(signLabelInfo.br).append(signLabelInfo.br);
builder.append(getFormatLabel("--------------------------------")).append(signLabelInfo.br).append(signLabelInfo.br);
// 操作员、打印时间
builder.append(getFormatLabel(StrUtil.format("操作员: {}", record.getOperator()), signLabelInfo.s)).append(signLabelInfo.br);
// 打印时间复用之前的DateUtil格式化若DTO需补充printTime字段可按需求添加

View File

@@ -249,7 +249,7 @@ public class PrintMachineLogServiceImpl extends ServiceImpl<PrintMachineLogMappe
//仅当是最后一次任务时,才执行更新操作
if (isLastTask) {
super.updateById(entity);
updateOrderEntity(orderId, config, isPrintSuccess);
// updateOrderEntity(orderId, config, isPrintSuccess);
}
}
};