Пример #1
0
def setTime(time):
    global currentTime
    # check if time is moving forward
    if time > currentTime:
        currentTime = time
        printTime()
        for truck in Trucks.TruckList:  # check Trucks O(t)
            truck.isDelivered(currentTime)
        Packages.checkPackageList(currentTime)  # check Packages O(p)
    else:
        print("Time can't go backwards")
Пример #2
0
def deliver_packages(Packed_Trucks, Truck_List):
    Package_List = Packages.get_package_list()
    truck_counter = 1;

    for truck in Packed_Trucks:

        #first truck gets fed in, we have find nerest package. now we need to run through until all packages are delivered'

        while truck.package_manifest:
            delivered_package = find_nearest_package(truck.package_manifest, truck.current_loc,truck)
            truck.set_current_loc(delivered_package.address)
            Package_List.search(delivered_package.id).set_time_left_hub(truck.departing_time)
            Package_List.search(delivered_package.id).update_status('Delivered')
            Package_List.search(delivered_package.id).set_time_delivered(Time.get_time(truck.departing_time, truck.distance_traveled))

            #print("Package delivered id and time: ", delivered_package.id, delivered_package.delivery_time, len(truck.package_manifest))
            truck.remove_package(delivered_package)

        if truck_counter == 1:
            Truck_List[2].departing_time = Time.get_time(truck.departing_time, truck.distance_traveled)
            truck_counter += 1

        print('Truck: ', truck.id, truck.departing_time)
        print('Total Distance Traveled: ',truck.distance_traveled, 'Time taken: ', Time.int_to_hours(truck.distance_traveled))
        print('Time finished = ', Time.get_time(truck.departing_time, truck.distance_traveled))
        print('************ \n')
def sendctofield():
    #this file sends the variables to the fields class
    # secondly it returns the variables that will be send later to html
    c, arearesult =connectdbfield() #connect to another function, that returns c
    tablefields = tablehead() # get the table header of another function
    svgfield = '' #create empty string that will be used later
    for row in c:
        #loop over c and append assign the variables
        fieldid = str(row[0])
        lowx = str(row[1])
        lowy = str(row[2])
        highx = str(row[3])
        highy = str(row[4])
        area = str(row[5])
        owner = str(row[6])
        cropid = str(row[7])
        #send the variables inside the loop to the class
        fields = Packages.fieldss(fieldid, lowx, lowy, highx, highy, area, owner, cropid)
        # to get the row for the tablefields
        tablefields += fields.renderfieldstable()
        #and the svg
        svgfield += fields.render()
    #close the table when the loop has ended
    tablefields += '</table>'
    return tablefields, svgfield, arearesult
Пример #4
0
    def print_html():
        #function that calls the classes and definition
        #and the send variables to the html

        env = Environment(loader=FileSystemLoader('.'))
        temp = env.get_template('main.html')
        #get varibales for finds
        c, tablefindss, svgPonit = Packages.sendctofind()

        #get varibales for fields
        tablefieldss, svgfields1, arearesult = Packages.sendctofield()

        # crops and artefact table
        tablecrops = Packages.rendercropstable()
        tableartefact = Packages.renderartefacttable()

        # map Background
        map = Packages.backgroundmap()
        viewbox, gviewbox, currenthx, currenthy, currentlx, currently = map.findhighestlowestxy(
        )
        gridsvgx, gridsvgy = map.rendersvggrid()
        svgtickx = map.renderxticks()
        svgticky = map.renderyticks()

        # pass the varibales to html
        print(
            temp.render(svggpoint=svgPonit,
                        svggField=svgfields1,
                        tablefinds=tablefindss,
                        tablefieldsH=tablefieldss,
                        tablecropss=tablecrops,
                        tableartefacts=tableartefact,
                        gridsvgxx=gridsvgx,
                        gridsvgyy=gridsvgy,
                        svgtickxx=svgtickx,
                        svgtickyy=svgticky,
                        vb=viewbox,
                        vbhx=currenthx,
                        vbhy=currenthy,
                        vblx=currentlx,
                        vbly=currently,
                        greatviewbox=gviewbox,
                        area=arearesult))
Пример #5
0
def Financial_Budget():
    CtlFB = 1
    while (CtlFB != 0):
        print()
        print("=Presupuesto Financiero=")
        print()
        print("1.-Estado de Costo de Producción y Ventas")
        print("2.-Estado de Resultados")
        print("3.-Estado de Flujo de Efectivo")
        print("4.-Balance General")
        print()
        print("0.-Regresar al menu principal")
        print()
        CtlFB = input("Ingrese la opcion a realizar: ")

        if (CtlFB == ""):
            print("Por favor selecciona una opción")
            input("presiona la tecla Enter para continuar")
            Clean()
        elif int(CtlFB) == 0:
            Clean()
            Menu()
        elif int(CtlFB) == 1:
            Clean()
            Packages.SCPS()
            Clean()
        elif int(CtlFB) == 2:
            Clean()
            Packages.Statement_Income()
            Clean()
        elif int(CtlFB) == 3:
            Clean()
            Packages.Cash_Flow_Statement()
            Clean()
        elif int(CtlFB) == 4:
            Clean()
            Packages.Balance_Sheet()
            Clean()
        else:
            print("Valor seleccionado no valido")
            input("presiona la tecla Enter para continuar")
            Clean()
Пример #6
0
def deliver_packages(packages_load, start_time):
    # NN sort -> 2 opt
    r = nearest_neighbor_sort(generate_graph(packages_load), packages_load)
    optimized_route = two_opt(r)
    package_dist_list = ChainingHashTable()
    lp = 0
    index = 0
    d = datetime.datetime(2021,
                          month=datetime.datetime.now().month,
                          day=datetime.datetime.now().day,
                          hour=start_time.hour,
                          minute=start_time.minute)
    d.replace(hour=start_time.hour, minute=start_time.minute)
    delivery_time = d
    final_time = d
    miles_traveled = optimized_route[0]
    # create package/dist id table
    for p in packages_load:
        for d in optimized_route[1]:
            if Distance.pkg_d_keys.search_key(p) == d:
                package_dist_list.insert(p, (p, d))
    # deliver packages- Timestamp and remove from package_dist_list
    for f, v in enumerate(optimized_route[1]):
        lp += 1
        if lp < len(optimized_route[1]):
            distance = Distance.distance_table.distances.search_key(
                (v, optimized_route[1][f + 1]))
            travel_time = datetime.timedelta(
                minutes=Distance.time_to_travel(distance))
            delivery_time = delivery_time + travel_time
            if v != 0:
                for n, m in package_dist_list.get_values():
                    if m == v:
                        package_id = n
                        package_dist_list.remove_entry(package_id)
                        Packages.set_start_time(package_id, start_time)
                        Packages.set_delivery_timestamp(
                            package_id, delivery_time)
                        final_time = delivery_time
                        index += 1
    return final_time, miles_traveled
Пример #7
0
def Final_Inventory_Valuation():
    while True:
        Packages.Clean()
        print("== PRESUPUESTO DE PRODUCCION ==")
        print()
        print("1.- Agregar información de un producto")
        print("2.- Mostrar Reporte de presupuesto de produccion")
        print("\n0.- Regresar al Menú principal\n")
        Opcion = input("Ingrese la opción a realizar: ")

        if Opcion == "":
            print("ERROR: Por favor selecciona una opción")
            input("presiona la tecla ENTER para continuar...")
            Packages.Clean()

        elif Opcion == "1":
            Packages.Clean()

        elif Opcion == "2":
            Packages.Clean()

        elif Opcion == "0":
            Packages.Clean()
            print("Regresando al Menú principal...")
            break

        else:
            print("ERROR: Opción no valida...")
            input("Presiona ENTER para continuar")
            Packages.Clean()
Пример #8
0
def pack_trucks(Truck_List, Package_List):
    truck_counter = 0
    deadline_counter = 0
    package_counter = 1
    Package_Listt = Packages.get_package_list()
    while package_counter < 41:

        package = Package_List.search(package_counter)
        truck_counter = truck_counter % 3
        deadline_counter = deadline_counter % 2

        if package.delivery_deadline != 'EOD':
            #print(package.delivery_deadline)
            if 'Must' in package.notes or 'None' in package.notes:
                Truck_List[0].add_package(package)
            elif package.id == 15:
                Truck_List[0].add_package(package)
            else:
                Truck_List[deadline_counter].add_package(package)
                deadline_counter +=1

        elif 'Can only be' in package.notes:
            Truck_List[1].add_package(package)

        elif 'Delayed' in package.notes:
            Truck_List[1].add_package(package)

        elif 'Wrong' in package.notes:
            package.address = '410 S State St'
            package.zip = '84111'
            Truck_List[2].add_package(package)

        if package not in Truck_List[0].package_manifest and package not in Truck_List[1].package_manifest and package not in Truck_List[2].package_manifest:
            if(len(Truck_List[2].package_manifest) >= 10):
                Truck_List[truck_counter].add_package(package)
            else:
                Truck_List[2].add_package(package)
        #Truck_List[truck_counter].package_count += 1
        #print("Truck", truck_counter, "Package Count", Truck_List[truck_counter].package_count, Truck_List[truck_counter].id)
        package.update_status('Loaded')
        truck_counter += 1
        package_counter += 1

    #print(Locations.get_address(0).address)
    Truck_List[0].set_current_loc("4001 South 700 East,")
    Truck_List[1].set_current_loc("4001 South 700 East,")
    Truck_List[2].set_current_loc("4001 South 700 East,")
    Truck_List[0].departing_time = datetime.time(hour=8,minute=00)
    Truck_List[1].departing_time = datetime.time(hour=9, minute=5)
    Truck_List[2].departing_time = datetime.time(hour=10, minute=00)
    return Truck_List
Пример #9
0
    def fieldshl(self):
        #this function looks for the highest/ lowest x and y value of the fields
        #get the oracle connector from the connectdbfinds.py
        fieldsc = Packages.connectdbfieldmap()
        #this function shall find the highest and lowest x and y value to
        # to create the view box in the html. This not hardcoded bc more finds and Fields
        #might be added at a later point and then the script does not have to be changed
        # assign the first row as given
        counter = 0

        for row in fieldsc:
            #loop over teh database
            # assign the first row as given
            if counter == 0:
                currenthx = (float(row[3]))
                currenthy = (float(row[4]))
                currentlx = (float(row[1]))
                currently = (float(row[2]))
            else:
                #loop through the data and test if the next value is higher/smaller then
                #the previous and replace respectively
                if (float(row[3])) > currenthx:
                    currenthx = (float(row[3]))
                if (float(row[4])) > currenthy:
                    currenthy = (float(row[4]))
                if (float(row[1])) < currentlx:
                    currentlx = (float(row[1]))
                if (float(row[2])) < currently:
                    currently = (float(row[2]))
            counter += 1
            #viewbox must be a square and plus two of the higher number
            #small viewbox
            # must be checked against the highest lowest x and y of the finds,
            #bc they could be outside of the fields
            #find highest and lowest values for the fields
        if currenthx > currenthy:
            highestfield = currenthx + 2.0
        else:
            highestfield = currenthy + 2.0

        if currentlx < currently:
            lowestfield = currentlx
            lowestfieldgvb = currentlx - 1.0
        else:
            lowestfield = currently
            lowestfieldgvb = currently - 1.0
        #greater viewbox must be slightly bigger than the smaller owner
        # ist must be - 1 to the old findhighestlowestxy

        return highestfield, lowestfield, lowestfieldgvb, currenthx, currenthy, currentlx, currently
Пример #10
0
def test_finddb():
    #get the rows from the function of the webpage
    is_string = ''
    cpage = Packages.connectdbfind()
    for i in cpage:
        is_string += str(i)
    #this is how the database should look like
    should_be2 = "(1, 4, 1, 1, 0.67, 'Found In Some Clay')"
    should_be2 += "(2, 8, 5, 1, 0.79, 'Several Similar Pieces Found Together')"
    should_be2 += "(3, 8, 14, 3, 1.21, 'Found Embeded In A Bone')"
    should_be2 += "(4, 7, 12, 4, 1.37, 'A Small Bone Fragment')"
    should_be2 += "(5, 4, 7, 4, 1.01, 'Markings Suggest Killed For Food')"
    should_be2 += "(6, 11, 9, 2, 0.91, 'Very Corroded')"
    should_be2 += "(7, 12, 2, 1, 0.54, 'Part Of Drinking Vessel ?')"
    should_be2 += "(8, 3, 14, 2, 0.62, 'Refined Craftwork, Found With Others')"

    #Are both equal?
    assert_equal(is_string, should_be2)
Пример #11
0
    def findshl(self):
        #this function looks for the highest/ lowest x and y value of the finds
        #get the oracle connector from the connectdbfinds.py
        findsc = Packages.connectdbfind()
        counterfind = 0

        for row in findsc:
            #loop over the database
            # assign the first row as given
            if counterfind == 0:
                findhx = (float(row[1]))
                findhy = (float(row[2]))
                findlx = (float(row[1]))
                findly = (float(row[2]))
            else:
                #loop through the data and test if the next value is higher/smaller then
                #the previous and replace respectively
                if (float(row[1])) > findhx:
                    findhx = (float(row[1]))
                if (float(row[2])) > findhy:
                    findhy = (float(row[2]))
                if (float(row[1])) < findlx:
                    findlx = (float(row[1]))
                if (float(row[2])) < findly:
                    findly = (float(row[2]))
            counterfind += 1

    #find highest and lowest values for the finds
        if findhx > findhy:
            highestfind = findhx + 2.0
        else:
            highestfind = findhy + 2.0

        if findlx < findly:
            lowestfind = findlx
            lowestfindgvb = findlx - 1.0
        else:
            lowestfind = findly
            lowestfindgvb = findly - 1.0
        #greater viewbox must be slightly bigger than the smaller one
        # it must be - 1 to the old

        return highestfind, lowestfind, lowestfindgvb, findhx, findhy, findlx, findly
Пример #12
0
def test_fielddb():
    #get the rows from the function of the webpage
    is_string1 = ''
    cpage = Packages.connectdbfieldmap()
    for i in cpage:
        is_string1 += str(i)

    #this is how the database should look like
    should_be = ("(1, 2, 0, 6, 6, 3.56, 'Farmer Brown', 4)"
                 "(2, 2, 6, 6, 11, 2.97, 'Farmer Brown', 2)"
                 "(3, 6, 0, 10, 6, 3.56, 'Farmer Green', 3)"
                 "(4, 6, 6, 10, 11, 2.97, 'Farmer Black', 2)"
                 "(5, 10, 0, 12, 11, 3.2600000000000002, 'Farmer Green', 4)"
                 "(6, 6, 11, 12, 15, 3.56, 'Farmer Black', 1)"
                 "(7, 3, 12, 5, 15, 0.89, 'Farmer White', 5)"
                 "(8, 0, 12, 3, 16, 1.78, 'Farmer White', 3)")

    #cpage = Packages.connectdbfieldmap()
    #for i in cpage:
    #should_be += str(i)
    #Are both equal?
    assert_equal(is_string1, should_be)
Пример #13
0
def sendctofind():
    #this file sends the variables to the findss class
    # secondly it returns the variables that will be send later to html
    c = connectdbfind()  #connect to another function, that returns c
    tablefinds1 = tablehead()  # get the table header of another function
    svgpoint = ''  #create empty string that will be used later
    for row in c:
        #loop over c and append assign the variables
        findid = str(row[0])
        xcoord = str(row[1])
        ycoord = str(row[2])
        type = str(row[3])
        depth = str(row[4])
        notes = str(row[5])
        #send the variables inside the loop to the class
        finds = Packages.findss(findid, xcoord, ycoord, type, depth, notes)
        # to get the row for the tablefinds
        tablefinds1 += finds.renderfindstable()
        #and svg
        svgpoint += finds.renderfind()
    #close the table when the loop has ended
    tablefinds1 += '</table>'
    return c, tablefinds1, svgpoint
# Flood it game using turtle                  #
# ProfEvans                                   #
# Total time spent on edditing:> 06:24:19 HMS #
###############################################

import turtle as trtl  # trtl is the GUI
import random as rand  #randomizes color choise
import threading  # less lag I think
from PIL import Image  #analizes screen shot specificaly RGB
import pyscreenshot  #takes a screen shot
import pyautogui  #get position for Screen shot
import time as t  #I didnt use this
import math as m

import Packages as p
p.run()

#INIT trtl
wn = trtl.Screen()
wn.delay(0)  #this makes the display update as fast as your computer allows.

writer = trtl.Turtle()
writer.hideturtle()
writer.penup()

Move_writer = trtl.Turtle()
Move_writer.hideturtle()
Move_writer.penup()

#var assignment for the most part
colorID_list = ['purple', 'orange', 'blue', 'red', 'green', 'yellow', 'tan']
Пример #15
0
# ReadFile.py
"""
This file contains class ReadFile which has functions to parse xml, csv and text files

"""
import operator
import os
import re
import xmltodict
import Packages
import itertools
from datetime import datetime

Logger = Packages.LoggerDetails()
log = Logger.setLogger()


class ReadFile:
    def __init__(self):
        pass

    @staticmethod
    def file_tokenizer_txt(fileName, funcInputs: dict):
        """
        This is a function to tokenize a txt file and create an output csv file which contains column provided in the input
        The Output File will be names: <Input File Name>_output.csv in the same directory as the source file
        :param
        fileName: Name of the source file. The File name should have the absolute path to the file
        funcInputs: Dictionary containing a list with the indexes of all the columns that need to be extracted.
            recordMarkerStartText (Mandatory): Text indicating the start of one record
            recordMarkerEndText (Mandatory): Text indicating the end of one record
Пример #16
0
    def main(self, **kwargs):
        """
        This is the main function of the App
        :param self:
        :param kwargs:
        :return:
        """

        Logger = Packages.LoggerDetails()
        log = Logger.setLogger()
        returnVal = {}

        print(kwargs)
        if log.getEffectiveLevel() == Packages.sv.XL_DEBUG:
            log.debug("-----------------Starting new Parsing-------------")
            log.debug('Entering function main(self,**kwargs) of Module: ' +
                      __name__)

        try:
            funcName = Packages.Utilities.getValuefromDict(
                kwargs, 'funcName', 'Y')
            fileName = Packages.Utilities.getValuefromDict(
                kwargs, 'fileName', 'Y')
            funcInput = Packages.Utilities.getValuefromDict(
                kwargs, 'funcInput', 'Y')

            print('funcName : ', funcName)
        except ValueError as error:
            log.error(repr(error))
            if log.getEffectiveLevel() == Packages.sv.XL_DEBUG:
                log.debug('Exiting function main(self,**kwargs) of Module: ' +
                          __name__)
            returnVal["retval"] = Packages.sv.XL_FAILURE
            returnVal["recordCount"] = 0
            return returnVal
        try:
            if str(funcName).upper() == "CSV":
                retval = ReadFile.ReadFile.file_tokenizer_csv(
                    fileName, funcInput)
                if log.getEffectiveLevel() == Packages.sv.XL_DEBUG:
                    recordCount = list(retval)[1]
                    log.debug(
                        'Value returned from function:file_tokenizer_txt is:  {0}  of Module: '
                        .format(retval) + __name__)
            elif str(funcName).upper() == "TXT":
                retval = ReadFile.ReadFile.file_tokenizer_txt(
                    fileName, funcInput)
                if log.getEffectiveLevel() == Packages.sv.XL_DEBUG:
                    recordCount = list(retval)[1]
                    log.debug(
                        'Value returned from function:file_tokenizer_txt is:  {0}  of Module: '
                        .format(retval) + __name__)

            elif str(funcName).upper() == "XML":
                retval = ReadFile.ReadFile.file_tokenizer_xml(
                    fileName, funcInput)

                if log.getEffectiveLevel() == Packages.sv.XL_DEBUG:
                    recordCount = list(retval)[1]
                    print("Number of records processed = {0}".format(
                        recordCount))
                    log.debug(
                        'Value returned from function:file_tokenizer_txt is:  {0}  of Module: '
                        .format(retval) + __name__)
            else:
                log.error("Invalid value: {0} passed for parameter: funcName.".
                          format(funcName))
                raise ValueError(
                    'Invalid value: {0} passed for parameter: funcName.'.
                    format(funcName))

        except ValueError as error:
            log.error(repr(error))
            if log.getEffectiveLevel() == Packages.sv.XL_DEBUG:
                log.debug('Exiting function main(self,**kwargs) of Module: ' +
                          __name__)
            returnVal["retval"] = Packages.sv.XL_FAILURE
            returnVal["recordCount"] = 0
            return returnVal

        if log.getEffectiveLevel() == Packages.sv.XL_DEBUG:
            log.debug('Exiting function main(self,**kwargs) of Module: ' +
                      __name__)
            log.debug("-----------------End ofParsing-------------")
        returnVal["retval"] = Packages.sv.XL_SUCCESS
        returnVal["recordCount"] = recordCount
        return returnVal
Пример #17
0
def Operation_Budget():
    CtlOB = 1
    while (CtlOB != 0):
        print()
        print("=Presupuesto de Operación=")
        print()
        print("1.-Presupuesto de venta")
        print("2.-Determinación del saldo de Clientes y Flujo de Entradas")
        print("3.-Presupuesto de Producción")
        print("4.-Presupuesto de Requerimiento de Materiales")
        print("5.-Presupuesto de Compra de Materiales")
        print("6.-Determinación del saldo de Proveedores y Flujo de Salidas")
        print("7.-Presupuesto de Mano de Obra Directa")
        print("8.-Presupuesto de Gastos Indirectos de Fabricación")
        print("9.-Presupuesto de Gastos de Operación")
        print("10.-Determinación del Costo Unitario de Productos Terminados")
        print("11.-Valuación de Inventarios Finales")
        print()
        print("0.-Regresar al menu principal")
        print()
        CtlOB = input("Ingrese la opcion a realizar: ")

        if (CtlOB == ""):
            print("Por favor selecciona una opción")
            input("presiona la tecla Enter para continuar")
            Clean()
        elif (int(CtlOB) == 0):
            Clean()
            Menu()
        elif (int(CtlOB) == 1):
            Clean()
            Packages.Sales_Budget()
            Clean()
        elif (int(CtlOB) == 2):
            Clean()
            Packages.DCBI()
            Clean()
        elif (int(CtlOB) == 3):
            Clean()
            Packages.Production_Budget()
            Clean()
        elif (int(CtlOB) == 4):
            Clean()
            Packages.Materials_Requirement_Budget()
            Clean()
        elif (int(CtlOB) == 5):
            Clean()
            Packages.Materials_Purchase_Budget()
            Clean()
        elif (int(CtlOB) == 6):
            Clean()
            Packages.DBSO()
            Clean()
        elif (int(CtlOB) == 7):
            Clean()
            Packages.Direct_Labor_Budget()
            Clean()
        elif (int(CtlOB) == 8):
            Clean()
            Packages.IMEB()
            Clean()
        elif (int(CtlOB) == 9):
            Clean()
            Packages.Operating_Expenses_Budget
            Clean()
        elif (int(CtlOB) == 10):
            Clean()
            Packages.DUCFP
            Clean()
        elif (int(CtlOB) == 11):
            Clean()
            Packages.Final_Inventory_Valuation()
            Clean()
        else:
            print("Valor seleccionado no valido")
            input("presiona la tecla Enter para continuar")
            Clean()
Пример #18
0
def DCBI():
    while True:
        Packages.Clean()
        print(
            "== Determinación del saldo de Clientes y Flujo de Entradas ==\n")
        print("1.- Agregar información de un Saldo de Cliente")
        print(
            "2.- Mostrar Reporte de los saldos de Clientes y Flujos de Entradas"
        )
        print("\n0.- Regresar al Menú principal\n")
        Opcion = input("Ingresa la opción a realizar: ")

        if Opcion == "":
            print("ERROR: Por favor selecciona una opción")
            input("presiona la tecla ENTER para continuar...")
            Packages.Clean()

        elif Opcion == "1":
            Packages.Clean()
            print()
            print(
                "== Determinación del saldo de Clientes y Flujo de Entradas ==\n"
            )

            for movimiento in Packages.dicSaldosCliente:
                ##Saldo de Clientes
                if movimiento == "SaldoCliente":
                    Packages.dicSaldosCliente[movimiento] = float(
                        input("Ingresa el Saldo del Cliente: "))
                ##Ventas
                elif movimiento == "Ventas":
                    Packages.dicSaldosCliente[movimiento] = sum(
                        Packages.lstTotalVS)
                ##Total Cliente
                elif movimiento == "TotalCliente":
                    Packages.dicSaldosCliente[movimiento] = (
                        Packages.dicSaldosCliente["SaldoCliente"] +
                        Packages.dicSaldosCliente["Ventas"])

                ##Entradas de Efectivo Por Cobranza
                elif movimiento == "EntCobranza":
                    Packages.dicSaldosCliente[
                        movimiento] = Packages.dicSaldosCliente["SaldoCliente"]
                elif movimiento == "EntCobranza0":
                    Packages.dicSaldosCliente[movimiento] = (
                        Packages.dicSaldosCliente["Ventas"] * 0.8)
                elif movimiento == "TotalEnt":
                    Packages.dicSaldosCliente[movimiento] = (
                        Packages.dicSaldosCliente["EntCobranza"] +
                        Packages.dicSaldosCliente["EntCobranza0"])

                ##Saldo de Clientes Total
                elif movimiento == "Total":
                    Packages.dicSaldosCliente[movimiento] = (
                        Packages.dicSaldosCliente["TotalCliente"] -
                        Packages.dicSaldosCliente["TotalEnt"])
            Packages.mtzDSCFE.append(Packages.dicSaldosCliente.copy())

        elif Opcion == "2":
            Packages.Clean()
            Reportes(Packages.mtzDSCFE)
            input("presiona la tecla ENTER para continuar...")

        elif Opcion == "0":
            Packages.Clean()
            print("Regresando al Menú principal...")
            break

        else:
            print("ERROR: Opción no valida...")
            input("Presiona ENTER para continuar")
            Packages.Clean()
Пример #19
0
def Materials_Purchase_Budget():
    while True:
        Packages.Clean()
        print("== Presupuesto de Compra de Materiales ==")
        print()
        print("1.- Agregar información de un producto")
        print("2.- Mostrar Reporte de Presupuesto de Compra de Materiales")
        print("\n0.- Regresar al Menú principal\n")
        Opcion = input("Ingrese la opción a realizar: ")

        if Opcion == "":
            print("ERROR: Por favor selecciona una opción")
            input("presiona la tecla ENTER para continuar...")
            Packages.Clean()

        elif Opcion == "1":
            Packages.Clean()
            ##Mostrar Catalogo de Materiales
            print("Catalago de Materiales")
            for DiccionarioMateriales in Packages.mtzMateriales:
                print(DiccionarioMateriales["CodMaterial"] + ' - ' +
                      DiccionarioMateriales["NomMaterial"])
                Packages.lstValArticulo.append(
                    DiccionarioMateriales["CodMaterial"])
            CodMat = input("Ingrese el codigo del Articulo a cargar: ")
            Packages.Clean()

            if (CodMat in Packages.lstValArticulo):
                for dic in range(0, len(Packages.mtzTotalRequerimientos)):
                    for registro in Packages.mtzTotalRequerimientos[dic]:
                        if registro == "Total1S":
                            Packages.dicPresupuestoCompraMat[
                                "ReqMat1"] = Packages.mtzTotalRequerimientos[
                                    dic][registro]
                        elif registro == "Total2S":
                            Packages.dicPresupuestoCompraMat[
                                "ReqMat2"] = Packages.mtzTotalRequerimientos[
                                    dic][registro]
                        elif registro == "TotalReq":
                            Packages.dicPresupuestoCompraMat[
                                "ReqMatTotal"] = Packages.mtzTotalRequerimientos[
                                    dic][registro]

                Packages.dicPresupuestoCompraMat["InventarioFin1"] = float(
                    input(
                        "Ingresa el valor del Inventario Final del Semestre 1: "
                    ))
                Packages.dicPresupuestoCompraMat["InventarioFin2"] = float(
                    input(
                        "Ingresa el valor del Inventario Final del Semestre 2: "
                    ))
                Packages.dicPresupuestoCompraMat[
                    "InventarioFinTotal"] = Packages.dicPresupuestoCompraMat[
                        "InventarioFin2"]

                Packages.dicPresupuestoCompraMat[
                    "TotalMateeriales1"] = Packages.dicPresupuestoCompraMat[
                        "InventarioFin1"] + Packages.dicPresupuestoCompraMat[
                            "ReqMat1"]
                Packages.dicPresupuestoCompraMat[
                    "TotalMateeriales2"] = Packages.dicPresupuestoCompraMat[
                        "InventarioFin2"] + Packages.dicPresupuestoCompraMat[
                            "ReqMat2"]
                Packages.dicPresupuestoCompraMat[
                    "TotalMateeriales"] = Packages.dicPresupuestoCompraMat[
                        "InventarioFinTotal"] + Packages.dicPresupuestoCompraMat[
                            "ReqMatTotal"]

                Packages.dicPresupuestoCompraMat["InventarioIni1"] = float(
                    input(
                        "Ingresa el valor del Inventario Inicial del Semestre 1: "
                    ))
                Packages.dicPresupuestoCompraMat["InventarioIni2"] = float(
                    input(
                        "Ingresa el valor del Inventario Inicial del Semestre 2: "
                    ))
                Packages.dicPresupuestoCompraMat[
                    "InventarioIniTotal"] = Packages.dicPresupuestoCompraMat[
                        "InventarioIni1"]

                Packages.dicPresupuestoCompraMat[
                    "MatCompra1"] = Packages.dicPresupuestoCompraMat[
                        "TotalMateeriales1"] - Packages.dicPresupuestoCompraMat[
                            "InventarioIni1"]
                Packages.dicPresupuestoCompraMat[
                    "MatCompra2"] = Packages.dicPresupuestoCompraMat[
                        "TotalMateeriales2"] - Packages.dicPresupuestoCompraMat[
                            "InventarioIni2"]
                Packages.dicPresupuestoCompraMat[
                    "MatCompraTotal"] = Packages.dicPresupuestoCompraMat[
                        "TotalMateeriales"] - Packages.dicPresupuestoCompraMat[
                            "InventarioIniTotal"]

                Packages.dicPresupuestoCompraMat["PrecioComp1"] = float(
                    input("Ingresa el Precio de Compra del Semestre 1: "))
                Packages.dicPresupuestoCompraMat["PrecioComp2"] = float(
                    input("Ingresa el Precio de Compra del Semestre 2: "))

                Packages.dicPresupuestoCompraMat[
                    "TotalMateial1"] = Packages.dicPresupuestoCompraMat[
                        "MatCompra1"] * Packages.dicPresupuestoCompraMat[
                            "PrecioComp1"]
                Packages.lstTotalComp1.append(
                    Packages.dicPresupuestoCompraMat["TotalMateial1"])
                Packages.dicPresupuestoCompraMat[
                    "TotalMateial2"] = Packages.dicPresupuestoCompraMat[
                        "MatCompra2"] * Packages.dicPresupuestoCompraMat[
                            "PrecioComp2"]
                Packages.lstTotalComp2.append(
                    Packages.dicPresupuestoCompraMat["TotalMateial2"])
                Packages.dicPresupuestoCompraMat[
                    "TotalMateial"] = Packages.dicPresupuestoCompraMat[
                        "TotalMateial1"] + Packages.dicPresupuestoCompraMat[
                            "TotalMateial2"]
                Packages.lstTotalComp.append(
                    Packages.dicPresupuestoCompraMat["TotalMateial"])

                Packages.dicTotalCompras["Semestre1"] = sum(
                    Packages.lstTotalComp1)
                Packages.dicTotalCompras["Semestre2"] = sum(
                    Packages.lstTotalComp2)
                Packages.dicTotalCompras["Total"] = sum(Packages.lstTotalComp)

                Packages.mtzPresupuestoCompraMat.append(
                    Packages.dicPresupuestoCompraMat)
                Packages.mtzTotalComp.append(Packages.dicTotalCompras)

        elif Opcion == "2":
            Packages.Clean()
            Reportes(Packages.mtzPresupuestoCompraMat)
            print("== Compras Totales ==")
            print(f"Semestre 1 = {sum(Packages.lstTotalComp1)}")
            print(f"Semestre 2 = {sum(Packages.lstTotalComp2)}")
            print(f"Total = {sum(Packages.lstTotalComp)}")
            input("Presiona ENTER para continuar")

        elif Opcion == "0":
            Packages.Clean()
            print("Regresando al Menú principal...")
            break

        else:
            print("ERROR: Opción no valida...")
            input("Presiona ENTER para continuar")
            Packages.Clean()
Пример #20
0
def DBSO():
    while True:
        Packages.Clean()
        print(
            "== Determinación del saldo de Proveedores y Flujo de Salidas ==")
        print()
        print("1.- Agregar información de un producto")
        print(
            "2.- Mostrar Reporte de Determinación del saldo de Proveedores y Flujo de Salidas"
        )
        print("\n0.- Regresar al Menú principal\n")
        Opcion = input("Ingrese la opción a realizar: ")

        if Opcion == "":
            print("ERROR: Por favor selecciona una opción")
            input("presiona la tecla ENTER para continuar...")
            Packages.Clean()

        elif Opcion == "1":
            Packages.Clean()
            for dic in range(0, len(Packages.mtzTotalComp)):
                for registro in Packages.mtzTotalComp[dic]:
                    if registro == "Total":
                        Packages.dicSaldoProveedores[
                            "Compras"] = Packages.mtzTotalComp[dic][registro]

            Packages.dicSaldoProveedores["SaldoProveedores"] = float(
                input("Ingresa el Saldo de Proveedores: "))
            Packages.dicSaldoProveedores[
                "TotalProveedores"] = Packages.dicSaldoProveedores[
                    "SaldoProveedores"] + Packages.dicSaldoProveedores[
                        "Compras"]
            Packages.dicSaldoProveedores[
                "SalidaXProveedor1"] = Packages.dicSaldoProveedores[
                    "SaldoProveedores"]
            Packages.dicSaldoProveedores[
                "SalidaXProveedor2"] = Packages.dicSaldoProveedores[
                    "Compras"] * 0.5
            Packages.dicSaldoProveedores[
                "TotalSalidas"] = Packages.dicSaldoProveedores[
                    "SalidaXProveedor1"] + Packages.dicSaldoProveedores[
                        "SalidaXProveedor2"]
            Packages.dicSaldoProveedores[
                "SaldoProveedoresTotal"] = Packages.dicSaldoProveedores[
                    "TotalProveedores"] - Packages.dicSaldoProveedores[
                        "TotalSalidas"]
            Packages.mtzSaldoProveedores.append(Packages.dicSaldoProveedores)

        elif Opcion == "2":
            Packages.Clean()
            Reportes(Packages.mtzSaldoProveedores)
            input("Presiona ENTER para continuar")

        elif Opcion == "0":
            Packages.Clean()
            print("Regresando al Menú principal...")
            break

        else:
            print("ERROR: Opción no valida...")
            input("Presiona ENTER para continuar")
            Packages.Clean()
Пример #21
0
def Production_Budget():
    while True:
        Packages.Clean()
        print("== PRESUPUESTO DE PRODUCCION ==")
        print()
        print("1.- Agregar información de un presupuesto de producción")
        print("2.- Mostrar Reporte de presupuesto de produccion")
        print("\n0.- Regresar al Menú principal\n")
        Opcion = input("Ingrese la opción a realizar: ")

        if Opcion == "":
            print("ERROR: Por favor selecciona una opción")
            input("presiona la tecla ENTER para continuar...")
            Packages.Clean()

        elif Opcion == "1":
            Packages.Clean()
            CodArt = 0
            print("Catalago de Articulos")
            for Diccionario in Packages.mtzArticulos:
                print(Diccionario["CodArticulo"] + ' - ' +
                      Diccionario["NomArticulo"])
                Packages.lstValArticulo.append(Diccionario["CodArticulo"])
            CodArt = input("Ingrese el codigo del articulo a cargar: ")

            if (CodArt in Packages.lstValArticulo):
                for reportes in range(0, len(Packages.mtzPVenta)):
                    #print("Saldo de Clientes y Flujo de Entradas: ")
                    for reporte in Packages.mtzPVenta[reportes]:
                        if Packages.mtzPVenta[reportes][reporte] == str(
                                CodArt):
                            Packages.dicPresupuestoOp["CodArticulo"] = str(
                                CodArt)
                            for campo in Packages.mtzPVenta[reportes]:
                                if campo == "Semestre" and Packages.mtzPVenta[
                                        reportes][campo] == 1:
                                    for valor in Packages.mtzPVenta[reportes]:
                                        if valor == "UnAVender":
                                            Packages.dicPresupuestoOp[
                                                "UnVender1S"] = Packages.mtzPVenta[
                                                    reportes][valor]

                                elif campo == "Semestre" and Packages.mtzPVenta[
                                        reportes][campo] == 2:
                                    for valor in Packages.mtzPVenta[reportes]:
                                        if valor == "UnAVender":
                                            Packages.dicPresupuestoOp[
                                                "UnVender2S"] = Packages.mtzPVenta[
                                                    reportes][
                                                        valor] = Packages.mtzPVenta[
                                                            reportes][valor]

                Packages.dicPresupuestoOp[
                    "TotalUnVender"] = Packages.dicPresupuestoOp[
                        "UnVender1S"] + Packages.dicPresupuestoOp["UnVender2S"]

                Packages.dicPresupuestoOp["InvenFin1"] = float(
                    input(
                        "Ingresa el valor del Inventario Final del Semestre 1: "
                    ))
                Packages.dicPresupuestoOp["InvenFin2"] = float(
                    input(
                        "Ingresa el valor del Inventario Final del Semestre 2: "
                    ))
                Packages.dicPresupuestoOp[
                    "InvenFinTotal"] = Packages.dicPresupuestoOp["InvenFin2"]

                Packages.dicPresupuestoOp[
                    "TotalUN1"] = Packages.dicPresupuestoOp[
                        "InvenFin1"] + Packages.dicPresupuestoOp["UnVender1S"]
                Packages.dicPresupuestoOp[
                    "TotalUN2"] = Packages.dicPresupuestoOp[
                        "InvenFin2"] + Packages.dicPresupuestoOp["UnVender2S"]
                Packages.dicPresupuestoOp[
                    "TotalUN"] = Packages.dicPresupuestoOp[
                        "TotalUnVender"] + Packages.dicPresupuestoOp[
                            "InvenFinTotal"]

                Packages.dicPresupuestoOp["InventarioIni1"] = float(
                    input(
                        "Ingresa el valor del Inventario Inicial del Semestre 1: "
                    ))
                Packages.dicPresupuestoOp["InventarioIni2"] = float(
                    input(
                        "Ingresa el valor del Inventario Inicial del Semestre 2: "
                    ))
                Packages.dicPresupuestoOp[
                    "InventarioIniTotal"] = Packages.dicPresupuestoOp[
                        "InventarioIni1"]

                Packages.dicPresupuestoOp[
                    "UnidadesProd1"] = Packages.dicPresupuestoOp[
                        "TotalUN1"] - Packages.dicPresupuestoOp[
                            "InventarioIni1"]
                Packages.dicPresupuestoOp[
                    "UnidadesProd2"] = Packages.dicPresupuestoOp[
                        "TotalUN2"] - Packages.dicPresupuestoOp[
                            "InventarioIni2"]
                Packages.dicPresupuestoOp[
                    "UnidadesProdTotal"] = Packages.dicPresupuestoOp[
                        "TotalUN"] - Packages.dicPresupuestoOp[
                            "InventarioIniTotal"]

                Packages.mtzPresupuestoOp.append(
                    Packages.dicPresupuestoOp.copy())
                Packages.Clean()

        elif Opcion == "2":
            Packages.Clean()
            Reportes(Packages.mtzPresupuestoOp)
            input("\nPresiona ENTER para continuar")

        elif Opcion == "0":
            Packages.Clean()
            print("Regresando al Menú principal...")
            break

        else:
            print("ERROR: Opción no valida...")
            input("Presiona ENTER para continuar")
            Packages.Clean()
Пример #22
0
def Materials_Requirement_Budget():
    while True:
        Packages.Clean()
        print("== Presupuesto de Requerimiento de Materiales ==")
        print()
        print("1.- Agregar información de un producto")
        print(
            "2.- Mostrar Reporte de Presupuesto de Requerimiento de Materiales"
        )
        print("\n0.- Regresar al Menú principal\n")
        Opcion = input("Ingrese la opción a realizar: ")

        if Opcion == "":
            print("ERROR: Por favor selecciona una opción")
            input("presiona la tecla ENTER para continuar...")
            Packages.Clean()

        elif Opcion == "1":
            Packages.Clean()
            print("Catalago de Articulos")
            ##Catalogo de Articulos
            for DiccionarioArticulos in Packages.mtzArticulos:
                print(DiccionarioArticulos["CodArticulo"] + ' - ' +
                      DiccionarioArticulos["NomArticulo"])
                Packages.lstValArticulo.append(
                    DiccionarioArticulos["CodArticulo"])
            CodArt = input("Ingrese el codigo del articulo a cargar: ")

            if (CodArt in Packages.lstValArticulo):
                Packages.Clean()
                ##Mostrar Catalogo de Materiales
                print("Catalago de Materiales")
                for DiccionarioMateriales in Packages.mtzMateriales:
                    print(DiccionarioMateriales["CodMaterial"] + ' - ' +
                          DiccionarioMateriales["NomMaterial"])
                    Packages.lstValArticulo.append(
                        DiccionarioMateriales["CodMaterial"])
                CodMat = input("Ingrese el codigo del Articulos a cargar: ")
                Packages.Clean()

                if (CodMat in Packages.lstValArticulo):
                    Packages.dicPresupuestoReqMat["CodMaterial"] = CodMat
                    ##Obtener  Unidades a producir
                    for reportes in range(0, len(Packages.mtzPresupuestoOp)):
                        for reporte in Packages.mtzPresupuestoOp[reportes]:
                            if reporte == "UnVender1S":
                                Packages.dicPresupuestoReqMat[
                                    "UnidadesProd1S"] = Packages.mtzPresupuestoOp[
                                        reportes][reporte]
                            elif reporte == "UnVender2S":
                                Packages.dicPresupuestoReqMat[
                                    "UnidadesProd2S"] = Packages.mtzPresupuestoOp[
                                        reportes][reporte]
                            elif reporte == "UnidadesProdTotal":
                                Packages.dicPresupuestoReqMat[
                                    "UnidadesProdTotal"] = Packages.mtzPresupuestoOp[
                                        reportes][reporte]
                    ##Solicitud de informacion
                    Packages.dicPresupuestoReqMat["RequerimientoMat1S"] = float(
                        input(
                            "Ingresa el Requerimiento de Material para el Semestre 1: "
                        ))
                    Packages.dicPresupuestoReqMat["RequerimientoMat2S"] = float(
                        input(
                            "Ingresa el Requerimiento de Material para el Semestre 2: "
                        ))
                    Packages.dicPresupuestoReqMat[
                        "RequerimientoMatTotal"] = Packages.dicPresupuestoReqMat[
                            "RequerimientoMat2S"]

                    Packages.dicPresupuestoReqMat[
                        "TotalMatRequerido1S"] = Packages.dicPresupuestoReqMat[
                            "UnidadesProd1S"] * Packages.dicPresupuestoReqMat[
                                "RequerimientoMat1S"]
                    Packages.dicPresupuestoReqMat[
                        "TotalMatRequerido2S"] = Packages.dicPresupuestoReqMat[
                            "UnidadesProd2S"] * Packages.dicPresupuestoReqMat[
                                "RequerimientoMat2S"]
                    Packages.dicPresupuestoReqMat[
                        "TotalMatRequeridoTotal"] = Packages.dicPresupuestoReqMat[
                            "RequerimientoMatTotal"] * Packages.dicPresupuestoReqMat[
                                "UnidadesProdTotal"]
                    Packages.mtzPresupuestoReqMat.append(
                        Packages.dicPresupuestoReqMat.copy())

                    for reportes in range(0,
                                          len(Packages.mtzPresupuestoReqMat)):
                        for reporte in Packages.mtzPresupuestoReqMat[reportes]:
                            if reporte == "TotalMatRequerido1S":
                                Packages.lstTotalRequerimientos1S.append(
                                    Packages.mtzPresupuestoReqMat[reportes]
                                    [reporte])
                            elif reporte == "TotalMatRequerido2S":
                                Packages.lstTotalRequerimientos2S.append(
                                    Packages.mtzPresupuestoReqMat[reportes]
                                    [reporte])
                            elif reporte == "TotalMatRequeridoTotal":
                                Packages.lstTotalReq.append(
                                    Packages.mtzPresupuestoReqMat[reportes]
                                    [reporte])

                    Packages.dicTotalRequerimientos["CodMaterial"] = CodMat
                    Packages.dicTotalRequerimientos["Total1S"] = sum(
                        Packages.lstTotalRequerimientos1S)
                    Packages.dicTotalRequerimientos["Total2S"] = sum(
                        Packages.lstTotalRequerimientos2S)
                    Packages.dicTotalRequerimientos["TotalReq"] = sum(
                        Packages.lstTotalReq)
                    Packages.mtzTotalRequerimientos.append(
                        Packages.dicTotalRequerimientos.copy())

                else:
                    print("ERROR: El codigo de articulo no es valido...")
                    input("Presiona ENTER para continuar")
        elif Opcion == "2":
            Packages.Clean()
            Reportes(Packages.mtzPresupuestoReqMat)
            print("Total de Requerimientos (gramos)")
            Reportes(Packages.mtzTotalRequerimientos)
            input("Presiona ENTER para continuar")

        elif Opcion == "0":
            Packages.Clean()
            print("Regresando al Menú principal...")
            break

        else:
            print("ERROR: Opción no valida...")
            input("Presiona ENTER para continuar")
            Packages.Clean()
Пример #23
0
import Packages

Packages.Menu()
Пример #24
0
def Sales_Budget():
    Opcion2 = 1
    while (Opcion2 != 0):
        Packages.Clean()
        print("== PRESUPUESTO DE VENTA ==")
        print("")
        print("1.- Agregar información de un producto")
        print("2.- Mostrar Reporte de presupuesto de venta")
        print("\n0.- Regresar al Menú principal\n")
        Opcion2 = int(input("Ingresa la opción a realizar: "))

        if (str(Opcion2) == ""):
            print("Por favor selecciona una opción")
            input("presiona la tecla Enter para continuar")
            Packages.Clean()

        elif (Opcion2 == 1):
            Packages.Clean()
            CodArt = 0
            print()

            print("Catalago de Articulos")
            for Diccionario in Packages.mtzArticulos:
                print(Diccionario["CodArticulo"] + ' - ' +
                      Diccionario["NomArticulo"])
                Packages.lstValArticulo.append(Diccionario["CodArticulo"])
            CodArt = input("Ingrese el codigo del articulo a cargar: ")

            if (CodArt in Packages.lstValArticulo):
                for Cont in range(0, 2):
                    TotalVentas = 0
                    for Campo in Packages.dicPVenta:
                        if (Campo == "CodArticulo"):
                            Packages.dicPVenta[Campo] = CodArt
                        elif (Campo == "Semestre"):
                            Packages.dicPVenta[Campo] = (Cont + 1)
                        elif (Campo == "UnAVender" or Campo == "Pventa"):
                            Packages.dicPVenta[Campo] = float(
                                input("Ingresa la cantidad de " + Campo +
                                      " para el " + str(Cont + 1) +
                                      "° semestre: "))
                        else:
                            Packages.dicPVenta[Campo] = Packages.dicPVenta[
                                "UnAVender"] * Packages.dicPVenta["Pventa"]
                            TotalVentas += Packages.dicPVenta[Campo]
                            Packages.lstTotalVS.append(TotalVentas)
                    Packages.mtzPVenta.append(Packages.dicPVenta.copy())
                    Packages.Clean()
            else:
                print("ERROR: El codigo de articulo no es valido...")
                input("Presiona ENTER para continuar")
                Packages.Clean()

        elif (Opcion2 == 2):
            Packages.Clean()
            print("=Reporte Presupuesto de Venta=")
            print()
            for reporte in Packages.mtzPVenta:
                print(reporte)
            print("Total Venta Anual = ", sum(Packages.lstTotalVS))
            input("Presiona ENTER para continuar")

        elif (Opcion2 == 0):
            Packages.Clean()
            print("Regresando al Menú principal...")
            break

        else:
            print("ERROR: Opción no valida...")
            input("Presiona ENTER para continuar")
            Packages.Clean()
Пример #25
0
Trucks.py contains Truck containers and the delivery algorithm
Time.py contains neseccary time functions/methods
Launcher.py contains calls to all main methods and UI interface logic

"""

#imports

import Packages
import Locations
import Trucks
import datetime
import time
#import deliver_packages

Packages.add_all_packages()
Package_List = Packages.get_package_list()

Locations.add_all_locations()
Location_List = Locations.get_loc_list()

Truck_List = Trucks.init_trucks()
Packed_Trucks = Trucks.pack_trucks(Truck_List, Package_List)

Trucks.deliver_packages(Packed_Trucks, Truck_List)

# Interface for user to look up package status.

start = input(
    "Welcome to the WGU UPS Program!\n"
    "Type 'track' to look up details on a specific package\n"
Пример #26
0
import pickle
import Packages

# All processing functions are in Packages.py, this file only executes them and saves the results to a pickle file
# this pickle file holds the output of the preprocessing, such as the DF with LOF scores.
# From there, I used the Jupyter notebook called "LSTM.ipynb" to test the results, as it is easier with visualisations.
# Make sure the dataset is in the data folder (you can download it from google drive)
# In the config file you can further change the trajectories or designated folders.

if __name__ == "__main__":
    all_results = Packages.create_historical_outlier_dfs()
    pickle.dump(all_results, open("./results/OBIS_results.pickle", "wb"))
Пример #27
0
                                                       start_time_truck_1_2)[1]
    truck_2_distance = Core_Algorithm.deliver_packages(Packages.second_truck,
                                                       start_time_truck_1_2)[1]
    # Truck 3 start time
    start_time_truck_3 = datetime.datetime(2021,
                                           datetime.datetime.now().month,
                                           datetime.datetime.now().day,
                                           hour=10,
                                           minute=30)
    # Deliver truck 3 and get distance
    truck_3_distance = Core_Algorithm.deliver_packages(Packages.third_truck,
                                                       start_time_truck_3)[1]
    # Sum total distance
    total_distance += truck_1_distance + truck_2_distance + truck_3_distance
    # Checking if all deadlines are met
    Packages.packages_delivered_on_time()

    # Command line interface
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def menu():
        print("Menu options - enter number below")
        print("Type 'close application' to stop application")
        print("1 - Search packages by any criteria")
        print("2 - Search packages status by time")
        print("3 - Show total distance traveled")
        user_input = input("Type Here: ")
        while user_input != "close application":
            if user_input == "1":
                while user_input != "menu" or user_input != "close application":
                    print("Type 'menu' to return to main menu")
                    print("Type 'close application' to stop application")
Пример #28
0
 def menu():
     print("Menu options - enter number below")
     print("Type 'close application' to stop application")
     print("1 - Search packages by any criteria")
     print("2 - Search packages status by time")
     print("3 - Show total distance traveled")
     user_input = input("Type Here: ")
     while user_input != "close application":
         if user_input == "1":
             while user_input != "menu" or user_input != "close application":
                 print("Type 'menu' to return to main menu")
                 print("Type 'close application' to stop application")
                 user_input = input("Search for packages: ")
                 print("\n")
                 Packages.search_Packages(user_input)
                 print("\n")
                 if user_input == "menu":
                     menu()
                 if user_input == "close application":
                     break
         if user_input == "2":
             while user_input != "menu" or user_input != "close application":
                 print("Enter time to check status of all packages")
                 print("Input based on 24 hr clock")
                 user_input_hour = input("hour = ")
                 user_input_minute = input("minutes = ")
                 user_input = input(
                     "Type 'menu' here to return to the main menu or just press enter to get results: "
                 )
                 if user_input_hour != "" and user_input_minute != "":
                     Packages.get_all_package_status(
                         int(user_input_hour), int(user_input_minute))
                 if user_input == "menu":
                     menu()
                 if user_input == "close application":
                     break
         if user_input == "3":
             while user_input != "menu" or user_input != "close application":
                 print("Select an option.")
                 print("Type 'menu' to return to main menu")
                 print("Type 'close application' to stop application")
                 print("1 - Truck 1 distance traveled")
                 print("2 - Truck 2 distance traveled")
                 print("3 - Truck 3 distance traveled")
                 print("4 - Combined distance of all trucks")
                 user_input = input("Type option here: ")
                 if user_input == "1":
                     print("\n", "Truck 1 distance: ", truck_1_distance,
                           " miles", "\n")
                 if user_input == "2":
                     print("\n", "Truck 2 distance: ", truck_2_distance,
                           " miles", "\n")
                 if user_input == "3":
                     print("\n", "Truck 3 distance: ", truck_3_distance,
                           " miles", "\n")
                 if user_input == "4":
                     print("\n", "Total distance by all trucks: ",
                           total_distance, " miles", "\n")
                 if user_input == "menu":
                     menu()
                 if user_input == "close application":
                     break
         else:
             menu()
Пример #29
0
              str(currentTime % 60))
    else:
        print("Current Time is: " + str(math.floor(currentTime / 60)) + ":" +
              str(currentTime % 60))


# Main Worst complexity O(p*d)
if __name__ == '__main__':
    # Setting up trucks O(t) t = trucks
    Trucks.CreateTrucks(3)
    truck1 = Trucks.TruckList[0]
    truck2 = Trucks.TruckList[1]
    # Reading Destinations from file O(d^2) d = destinations
    Destination.readDestinations()
    # Reading Packages from File O(p*d) p = packages d = destinations
    Packages.readPackageList()

    # HardCoded Loading
    # 8:00 Loading #####################################################################################################
    printTime()

    print("\nLoading Packages 1,13,14,15,16,19,20,21,34,39 -> Truck 1")
    # 1,13,14,15,16,19,20,21,34,39 -> Truck 1
    truck1.loadPackage(Packages.hashTable.search(1))  # O(1)
    truck1.loadPackage(Packages.hashTable.search(13))  # O(1)
    truck1.loadPackage(Packages.hashTable.search(14))  # O(1)
    truck1.loadPackage(Packages.hashTable.search(15))  # O(1)
    truck1.loadPackage(Packages.hashTable.search(16))  # O(1)
    truck1.loadPackage(Packages.hashTable.search(19))  # O(1)
    truck1.loadPackage(Packages.hashTable.search(20))  # O(1)
    truck1.loadPackage(Packages.hashTable.search(21))  # O(1)