店铺管理-店铺配置:打印机设置相关接口
This commit is contained in:
@@ -255,7 +255,7 @@ public class PrintMechineConsumer {
|
||||
String data = PrinterUtils.getCashPrintData(detailPO, printType, orderInfo.getOrderType());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -630,7 +630,7 @@ public class PrintMechineConsumer {
|
||||
}
|
||||
|
||||
log.error("打印数据2>>>>>>>>>>>>>>>>>>>>>>>>: {}", JSON.toJSONString(detailPO));
|
||||
FeieyunPrintUtil.getCashPrintData(detailPO, tbPrintMachineWithBLOBs.getAddress(), printType, printType);
|
||||
FeieyunPrintUtil.getCashPrintData(detailPO, tbPrintMachineWithBLOBs.getAddress(), printType, printType, printerNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -85,7 +85,12 @@ public class FeiPrinter extends PrinterHandler {
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
String printType = "退款单";
|
||||
log.error("打印数据3>>>>>>>>>>>>>>>>>>>>>>>>: {}", JSON.toJSONString(detailPO));
|
||||
String[] resp = FeieyunPrintUtil.getCashPrintData(detailPO, machine.getAddress(), printType, printType);
|
||||
String printerNum = "1";
|
||||
if (StrUtil.isNotBlank(machine.getPrintQty())) {
|
||||
printerNum = machine.getPrintQty().split("\\^")[1];
|
||||
}
|
||||
StrUtil.blankToDefault(machine.getPrintQty(), "");
|
||||
String[] resp = FeieyunPrintUtil.getCashPrintData(detailPO, machine.getAddress(), printType, printType, printerNum);
|
||||
shopPrintLogService.save(machine, "退款单", resp[0], resp[1]);
|
||||
}
|
||||
|
||||
@@ -100,7 +105,11 @@ public class FeiPrinter extends PrinterHandler {
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
String printType = "结算单";
|
||||
log.error("打印数据1>>>>>>>>>>>>>>>>>>>>>>>>: {}", JSON.toJSONString(detailPO));
|
||||
String[] resp = FeieyunPrintUtil.getCashPrintData(detailPO, machine.getAddress(), printType, printType);
|
||||
String printerNum = "1";
|
||||
if (StrUtil.isNotBlank(machine.getPrintQty())) {
|
||||
printerNum = machine.getPrintQty().split("\\^")[1];
|
||||
}
|
||||
String[] resp = FeieyunPrintUtil.getCashPrintData(detailPO, machine.getAddress(), printType, printType, printerNum);
|
||||
shopPrintLogService.save(machine, "结算单", resp[0], resp[1]);
|
||||
}
|
||||
|
||||
@@ -130,7 +139,7 @@ public class FeiPrinter extends PrinterHandler {
|
||||
po.setTakeTime(queue.getCreateTime());
|
||||
po.setShopNote(StrUtil.format("过号顺延{}桌 {}桌后需重新排号 谢谢理解!", tbCallTable.getPostponeNum(), tbCallTable.getPostponeNum()));
|
||||
String data = FeieyunPrintUtil.getCallNumPrintData(po);
|
||||
String resp = FeieyunPrintUtil.print(data, machine.getAddress());
|
||||
String resp = FeieyunPrintUtil.print(data, machine.getAddress(), "1");
|
||||
shopPrintLogService.save(machine, "叫号单", data, resp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class PrinterHandler {
|
||||
if (StrUtil.isBlank(printMethod) && StrUtil.isBlank(machine.getPrintType())) {
|
||||
throw new MsgException("打印机配置为空");
|
||||
}
|
||||
if(StrUtil.isNotBlank(printMethod)){
|
||||
if (StrUtil.isNotBlank(printMethod)) {
|
||||
List<CategoryInfo> categoryInfos = JSONUtil.parseJSONStr2TList(StrUtil.emptyToDefault(machine.getCategoryList(), "[]"), CategoryInfo.class);
|
||||
//仅打印后厨-一菜一品
|
||||
if ("one".equals(printMethod)) {
|
||||
@@ -72,6 +72,9 @@ public abstract class PrinterHandler {
|
||||
if (!CollUtil.contains(optionList, "queue")) {
|
||||
return;
|
||||
}
|
||||
if (printDTO == null) {
|
||||
return;
|
||||
}
|
||||
callNumPrint(machine, printDTO);
|
||||
}
|
||||
|
||||
@@ -92,7 +95,10 @@ public abstract class PrinterHandler {
|
||||
log.error("商品不存在, id: {}", item.getProductSkuId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(machine.getClassifyPrint())) {
|
||||
log.error("分类打印是空, classifyPrint: {}", machine.getClassifyPrint());
|
||||
return;
|
||||
}
|
||||
long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
|
||||
@@ -281,7 +281,7 @@ public class CloudPrinterService {
|
||||
ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0",
|
||||
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount()==null?null:orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio()==null?null:orderInfo.getDiscountRatio().toPlainString());
|
||||
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
detailPO.setOutNumber(orderInfo.getOutNumber());
|
||||
String printType = "退款单";
|
||||
|
||||
@@ -373,7 +373,7 @@ public class CloudPrinterService {
|
||||
/**
|
||||
* 仅打印结算单「前台」
|
||||
*/
|
||||
private Result onlyFrontDeskForFe(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos, String type, Boolean ispre,String orderId) {
|
||||
private Result onlyFrontDeskForFe(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos, String type, Boolean ispre, String orderId) {
|
||||
if (!"normal".equals(type)) {
|
||||
return Result.fail("非小票打印");
|
||||
}
|
||||
@@ -473,7 +473,7 @@ public class CloudPrinterService {
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(),
|
||||
balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount()==null?null:orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio()==null?null:orderInfo.getDiscountRatio().toPlainString());
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
String printType = "结算单";
|
||||
if (ispre) {
|
||||
printType = "预结算单";
|
||||
@@ -484,7 +484,7 @@ public class CloudPrinterService {
|
||||
}
|
||||
|
||||
log.error("打印数据4>>>>>>>>>>>>>>>>>>>>>>>>: {}", JSON.toJSONString(detailPO));
|
||||
FeieyunPrintUtil.getCashPrintData(detailPO, tbPrintMachineWithBLOBs.getAddress(), printType, printType);
|
||||
FeieyunPrintUtil.getCashPrintData(detailPO, tbPrintMachineWithBLOBs.getAddress(), printType, printType, printerNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class FeieyunPrintUtil {
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
public static String[] getCashPrintData(OrderDetailPO detailPO, String sn, String type, String orderType) {
|
||||
public static String[] getCashPrintData(OrderDetailPO detailPO, String sn, String type, String orderType, String printerNum) {
|
||||
String content = buildPrintContent(detailPO, type, orderType);
|
||||
|
||||
//通过POST请求,发送打印信息到服务器
|
||||
@@ -277,7 +277,7 @@ public class FeieyunPrintUtil {
|
||||
nvps.add(new BasicNameValuePair("apiname", "Open_printMsg"));//固定值,不需要修改
|
||||
nvps.add(new BasicNameValuePair("sn", sn));
|
||||
nvps.add(new BasicNameValuePair("content", content));
|
||||
nvps.add(new BasicNameValuePair("times", "1"));//打印联数
|
||||
nvps.add(new BasicNameValuePair("times", printerNum));//打印联数
|
||||
|
||||
CloseableHttpResponse response = null;
|
||||
String result = null;
|
||||
@@ -317,7 +317,7 @@ public class FeieyunPrintUtil {
|
||||
|
||||
}
|
||||
|
||||
public static String print(String content, String sn){
|
||||
public static String print(String content, String sn, String printerNum) {
|
||||
// 通过POST请求,发送打印信息到服务器
|
||||
RequestConfig requestConfig = RequestConfig.custom()
|
||||
.setSocketTimeout(30000)// 读取超时
|
||||
@@ -334,7 +334,7 @@ public class FeieyunPrintUtil {
|
||||
nvps.add(new BasicNameValuePair("apiname", "Open_printMsg"));// 固定值,不需要修改
|
||||
nvps.add(new BasicNameValuePair("sn", sn));
|
||||
nvps.add(new BasicNameValuePair("content", content));
|
||||
nvps.add(new BasicNameValuePair("times", "1"));// 打印联数
|
||||
nvps.add(new BasicNameValuePair("times", printerNum));// 打印联数
|
||||
|
||||
CloseableHttpResponse response = null;
|
||||
String result = null;
|
||||
@@ -402,12 +402,12 @@ public class FeieyunPrintUtil {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(StrUtil.format("<CB>{}</CB><BR>", po.getShopName()));
|
||||
sb.append("--------------------------------<BR>");
|
||||
sb.append(StrUtil.format("<CB>{} {}</CB><BR>",po.getTableName(),po.getCallNum()));
|
||||
sb.append(StrUtil.format("<C>前面有{}桌</C><BR>",po.getPreNum()));
|
||||
sb.append(StrUtil.format("<CB>{} {}</CB><BR>", po.getTableName(), po.getCallNum()));
|
||||
sb.append(StrUtil.format("<C>前面有{}桌</C><BR>", po.getPreNum()));
|
||||
sb.append(StrUtil.format("<C><QR>{}</QR></C><BR>", po.getCodeUrl()));
|
||||
sb.append("<CB>怕过号扫一扫</CB><BR>");
|
||||
sb.append("--------------------------------<BR>");
|
||||
sb.append(po.getShopNote()+"<BR>");
|
||||
sb.append(po.getShopNote() + "<BR>");
|
||||
sb.append("--------------------------------<BR>");
|
||||
sb.append(StrUtil.format("取号时间:{}<BR>", DateUtils.getTime(po.getTakeTime())));
|
||||
sb.append(StrUtil.format("打印时间:{}<BR>", DateUtils.getTime(new Date())));
|
||||
|
||||
Reference in New Issue
Block a user