Defprint _ small _ ticket (self,code,lang) :
单击“”
:代码订购代码
:lang打印机所在国家的语言。
""" # 引用其他方法:获取到打印机输出的内容 mch_service = ('MchFoodService') logger.info('1.1 print_Small_ticket enter') text_dict = mc(code, lang) text_dict = ('data') # 1. 打印内容的拼接, # ---------------------------------------------------------------- # chr(27) + chr(97) + chr(49):字体居中对齐 chr(27) + chr(33) + chr(48):字体倍高宽, chr(10):换行 shop_name = chr(27) + chr(97) + chr(49) + chr(27) + chr(33) + chr(48) + text_dict['shop_name'] + chr(27) + chr( 33) + chr(0) + chr(10) + chr(10) print_time = chr(27) + chr(97) + chr(48) + Language.TIME.get(lang) + text_dict['now_time'] + chr(10) order_no = Language.ORDER_NUM.get(lang) + text_dict['code'] + chr(10) logger.info('1.2 text_dict={}'.format(str(text_dict))) text_example = '' for index, text in enumerate(text_dict['food_list']): # if is '': # = '0' # text_example += + ' ' + + '\n' text_example += chr(27) + chr(97) + chr(48) + str(index + 1) + '.' + text['flavor'] + '\n' + \ chr(27) + chr(97) + chr(50) + str(text['price'] / 100) + ' ' + '×' + str(text['num']) + \ ' ' * 14 + str(text['total_price'] / 100) + '\n' division_1 = '-' * 32 + '\n' # ----------------------------------------------------------------- # 总价 zong = str(text_dict['total_fee'] / 100) total_fee = chr(27) + chr(97) + chr(48) + Language.TOTAL_PRICE.get(lang) + '\n' + chr(27) + chr(97) + chr( 50) + zong + '\n' # 配送费 fei = str(text_dict['freight'] / 100) freight = chr(27) + chr(97) + chr(48) + Language.DELIVER_YFEE.get(lang) + '\n' + chr(27) + chr(97) + chr( 50) + fei + '\n' # 税金 Taxes = str(text_dict['tax_fee'] / 100) tax_fee = chr(27) + chr(97) + chr(48) + Language.TAXES.get(lang) + '\n' + chr(27) + chr(97) + chr( 50) + Taxes + '\n' # 商品总数, 总计费用 number = str(text_dict['food_num']) food_num = chr(27) + chr(97) + chr(48) + Language.NUMBER_OF_PIECES.get(lang).format(number) + '\n' pay_price = food_num + chr(27) + chr(97) + chr(50) + text_dict['fee_symbol'] + str( text_dict['pay_price'] / 100) + '\n' division_2 = '-' * 32 + '\n' logger.info('1.3 data ') # --------------------------------------------------------------------- # 用户名 user_name = chr(27) + chr(97) + chr(48) + text_dict['user_name'] user_phone = text_dict['user_phone'] + '\n' + '\n' user_address = text_dict['user_address'] + '\n' # 尾联 complimentary_close = ' ' * 10 + 'ยินดีต้อนรับอีกครั้ง' + ' ' * 8 # 组数据 result_text = shop_name + print_time + order_no + text_example + division_1 + \ total_fee + freight + tax_fee + pay_price + division_2 + \ user_name + user_phone + user_address + complimentary_close + '\n' + '\n' + '\n' logger.info('1.4 print_Small_ticket result_text={}'.format(result_text)) # 2.解码,并且将文本内容转化为16进制。 data_time = re() data = bina(data_time) logger.info('1.5 print_Small_ticket print begin') # # 3. 调用米商打印接口 mi( msn='#########', pushId= 111, voiceCnt=1, voice= '新订单来了', voiceUrl='', orderCnt=1, #(int)打印票据张数 orderType=1, # 打印票据类型,1 新订单,2 取消订单,3 催单,4 退单,5 其它 orderData=da())欢迎一起交流,分享
1.《打印机模板怎么选?终于找到答案了python sunmi58mm打印机输出格式的模板》援引自互联网,旨在传递更多网络信息知识,仅代表作者本人观点,与本网站无关,侵删请联系页脚下方联系方式。
2.《打印机模板怎么选?终于找到答案了python sunmi58mm打印机输出格式的模板》仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证。
3.文章转载时请保留本站内容来源地址,https://www.lu-xu.com/why/3056827.html