第一次

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 @Override
public PrintInfoDTO guestOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) { public PrintInfoDTO guestOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.guestOrderPrint(operator, orderInfo, machine, detailList); PrintInfoDTO printInfoDTO = super.guestOrderPrint(orderInfo, machine, detailList);
String data = buildGuestOrderPrintData(printInfoDTO, detailList); String data = buildGuestOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "客看单"); sendOrderPrint(data, orderInfo.getId(), machine, "客看单");
return null; return null;
} }
@Override @Override
public PrintInfoDTO preOrderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) { public PrintInfoDTO preOrderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.preOrderPrint(operator, orderInfo, machine, detailList); PrintInfoDTO printInfoDTO = super.preOrderPrint(orderInfo, machine, detailList);
String data = buildOrderPrintData(printInfoDTO, detailList); String data = buildOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "预结算单"); sendOrderPrint(data, orderInfo.getId(), machine, "预结算单");
return null; return null;
} }
@Override @Override
public PrintInfoDTO orderPrint(String operator, OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) { public PrintInfoDTO orderPrint(OrderInfo orderInfo, PrintMachine machine, List<OrderDetail> detailList) {
PrintInfoDTO printInfoDTO = super.orderPrint(operator, orderInfo, machine, detailList); PrintInfoDTO printInfoDTO = super.orderPrint(orderInfo, machine, detailList);
String data = buildOrderPrintData(printInfoDTO, detailList); String data = buildOrderPrintData(printInfoDTO, detailList);
sendOrderPrint(data, orderInfo.getId(), machine, "结算单"); sendOrderPrint(data, orderInfo.getId(), machine, "结算单");

View File

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

View File

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