Commit 4c3f4ccc authored by 虢奥's avatar 虢奥

bug修复

parent 4f28691d
...@@ -10,6 +10,7 @@ from data.para_config import * ...@@ -10,6 +10,7 @@ from data.para_config import *
from data.dispatchInfo import DispatchInfo from data.dispatchInfo import DispatchInfo
import uuid import uuid
import json import json
import random
def area_choose(excavators_id, closer_area_id, further_area_id, further_lane_set, closer_lane_set, def area_choose(excavators_id, closer_area_id, further_area_id, further_lane_set, closer_lane_set,
...@@ -112,9 +113,10 @@ def area_choose(excavators_id, closer_area_id, further_area_id, further_lane_set ...@@ -112,9 +113,10 @@ def area_choose(excavators_id, closer_area_id, further_area_id, further_lane_set
# logger.info("近端挖机排队时间短, 调度车辆前往") # logger.info("近端挖机排队时间短, 调度车辆前往")
# target_excavator = DispatchInfo.load_excavator_dict[closer_area_id] # target_excavator = DispatchInfo.load_excavator_dict[closer_area_id]
# # truck_dispatch_to_redis(request_truck_id, group_id, DispatchInfo.load_excavator_dict[closer_area_id]) # # truck_dispatch_to_redis(request_truck_id, group_id, DispatchInfo.load_excavator_dict[closer_area_id])
try:
load_value = json.load(f) load_value = json.load(f)
gothrough_config_area = load_value["gothrough"] gothrough_config_area = load_value["gothrough"]
dispatch_factor = gothrough_config_area["closer_area_name"] dispatch_factor = float(gothrough_config_area["factor"])
# 远端挖机空闲 # 远端挖机空闲
if further_excavator_state == 0 and goto_further_area_num == 0: if further_excavator_state == 0 and goto_further_area_num == 0:
logger.info("远端挖机空闲, 调度车辆前往远端装载区") logger.info("远端挖机空闲, 调度车辆前往远端装载区")
...@@ -133,7 +135,14 @@ def area_choose(excavators_id, closer_area_id, further_area_id, further_lane_set ...@@ -133,7 +135,14 @@ def area_choose(excavators_id, closer_area_id, further_area_id, further_lane_set
logger.info("近端挖机满载, 调度车辆前往远端装载区") logger.info("近端挖机满载, 调度车辆前往远端装载区")
target_excavator = DispatchInfo.load_excavator_dict[further_area_id] target_excavator = DispatchInfo.load_excavator_dict[further_area_id]
# truck_dispatch_to_redis(request_truck_id, group_id, DispatchInfo.load_excavator_dict[further_area_id]) # truck_dispatch_to_redis(request_truck_id, group_id, DispatchInfo.load_excavator_dict[further_area_id])
except Exception as es:
logger.error("找寻最空闲挖机异常")
logger.error(es)
logger.error("随机分配挖机")
if random.random() < 0.5:
target_excavator = DispatchInfo.load_excavator_dict[further_area_id]
else:
target_excavator = DispatchInfo.load_excavator_dict[closer_area_id]
return target_excavator return target_excavator
......
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