refactor: equipment by id response
parent
30e7679a18
commit
cd3304438c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,17 +1,74 @@
|
|||||||
|
from sqlalchemy import Column, Float, Integer, String, ForeignKey
|
||||||
from sqlalchemy import Column, Float, Integer, String
|
from sqlalchemy.orm import relationship
|
||||||
from src.database.core import Base
|
from src.database.core import Base
|
||||||
from src.models import DefaultMixin, IdentityMixin
|
from src.models import DefaultMixin, IdentityMixin
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Equipment(Base, DefaultMixin, IdentityMixin):
|
class Equipment(Base, DefaultMixin, IdentityMixin):
|
||||||
__tablename__ = "lcc_ms_equipment_data"
|
__tablename__ = "lcc_ms_equipment_data"
|
||||||
|
|
||||||
equipment_id = Column(String, nullable=False)
|
assetnum = Column(String, nullable=False)
|
||||||
acquisition_year = Column(Integer, nullable=False)
|
acquisition_year = Column(Integer, nullable=False)
|
||||||
acquisition_cost = Column(Float, nullable=False)
|
acquisition_cost = Column(Float, nullable=False)
|
||||||
capital_cost_record_time = Column(Integer, nullable=False)
|
capital_cost_record_time = Column(Integer, nullable=False)
|
||||||
design_life = Column(Integer, nullable=False)
|
design_life = Column(Integer, nullable=False)
|
||||||
forecasting_target_year = Column(Integer, nullable=False)
|
forecasting_target_year = Column(Integer, nullable=False)
|
||||||
manhours_rate = Column(Float, nullable=False)
|
manhours_rate = Column(Float, nullable=False)
|
||||||
|
|
||||||
|
|
||||||
|
class MasterRecords(Base, DefaultMixin, IdentityMixin):
|
||||||
|
__tablename__ = "lcc_tr_data"
|
||||||
|
|
||||||
|
equipment = relationship(
|
||||||
|
"Equipment",
|
||||||
|
backref="maintenance_records",
|
||||||
|
lazy="raise",
|
||||||
|
primaryjoin="and_(MasterRecords.assetnum == foreign(Equipment.assetnum))",
|
||||||
|
viewonly=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# master_equipment = relationship(
|
||||||
|
# "MasterEquipment",
|
||||||
|
# lazy="raise",
|
||||||
|
# primaryjoin="and_(ScopeEquipment.assetnum == foreign(MasterEquipment.assetnum))",
|
||||||
|
# uselist=False # Add this if it's a one-to-one relationship
|
||||||
|
# )
|
||||||
|
|
||||||
|
assetnum = Column(String, nullable=False)
|
||||||
|
tahun = Column(String, nullable=False)
|
||||||
|
seq = Column(String, nullable=False)
|
||||||
|
is_actual = Column(String, nullable=False)
|
||||||
|
raw_cm_interval = Column(String, nullable=False)
|
||||||
|
raw_cm_material_cost = Column(String, nullable=False)
|
||||||
|
raw_cm_labor_time = Column(String, nullable=False)
|
||||||
|
raw_cm_labor_human = Column(String, nullable=False)
|
||||||
|
raw_pm_interval = Column(String, nullable=False)
|
||||||
|
raw_pm_material_cost = Column(String, nullable=False)
|
||||||
|
raw_pm_labor_time = Column(String, nullable=False)
|
||||||
|
raw_pm_labor_human = Column(String, nullable=False)
|
||||||
|
raw_predictive_labor_time = Column(String, nullable=False)
|
||||||
|
raw_predictive_labor_human = Column(String, nullable=False)
|
||||||
|
raw_oh_material_cost = Column(String, nullable=False)
|
||||||
|
raw_oh_labor_time = Column(String, nullable=False)
|
||||||
|
raw_oh_labor_human = Column(String, nullable=False)
|
||||||
|
raw_project_task_material_cost = Column(String, nullable=False)
|
||||||
|
raw_loss_output_MW = Column(String, nullable=False)
|
||||||
|
raw_loss_output_price = Column(String, nullable=False)
|
||||||
|
raw_operational_cost = Column(String, nullable=False)
|
||||||
|
raw_maintenance_cost = Column(String, nullable=False)
|
||||||
|
rc_cm_material_cost = Column(String, nullable=False)
|
||||||
|
rc_cm_labor_cost = Column(String, nullable=False)
|
||||||
|
rc_pm_material_cost = Column(String, nullable=False)
|
||||||
|
rc_pm_labor_cost = Column(String, nullable=False)
|
||||||
|
rc_predictive_labor_cost = Column(String, nullable=False)
|
||||||
|
rc_oh_material_cost = Column(String, nullable=False)
|
||||||
|
rc_oh_labor_cost = Column(String, nullable=False)
|
||||||
|
rc_project_material_cost = Column(String, nullable=False)
|
||||||
|
rc_lost_cost = Column(String, nullable=False)
|
||||||
|
rc_operation_cost = Column(String, nullable=False)
|
||||||
|
rc_maintenance_cost = Column(String, nullable=False)
|
||||||
|
rc_total_cost = Column(String, nullable=False)
|
||||||
|
eac_npv = Column(String, nullable=False)
|
||||||
|
eac_annual_mnt_cost = Column(String, nullable=False)
|
||||||
|
eac_annual_acq_cost = Column(String, nullable=False)
|
||||||
|
eac_eac = Column(String, nullable=False)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue