第一次

This commit is contained in:
2026-04-03 16:01:30 +08:00
parent 9d267a539d
commit c8bb4d2658
3 changed files with 26 additions and 23 deletions

View File

@@ -99,24 +99,24 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl {
}
@Override
public PrintInfoDTO guestOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.guestOrderPrint(operator, orderInfo, machine, detailList);
public PrintInfoDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.guestOrderPrint(orderInfo, machine, detailList);
String data = buildGuestOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "客看单");
return null;
}
@Override
public PrintInfoDTO preOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.preOrderPrint(operator, orderInfo, machine, detailList);
public PrintInfoDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.preOrderPrint(orderInfo, machine, detailList);
String data = buildOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "预结算单");
return null;
}
@Override
public PrintInfoDTO orderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.orderPrint(operator, orderInfo, machine, detailList);
public PrintInfoDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.orderPrint(orderInfo, machine, detailList);
String data = buildOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "结算单");

View File

@@ -380,8 +380,9 @@ public abstract class PrinterHandler {
case PrintTypeEnum.GUEST_ORDER:
log.info("准备开始打印客看订单");
if (data instanceof OrderInfo orderInfo) {
orderInfo.setPlaceNum(placeNum);
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()).eq(OrderDetail::getPlaceNum, placeNum));
guestOrderPrint("", orderInfo, machine, orderDetailList);
guestOrderPrint(orderInfo, machine, orderDetailList);
} else {
throw new RuntimeException("传递数据类型有误");
}
@@ -562,7 +563,7 @@ public abstract class PrinterHandler {
});
if (!detailList.isEmpty()) {
preOrderPrint("操作人名称", orderInfo, machine, orderDetail);
preOrderPrint(orderInfo, machine, orderDetail);
}
}
@@ -611,7 +612,7 @@ public abstract class PrinterHandler {
detailList.add(detail);
});
if (!detailList.isEmpty()) {
orderPrint("操作人名称", orderInfo, machine, tbOrderDetailList);
orderPrint(orderInfo, machine, tbOrderDetailList);
}
}
@@ -671,13 +672,12 @@ public abstract class PrinterHandler {
}
public PrintInfoDTO guestOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = getPrintInfoDTO(operator, orderInfo, "客看单");
public PrintInfoDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = getPrintInfoDTO(orderInfo, "客看单");
BigDecimal originalAmount = BigDecimal.ZERO;
for (OrderDetail orderDetail : detailList) {
if (orderDetail.getIsGift() == 1) {
} else if (orderDetail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
originalAmount = originalAmount.add((orderDetail.getNum().subtract(orderDetail.getReturnNum()).subtract(orderDetail.getRefundNum())).multiply(orderDetail.getUnitPrice()));
} else {
@@ -698,6 +698,9 @@ public abstract class PrinterHandler {
orderDetail.setProductName("【赠】%s".formatted(orderDetail.getProductName()));
}
}
if (orderInfo.getPlaceNum() != null && orderInfo.getPlaceNum() != 1) {
orderInfo.setSeatAmount(BigDecimal.ZERO);
}
printInfoDTO.setOriginalAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee()))
.setScale(2, RoundingMode.HALF_UP).toPlainString());
printInfoDTO.setPayAmount((originalAmount.add(orderInfo.getSeatAmount()).add(orderInfo.getPackFee())
@@ -709,8 +712,8 @@ public abstract class PrinterHandler {
return printInfoDTO;
}
public PrintInfoDTO preOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = getPrintInfoDTO(operator, orderInfo, "预结算单");
public PrintInfoDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = getPrintInfoDTO(orderInfo, "预结算单");
BigDecimal originalAmount = BigDecimal.ZERO;
for (OrderDetail orderDetail : detailList) {
@@ -732,8 +735,8 @@ public abstract class PrinterHandler {
return printInfoDTO;
}
public PrintInfoDTO orderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = getPrintInfoDTO(operator, orderInfo, "结算单");
public PrintInfoDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = getPrintInfoDTO(orderInfo, "结算单");
BigDecimal originalAmount = orderInfo.getOriginAmount() == null ? BigDecimal.ZERO : orderInfo.getOriginAmount();
printInfoDTO.setOriginalAmount(originalAmount.toPlainString());
@@ -744,7 +747,7 @@ public abstract class PrinterHandler {
return printInfoDTO;
}
private PrintInfoDTO getPrintInfoDTO(String operator, OrderInfo orderInfo, String printTitle) {
private PrintInfoDTO getPrintInfoDTO(OrderInfo orderInfo, String printTitle) {
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
long count = orderInfoService.count(new QueryWrapper().eq(OrderInfo::getTradeDay, orderInfo.getTradeDay())
.eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode())

View File

@@ -137,24 +137,24 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
}
@Override
public PrintInfoDTO guestOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.guestOrderPrint(operator, orderInfo, machine, detailList);
public PrintInfoDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.guestOrderPrint(orderInfo, machine, detailList);
String data = buildGuestOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "客看单");
return null;
}
@Override
public PrintInfoDTO preOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.preOrderPrint(operator, orderInfo, machine, detailList);
public PrintInfoDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.preOrderPrint(orderInfo, machine, detailList);
String data = buildOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "预结算单");
return null;
}
@Override
public PrintInfoDTO orderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.orderPrint(operator, orderInfo, machine, detailList);
public PrintInfoDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.orderPrint(orderInfo, machine, detailList);
String data = buildOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "结算单");
return null;