打印机相关实现
This commit is contained in:
@@ -46,14 +46,14 @@ public class PrintMqListener {
|
||||
log.info("接收到订单打印消息:{}", orderId);
|
||||
MqLog mqLog = new MqLog().setQueue(RabbitConstants.Queue.ORDER_PRINT_QUEUE).setMsg(orderId).setType("orderPrint").setPlat("java.account").setCreateTime(DateUtil.date().toLocalDateTime());
|
||||
try {
|
||||
OrderInfo orderInfo = orderInfoService.getById(orderId);
|
||||
if (orderInfo == null) {
|
||||
log.error("订单信息不存在, {}", orderId);
|
||||
throw new RuntimeException("订单信息不存在");
|
||||
}
|
||||
// OrderInfo orderInfo = orderInfoService.getById(orderId);
|
||||
// if (orderInfo == null) {
|
||||
// log.error("订单信息不存在, {}", orderId);
|
||||
// throw new RuntimeException("订单信息不存在");
|
||||
// }
|
||||
|
||||
getPrintMachine(orderInfo.getShopId(), "cash", "one", "order").forEach(machine -> {
|
||||
printerHandler.handleRequest(machine, orderInfo);
|
||||
getPrintMachine(1L, "cash", "queue", "queue").forEach(machine -> {
|
||||
printerHandler.handleRequest(machine, null, 1L);
|
||||
// printPlaceTicket(isReturn, machine, orderInfo, shopInfo);
|
||||
});
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -108,7 +109,9 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl{
|
||||
if (StrUtil.isNotBlank(machine.getPrintQty())) {
|
||||
printerNum = machine.getPrintQty().split("\\^")[1];
|
||||
}
|
||||
PrintInfoDTO printInfoDTO = new PrintInfoDTO().setShopName(shopInfo.getShopName()).setPrintType("普通打印").setPickupNum(getPickupNum(orderInfo))
|
||||
|
||||
PrintInfoDTO printInfoDTO = new PrintInfoDTO().setShopName(shopInfo.getShopName())
|
||||
.setPrintType("普通打印").setPickupNum(getPickupNum(orderInfo))
|
||||
.setOrderNo(orderInfo.getOrderNo()).setTradeDate(DateUtil.date().toDateStr()).setOperator("【POS-1】001").setPayAmount(orderInfo.getPayAmount().toPlainString())
|
||||
.setOriginalAmount(orderInfo.getOriginAmount().toPlainString()).setReturn(isReturn(orderInfo))
|
||||
.setBalance(balance).setPayType((ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType())).setIntegral("0")
|
||||
@@ -120,8 +123,11 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void callNumPrint(PrintMachine machine) {
|
||||
log.warn("叫号打印功能未实现");
|
||||
protected void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum, String codeUrl, LocalDateTime takeTime, String shopNote) {
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一条新的排号记录\"}";
|
||||
String resp = buildCallTicketData(shopName, tableName, callNum, preNum, codeUrl,shopNote, takeTime);
|
||||
sendPrintRequest(machine.getAddress(), resp, voiceJson, "1");
|
||||
// shopPrintLogService.save(machine, "叫号单", data, resp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,100 +137,6 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl{
|
||||
return DigestUtils.sha1Hex(FeiPrinter.USER + FeiPrinter.UKEY + timeStamp);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String buildOrderPrintData(PrintInfoDTO printInfoDTO, List<OrderDetail> detailList) {
|
||||
// StringBuilder data = new StringBuilder();
|
||||
// data.append(StrUtil.format("<CB>{}</CB><BR>", printInfoDTO.getShopName()));
|
||||
// data.append("<BR>");
|
||||
// data.append(StrUtil.format("<C><BOLD>{}【{}】</C></BOLD><BR>", printInfoDTO.getPrintTitle(), printInfoDTO.getPickupNum()));
|
||||
// data.append("<BR>");
|
||||
// data.append(StrUtil.format("订单号:{}<BR>", printInfoDTO.getOrderNo()));
|
||||
// data.append(StrUtil.format("交易时间:{}<BR>", printInfoDTO.getTradeDate()));
|
||||
// data.append(StrUtil.format("收银员:{}<BR>", printInfoDTO.getOperator()));
|
||||
// data.append("<BR>");
|
||||
// data.append("品名 数量 小计<BR>");
|
||||
// data.append("--------------------------------<BR>");
|
||||
// for (OrderDetail detail : detailList) {
|
||||
// String productName = detail.getProductName();
|
||||
// String number = detail.getNum().stripTrailingZeros().toPlainString();
|
||||
// String amount = toPlainStr(detail.getPayAmount().toPlainString());
|
||||
// //58mm的机器,一行打印16个汉字,32个字母; 80mm的机器,一行打印24个汉字,48个字母
|
||||
// //展示4列 b1代表名称列占用(14个字节) b2单价列(6个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,14+6+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节
|
||||
// //String row = FeieYunUtil.getRow(productName, "",number, amount, 14, 6,3, 6)
|
||||
// //展示3列 b1代表名称列占用(20个字节) b2单价列(0个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,20+0+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节
|
||||
// String row = getRow(productName, "", number, amount, 20, 0, 3, 6);
|
||||
// data.append(row);
|
||||
// if (StrUtil.isNotBlank(detail.getSkuName())) {
|
||||
// data.append("规格:").append(detail.getSkuName()).append("<BR>");
|
||||
// }
|
||||
// String proGroupInfo = detail.getProGroupInfo();
|
||||
// if (StrUtil.isBlank(proGroupInfo)) {
|
||||
// continue;
|
||||
// }
|
||||
// if (!JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
||||
// continue;
|
||||
// }
|
||||
// JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
|
||||
// for (int i = 0; i < subItems.size(); i++) {
|
||||
// String proName = subItems.getJSONObject(i).getStr("proName");
|
||||
// int qty = subItems.getJSONObject(i).getInt("number");
|
||||
// String subRow = getRow(" - %s".formatted(proName), "", "%d.00".formatted(qty), "0.00", 20, 0, 3, 6);
|
||||
// data.append(subRow);
|
||||
// }
|
||||
// }
|
||||
// if (ObjectUtil.isNotNull(printInfoDTO.getDiscountAmount())) {
|
||||
// data.append("--------------------------------<BR>");
|
||||
// data.append(StrUtil.format("原价:{}<BR>", toPlainStr(printInfoDTO.getOriginalAmount())));
|
||||
// data.append(StrUtil.format("折扣:-{}<BR>", toPlainStr(printInfoDTO.getDiscountAmount())));
|
||||
// }
|
||||
// data.append("--------------------------------<BR>");
|
||||
// String t = "¥" + printInfoDTO.getPayAmount();
|
||||
// if (printInfoDTO.isReturn()) {
|
||||
// data.append(StrUtil.format("<B>应退:{}</B><BR>", t));
|
||||
// } else {
|
||||
// data.append(StrUtil.format("<B>应收:{}</B><BR>", t));
|
||||
// }
|
||||
// data.append("--------------------------------<BR>");
|
||||
// if (ObjectUtil.isNotEmpty(printInfoDTO.getPayType()) && ObjectUtil.isNotNull(printInfoDTO.getPayType()) && printInfoDTO.getPayType().equals("deposit")) {
|
||||
// data.append(StrUtil.format("储值:{}<BR>", toPlainStr(printInfoDTO.getOriginalAmount())));
|
||||
// data.append(StrUtil.format("积分:{}<BR>", printInfoDTO.getIntegral()));
|
||||
// }
|
||||
// data.append(StrUtil.format("余额:{}<BR>", toPlainStr(printInfoDTO.getBalance())));
|
||||
// data.append("--------------------------------<BR>");
|
||||
// if (StrUtil.isNotBlank(printInfoDTO.getRemark())) {
|
||||
// data.append(StrUtil.format("<L><BOLD>备注:{}</BOLD></L><BR>", printInfoDTO.getRemark()));
|
||||
// }
|
||||
// data.append("打印时间:").append(DateUtil.date().toDateStr()).append("<BR>");
|
||||
// data.append("<CUT>");
|
||||
// return data.toString();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 构建打印内容
|
||||
*/
|
||||
// @Override
|
||||
// public String buildDishPrintData(String pickupNumber, String date, String productName,
|
||||
// BigDecimal number, String remark, String proGroupInfo) {
|
||||
// StringBuilder builder = new StringBuilder()
|
||||
// .append("<CB>").append(pickupNumber).append("</CB><BR>")
|
||||
// .append("<L>时间: ").append(date).append(" </L><BR>")
|
||||
// .append("<B><BOLD>").append(productName).append(" x ")
|
||||
// .append(number.stripTrailingZeros().toPlainString()).append("</BOLD></B><BR>")
|
||||
// .append("<B><BOLD>").append(StrUtil.emptyToDefault(remark, "")).append("</BOLD></B><BR>");
|
||||
//
|
||||
// if (StrUtil.isNotBlank(proGroupInfo) && JSONUtil.isTypeJSONArray(proGroupInfo)) {
|
||||
// JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
|
||||
// for (int i = 0; i < subItems.size(); i++) {
|
||||
// builder.append("<B>(").append(i + 1).append(")")
|
||||
// .append(subItems.getJSONObject(i).getStr("proName"))
|
||||
// .append(" x ").append(subItems.getJSONObject(i).getInt("number"))
|
||||
// .append("</B><BR>");
|
||||
// }
|
||||
// }
|
||||
// return builder.toString();
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public <R> R sendPrintRequest(String address, String metaPrintData, String voiceData, String printerNum) {
|
||||
log.info("飞蛾打印机开始发送打印请求, 设备地址: {}, 元数据: {}", address, metaPrintData);
|
||||
@@ -253,5 +165,4 @@ public class FeiPrinter extends PrinterHandler implements PrinterImpl{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.account.dto.PrintOrderDetailDTO;
|
||||
import com.czg.account.entity.PrintMachine;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.*;
|
||||
import com.czg.account.service.CallQueueService;
|
||||
import com.czg.account.service.CallTableService;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.config.RedisCst;
|
||||
import com.czg.order.entity.OrderDetail;
|
||||
@@ -21,7 +23,10 @@ import com.czg.product.entity.ProdSku;
|
||||
import com.czg.product.entity.Product;
|
||||
import com.czg.product.service.ProdSkuService;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.Data;
|
||||
@@ -32,10 +37,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -52,7 +55,15 @@ public abstract class PrinterHandler {
|
||||
protected RedisService redisService;
|
||||
@Resource
|
||||
protected ShopUserService shopUserService;
|
||||
@Resource
|
||||
protected CallQueueService callQueueService;
|
||||
@Resource
|
||||
protected CallTableService callTableService;
|
||||
@Resource
|
||||
protected ShopInfoService shopInfoService;
|
||||
|
||||
@DubboReference
|
||||
protected SysParamsService sysParamsService;
|
||||
@DubboReference
|
||||
protected OrderDetailService orderDetailService;
|
||||
@DubboReference
|
||||
@@ -110,13 +121,13 @@ public abstract class PrinterHandler {
|
||||
this.printerBrand = printerBrand;
|
||||
}
|
||||
|
||||
public void handleRequest(PrintMachine machine, OrderInfo orderInfo) {
|
||||
public void handleRequest(PrintMachine machine, OrderInfo orderInfo, Long callQueueId) {
|
||||
if (canHandleRequest(machine.getContentType(), machine.getConnectionType())) {
|
||||
log.info("打印机: {}, 订单信息: {}", machine.getName(), orderInfo);
|
||||
print(machine, orderInfo);
|
||||
print(machine, orderInfo, callQueueId);
|
||||
} else if (nextPrinter != null) {
|
||||
log.info("当前打印机无法处理: {},将请求传递给下一个打印机:{}...", this.printerBrand, nextPrinter.printerBrand);
|
||||
nextPrinter.handleRequest(machine, orderInfo);
|
||||
nextPrinter.handleRequest(machine, orderInfo, callQueueId);
|
||||
} else {
|
||||
log.warn("未找到匹配打印机");
|
||||
}
|
||||
@@ -162,14 +173,15 @@ public abstract class PrinterHandler {
|
||||
return orderDetails;
|
||||
}
|
||||
|
||||
protected void print(PrintMachine machine, OrderInfo orderInfo) {
|
||||
protected void print(PrintMachine machine, OrderInfo orderInfo, Long callQueueId) {
|
||||
String printMethod = machine.getPrintMethod();
|
||||
if (StrUtil.isBlank(printMethod) && StrUtil.isBlank(machine.getPrintType())) {
|
||||
throw new RuntimeException("打印机配置为空");
|
||||
}
|
||||
|
||||
// 订单打印
|
||||
if (StrUtil.isNotBlank(printMethod)) {
|
||||
if (StrUtil.isNotBlank(printMethod) && !"queue".equals(printMethod)) {
|
||||
log.info("准备开始打印订单或菜品单");
|
||||
// 查询订单详情
|
||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||
//仅打印后厨-一菜一品
|
||||
@@ -185,26 +197,28 @@ public abstract class PrinterHandler {
|
||||
}
|
||||
default -> log.warn("未知打印类型: {}", printMethod);
|
||||
}
|
||||
}
|
||||
if (StrUtil.isBlank(machine.getPrintType())) {
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
log.info("准备开始打印叫号单");
|
||||
if (StrUtil.isBlank(machine.getPrintType())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
JSONArray options = JSONArray.parseArray(machine.getPrintType());
|
||||
if (options == null || options.isEmpty()) {
|
||||
log.warn("打印机: {}, 未配置: print_type", machine.getId());
|
||||
return;
|
||||
}
|
||||
//是否包含排队取号
|
||||
if (!options.contains("queue")) {
|
||||
log.warn("打印机: {}, 此打印机不包含排队叫号打印", machine.getId());
|
||||
return;
|
||||
}
|
||||
JSONArray options = JSONArray.parseArray(machine.getPrintType());
|
||||
if (options == null || options.isEmpty()) {
|
||||
log.warn("打印机: {}, 未配置: print_type", machine.getId());
|
||||
return;
|
||||
}
|
||||
//是否包含排队取号
|
||||
if (!options.contains("queue")) {
|
||||
log.warn("打印机: {}, 此打印机不包含排队叫号打印", machine.getId());
|
||||
return;
|
||||
}
|
||||
// if (printDTO == null) {
|
||||
// return;
|
||||
// }
|
||||
// callNumPrint(machine, printDTO);
|
||||
onlyCallNumPrint(machine, callQueueId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,6 +331,37 @@ public abstract class PrinterHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印排队小票
|
||||
*/
|
||||
private void onlyCallNumPrint(PrintMachine machine, Long callQueueId) {
|
||||
if (callQueueId == null) {
|
||||
log.warn("打印叫号小票失败,id为空");
|
||||
}
|
||||
|
||||
CallQueue queue = callQueueService.getById(callQueueId);
|
||||
if (queue == null) {
|
||||
log.warn("叫号记录不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
CzgResult<SysParamsDTO> paramsByCode = sysParamsService.getParamsByCode("call_page_url");
|
||||
SysParamsDTO params = paramsByCode.getData();
|
||||
String callUrl = null;
|
||||
if (params != null && StrUtil.isNotBlank(params.getParamValue())) {
|
||||
callUrl = params.getParamValue();
|
||||
}
|
||||
|
||||
CallTable tbCallTable = callTableService.getById(queue.getCallTableId());
|
||||
ShopInfo shopInfo = shopInfoService.getById(queue.getShopId());
|
||||
callNumPrint(machine, queue.getCallNum(), shopInfo.getShopName(), tbCallTable.getName(), tbCallTable.getNote(), String.valueOf(callQueueService.count(new QueryWrapper()
|
||||
.eq(CallQueue::getShopId, queue.getShopId())
|
||||
.eq(CallQueue::getCallTableId, queue.getCallTableId())
|
||||
.lt(CallQueue::getId, queue.getId())
|
||||
.in(CallQueue::getState, 0, 1))), callUrl == null ? "未配置页面" : StrUtil.format(callUrl, queue.getShopId(), queue.getId()), queue.getCreateTime(),
|
||||
StrUtil.format("过号顺延{}桌 {}桌后需重新排号 谢谢理解!", tbCallTable.getPostponeNum(), tbCallTable.getPostponeNum()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取取餐号
|
||||
*/
|
||||
@@ -324,6 +369,11 @@ public abstract class PrinterHandler {
|
||||
return StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getTakeCode() : orderInfo.getTableName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单信息判断是否是退单
|
||||
* @param orderInfo 顶动感信息
|
||||
* @return 是否退款
|
||||
*/
|
||||
protected static boolean isReturn(OrderInfo orderInfo) {
|
||||
return ArrayUtil.contains(new String[]{"refunding", "part-refund", "refund"}, orderInfo.getStatus());
|
||||
}
|
||||
@@ -337,7 +387,8 @@ public abstract class PrinterHandler {
|
||||
|
||||
protected abstract void normalOrderPrint(OrderInfo orderInfo, PrintMachine machine, String balance, List<OrderDetail> detailList);
|
||||
|
||||
protected abstract void callNumPrint(PrintMachine machine);
|
||||
protected abstract void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum,
|
||||
String codeUrl, LocalDateTime takeTime, String shopNote);
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -12,7 +12,9 @@ import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -132,6 +134,13 @@ public interface PrinterImpl {
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建订单打印元数据
|
||||
*
|
||||
* @param printInfoDTO 打印信息
|
||||
* @param detailList 订单详情
|
||||
* @return 订单打印元数据
|
||||
*/
|
||||
default String buildOrderPrintData(PrinterHandler.PrintInfoDTO printInfoDTO, List<OrderDetail> detailList) {
|
||||
PrintSignLabel signLabelInfo = getSignLabelInfo();
|
||||
StringBuilder data = new StringBuilder();
|
||||
@@ -316,12 +325,62 @@ public interface PrinterImpl {
|
||||
// builder.append("<CS:32>(").append(i + 1).append(")").append(proName).append(" x ").append(qty).append("</CS><BR>");
|
||||
}
|
||||
}
|
||||
builder.append(signLabelInfo.br);
|
||||
builder.append(signLabelInfo.br)
|
||||
.append(signLabelInfo.cut);
|
||||
// builder.append("<OUT:150>");
|
||||
// builder.append("<PCUT>");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建叫号元数据
|
||||
* @param shopName 店铺名称
|
||||
* @param tableName 表名
|
||||
* @param callNum 号码
|
||||
* @param preNum 前面还有几桌
|
||||
* @param codeUrl 二维码地址
|
||||
* @param shopNote 店铺备注
|
||||
* @param takeTime 取号时间
|
||||
* @return 元数据
|
||||
*/
|
||||
default String buildCallTicketData(String shopName, String tableName, String callNum, String preNum, String codeUrl, String shopNote, LocalDateTime takeTime) {
|
||||
PrintSignLabel signLabelInfo = getSignLabelInfo();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getFormatLabel(shopName, signLabelInfo.center, signLabelInfo.bold))
|
||||
.append(signLabelInfo.br)
|
||||
.append(signLabelInfo.br)
|
||||
.append("------------------------").append(signLabelInfo.br)
|
||||
.append(getFormatLabel(StrUtil.format("{} {}", tableName, callNum), signLabelInfo.center, signLabelInfo.bold))
|
||||
.append(signLabelInfo.br)
|
||||
.append(getFormatLabel(StrUtil.format("前面有{}桌", preNum), signLabelInfo.center))
|
||||
.append(signLabelInfo.br)
|
||||
.append(getFormatLabel("怕过号扫一扫", signLabelInfo.center, signLabelInfo.bold))
|
||||
.append(signLabelInfo.br)
|
||||
.append(getFormatLabel(codeUrl, signLabelInfo.center, signLabelInfo.qr))
|
||||
.append(signLabelInfo.br)
|
||||
.append("------------------------").append(signLabelInfo.br)
|
||||
.append(getFormatLabel(shopNote, signLabelInfo.s))
|
||||
.append(signLabelInfo.br)
|
||||
.append("------------------------").append(signLabelInfo.br)
|
||||
.append(getFormatLabel(StrUtil.format("取号时间:{}", DateUtil.format(takeTime, "yyyy-MM-dd HH:mm:ss")), signLabelInfo.s))
|
||||
.append(signLabelInfo.br)
|
||||
.append(getFormatLabel(StrUtil.format("打印时间:{}", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss")), signLabelInfo.s))
|
||||
.append(signLabelInfo.br)
|
||||
.append(signLabelInfo.cut);
|
||||
// sb.append("<C><B>").append(shopName).append("</B></C><BR><BR>")
|
||||
// .append("------------------------<BR>")
|
||||
// .append(StrUtil.format(StrUtil.format("<C><B>{} {}</B></C><BR>", tableName, callNum)))
|
||||
// .append(StrUtil.format("<C>前面有{}桌</C><BR>", preNum))
|
||||
// .append(StrUtil.format("<C><QR>{}</QR></C><BR>", codeUrl))
|
||||
// .append("<C><B>怕过号扫一扫<B></C><BR>")
|
||||
// .append("------------------------<BR>")
|
||||
// .append(StrUtil.format("<S>{}</S><BR>", shopNote))
|
||||
// .append("------------------------<BR>").append("<S>取号时间:").append(DateUtil.format(takeTime, "yyyy-MM-dd HH:mm:ss"))
|
||||
// .append("</S><BR>").append("<S>打印时间:").append(DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss")).append("</S><BR>")
|
||||
// .append("<OUT:180>").append("<PCUT>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按字符数补足空格(英文、数字时使用)
|
||||
*
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -150,8 +151,9 @@ public class YxyPrinter extends PrinterHandler implements PrinterImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void callNumPrint(PrintMachine machine) {
|
||||
|
||||
protected void callNumPrint(PrintMachine machine, String callNum, String shopName, String tableName, String tableNote, String preNum, String codeUrl, LocalDateTime takeTime, String shopNote) {
|
||||
String resp = buildCallTicketData(shopName, tableName, callNum, preNum, codeUrl,shopNote, takeTime);
|
||||
sendPrintRequest(machine.getAddress(), resp, null, "1");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Main {
|
||||
// String packageName = "product";
|
||||
// String packageName = "order";
|
||||
|
||||
String tableName = "tb_print_machine";
|
||||
String tableName = "tb_order_info";
|
||||
String author = "zs";
|
||||
//是否生成DTO实体 默认生成
|
||||
boolean isGenerateDto = true;
|
||||
|
||||
Reference in New Issue
Block a user