打印简化

This commit is contained in:
2024-09-28 10:40:52 +08:00
parent 57800dab04
commit ea21e97e29
5 changed files with 47 additions and 35 deletions

View File

@@ -341,14 +341,14 @@ public class PrintMechineConsumer {
data = PrinterUtils.getPrintData("return",
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), Math.abs(printerNum), remark);
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), Math.abs(printerNum), remark, null);
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
} else {
data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
printerNum, remark);
printerNum, remark, null);
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
@@ -366,7 +366,7 @@ public class PrintMechineConsumer {
TbOrderDetail orderDetail = (TbOrderDetail) item;
String data = PrinterUtils.getPrintData("return",
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark());
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark(), null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
@@ -436,7 +436,7 @@ public class PrintMechineConsumer {
TbOrderDetail orderDetail = (TbOrderDetail) item;
String data = PrinterUtils.getPrintData("return",
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark());
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark(), null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
@@ -478,7 +478,7 @@ public class PrintMechineConsumer {
}
String data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
it.getNum(), remark);
it.getNum(), remark, null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
}
@@ -506,7 +506,8 @@ public class PrintMechineConsumer {
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap();
}
String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ? orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark);
String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ?
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark, null);
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
}

View File

@@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.rabbit.print;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -44,8 +45,10 @@ public class YxyPrinter extends PrinterHandler{
protected void returnDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
String data = PrinterUtils.getPrintData("return",
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), Math.abs(orderDetail.getNum()), orderDetail.getRemark());
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(),
Math.abs(orderDetail.getNum()), orderDetail.getRemark(), orderDetail.getNote());
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
}
@@ -53,8 +56,9 @@ public class YxyPrinter extends PrinterHandler{
protected void normalDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
String data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(),
orderDetail.getNum(), orderDetail.getRemark());
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
orderDetail.getNum(), orderDetail.getRemark(), orderDetail.getNote());
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
}
@@ -71,7 +75,8 @@ public class YxyPrinter extends PrinterHandler{
String printType = "退款单";
String data = PrinterUtils.getCashPrintData(detailPO, printType, "return");
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
PrinterUtils.printTickets(voiceJson, 1, 1, machine.getAddress(), data);
}
@@ -89,7 +94,8 @@ public class YxyPrinter extends PrinterHandler{
detailPO.setOutNumber(orderInfo.getOutNumber());
String printType = "结算单";
String data = PrinterUtils.getCashPrintData(detailPO, printType, orderInfo.getOrderType());
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
}
@@ -123,6 +129,10 @@ public class YxyPrinter extends PrinterHandler{
}
public static void main(String[] args) {
String data = PrinterUtils.getPrintData("", "#3",
DateUtils.getTime(DateUtil.date()), "九度",
Integer.valueOf("20"), "少冰", "加菜防守打法火速地方啊地上1三大法宝苏俄倒海翻江");
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
PrinterUtils.printTickets(voiceJson, 3, 1, "ZF544PG03W00005", data);
}
}