Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling-v3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张晓彤
integrated-scheduling-v3
Commits
0619e46c
Commit
0619e46c
authored
Sep 09, 2022
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次调度修复及加入请求机制
parent
c5099188
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
268 additions
and
159 deletions
+268
-159
CHANGELOG.txt
CHANGELOG.txt
+11
-0
dispatcher.py
core/dispatcher.py
+108
-35
group.py
core/group.py
+51
-31
ruler.py
core/ruler.py
+0
-8
util.py
core/util.py
+36
-73
dispatchInfo.py
data/dispatchInfo.py
+4
-4
excavator.py
equipment/excavator.py
+1
-1
truck.py
equipment/truck.py
+42
-0
topo_graph.py
graph/topo_graph.py
+12
-4
topo_update_server.py
topo_update_server.py
+3
-3
调度系统部署说明4.1.docx
调度系统部署说明4.1.docx
+0
-0
No files found.
CHANGELOG.txt
View file @
0619e46c
...
...
@@ -51,3 +51,13 @@ Changelog for package Dispatch
[TODO ]:
[info ]: author: zxt ; time: 2022-04-07 17:33:00 ; email: ; tel: ;
--------------------
--------------------
[version]: 3.4.0
[message]: 新增拓扑路网功能,新增部分依赖库,启动方式发生改变,部署前注意查阅部署文档;
[feather]:
[fix ]:
[TODO ]:
[info ]: author: zxt ; time: 2022-09-09 14:00:00 ; email: ; tel: ;
--------------------
\ No newline at end of file
core/dispatcher.py
View file @
0619e46c
This diff is collapsed.
Click to expand it.
core/group.py
View file @
0619e46c
This diff is collapsed.
Click to expand it.
core/ruler.py
deleted
100644 → 0
View file @
c5099188
#!E:\Pycharm Projects\Waytous
# -*- coding: utf-8 -*-
# @Time : 2022/8/18 13:53
# @Author : Opfer
# @Site :
# @File : ruler.py
# @Software: PyCharm
\ No newline at end of file
core/util.py
View file @
0619e46c
...
...
@@ -8,83 +8,46 @@
import
requests
from
tables
import
*
import
uuid
def
redispatch_request
(
truck_id
,
excavator_id
,
unload_area_id
):
"""
redispatch request.
:param truck_id:
:param excavator_id:
:param unload_area_id:
:return:
"""
exactor_no
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
excavator_id
)
.
first
()
.
device_name
unload_area_name
=
session_postgre
.
query
(
DumpArea
)
.
filter_by
(
Id
=
unload_area_id
)
.
first
()
.
Name
truck_name
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
truck_id
)
.
first
()
.
device_name
real_data
=
{
"exactorId"
:
excavator_id
,
"exactorNo"
:
exactor_no
,
"id"
:
str
(
uuid
.
uuid4
()),
"unloadAreaId"
:
unload_area_id
,
"unloadAreaName"
:
unload_area_name
,
"truckId"
:
truck_id
,
"truckNo"
:
truck_name
,
"isauto"
:
"true"
,
"tempChange"
:
1
,
"immediateEffect"
:
1
}
with
open
(
json_file
)
as
f
:
mysql_config
=
json
.
load
(
f
)[
"mysql"
]
# def redispatch_request(truck_id, excavator_id, unload_area_id):
# """
# redispatch request.
# :param truck_id:
# :param excavator_id:
# :param unload_area_id:
# :return:
# """
#
# exactor_no = session_mysql.query(Equipment).filter_by(id=excavator_id).first().device_name
# unload_area_name = session_postgre.query(DumpArea).filter_by(Id=unload_area_id).first().Name
# truck_name = session_mysql.query(Equipment).filter_by(id=truck_id).first().device_name
#
# real_data = {
# "exactorId": excavator_id,
# "exactorNo": exactor_no,
# "id": str(uuid.uuid4()),
# "unloadAreaId": unload_area_id,
# "unloadAreaName": unload_area_name,
# "truckId": truck_id,
# "truckNo": truck_name,
# "isauto": "true",
# "tempChange": 1,
# "immediateEffect": 1
# }
#
# return POST(real_data)
return
POST
(
real_data
)
def
POST
(
real_data
):
def
POST
(
truck_id
):
"""
Post.
:param real_data:
:return:
"""
# real_data = {
# "exactorId": "ddaa65cc-2658-4e35-b6ec-9deb046e0bfb",
# "exactorNo": "WJ001",
# "id": "d83f09cb-8df3-44d5-8e46-10dbaa317e19",
# "unloadAreaId": "10c75b23-4134-3ef1-9097-114bacac1982",
# "unloadAreaName": "卸载区4",
# "truckId": "de4080b3-fb89-460d-b511-c2ecd73c815c",
# "truckNo": "de4080b3-fb89-460d-b511-c2ecd73c815c",
# "isauto": "false",
# "tempChange": 1,
# "immediateEffect": 1
# }
#
# real_data = {
# 'exactorId': 'a3d09975-82d7-4a30-8c54-fe4ed8ff5a29',
# 'exactorNo': 'BI395-02',
# 'id': '76cb19a8-6541-4245-8ef6-40682aca9635',
# 'unloadAreaId': 'd4675d61-2134-8be7-fb36-fb9ef3c97f7c',
# 'unloadAreaName': '哈卸4',
# 'truckId': '7c196882-8850-4344-aff8-846a597f7792',
# 'truckNo': '7c196882-8850-4344-aff8-846a597f7792',
# 'isauto': 'true',
# 'tempChange': 1,
# 'immediateEffect': 1
# }
#
# head = {"Content-Type":"application/json; charset=UTF-8", 'Connection': 'close'}
url_d
=
"http://172.16.0.103:8020/ht/api/dispatch/update"
real_data
=
json
.
dumps
(
real_data
)
print
(
real_data
)
res_d
=
requests
.
post
(
url
=
url_d
,
data
=
real_data
)
url_d
=
"http://"
+
mysql_config
[
"host"
]
+
":8020/ht/api/dispatch/updateTemp?truckId="
+
truck_id
res_d
=
requests
.
get
(
url_d
)
print
(
res_d
.
text
)
return
res_d
.
text
\ No newline at end of file
#
# truck_id, excavator_id, unload_area_id = "9ce82957-b1e1-4dee-8dd1-3bbfa2a496b5", \
# "a3d09975-82d7-4a30-8c54-fe4ed8ff5a29", \
# "d4675d61-2134-8be7-fb36-fb9ef3c97f7c"
#
# res = redispatch_request(truck_id, excavator_id, unload_area_id)
#
# print(res)
\ No newline at end of file
data/dispatchInfo.py
View file @
0619e46c
...
...
@@ -401,9 +401,9 @@ class DispatchInfo:
cls
.
load_distance
[
item
]
=
unload_load_distance
except
Exception
as
es
:
logger
.
error
(
f
'{item} 分组装载路网异常'
)
logger
.
warning
(
f
'{item} 分组装载路网异常'
)
cls
.
load_distance
[
item
]
=
np
.
full
((
len
(
unload_areas
),
len
(
load_areas
)),
10000
)
logger
.
error
(
es
)
logger
.
warning
(
es
)
session_postgre
.
rollback
()
session_mysql
.
rollback
()
...
...
@@ -418,9 +418,9 @@ class DispatchInfo:
cls
.
unload_distance
[
item
]
=
load_unload_distance
except
Exception
as
es
:
logger
.
error
(
f
'{item} 分组卸载路网异常'
)
logger
.
warning
(
f
'{item} 分组卸载路网异常'
)
cls
.
unload_distance
[
item
]
=
np
.
full
((
len
(
load_areas
),
len
(
unload_areas
)),
10000
)
logger
.
error
(
es
)
logger
.
warning
(
es
)
session_postgre
.
rollback
()
session_mysql
.
rollback
()
...
...
equipment/excavator.py
View file @
0619e46c
...
...
@@ -82,7 +82,7 @@ class ExcavatorInfo(WalkManage):
self
.
logger
.
info
(
self
.
loading_time
)
self
.
logger
.
info
(
"excavator_uuid_to_index_dict"
)
self
.
logger
.
info
(
self
.
excavator_uuid_to_index_dict
)
self
.
loading_time
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
10
.00
self
.
loading_time
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
2
.00
# 更新挖机设备出入时间
def
update_excavator_entrance_exit_time
(
self
):
...
...
equipment/truck.py
View file @
0619e46c
...
...
@@ -86,6 +86,8 @@ class TruckInfo(WalkManage):
self
.
_excavator
=
excavator
# 车辆位置信息
self
.
truck_locate_dict
=
{}
# 车辆临时调度
self
.
truck_is_temp
=
{}
def
get_truck_current_trip
(
self
):
return
self
.
truck_current_trip
...
...
@@ -137,6 +139,7 @@ class TruckInfo(WalkManage):
# 更新矿卡当前任务
def
update_truck_current_task
(
self
):
self
.
truck_current_task
=
{}
self
.
truck_current_state
=
{}
device_name_set
=
redis2
.
keys
()
truck_name_to_uuid_dict
=
get_value
(
"truck_name_to_uuid_dict"
)
...
...
@@ -186,6 +189,43 @@ class TruckInfo(WalkManage):
# logger.info("矿卡当前任务:")
# logger.info(self.truck_current_task)
def
update_truck_is_temp
(
self
):
"""
:return:
"""
self
.
truck_is_temp
=
{}
device_name_set
=
redis2
.
keys
()
truck_name_to_uuid_dict
=
get_value
(
"truck_name_to_uuid_dict"
)
for
item
in
device_name_set
:
try
:
item
=
item
.
decode
(
encoding
=
"utf-8"
)
if
item
not
in
truck_name_to_uuid_dict
:
continue
key_value_dict
=
byte_to_str
(
redis5
.
get
(
truck_name_to_uuid_dict
[
item
]))
# reids str可以自动转为bytes
print
(
key_value_dict
)
key_value_dict
=
json
.
loads
(
key_value_dict
)
if
truck_name_to_uuid_dict
[
item
]
in
self
.
dynamic_truck_set
:
try
:
isTemp
=
key_value_dict
[
"isTemp"
]
print
(
isTemp
)
self
.
truck_is_temp
[
truck_name_to_uuid_dict
[
item
]]
=
bool
(
isTemp
)
except
Exception
as
es
:
self
.
logger
.
error
(
es
)
self
.
truck_is_temp
[
truck_name_to_uuid_dict
[
item
]]
=
True
print
(
f
'here3 {item} {bool(isTemp)}'
)
except
Exception
as
es
:
self
.
logger
.
warning
(
"读取矿卡任务异常-reids读取异常"
)
self
.
logger
.
warning
(
es
)
self
.
logger
.
info
(
"isTemp"
)
self
.
logger
.
info
(
self
.
truck_is_temp
)
# 更新矿卡最后装载/卸载时间
def
update_truck_last_leave_time
(
self
):
self
.
last_load_time
=
{}
...
...
@@ -885,6 +925,8 @@ class TruckInfo(WalkManage):
# 更新卡车当前任务
self
.
update_truck_current_task
()
self
.
update_truck_is_temp
()
# 更新卡车最后一次装载/卸载时间
self
.
update_truck_last_leave_time
()
...
...
graph/topo_graph.py
View file @
0619e46c
...
...
@@ -326,14 +326,18 @@ class Topo():
unload_G target
"""
def
get_unload_target_node_real
(
self
,
truck_location_lane
,
pre_target
):
def
get_unload_target_node_real
(
self
,
truck_location_lane
,
pre_target
,
allow
):
source_node
=
self
.
get_unload_edge_node
(
truck_location_lane
)
target_list
=
[]
for
(
u
,
wt
)
in
self
.
unload_G
.
nodes
.
data
(
'name'
):
# select next reachable target
if
wt
==
'dump'
and
u
!=
pre_target
:
if
wt
==
'dump'
:
if
allow
:
target_list
.
append
(
u
)
else
:
if
u
!=
pre_target
:
target_list
.
append
(
u
)
if
not
len
(
target_list
):
...
...
@@ -420,7 +424,7 @@ class Topo():
load_G target
"""
def
get_load_target_node_real
(
self
,
truck_location_lane
,
pre_target
):
def
get_load_target_node_real
(
self
,
truck_location_lane
,
pre_target
,
allow
):
# source_node = self.get_load_edge_node(truck_location_lane)
source_node
,
end_node
=
self
.
get_load_edge_node
(
truck_location_lane
)
...
...
@@ -432,7 +436,11 @@ class Topo():
target_list
=
[]
for
(
node
,
att
)
in
self
.
load_G
.
nodes
.
data
(
'name'
):
# select next reachable target
if
att
==
'digging'
and
node
!=
pre_destination_node
:
if
att
==
'digging'
:
if
allow
:
target_list
.
append
(
node
)
else
:
if
node
!=
pre_destination_node
:
target_list
.
append
(
node
)
if
not
len
(
target_list
):
...
...
topo_update_server.py
View file @
0619e46c
...
...
@@ -9,6 +9,6 @@
from
graph.topo_update
import
topo_graph_update
from
graph.graph_load
import
graph_construct
#
topo_graph_update()
topo_graph_update
()
graph_construct
()
\ No newline at end of file
# graph_construct()
\ No newline at end of file
调度系统部署说明4.1.docx
View file @
0619e46c
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment