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
404927e0
Commit
404927e0
authored
Aug 29, 2025
by
Allvey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复挖机故障/下线后继续派车问题
parent
336b0653
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
util.py
core/util.py
+9
-2
dispatchInfo.py
data/dispatchInfo.py
+22
-6
No files found.
core/util.py
View file @
404927e0
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
import
requests
import
requests
from
tables
import
*
from
tables
import
*
from
settings
import
get_logger
from
settings
import
get_logger
from
data.para_config
import
get_value
with
open
(
json_file
,
encoding
=
'UTF-8'
)
as
f
:
with
open
(
json_file
,
encoding
=
'UTF-8'
)
as
f
:
mysql_config
=
json
.
load
(
f
)[
"mysql"
]
mysql_config
=
json
.
load
(
f
)[
"mysql"
]
with
open
(
json_file
,
encoding
=
'UTF-8'
)
as
f
:
with
open
(
json_file
,
encoding
=
'UTF-8'
)
as
f
:
...
@@ -138,8 +139,14 @@ def delete_disabled_load_area(load_area_dict):
...
@@ -138,8 +139,14 @@ def delete_disabled_load_area(load_area_dict):
"""
"""
for
load_area
in
list
(
load_area_dict
.
keys
()):
for
load_area
in
list
(
load_area_dict
.
keys
()):
excavator_id
=
session_mysql
.
query
(
DispatchSetting
)
.
filter_by
(
load_area_id
=
load_area
)
.
first
()
.
exactor_id
excavator_id
=
session_mysql
.
query
(
DispatchSetting
)
.
filter_by
(
load_area_id
=
load_area
)
.
first
()
.
exactor_id
excavator_info
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
excavator_id
)
.
first
()
excavator_uuid_to_name_dict
=
get_value
(
"excavator_uuid_to_name_dict"
)
if
excavator_info
is
None
or
excavator_info
.
disabled
==
1
:
excavator_name
=
excavator_uuid_to_name_dict
[
excavator_id
]
key_value_dict
=
redis2
.
hgetall
(
excavator_name
)
is_excavator_online
=
key_value_dict
[
str_to_byte
(
'online'
)]
if
bytes
.
decode
(
is_excavator_online
)
not
in
[
"true"
or
"True"
]:
# continue
# excavator_info = session_mysql.query(Equipment).filter_by(id=excavator_id).first()
# if excavator_info is None or excavator_info.disabled == 1:
del
load_area_dict
[
load_area
]
del
load_area_dict
[
load_area
]
...
...
data/dispatchInfo.py
View file @
404927e0
...
@@ -195,6 +195,26 @@ class DispatchInfo:
...
@@ -195,6 +195,26 @@ class DispatchInfo:
# update excavator_id <-> group_id && unload_area_id <-> group_id && truck_id <-> group_id
# update excavator_id <-> group_id && unload_area_id <-> group_id && truck_id <-> group_id
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
():
excavator_uuid_to_name_dict
=
get_value
(
"excavator_uuid_to_name_dict"
)
excavator_name
=
excavator_uuid_to_name_dict
[
item
.
exactor_id
]
key_value_dict
=
redis2
.
hgetall
(
excavator_name
)
is_excavator_online
=
key_value_dict
[
str_to_byte
(
'online'
)]
excavator_state
=
key_value_dict
[
str_to_byte
(
'state'
)]
truck_uuid_to_name_dict
=
get_value
(
"truck_uuid_to_name_dict"
)
truck_name
=
truck_uuid_to_name_dict
[
item
.
truck_id
]
key_value_dict
=
redis2
.
hgetall
(
truck_name
)
is_truck_online
=
key_value_dict
[
str_to_byte
(
'online'
)]
truck_state
=
key_value_dict
[
str_to_byte
(
'state'
)]
if
str
(
bytes
.
decode
(
excavator_state
))
==
"7"
or
str
(
bytes
.
decode
(
truck_state
))
==
"7"
:
continue
if
bytes
.
decode
(
is_excavator_online
)
not
in
[
"true"
or
"True"
]
or
bytes
.
decode
(
is_truck_online
)
not
in
\
[
"true"
or
"True"
]:
continue
# add group_excavators
# add group_excavators
excavator_state
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
item
.
exactor_id
)
.
first
()
excavator_state
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
item
.
exactor_id
)
.
first
()
# if excavator_state is not None and excavator_state.disabled == 0:
# if excavator_state is not None and excavator_state.disabled == 0:
...
@@ -227,12 +247,6 @@ class DispatchInfo:
...
@@ -227,12 +247,6 @@ class DispatchInfo:
# add truck
# add truck
truck_state
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
item
.
truck_id
)
.
first
()
truck_state
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
item
.
truck_id
)
.
first
()
# if truck_state is not None and truck_state.disabled == 1:
# if truck_state is not None and truck_state.disabled == 1:
truck_uuid_to_name_dict
=
get_value
(
"truck_uuid_to_name_dict"
)
truck_name
=
truck_uuid_to_name_dict
[
item
.
truck_id
]
key_value_dict
=
redis2
.
hgetall
(
truck_name
)
is_online
=
key_value_dict
[
str_to_byte
(
'online'
)]
if
bytes
.
decode
(
is_online
)
not
in
[
"true"
or
"True"
]:
continue
if
item
.
group_id
not
in
cls
.
group_truck_dict
.
keys
():
if
item
.
group_id
not
in
cls
.
group_truck_dict
.
keys
():
cls
.
group_truck_dict
[
item
.
group_id
]
=
[
item
.
truck_id
]
cls
.
group_truck_dict
[
item
.
group_id
]
=
[
item
.
truck_id
]
else
:
else
:
...
@@ -242,6 +256,8 @@ class DispatchInfo:
...
@@ -242,6 +256,8 @@ class DispatchInfo:
logger
.
info
(
"存在的分组"
)
logger
.
info
(
"存在的分组"
)
logger
.
info
(
cls
.
group_excavator_dict
.
keys
())
logger
.
info
(
cls
.
group_excavator_dict
.
keys
())
logger
.
info
(
cls
.
group_dump_dict
.
keys
())
logger
.
info
(
cls
.
group_truck_dict
.
keys
())
except
Exception
as
es
:
except
Exception
as
es
:
logger
.
error
(
"挖机/卸载区/矿卡与group_id映射更新异常"
)
logger
.
error
(
"挖机/卸载区/矿卡与group_id映射更新异常"
)
logger
.
error
(
es
)
logger
.
error
(
es
)
...
...
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