打印消息

This commit is contained in:
2026-04-17 15:22:11 +08:00
parent 3a6f244225
commit f14dd5ed4e

View File

@@ -130,8 +130,8 @@ public interface PrinterImpl {
default String buildHandoverData(HandoverRecordDTO handoverRecord) { default String buildHandoverData(HandoverRecordDTO handoverRecord) {
PrintSignLabel signLabelInfo = getSignLabelInfo(); PrintSignLabel signLabelInfo = getSignLabelInfo();
StringBuilder builder = new StringBuilder() StringBuilder builder = new StringBuilder()
.append(getFormatLabel(handoverRecord.getShopName(), signLabelInfo.center, signLabelInfo.s)).append(signLabelInfo.br) .append(getFormatLabel(handoverRecord.getShopName(), signLabelInfo.center)).append(signLabelInfo.br)
.append(getFormatLabel("交班小票", signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br) .append(getFormatLabel("交班小票", signLabelInfo.center)).append(signLabelInfo.br)
.append(getFormatLabel("交班时间: " + DateUtil.format(handoverRecord.getHandoverTime(), "yyyy/MM/dd HH:mm:ss"), signLabelInfo.s)).append(signLabelInfo.br) .append(getFormatLabel("交班时间: " + DateUtil.format(handoverRecord.getHandoverTime(), "yyyy/MM/dd HH:mm:ss"), signLabelInfo.s)).append(signLabelInfo.br)
.append(getFormatLabel("收银员: " + handoverRecord.getStaffName(), signLabelInfo.s)).append(signLabelInfo.br) .append(getFormatLabel("收银员: " + handoverRecord.getStaffName(), signLabelInfo.s)).append(signLabelInfo.br)
.append(getFormatLabel("交班周期: " + DateUtil.format(handoverRecord.getLoginTime(), "dd日HH:mm") + "--" + .append(getFormatLabel("交班周期: " + DateUtil.format(handoverRecord.getLoginTime(), "dd日HH:mm") + "--" +
@@ -187,8 +187,8 @@ public interface PrinterImpl {
default String buildOrderPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) { default String buildOrderPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) {
PrintSignLabel signLabelInfo = getSignLabelInfo(); PrintSignLabel signLabelInfo = getSignLabelInfo();
StringBuilder data = new StringBuilder(); StringBuilder data = new StringBuilder();
data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
data.append(getFormatLabel(orderPrintDTO.getPrintTitle(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getPrintTitle(), signLabelInfo.center)).append(signLabelInfo.br);
data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br);
data.append(getFormatLabel(getFormatLabel(leftRightAlign(orderPrintDTO.getPrintType(), StrUtil.isNotBlank(orderPrintDTO.getSeatNum()) ? orderPrintDTO.getSeatNum() + "" : "", 32)) data.append(getFormatLabel(getFormatLabel(leftRightAlign(orderPrintDTO.getPrintType(), StrUtil.isNotBlank(orderPrintDTO.getSeatNum()) ? orderPrintDTO.getSeatNum() + "" : "", 32))
, signLabelInfo.s)).append(signLabelInfo.br); , signLabelInfo.s)).append(signLabelInfo.br);
@@ -272,8 +272,8 @@ public interface PrinterImpl {
default String buildGuestOrderPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) { default String buildGuestOrderPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) {
PrintSignLabel signLabelInfo = getSignLabelInfo(); PrintSignLabel signLabelInfo = getSignLabelInfo();
StringBuilder data = new StringBuilder(); StringBuilder data = new StringBuilder();
data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
data.append(getFormatLabel("客看单", signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel("客看单", signLabelInfo.center)).append(signLabelInfo.br);
if (StrUtil.isNotBlank(orderPrintDTO.getPickupNum())) { if (StrUtil.isNotBlank(orderPrintDTO.getPickupNum())) {
data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br);
} }
@@ -345,8 +345,8 @@ public interface PrinterImpl {
default String buildRefundOrderPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) { default String buildRefundOrderPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) {
PrintSignLabel signLabelInfo = getSignLabelInfo(); PrintSignLabel signLabelInfo = getSignLabelInfo();
StringBuilder data = new StringBuilder(); StringBuilder data = new StringBuilder();
data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
data.append(getFormatLabel(orderPrintDTO.getPrintTitle(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getPrintTitle(), signLabelInfo.center)).append(signLabelInfo.br);
data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br);
data.append(getFormatLabel(getFormatLabel(leftRightAlign(orderPrintDTO.getPrintType(), StrUtil.isNotBlank(orderPrintDTO.getSeatNum()) ? orderPrintDTO.getSeatNum() + "" : "", 32)) data.append(getFormatLabel(getFormatLabel(leftRightAlign(orderPrintDTO.getPrintType(), StrUtil.isNotBlank(orderPrintDTO.getSeatNum()) ? orderPrintDTO.getSeatNum() + "" : "", 32))
, signLabelInfo.s)).append(signLabelInfo.br); , signLabelInfo.s)).append(signLabelInfo.br);
@@ -414,8 +414,8 @@ public interface PrinterImpl {
default String buildAllKitchenPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) { default String buildAllKitchenPrintData(OrderPrintDTO orderPrintDTO, List<OrderDetail> detailList) {
PrintSignLabel signLabelInfo = getSignLabelInfo(); PrintSignLabel signLabelInfo = getSignLabelInfo();
StringBuilder data = new StringBuilder(); StringBuilder data = new StringBuilder();
data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
data.append(getFormatLabel(orderPrintDTO.getPrintTitle(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getPrintTitle(), signLabelInfo.center)).append(signLabelInfo.br);
data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br); data.append(getFormatLabel(orderPrintDTO.getPickupNum(), signLabelInfo.f)).append(signLabelInfo.br);
data.append(getFormatLabel(getFormatLabel(orderPrintDTO.getPrintType()), signLabelInfo.s)).append(signLabelInfo.br); data.append(getFormatLabel(getFormatLabel(orderPrintDTO.getPrintType()), signLabelInfo.s)).append(signLabelInfo.br);
data.append(getDividingLine()).append(signLabelInfo.br); data.append(getDividingLine()).append(signLabelInfo.br);
@@ -541,7 +541,7 @@ public interface PrinterImpl {
// 标题:入库 + 店铺名称 + 入库单 // 标题:入库 + 店铺名称 + 入库单
builder.append(getFormatLabel(record.getShopName(), signLabelInfo.center)).append(signLabelInfo.br); builder.append(getFormatLabel(record.getShopName(), signLabelInfo.center)).append(signLabelInfo.br);
builder.append(getFormatLabel("IN".equals(record.getType()) ? "入库单" : "出库单", signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); builder.append(getFormatLabel("IN".equals(record.getType()) ? "入库单" : "出库单", signLabelInfo.center)).append(signLabelInfo.br);
// 入库时间 // 入库时间
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(StrUtil.format("IN".equals(record.getType()) ? "入库时间: {}" : "出库时间: {}", DateUtil.format(record.getInStockTime(), "yyyy/MM/dd HH:mm:ss")), signLabelInfo.s)).append(signLabelInfo.br);
@@ -710,8 +710,8 @@ public interface PrinterImpl {
PrintSignLabel signLabelInfo = getSignLabelInfo(); PrintSignLabel signLabelInfo = getSignLabelInfo();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
// 标题:店铺名称 + 充值凭证 // 标题:店铺名称 + 充值凭证
builder.append(getFormatLabel(record.getShopName(), signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); builder.append(getFormatLabel(record.getShopName(),signLabelInfo.center)).append(signLabelInfo.br);
builder.append(getFormatLabel("充值凭证", signLabelInfo.s, signLabelInfo.center)).append(signLabelInfo.br); builder.append(getFormatLabel("充值凭证", signLabelInfo.center)).append(signLabelInfo.br);
// 用户信息 // 用户信息
builder.append(getFormatLabel("充值用户:" + record.getUserName(), signLabelInfo.s)).append(signLabelInfo.br); builder.append(getFormatLabel("充值用户:" + record.getUserName(), signLabelInfo.s)).append(signLabelInfo.br);