Exemplo n.º 1
0
def history_product_display(index):
    locktarget = int(index)
    hist_prod_disp = Toplevel(main_window)
    hist_prod_disp.title(
        f"History {product_list[index].id} @ {displaytime(time, timespan)[9:]}"
    )
    labela = Label(hist_prod_disp, text="Time").grid(column=0, row=0)
    labelb = Label(hist_prod_disp, text="Location").grid(column=1, row=0)
    labelc = Label(hist_prod_disp, text="Status").grid(column=2, row=0)
    labeld = Label(hist_prod_disp, text="Component").grid(column=3, row=0)
    for i in range(len(product_list[locktarget].history[0])):
        if i == 0:
            label1 = Label(hist_prod_disp,
                           text=displaytime(locktarget,
                                            timespan)[:5]).grid(column=0,
                                                                row=i + 1)
        else:
            a = i - 1 + locktarget
            label1 = Label(hist_prod_disp,
                           text=displaytime(a, timespan)).grid(column=0,
                                                               row=i + 1)
        label2 = Label(hist_prod_disp,
                       text=product_list[locktarget].history[0][i]).grid(
                           column=1, row=i + 1)
        if i + 1 < len(product_list[locktarget].history[0]):
            stat = product_list[locktarget].history[2][i]
        else:
            if product_list[locktarget].location.id == workstation_list[-1].id:
                stat = "Done"
            elif product_list[locktarget].history[0][-1] != product_list[
                    locktarget].history[0][-2]:
                if product_list[locktarget].empty == 1:
                    stat = "Lack of component"
                else:
                    stat = "In progress"
            elif product_list[locktarget].history[2][-1] == "Waiting":
                stat = "Waiting"
            elif product_list[locktarget].empty == 1:
                stat = "Lack of component"
            elif product_list[locktarget].empty == 0:
                stat = "In progress"
        label3 = Label(hist_prod_disp, text=stat).grid(column=2, row=i + 1)
        if len(product_list[locktarget].history[1][i]) == 0:
            show = "None  "
        else:
            show = ""
            for j in range(len(product_list[locktarget].history[1][i])):
                show += f"{product_list[locktarget].history[1][i][j]}, "
        label4 = Label(hist_prod_disp, text=show[:-2]).grid(column=3,
                                                            row=i + 1)
Exemplo n.º 2
0
def history_workstation(index):
    hist_ws = Toplevel(main_window)
    hist_ws.title(f"History {workstation_list[index].id} @ {displaytime(time, timespan)[9:]}")
    labela = Label(hist_ws, text = "Time").grid(column = 0, row = 0)
    labelb = Label(hist_ws, text = "Product").grid(column = 1, row = 0)
    for i in range(len(workstation_list[index].history)):
        label1 = Label(hist_ws, text = displaytime(i, timespan)).grid(column = 0, row = i+1)
        if len(workstation_list[index].history[i]) > 1:
            show = f"{workstation_list[index].history[i][0]}"
            for j in range(1, len(workstation_list[index].history[i])):
                show += f", {workstation_list[index].history[i][j]}"
        elif len(workstation_list[index].history[i]) == 1:
            show = f"{workstation_list[index].history[i][0]}"
        else:
            show = "None"
        label2 = Label(hist_ws, text = show).grid(column = 1, row = i+1)
Exemplo n.º 3
0
Print history     
p: product
w: workstation""")
        taskh = input(">> h/")
        # PRINT PRODUCT HISTORY
        if taskh.lower() == "p":
            target = input("Product ID: ")
            locktarget = -1
            for i in range(len(product_list)):
                if str(target.lower()) == str(product_list[i].id.lower()):
                    locktarget = i
            if locktarget >= 0:
                print(f"History: {product_list[locktarget].id}")
                for i in range(len(product_list[locktarget].history[0])):
                    if i == 0:
                        display = displaytime(locktarget, timespan)
                        display = display[:5] + "        "
                    else :
                        a = i-1+locktarget
                        display = displaytime(a, timespan)
                    show = f"{display}    Loc: {product_list[locktarget].history[0][i]}"
                    show += " " * (25 - len(product_list[locktarget].history[0][i]))
                    if i+1 < len(product_list[locktarget].history[0]):
                        a = product_list[locktarget].history[2][i]
                    else:
                        if product_list[locktarget].location.id == workstation_list[-1].id:
                            a = "Done"
                        elif product_list[locktarget].history[0][-1] != product_list[locktarget].history[0][-2]:
                            if product_list[locktarget].empty == 1:
                                a = "Lack of component"
                            else: