本来打算2020都不写博客的,因为太忙了,一直在项目。不是在项目的策划中,就是在项目的实现中;不是在项目的实现中,就是在项目修复bug中;不是在项目的修复bug中,就是在项目的新增需求中; 项目,项目还是项目,循环往复无穷尽也。坑也罢,路也罢,任他东西南北龙卷风,博客还是要不断进行中... 哈哈哈
sunmi打印小票测试代码:
public void printerTest(){
SunmiPrintHelper.getInstance().print3Line();
SunmiPrintHelper.getInstance().setAlign(1);
SunmiPrintHelper.getInstance().printText("积分兑换小票\n", 36, true, false);
SunmiPrintHelper.getInstance().printNumLine(1);
SunmiPrintHelper.getInstance().setAlign(0);
SunmiPrintHelper.getInstance().printText("************************\n", 32, true, false);
SunmiPrintHelper.getInstance().printText("姓名:张飒\n", 32, true, false);
SunmiPrintHelper.getInstance().printText("地址:大陆村123号\n", 32, true, false);
SunmiPrintHelper.getInstance().printText("电话:123****5678\n", 32, true, false);
SunmiPrintHelper.getInstance().printText("日期:2020年8月19日\n", 32, true, false);
String txts[] = new String[]{"商品", "数量", "积分"};
int width[] = new int[]{1, 1, 1};
int align[] = new int[]{0, 1, 2};
SunmiPrintHelper.getInstance().printNumLine(1);
SunmiPrintHelper.getInstance().printText("************************\n", 32, true, false);
SunmiPrintHelper.getInstance().printTable(txts, width, align);
SunmiPrintHelper.getInstance().printText("************************\n", 32, true, false);
txts[0] = "酱油";
txts[1] = "1";
txts[2] = "350";
SunmiPrintHelper.getInstance().printTable(txts, width, align);
txts[0] = "拖把";
txts[1] = "1";
txts[2] = "500";
SunmiPrintHelper.getInstance().printTable(txts, width, align);
txts[0] = "扫把";
txts[1] = "1";
txts[2] = "500";
SunmiPrintHelper.getInstance().printTable(txts, width, align);
SunmiPrintHelper.getInstance().printText("************************\n", 32, true, false);
txts[0] = "合计";
txts[1] = "";
txts[2] = "1350";
SunmiPrintHelper.getInstance().printTable(txts, width, align);
txts[0] = "剩余";
txts[1] = "";
txts[2] = "150";
SunmiPrintHelper.getInstance().printTable(txts, width, align);
SunmiPrintHelper.getInstance().printNumLine(1);
SunmiPrintHelper.getInstance().setAlign(1);
SunmiPrintHelper.getInstance().printText("谢谢惠顾!\n", 30, true, false);
SunmiPrintHelper.getInstance().setAlign(0);
SunmiPrintHelper.getInstance().printNumLine(6);
SunmiPrintHelper.getInstance().cutpaper();
}