Ejemplo n.º 1
0
class Equipment():
    def __init__(self, factory, equip_id, equip_type, max_quantity):
        self.factory = factory
        self.equip_id = equip_id
        self.equip_type = equip_type
        self.max_quantity = max_quantity
        self.calendar = Calendar()

        self.create_calendar()

    def show(self):
        print(
            f"Equipment ID : {self.equip_id}; Type : {self.equip_type}; Maximum quantity : {self.max_quantity}"
        )

    def create_calendar(self):
        for n in range(1000):
            new_date = datetime.datetime.today() + datetime.timedelta(days=n)
            day = new_date.day
            month = new_date.month
            year = new_date.year
            self.calendar.add_days_equipment(day, month, year,
                                             self.max_quantity)

    def show_calendar(self):
        print(f"The calendar of the Equipment {self.equip_id} is:")
        self.calendar.show()

    def add_equipment(self):
        self.factory.list_equipment.append(self)
class Employee():


    
    def __init__(self, factory, employee_id, name, *skill):
        self.factory = factory
        self.employee_id = employee_id
        self.name = name
        self.skills = skill
        self.calendar = Calendar()
        self.start_hour = 8
        self.finish_hour = 18
        self.start_lunch = 12
        self.finish_lunch = 13.5

        self.create_calendar()
        self.add_employee()


    def show(self):
        print(f"Employee ID : {self.employee_id}; Name : {self.name}; Skills : {self.skills}.")


    def create_calendar(self):
        for n in range(1000):
            new_date = datetime.datetime.today() + datetime.timedelta(days=n)
            if new_date.weekday() != 5 and new_date.weekday() != 6:
                day = new_date.day
                month = new_date.month
                year = new_date.year
                self.calendar.add_days_employee(day, month, year, self.start_hour, self.finish_hour, self.start_lunch, self.finish_lunch)


    def show_calendar(self):
        print(f"The calendar of the employee with the ID {self.employee_id} is:")
        self.calendar.show()


    def add_skill(self, skill):
        self.skills.append(skill)
    

    def add_employee(self):
        self.factory.list_employees.append(self)