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
c5099188
Commit
c5099188
authored
Sep 08, 2022
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次调度调试
parent
4ef1d396
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
20 deletions
+118
-20
algorithm.py
alg/algorithm.py
+18
-18
dispatcher.py
core/dispatcher.py
+9
-2
group.py
core/group.py
+0
-0
util.py
core/util.py
+91
-0
调度系统部署说明4.1.docx
调度系统部署说明4.1.docx
+0
-0
No files found.
alg/algorithm.py
View file @
c5099188
...
...
@@ -147,33 +147,33 @@ class ExpectedTime(AlgorithmBase):
:return: travel_time_value
"""
#
try:
try
:
# truck_index = self.truck.truck_uuid_to_index_dict[truck_id]
# truck_index = self.truck.truck_uuid_to_index_dict[truck_id]
# trip = self.truck.get_truck_current_trip()[truck_index]
#
# task = self.truck.get_truck_current_task()[truck_id]
# trip = self.truck.get_truck_current_trip()[truck_index]
#
# task = self.truck.get_truck_current_task()[truck_id]
truck_id
=
truck_info
.
get_truck_id
()
truck_id
=
truck_info
.
get_truck_id
()
truck_index
=
self
.
truck
.
truck_uuid_to_index_dict
[
truck_id
]
# task = truck_task
# trip = truck_trip
truck_index
=
self
.
truck
.
truck_uuid_to_index_dict
[
truck_id
]
# task = truck_task
# trip = truck_trip
trip
=
truck_info
.
get_trip
()
trip
=
truck_info
.
get_trip
()
task
=
truck_info
.
get_task
()
task
=
truck_info
.
get_task
()
truck_avl_time
=
self
.
pre_sch
.
get_truck_avl_time
(
truck_id
=
truck_id
)
truck_avl_time
=
self
.
pre_sch
.
get_truck_avl_time
(
truck_id
=
truck_id
)
group_dynamic_excavator_num
=
len
(
self
.
group
.
excavator
)
group_dynamic_excavator_num
=
len
(
self
.
group
.
excavator
)
group_dynamic_unload_area_num
=
len
(
self
.
group
.
unload_area
)
#
#
except Exception as es:
#
self.logger.error("车辆调度信息读取异常")
#
self.logger.error(es)
group_dynamic_unload_area_num
=
len
(
self
.
group
.
unload_area
)
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆调度信息读取异常"
)
self
.
logger
.
error
(
es
)
if
task
==
-
2
:
################################################ 矿卡启动 ###############################################
...
...
core/dispatcher.py
View file @
c5099188
...
...
@@ -137,6 +137,7 @@ class DispatchSubmission:
if
group_mode
==
3
:
try
:
self
.
logger
.
info
(
f
'调度0 {truck_id}'
)
item
=
session_mysql
.
query
(
DispatchSetting
)
.
filter_by
(
truck_id
=
truck_id
,
isdeleted
=
0
,
)
.
first
()
record
[
"dispatchId"
]
=
item
.
id
record
[
"exactorId"
]
=
item
.
exactor_id
...
...
@@ -159,8 +160,9 @@ class DispatchSubmission:
redis5
.
set
(
truck_id
,
str
(
json
.
dumps
(
record
)))
else
:
if
task
in
[
1
,
2
]
or
(
task
==
3
and
state
==
2
):
# 卡车空载或在装载区出场前, 可变更卸载目的地
if
(
task
in
[
1
,
2
])
or
(
task
==
3
and
state
==
2
):
# 卡车空载或在装载区出场前, 可变更卸载目的地
self
.
logger
.
info
(
f
'调度1 {truck_id}'
)
# 查询车辆相关派车计划
try
:
dump_id
=
DispatchInfo
.
unload_area_dump_dict
[
dispatch_seq
[
1
]]
...
...
@@ -191,14 +193,16 @@ class DispatchSubmission:
record
[
"groupName"
]
=
DispatchInfo
.
group_name
[
group_id
]
self
.
logger
.
info
(
f
'redis 注入 {record}'
)
redis5
.
set
(
truck_id
,
str
(
json
.
dumps
(
record
)))
except
Exception
as
es
:
self
.
logger
.
error
(
"调度结果写入异常-矿卡空载"
)
self
.
logger
.
error
(
es
)
finally
:
redis5
.
set
(
truck_id
,
str
(
json
.
dumps
(
record
)))
elif
task
in
[
4
,
5
]
or
(
task
==
0
and
state
==
2
):
# 卡车重载或在卸载区出场前, 可变更装载目的地
elif
(
task
in
[
4
,
5
])
or
(
task
==
0
and
state
==
2
):
# 卡车重载或在卸载区出场前, 可变更装载目的地
self
.
logger
.
info
(
f
'调度2 {truck_id}'
)
# 查询车辆相关派车计划
try
:
item
=
(
session_mysql
.
query
(
DispatchSetting
)
.
filter_by
(
exactor_id
=
dispatch_seq
[
0
],
group_id
=
group_id
,
...
...
@@ -226,12 +230,14 @@ class DispatchSubmission:
record
[
"groupName"
]
=
DispatchInfo
.
group_name
[
group_id
]
self
.
logger
.
info
(
f
'redis 注入 {record}'
)
redis5
.
set
(
truck_id
,
str
(
json
.
dumps
(
record
)))
except
Exception
as
es
:
self
.
logger
.
error
(
"调度结果写入异常-矿卡重载"
)
finally
:
redis5
.
set
(
truck_id
,
str
(
json
.
dumps
(
record
)))
elif
task
==
-
2
:
self
.
logger
.
info
(
f
'调度3 {truck_id}'
)
try
:
# 查询车辆相关派车计划
...
...
@@ -263,6 +269,7 @@ class DispatchSubmission:
record
[
"groupName"
]
=
DispatchInfo
.
group_name
[
group_id
]
self
.
logger
.
info
(
f
'redis 注入 {record}'
)
redis5
.
set
(
truck_id
,
str
(
json
.
dumps
(
record
)))
# record["createtime"] = datetime.now().strftime(
# "%b %d, %Y %I:%M:%S %p")
...
...
core/group.py
View file @
c5099188
This diff is collapsed.
Click to expand it.
core/util.py
0 → 100644
View file @
c5099188
#!E:\Pycharm Projects\Waytous
# -*- coding: utf-8 -*-
# @Time : 2022/9/8 9:42
# @Author : Opfer
# @Site :
# @File : util.py
# @Software: PyCharm
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
}
return
POST
(
real_data
)
def
POST
(
real_data
):
"""
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
)
return
res_d
.
text
#
# 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
调度系统部署说明4.1.docx
View file @
c5099188
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