Merge remote-tracking branch 'origin/hph' into dev
This commit is contained in:
commit
14f9f36ef5
|
|
@ -31,6 +31,7 @@ public class PrinterUtils {
|
|||
|
||||
/**
|
||||
* 获取TOKEN值
|
||||
*
|
||||
* @param timestamp 时间戳,13位
|
||||
* @param requestId 请求ID,自定义
|
||||
* @return
|
||||
|
|
@ -62,6 +63,7 @@ public class PrinterUtils {
|
|||
|
||||
/**
|
||||
* 厨房打印机
|
||||
*
|
||||
* @param pickupNumber
|
||||
* @param date
|
||||
* @param productName
|
||||
|
|
@ -201,21 +203,25 @@ public class PrinterUtils {
|
|||
|
||||
for (ProductInfo productInfo : handoverInfo.getProductInfos()) {
|
||||
|
||||
|
||||
if (productInfo.getProductName().length() >= 14) {
|
||||
|
||||
sb.append("<S> " + productInfo.getProductName() + "</S><BR>");
|
||||
sb.append("<S> "+String.format("%27s",productInfo.getNum()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
sb.append("<S> " + String.format("%27s", "*" + productInfo.getNum()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
|
||||
} else {
|
||||
int tt=22-productInfo.getProductName().length();
|
||||
sb.append("<S> "+productInfo.getProductName()+String.format("%"+tt+"s",productInfo.getNum()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
//计算英文和数字数量
|
||||
//计算中文数量
|
||||
int m = getProducrName(productInfo.getProductName());
|
||||
int tt = 23 - productInfo.getProductName().length();
|
||||
|
||||
sb.append("<S> " + productInfo.getProductName() + String.format("%" + 6 + "s", "*" + productInfo.getNum()).replace(' ', paddingCharacter) + "</S><BR>");
|
||||
}
|
||||
sb.append("<BR>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handoverInfo.getProductInfoPOS()) && handoverInfo.getProductInfoPOS().size() > 0) {
|
||||
sb.append("<S>商品数据</S><BR>");
|
||||
char paddingCharacter = ' ';
|
||||
|
|
@ -250,9 +256,6 @@ public class PrinterUtils {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sb.append("<S>快捷收款金额 :".concat(ObjectUtil.isNull(handoverInfo.getQuickAmount()) ? "0" : handoverInfo.getQuickAmount()) + "</S><BR>");
|
||||
sb.append("<S>退款金额 :".concat(handoverInfo.getReturnAmount()) + "</S><BR>");
|
||||
sb.append("<S>总收入: " + handoverInfo.getTotalAmount() + "</S><BR>");
|
||||
|
|
@ -272,26 +275,19 @@ public class PrinterUtils {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static String printInvoice(String content, String remark, String amount) {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append("<C><QR>".concat(content.concat("</QR></C><BR>")));
|
||||
sb.append("<C><BOLD>".concat(remark).concat("</BOLD></C><BR>"));
|
||||
sb.append("<C><BOLD>【开票金额:".concat(amount).concat("】</BOLD></C>"));
|
||||
sb.append("<OUT:200>");
|
||||
sb.append("<PCUT>");
|
||||
return sb.toString();
|
||||
String sb = "<C><QR>".concat(content.concat("</QR></C><BR>")) +
|
||||
"<C><BOLD>".concat(remark).concat("</BOLD></C><BR>") +
|
||||
"<C><BOLD>【开票金额:".concat(amount).concat("】</BOLD></C>") +
|
||||
"<OUT:200>" +
|
||||
"<PCUT>";
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 打印票据
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void printTickets(String voiceJson, Integer actWay, Integer cn, String devName, String data) {
|
||||
|
|
@ -330,8 +326,6 @@ public class PrinterUtils {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static int getProducrName(String str) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
|
|
@ -363,12 +357,12 @@ public class PrinterUtils {
|
|||
|
||||
List<ProductInfo> productInfos = new ArrayList<>();
|
||||
|
||||
productInfos.add(new ProductInfo("161616161616161616161616161",16,new BigDecimal(65.00)));
|
||||
productInfos.add(new ProductInfo("161616161616161616161616161", 16, new BigDecimal("65.00")));
|
||||
|
||||
productInfos.add(new ProductInfo("张三",16,new BigDecimal(65.00)));
|
||||
productInfos.add(new ProductInfo("张三", 16, new BigDecimal("65.00")));
|
||||
|
||||
|
||||
productInfos.add(new ProductInfo("牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪",16,new BigDecimal(65.00)));
|
||||
productInfos.add(new ProductInfo("牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪牛叉闪闪", 16, new BigDecimal("65.00")));
|
||||
|
||||
HandoverInfo handoverInfo = new HandoverInfo("牛叉闪闪", DateUtils.getTime(new Date()), DateUtils.getTime(new Date()), "李四", payInfos, memberDatas, "5000.00", "5000.00", "5000.00", "5000.00", "50.00", "80", null, "5000.00", null, productInfos);
|
||||
|
||||
|
|
@ -390,7 +384,6 @@ public class PrinterUtils {
|
|||
// printTickets(voiceJson,1,1,"ZF544PG03W00002",getCashPrintData(detailPO,"结算单",""));\\
|
||||
|
||||
|
||||
|
||||
// String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
// printTickets(voiceJson,1,1,"ZF544PG03W00002", printInvoice("http://weixin.qq.com/q/020fVS8lcLeiG1ID3SxCcH","【30天内开票有效】","1000000"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue