Commit ec053b0d authored by harshavardhan.c's avatar harshavardhan.c

sending the start_time range for calculating the downtime while calculating batch oee.

parent 21d7bc6c
...@@ -66,8 +66,19 @@ class CalculateBatchOEEHandler: ...@@ -66,8 +66,19 @@ class CalculateBatchOEEHandler:
CommonConstants.USER_META_TIME_FORMAT).astimezone( CommonConstants.USER_META_TIME_FORMAT).astimezone(
tz=pytz.timezone(request_data.tz)).isoformat() tz=pytz.timezone(request_data.tz)).isoformat()
request_data = OEEDataSaveRequest(**request_data.dict(exclude_none=True)) request_data = OEEDataSaveRequest(**request_data.dict(exclude_none=True))
request_data.downtime = self.common_util.get_downtime_details_by_hierarchy( start_timestamp = int(
hierarchy=request_data.hierarchy, project_id=request_data.project_id) self.common_util.pendulum_conversion(request_data.prod_start_time, timestamp=True,
tz=request_data.tz)) * 1000
curr_timestamp = int(
self.common_util.pendulum_conversion(request_data.prod_end_time, timestamp=True,
tz=request_data.tz)) * 1000
downtime = self.common_util.get_downtime_details_by_hierarchy(
hierarchy=request_data.hierarchy, project_id=request_data.project_id,
filters={"start_time": [start_timestamp, curr_timestamp]})
if downtime is None:
logger.debug("Downtime for selected hierarchy got None, Updating to zero")
downtime = 0
request_data.downtime = downtime
oee_calculation = oee_engine.start_batch_oee_calc(request_data=request_data) oee_calculation = oee_engine.start_batch_oee_calc(request_data=request_data)
self.save_oee_data(oee_calculation, db) self.save_oee_data(oee_calculation, db)
if not request_data.prod_end_time: if not request_data.prod_end_time:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment