Exemple #1
0
def print_order(id_, order):
    pnc = PrinterNetCalls()
    if len(sys.argv) == 2:
        serial_port = sys.argv[1]
    else:
        serial_port = thermal.ThermalPrinter.SERIALPORT
    p = thermal.ThermalPrinter(serialport=serial_port)

    print("Attempting to print ord er_id: ", id_)
    lines = order
    print("initial paper check")
    printer_paper_status(p)
    print("---NEW--ORDER----!!")
    print("printing order_id", id_)
    p.print_text("---NEW--ORDER----!!")
    p.print_text("\n")
    for line in lines:
        printer_paper_status(p)
        print("printing line", line[:])
        p.print_text(line[:]+'\n')

    p.linefeed(5)

    check_printer_status(p)

    pnc.post_that_order_was_printed(int(id_))
    print("Sending message to server for order id: ", id_)
    time.sleep(5)
Exemple #2
0
# coding: utf-8
import requests
import sys
import thermal
import time
from network import PrinterNetCalls, InternetConnection
import sys
import os
import greeklish
__author__ = 'gpamfilis'
import os
import shutil


pnc = PrinterNetCalls()

ids = pnc.get_orders_to_print()


def create_deltio(id_):
    try:
        # int.check_internet()
        json = pnc.get_order(id_)
    except Exception, e:
        print("This is the create_deltio exception", e)

    if json is None:
        return None
    else:    
        order = []
Exemple #3
0
    p.linefeed(10)

    check_printer_status(p)

    pnc.post_that_checkout_was_printed(int(id_))
    print("Sending message to server for checkout id: ", id_)

    time.sleep(5)


if __name__ == '__main__':
    get_configuration()
    with open('values.json') as data_file:
        data = json.load(data_file)
    values = data
    pnc = PrinterNetCalls(**values)
    serial_port = thermal.ThermalPrinter.SERIALPORT
    p = thermal.ThermalPrinter(serialport=serial_port)
    create = Create()
    while True:
        pnc.check_internet()
        print('New Order Section')
        order_ids = pnc.get_orders_to_print()
        print(order_ids)
        for order_id in order_ids:
            order_list = pnc.get_order3(order_id)
            print('Order List: ', order_list)
            if order_list is None:
                pass
            else:
                print_order2(order_id, order_list, p=p, pnc=pnc)