Commit 8794c315 authored by 张晓彤's avatar 张晓彤

解决空/重载过程中长时间无法获取派车计划问题

parent edc1105f
...@@ -14,6 +14,7 @@ from equipment import TruckInfo, ExcavatorInfo, DumpInfo ...@@ -14,6 +14,7 @@ from equipment import TruckInfo, ExcavatorInfo, DumpInfo
from core.schedule import PreSchedule from core.schedule import PreSchedule
from graph.graph_load import graph_construct from graph.graph_load import graph_construct
from core.group import GroupDispatcher from core.group import GroupDispatcher
from graph.topo_graph import *
class Dispatcher: class Dispatcher:
...@@ -31,7 +32,8 @@ class Dispatcher: ...@@ -31,7 +32,8 @@ class Dispatcher:
self.logger = get_logger("zxt.dispatcher") self.logger = get_logger("zxt.dispatcher")
self.redispatch_active = active self.redispatch_active = active
if self.redispatch_active: if self.redispatch_active:
self.topo = graph_construct() self.topo = Topo()
self.topo.generate_topo_graph()
else: else:
self.topo = None self.topo = None
self.submission = DispatchSubmission(dump, excavator, truck, self.topo) self.submission = DispatchSubmission(dump, excavator, truck, self.topo)
......
This diff is collapsed.
...@@ -193,12 +193,14 @@ class DispatchInfo: ...@@ -193,12 +193,14 @@ class DispatchInfo:
try: try:
for item in session_mysql.query(DispatchSetting).filter_by(isdeleted=0).all(): for item in session_mysql.query(DispatchSetting).filter_by(isdeleted=0).all():
# add group_excavators # add group_excavators
if item.group_id not in cls.group_excavator_dict.keys(): excavator_state = session_mysql.query(Equipment).filter_by(id=item.exactor_id).first()
cls.group_excavator_dict[item.group_id] = [item.exactor_id] if excavator_state is not None and excavator_state.disabled == 1:
else: if item.group_id not in cls.group_excavator_dict.keys():
if item.exactor_id not in cls.group_excavator_dict[item.group_id]: cls.group_excavator_dict[item.group_id] = [item.exactor_id]
cls.group_excavator_dict[item.group_id].append(item.exactor_id) else:
cls.excavator_group_dict[item.exactor_id] = item.group_id if item.exactor_id not in cls.group_excavator_dict[item.group_id]:
cls.group_excavator_dict[item.group_id].append(item.exactor_id)
cls.excavator_group_dict[item.exactor_id] = item.group_id
# add group_unload_areas # add group_unload_areas
if item.group_id not in cls.group_unload_area_dict.keys(): if item.group_id not in cls.group_unload_area_dict.keys():
...@@ -208,21 +210,26 @@ class DispatchInfo: ...@@ -208,21 +210,26 @@ class DispatchInfo:
cls.group_unload_area_dict[item.group_id].append(item.unload_area_id) cls.group_unload_area_dict[item.group_id].append(item.unload_area_id)
cls.unload_area_group_dict[item.unload_area_id] = item.group_id cls.unload_area_group_dict[item.unload_area_id] = item.group_id
# add group_dumps # add dump
if item.group_id not in cls.group_dump_dict.keys(): dump_state = session_mysql.query(Equipment).filter_by(id=item.dump_id).first()
cls.group_dump_dict[item.group_id] = [item.dump_id] if dump_state is not None and dump_state.disabled == 1:
else: # add group_dumps
if item.dump_id not in cls.group_dump_dict[item.group_id]: if item.group_id not in cls.group_dump_dict.keys():
cls.group_dump_dict[item.group_id].append(item.dump_id) cls.group_dump_dict[item.group_id] = [item.dump_id]
cls.dump_group_dict[item.dump_id] = item.group_id else:
if item.dump_id not in cls.group_dump_dict[item.group_id]:
cls.group_dump_dict[item.group_id].append(item.dump_id)
cls.dump_group_dict[item.dump_id] = item.group_id
# add truck # add truck
if item.group_id not in cls.group_truck_dict.keys(): truck_state = session_mysql.query(Equipment).filter_by(id=item.truck_id).first()
cls.group_truck_dict[item.group_id] = [item.truck_id] if truck_state is not None and truck_state.disabled == 1:
else: if item.group_id not in cls.group_truck_dict.keys():
if item.truck_id not in cls.group_truck_dict[item.group_id]: cls.group_truck_dict[item.group_id] = [item.truck_id]
cls.group_truck_dict[item.group_id].append(item.truck_id) else:
cls.truck_group_dict[item.truck_id] = item.group_id if item.truck_id not in cls.group_truck_dict[item.group_id]:
cls.group_truck_dict[item.group_id].append(item.truck_id)
cls.truck_group_dict[item.truck_id] = item.group_id
print("存在的分组") print("存在的分组")
print(cls.group_excavator_dict.keys()) print(cls.group_excavator_dict.keys())
......
...@@ -166,4 +166,4 @@ if __name__ == "__main__": ...@@ -166,4 +166,4 @@ if __name__ == "__main__":
logger.info(" ") logger.info(" ")
logger.info("调度系统启动") logger.info("调度系统启动")
main(30, dispatcher) main(20, dispatcher)
#!/bin/bash #!/bin/bash
ps -ef|grep realtime_dispatch.py|grep -v grep |awk {'print $2'} ps -ef|grep realtime_dispatch.py|grep -v grep |awk {'print $2'} |xargs kill -9
kill -9 ps
python3 topo_update_server.py python3 topo_update_server.py
nohup python3 realtime_dispatch.py --active >/dev/null 2>&1 & nohup python3 realtime_dispatch.py --active >/dev/null 2>&1 &
nohup flask run --host=0.0.0.0 >/dev/null 2>&1 & nohup flask run --host=0.0.0.0 >/dev/null 2>&1 &
\ No newline at end of file
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