Commit ff0044b7 authored by Allvey's avatar Allvey

处理车辆任务与派车计划不一致问题

parent 8ac576ea
{
"para": {
"log_path": "/usr/local/fleet-log/dispatch",
"empty_speed": 120,
"heavy_speed": 80,
"empty_speed": 25,
"heavy_speed": 20,
"dump_target_mass": 5000,
"excavator_target_mass": 5000
},
"mysql": {
"host": "172.16.0.103",
"host": "172.16.0.51",
"port": "3306",
"user": "root",
"password": "Huituo@123",
"database": "ht_zhunneng"
},
"postgresql": {
"host": "172.16.0.103",
"host": "172.16.0.51",
"port": "5432",
"user": "postgres",
"password": "Huituo@123",
"database": "gis_zhunneng"
},
"redis": {
"host": "172.16.0.103",
"host": "172.16.0.51",
"password": "Huituo@123"
}
}
\ No newline at end of file
......@@ -651,13 +651,6 @@ class GroupDispatcher:
try:
if truck_id in self.group.truck.truck_excavator_bind:
self.logger.info("车辆存在绑定关系")
# try:
# if truck_id not in self.group.truck.truck_excavator_bind:
# raise CoreException(102, f'truck.group_excavators bind 中不存在 {truck_id}')
# except CoreException as es:
# es.with_traceback_info()
# self.logger.error(es)
# return
next_excavator_id = self.group.truck.truck_excavator_bind[truck_id]
else:
self.logger.info("触发调度算法逻辑")
......@@ -673,21 +666,31 @@ class GroupDispatcher:
if truck_task == -2:
next_unload_area_id = "Park"
else:
if truck_trip[-1] != -1:
dump_id = get_value("dump_index_to_uuid_dict")[truck_trip[-1]]
next_unload_area_id = get_value("dump_uuid_to_unload_area_uuid_dict")[dump_id]
else:
# self.logger.error("车辆重载任务与派车计划不匹配")
raise Exception("车辆重载任务与派车计划不匹配")
# next_unload_area_id = "Park"
truck_dispatch[truck_id] = [next_excavator_id, next_unload_area_id]
self.logger.info(f'调度结果 next_excavator_id: '
f'{next_excavator_id} next_unload_area_id: {next_unload_area_id}')
except Exception as es:
self.logger.error("重载车辆全智能模式-计算异常")
self.logger.error("空载车辆全智能模式-计算异常")
self.logger.error(es.__traceback__.tb_lineno)
self.logger.error(es)
def empty_period_dispatch(self, s: AlgorithmBase, truck_dispatch: Mapping[str, List[str]], truck_id: str, truck_info: CurrentTruck,
truck_trip: List[int]):
try:
if truck_trip[-1] != -1:
next_excavator_id = get_value("excavator_index_to_uuid_dict")[truck_trip[-1]]
else:
raise Exception("车辆重载任务与派车计划不匹配")
next_unload_area_value = s.solve(truck_info)
if truck_id in self.group.truck.truck_dump_bind:
......@@ -715,7 +718,6 @@ class GroupDispatcher:
self.logger.error("空载车辆全智能模式-计算异常")
self.logger.error(es.__traceback__.tb_lineno)
self.logger.error(es)
truck_dispatch[truck_id] = [None, None]
def truck_construct(self, truck_id):
"""
......
......@@ -235,16 +235,16 @@ class DispatchSubmission:
self.logger.info("dispatch_plan_dict")
self.logger.info(dispatch_plan_dict)
for truck_id, dispatch_plan in dispatch_plan_dict.items():
for truck_id in group.group_trucks:
try:
if truck_id in group.truck_info_list:
if truck_id in dispatch_plan_dict and truck_id in group.truck_info_list:
self.logger.info(
f'======================================= 派车计划写入 =======================================')
self.truck_dispatch_to_redis(truck_id, group.truck_info_list[truck_id], dispatch_plan, group.group_mode)
self.truck_dispatch_to_redis(truck_id, group.truck_info_list[truck_id], dispatch_plan_dict[truck_id], group.group_mode)
self.logger.info(
"======================================== 计划完成写入 =======================================")
else:
raise Exception("车辆对象信息不存在 group.truck_info_list")
raise Exception(f'车辆 {truck_id} 未正常生成派车计划')
except Exception as es:
# self.logger.error("group_dispatch_to_redis_error")
self.logger.error(es)
......
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