Exemplo n.º 1
0
 def __call__(self):
     db_session = load_session()
     self.hardware = db_session.query(Hardware).filter(Hardware.hardware_id == self.hardware_id).scalar()
     self.hardware_conditions = db_session.query(HardwareCondition).all()
     self.hardware_types = db_session.query(HardwareType).all()
     self.hardware_brands = db_session.query(Brand).all()
     db_session.close()
Exemplo n.º 2
0
    def get_hardware_arrangement(cls, hardware_id):
        db_session = load_session()
        result = db_session.query(ArrangeHardware).filter(ArrangeHardware.hardware_id == hardware_id).\
            order_by(ArrangeHardware.doc_date).all()

        # db_session.close()
        return result
Exemplo n.º 3
0
 def __init__(self, hardware):
     self.db_session = load_session()
     self.hardware = self.get_selected_hardware(hardware_id=hardware)
     self.it_workers = self.get_workers(it_workers=True)
     self.workers = self.get_workers(it_workers=False)
     self.doc_num = self.get_next_doc_num()
     self.arrange_operations = self.get_arrange_operations()
     self.doc_date = date.today()
Exemplo n.º 4
0
    def edit_hardware(self):
        db_session = load_session()
        hardware = db_session.query(Hardware).filter(Hardware.hardware_id == self.hardware_id).scalar()

        hardware.name = self.name
        hardware.hardware_condition_id = self.hardware_condition_id
        hardware.hardware_type_id = self.hardware_type_id
        hardware.hardware_brand_id = self.hardware_brand_id
        hardware.validation_date = self.validation_date
        hardware.serial_num = self.serial_num
        hardware.description = self.description
        db_session.commit()
        db_session.close()
Exemplo n.º 5
0
 def get_list_of_hardware(self):
     db_session = load_session()
     result = db_session.query(Hardware).all()
     return result
Exemplo n.º 6
0
 def __call__(self):
     self.db_session = load_session()
     self.hardware_arrange = self.get_hardware()
     self.create_missing_hardware()
     return self.arrange()
Exemplo n.º 7
0
 def get_hardware(cls, hardware_id):
     db_session = load_session()
     hrdw = db_session.query(Hardware).filter(Hardware.hardware_id == hardware_id).scalar()
     db_session.close()
     return hrdw