def update_package_status(self, package: Package, status: PackageStatus,
                           time: datetime) -> None:
     if status == PackageStatus.ON_TRUCK:
         package = self.packages.search(package)
         package.status = status
         package.time_on_truck = time
         self.packages.update(package)
     if status == PackageStatus.DELIVERED:
         package = self.packages.search(package)
         package.status = status
         package.delivery_time = time
         self.packages.update(package)
 def load_package(self, package: Package):
     if len(self.truck_package_list) < 16:
         package.status = 'Loaded on Truck #' + str(self.truck_num)
         self.truck_package_list.append(package)
         return 'Loaded\n'
     else:
         return 'Truck full\n'
예제 #3
0
파일: main.py 프로젝트: C-Iannotti/WGUPS
# Creates interface to check the packages
user_input = 0
while user_input != 'q' and user_input != 'Q':
    print(
        'Enter t to check all packages at a specific time, k to check a specific package, and q'
        + ' to exit the application: ',
        end='')
    user_input = input()

    if user_input == 't' or user_input == 'T':
        print('Enter a time between 00:00 and 24:00: ', end='')
        user_time = input()
        if len(user_time) == 5:
            for package in packages.get_all_items():
                print()
                package.status(user_time)
        else:
            print('Improper time entered!')
    elif user_input == 'k' or user_input == 'K':
        print('Enter the key of the package: ', end='')
        user_key = int(input())

        print('Enter a time between 00:00 and 24:00: ', end='')
        user_time = input()
        if len(user_time) == 5:
            print()
            package = packages.search(user_key)
            if package is None:
                print('Package not found!')
            else:
                package.status(user_time)