打印修改
This commit is contained in:
parent
ec7c7d1ec0
commit
4726aab7b5
|
|
@ -46,14 +46,6 @@ public interface PrinterImpl {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建订单打印元数据
|
||||
* @param printInfoDTO 打印信息
|
||||
* @param detailList 订单详情内容
|
||||
* @return 元数据
|
||||
*/
|
||||
// String buildOrderPrintData(PrinterHandler.PrintInfoDTO printInfoDTO, List<OrderDetail> detailList);
|
||||
|
||||
|
||||
/**
|
||||
* 发送打印请求
|
||||
|
|
@ -300,7 +292,7 @@ public interface PrinterImpl {
|
|||
.append(signLabelInfo.br)
|
||||
.append(signLabelInfo.br);
|
||||
// builder.append("<S><L>时间: ").append(date).append(" </L></S><BR><BR><BR>");
|
||||
if (productName.length() > 4 || skuName.length() > 4) {
|
||||
if (productName.length() > 4) {
|
||||
builder.append(getFormatLabel(StrUtil.format("{} x {}", productName, number.stripTrailingZeros().toPlainString()), signLabelInfo.l))
|
||||
.append(signLabelInfo.br);
|
||||
// builder.append("<CS:32>").append(productName).append(" x ").append(number).append("</CS><BR>");
|
||||
|
|
@ -328,7 +320,7 @@ public interface PrinterImpl {
|
|||
for (int i = 0; i < subItems.size(); i++) {
|
||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
||||
int qty = subItems.getJSONObject(i).getInt("number");
|
||||
builder.append(StrUtil.format("({}) x ", proName))
|
||||
builder.append(StrUtil.format("({}) x {}", proName, qty))
|
||||
.append(signLabelInfo.br);
|
||||
// builder.append("<CS:32>(").append(i + 1).append(")").append(proName).append(" x ").append(qty).append("</CS><BR>");
|
||||
}
|
||||
|
|
@ -354,28 +346,7 @@ public interface PrinterImpl {
|
|||
*/
|
||||
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(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>")
|
||||
// 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))
|
||||
|
|
@ -386,7 +357,26 @@ public interface PrinterImpl {
|
|||
// .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();
|
||||
return getFormatLabel(shopName, signLabelInfo.center, signLabelInfo.bold) +
|
||||
signLabelInfo.br +
|
||||
signLabelInfo.br +
|
||||
getFormatLabel(StrUtil.format("{} {}", tableName, callNum), signLabelInfo.center, signLabelInfo.bold) +
|
||||
signLabelInfo.br +
|
||||
getFormatLabel(StrUtil.format("前面有{}桌", preNum), signLabelInfo.center) +
|
||||
signLabelInfo.br +
|
||||
getFormatLabel("怕过号扫一扫", signLabelInfo.center, signLabelInfo.bold) +
|
||||
signLabelInfo.br +
|
||||
getFormatLabel(codeUrl, signLabelInfo.center, signLabelInfo.qr) +
|
||||
signLabelInfo.br +
|
||||
"--------------------------------" + signLabelInfo.br +
|
||||
getFormatLabel(shopNote, signLabelInfo.s) +
|
||||
signLabelInfo.br +
|
||||
"--------------------------------" + signLabelInfo.br +
|
||||
getFormatLabel(StrUtil.format("取号时间:{}", DateUtil.format(takeTime, "yyyy-MM-dd HH:mm:ss")), signLabelInfo.s) +
|
||||
signLabelInfo.br +
|
||||
getFormatLabel(StrUtil.format("打印时间:{}", DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss")), signLabelInfo.s) +
|
||||
signLabelInfo.br +
|
||||
signLabelInfo.cut;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -443,7 +433,7 @@ public interface PrinterImpl {
|
|||
*
|
||||
* @param length 长度
|
||||
* @param string 字符串
|
||||
* @return
|
||||
* @return 填充字符串
|
||||
*/
|
||||
default String getStringByEnter(String string, int length) {
|
||||
PrintSignLabel signLabelInfo = getSignLabelInfo();
|
||||
|
|
@ -452,7 +442,9 @@ public interface PrinterImpl {
|
|||
int pos = 0, byteCount = 0;
|
||||
for (int i = 0; i < string.length(); i++) {
|
||||
int charByteLen = StrUtil.bytes(string.substring(i, i + 1), CharsetUtil.CHARSET_GBK).length;
|
||||
if (byteCount + charByteLen > length) break;
|
||||
if (byteCount + charByteLen > length) {
|
||||
break;
|
||||
}
|
||||
byteCount += charByteLen;
|
||||
pos = i + 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue