|
|
|
@ -140,9 +140,9 @@ async def get_corrective_cost_time_chart(
|
|
|
|
days_difference = (end_date - start_date).days
|
|
|
|
days_difference = (end_date - start_date).days
|
|
|
|
|
|
|
|
|
|
|
|
today = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
|
|
|
|
today = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
|
|
|
|
|
|
|
|
tomorrow = today + datetime.timedelta(days=1)
|
|
|
|
url_prediction = f"http://192.168.1.82:8000/reliability/main/number-of-failures/{location_tag}/{start_date.strftime('%Y-%m-%d')}/{end_date.strftime('%Y-%m-%d')}"
|
|
|
|
url_prediction = f"http://192.168.1.82:8000/reliability/main/number-of-failures/{location_tag}/{tomorrow.strftime('%Y-%m-%d')}/{end_date.strftime('%Y-%m-%d')}"
|
|
|
|
url_history = f"http://192.168.1.82:8000/reliability/main/failures/{location_tag}/{start_date.strftime('%Y-%m-%d')}/{end_date.strftime('%Y-%m-%d')}"
|
|
|
|
url_history = f"http://192.168.1.82:8000/reliability/main/failures/{location_tag}/{start_date.strftime('%Y-%m-%d')}/{today.strftime('%Y-%m-%d')}"
|
|
|
|
|
|
|
|
|
|
|
|
# Initialize monthly data dictionary
|
|
|
|
# Initialize monthly data dictionary
|
|
|
|
monthly_data = {}
|
|
|
|
monthly_data = {}
|
|
|
|
@ -366,10 +366,7 @@ async def create_param_and_data(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def get_calculation_result(db_session: DbSession, calculation_id: str):
|
|
|
|
async def get_calculation_result(db_session: DbSession, calculation_id: str):
|
|
|
|
start_date = datetime.datetime(2025, 1, 1)
|
|
|
|
|
|
|
|
end_date = datetime.datetime(2026, 12, 31)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
months_num = get_months_between(start_date, end_date)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope_calculation = await get_calculation_data_by_id(
|
|
|
|
scope_calculation = await get_calculation_data_by_id(
|
|
|
|
db_session=db_session, calculation_id=calculation_id
|
|
|
|
db_session=db_session, calculation_id=calculation_id
|
|
|
|
@ -388,6 +385,10 @@ async def get_calculation_result(db_session: DbSession, calculation_id: str):
|
|
|
|
status_code=status.HTTP_404_NOT_FOUND,
|
|
|
|
status_code=status.HTTP_404_NOT_FOUND,
|
|
|
|
detail="A data with this id does not exist.",
|
|
|
|
detail="A data with this id does not exist.",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
start_date = datetime.datetime.combine(scope_overhaul.start_date, datetime.time.min)
|
|
|
|
|
|
|
|
end_date = datetime.datetime.combine(scope_overhaul.end_date, datetime.time.min)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
months_num = get_months_between(start_date, end_date)
|
|
|
|
|
|
|
|
|
|
|
|
calculation_results = []
|
|
|
|
calculation_results = []
|
|
|
|
for i in range(months_num):
|
|
|
|
for i in range(months_num):
|
|
|
|
@ -511,10 +512,13 @@ async def get_calculation_by_assetnum(
|
|
|
|
async def create_calculation_result_service(
|
|
|
|
async def create_calculation_result_service(
|
|
|
|
db_session: DbSession, calculation: CalculationData, token: str
|
|
|
|
db_session: DbSession, calculation: CalculationData, token: str
|
|
|
|
) -> CalculationTimeConstrainsRead:
|
|
|
|
) -> CalculationTimeConstrainsRead:
|
|
|
|
start_date = datetime.datetime(2023, 1, 23)
|
|
|
|
|
|
|
|
end_date = datetime.datetime(2025, 12, 31)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope = await get_scope(db_session=db_session, overhaul_session_id=calculation.overhaul_session_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start_date = datetime.datetime.combine(scope.start_date, datetime.time.min)
|
|
|
|
|
|
|
|
end_date = datetime.datetime.combine(scope.end_date, datetime.time.min)
|
|
|
|
|
|
|
|
|
|
|
|
months_num = get_months_between(start_date, end_date)
|
|
|
|
months_num = get_months_between(start_date, end_date)
|
|
|
|
|
|
|
|
|
|
|
|
# Get all equipment for this calculation session
|
|
|
|
# Get all equipment for this calculation session
|
|
|
|
|