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
5858ccf0
Commit
5858ccf0
authored
Sep 05, 2024
by
Allvey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理装卸载时间格式问题
parent
eae7235d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
truck.py
equipment/truck.py
+31
-9
No files found.
equipment/truck.py
View file @
5858ccf0
...
@@ -262,6 +262,7 @@ class TruckInfo(WalkManage):
...
@@ -262,6 +262,7 @@ class TruckInfo(WalkManage):
try
:
try
:
truck_uuid_to_name_dict
=
get_value
(
"truck_uuid_to_name_dict"
)
truck_uuid_to_name_dict
=
get_value
(
"truck_uuid_to_name_dict"
)
for
item
in
self
.
dynamic_truck_set
:
for
item
in
self
.
dynamic_truck_set
:
try
:
truck_name
=
truck_uuid_to_name_dict
[
item
]
truck_name
=
truck_uuid_to_name_dict
[
item
]
key_value_dict
=
redis2
.
hgetall
(
truck_uuid_to_name_dict
[
item
])
key_value_dict
=
redis2
.
hgetall
(
truck_uuid_to_name_dict
[
item
])
device_type
=
int
(
key_value_dict
[
str_to_byte
(
"type"
)])
device_type
=
int
(
key_value_dict
[
str_to_byte
(
"type"
)])
...
@@ -317,6 +318,19 @@ class TruckInfo(WalkManage):
...
@@ -317,6 +318,19 @@ class TruckInfo(WalkManage):
# self.logger.info(f'{truck_name} 相对last_unload_time')
# self.logger.info(f'{truck_name} 相对last_unload_time')
# self.logger.info(self.relative_last_unload_time[item])
# self.logger.info(self.relative_last_unload_time[item])
except
Exception
as
es
:
self
.
logger
.
error
(
es
)
self
.
logger
.
error
(
f
'{item}读取上次装卸载时间异常'
)
self
.
last_unload_time
[
item
]
=
datetime
.
now
()
self
.
last_load_time
[
item
]
=
datetime
.
now
()
self
.
relative_last_unload_time
[
item
]
=
max
(
float
(
(
self
.
last_unload_time
[
item
]
-
self
.
start_time
)
/
timedelta
(
hours
=
0
,
minutes
=
1
,
seconds
=
0
)
),
0.0
)
self
.
relative_last_load_time
[
item
]
=
max
(
float
(
(
self
.
last_load_time
[
item
]
-
self
.
start_time
)
/
timedelta
(
hours
=
0
,
minutes
=
1
,
seconds
=
0
)
),
0.0
)
self
.
logger
.
info
(
f
'上次装载时间信息'
)
self
.
logger
.
info
(
f
'上次装载时间信息'
)
self
.
logger
.
info
(
self
.
relative_last_unload_time
)
self
.
logger
.
info
(
self
.
relative_last_unload_time
)
...
@@ -363,9 +377,6 @@ class TruckInfo(WalkManage):
...
@@ -363,9 +377,6 @@ class TruckInfo(WalkManage):
unload_area_uuid_to_index_dict
=
get_value
(
"unload_area_uuid_to_index_dict"
)
unload_area_uuid_to_index_dict
=
get_value
(
"unload_area_uuid_to_index_dict"
)
# 若矿卡状态为空运
# 若矿卡状态为空运
if
task
in
[
0
,
1
,
2
]:
# 矿卡空载或仍未出装载区
if
task
in
[
0
,
1
,
2
]:
# 矿卡空载或仍未出装载区
last_unload_time
=
self
.
relative_last_unload_time
[
truck_id
]
if
item
.
dump_id
in
DeviceMap
.
dump_uuid_to_unload_area_uuid_dict
:
if
item
.
dump_id
in
DeviceMap
.
dump_uuid_to_unload_area_uuid_dict
:
start_area_id
=
self
.
dump_uuid_to_unload_area_uuid_dict
[
item
.
dump_id
]
start_area_id
=
self
.
dump_uuid_to_unload_area_uuid_dict
[
item
.
dump_id
]
...
@@ -385,11 +396,18 @@ class TruckInfo(WalkManage):
...
@@ -385,11 +396,18 @@ class TruckInfo(WalkManage):
self
.
truck_current_trip
[
i
]
=
[
start_eq_index
,
end_eq_index
]
self
.
truck_current_trip
[
i
]
=
[
start_eq_index
,
end_eq_index
]
try
:
last_unload_time
=
self
.
relative_last_unload_time
[
truck_id
]
self
.
cur_truck_reach_excavator
[
i
]
=
(
self
.
cur_truck_reach_excavator
[
i
]
=
(
last_unload_time
last_unload_time
+
walk_time_to_load_area
[
start_area_index
][
end_area_index
]
+
walk_time_to_load_area
[
start_area_index
][
end_area_index
]
)
)
except
Exception
as
es
:
self
.
logger
.
info
(
es
)
self
.
logger
.
error
(
"更新空载抵达时间异常"
)
# self.logger.info(f'{truck_name}-last_unload_time')
# self.logger.info(f'{truck_name}-last_unload_time')
# self.logger.info(last_unload_time)
# self.logger.info(last_unload_time)
# self.logger.info(f'{truck_name}-walk_time_to_load_area')
# self.logger.info(f'{truck_name}-walk_time_to_load_area')
...
@@ -403,9 +421,6 @@ class TruckInfo(WalkManage):
...
@@ -403,9 +421,6 @@ class TruckInfo(WalkManage):
elif
task
in
[
3
,
4
,
5
]:
# 矿卡重载或仍未出卸载区
elif
task
in
[
3
,
4
,
5
]:
# 矿卡重载或仍未出卸载区
# print("读取重载行程")
# print("读取重载行程")
# print(item.exactor_id, item.dump_id)
# print(item.exactor_id, item.dump_id)
last_load_time
=
self
.
relative_last_load_time
[
self
.
truck_index_to_uuid_dict
[
i
]
]
if
item
.
exactor_id
in
DeviceMap
.
excavator_uuid_to_load_area_uuid_dict
:
if
item
.
exactor_id
in
DeviceMap
.
excavator_uuid_to_load_area_uuid_dict
:
start_area_id
=
self
.
excavator_uuid_to_load_area_uuid_dict
[
item
.
exactor_id
]
start_area_id
=
self
.
excavator_uuid_to_load_area_uuid_dict
[
item
.
exactor_id
]
...
@@ -423,15 +438,22 @@ class TruckInfo(WalkManage):
...
@@ -423,15 +438,22 @@ class TruckInfo(WalkManage):
end_area_index
=
-
1
end_area_index
=
-
1
end_eq_index
=
-
1
end_eq_index
=
-
1
self
.
truck_current_trip
[
i
]
=
[
start_eq_index
,
end_eq_index
]
# # 结束设备index
# # 结束设备index
# end_eqp_index = self.dump_uuid_to_index_dict[item.dump_id]
# end_eqp_index = self.dump_uuid_to_index_dict[item.dump_id]
try
:
self
.
truck_current_trip
[
i
]
=
[
start_eq_index
,
end_eq_index
]
last_load_time
=
self
.
relative_last_load_time
[
self
.
truck_index_to_uuid_dict
[
i
]
]
self
.
cur_truck_reach_dump
[
i
]
=
(
self
.
cur_truck_reach_dump
[
i
]
=
(
last_load_time
last_load_time
+
walk_time_to_unload_area
[
end_area_index
][
start_area_index
]
+
walk_time_to_unload_area
[
end_area_index
][
start_area_index
]
)
)
except
Exception
as
es
:
self
.
logger
.
error
(
es
)
self
.
logger
.
error
(
"读取重载抵达时间异常"
)
# self.logger.info(f'{truck_name}-last_load_time')
# self.logger.info(f'{truck_name}-last_load_time')
# self.logger.info(last_load_time)
# self.logger.info(last_load_time)
...
...
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