Commit 5858ccf0 authored by Allvey's avatar Allvey

处理装卸载时间格式问题

parent eae7235d
......@@ -262,6 +262,7 @@ class TruckInfo(WalkManage):
try:
truck_uuid_to_name_dict = get_value("truck_uuid_to_name_dict")
for item in self.dynamic_truck_set:
try:
truck_name = truck_uuid_to_name_dict[item]
key_value_dict = redis2.hgetall(truck_uuid_to_name_dict[item])
device_type = int(key_value_dict[str_to_byte("type")])
......@@ -317,6 +318,19 @@ class TruckInfo(WalkManage):
# self.logger.info(f'{truck_name} 相对last_unload_time')
# self.logger.info(self.relative_last_unload_time[item])
except Exception as es:
self.logger.error(es)
self.logger.error(f'{item}读取上次装卸载时间异常')
self.last_unload_time[item] = datetime.now()
self.last_load_time[item] = datetime.now()
self.relative_last_unload_time[item] = max(float(
(self.last_unload_time[item] - self.start_time)
/ timedelta(hours=0, minutes=1, seconds=0)
), 0.0)
self.relative_last_load_time[item] = max(float(
(self.last_load_time[item] - self.start_time)
/ timedelta(hours=0, minutes=1, seconds=0)
), 0.0)
self.logger.info(f'上次装载时间信息')
self.logger.info(self.relative_last_unload_time)
......@@ -363,9 +377,6 @@ class TruckInfo(WalkManage):
unload_area_uuid_to_index_dict = get_value("unload_area_uuid_to_index_dict")
# 若矿卡状态为空运
if task in [0, 1, 2]: # 矿卡空载或仍未出装载区
last_unload_time = self.relative_last_unload_time[
truck_id
]
if item.dump_id in DeviceMap.dump_uuid_to_unload_area_uuid_dict:
start_area_id = self.dump_uuid_to_unload_area_uuid_dict[item.dump_id]
......@@ -385,11 +396,18 @@ class TruckInfo(WalkManage):
self.truck_current_trip[i] = [start_eq_index, end_eq_index]
try:
last_unload_time = self.relative_last_unload_time[
truck_id
]
self.cur_truck_reach_excavator[i] = (
last_unload_time
+ walk_time_to_load_area[start_area_index][end_area_index]
)
except Exception as es:
self.logger.info(es)
self.logger.error("更新空载抵达时间异常")
# self.logger.info(f'{truck_name}-last_unload_time')
# self.logger.info(last_unload_time)
# self.logger.info(f'{truck_name}-walk_time_to_load_area')
......@@ -403,9 +421,6 @@ class TruckInfo(WalkManage):
elif task in [3, 4, 5]: # 矿卡重载或仍未出卸载区
# print("读取重载行程")
# print(item.exactor_id, item.dump_id)
last_load_time = self.relative_last_load_time[
self.truck_index_to_uuid_dict[i]
]
if item.exactor_id in DeviceMap.excavator_uuid_to_load_area_uuid_dict:
start_area_id = self.excavator_uuid_to_load_area_uuid_dict[item.exactor_id]
......@@ -423,15 +438,22 @@ class TruckInfo(WalkManage):
end_area_index = -1
end_eq_index = -1
self.truck_current_trip[i] = [start_eq_index, end_eq_index]
# # 结束设备index
# end_eqp_index = self.dump_uuid_to_index_dict[item.dump_id]
self.truck_current_trip[i] = [start_eq_index, end_eq_index]
try:
last_load_time = self.relative_last_load_time[
self.truck_index_to_uuid_dict[i]
]
self.cur_truck_reach_dump[i] = (
last_load_time
+ walk_time_to_unload_area[end_area_index][start_area_index]
)
except Exception as es:
self.logger.error(es)
self.logger.error("读取重载抵达时间异常")
# self.logger.info(f'{truck_name}-last_load_time')
# self.logger.info(last_load_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