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
c6d18b36
Commit
c6d18b36
authored
Nov 13, 2022
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库迁移p1
parent
430230f1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
100 deletions
+149
-100
util.py
core/util.py
+3
-2
static_data_process.py
data/static_data_process.py
+12
-12
excavator.py
equipment/excavator.py
+6
-6
truck.py
equipment/truck.py
+30
-27
gothrough_digging.py
gothrough/gothrough_digging.py
+1
-1
settings.py
settings.py
+1
-1
tables.py
tables.py
+96
-51
No files found.
core/util.py
View file @
c6d18b36
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
import
requests
import
requests
from
tables
import
*
from
tables
import
*
with
open
(
json_file
)
as
f
:
with
open
(
json_file
)
as
f
:
mysql_config
=
json
.
load
(
f
)[
"mysql"
]
config
=
json
.
load
(
f
)
# def redispatch_request(truck_id, excavator_id, unload_area_id):
# def redispatch_request(truck_id, excavator_id, unload_area_id):
...
@@ -98,7 +98,7 @@ def POST(truck_id):
...
@@ -98,7 +98,7 @@ def POST(truck_id):
:param real_data:
:param real_data:
:return:
:return:
"""
"""
url_d
=
"http://"
+
mysql_
config
[
"host"
]
+
":8020/ht/api/dispatch/updateTemp?truckId="
+
truck_id
url_d
=
"http://"
+
config
[
"host"
]
+
":8020/ht/api/dispatch/updateTemp?truckId="
+
truck_id
res_d
=
requests
.
get
(
url_d
)
res_d
=
requests
.
get
(
url_d
)
print
(
res_d
.
text
)
print
(
res_d
.
text
)
return
res_d
.
text
return
res_d
.
text
\ No newline at end of file
data/static_data_process.py
View file @
c6d18b36
...
@@ -85,9 +85,9 @@ def build_truck_uuid_name_map():
...
@@ -85,9 +85,9 @@ def build_truck_uuid_name_map():
truck_name_to_uuid_dict
=
{}
truck_name_to_uuid_dict
=
{}
try
:
try
:
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
device_type
=
1
)
.
all
():
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_TYPE_ID
=
1
)
.
all
():
truck_id
=
item
.
id
truck_id
=
item
.
EQUIPMENT_ID
truck_name
=
item
.
equipment_id
truck_name
=
item
.
EQUIPMENT_NAME
.
encode
(
"latin-1"
)
.
decode
(
"GBK"
,
"ignore"
)
truck_name_to_uuid_dict
[
truck_name
]
=
truck_id
truck_name_to_uuid_dict
[
truck_name
]
=
truck_id
truck_uuid_to_name_dict
[
truck_id
]
=
truck_name
truck_uuid_to_name_dict
[
truck_id
]
=
truck_name
...
@@ -107,9 +107,9 @@ def build_equipment_uuid_name_map():
...
@@ -107,9 +107,9 @@ def build_equipment_uuid_name_map():
dump_uuid_to_name_dict
=
{}
dump_uuid_to_name_dict
=
{}
try
:
try
:
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
device_type
=
2
)
.
all
():
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_TYPE_ID
=
2
)
.
all
():
truck_id
=
item
.
id
truck_id
=
item
.
EQUIPMENT_ID
truck_name
=
item
.
equipment_id
truck_name
=
item
.
EQUIPMENT_NAME
excavator_uuid_to_name_dict
[
truck_id
]
=
truck_name
excavator_uuid_to_name_dict
[
truck_id
]
=
truck_name
if
len
(
excavator_uuid_to_name_dict
)
<
1
:
if
len
(
excavator_uuid_to_name_dict
)
<
1
:
...
@@ -121,9 +121,9 @@ def build_equipment_uuid_name_map():
...
@@ -121,9 +121,9 @@ def build_equipment_uuid_name_map():
try
:
try
:
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
device_type
=
3
)
.
all
():
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_TYPE_ID
=
3
)
.
all
():
truck_id
=
item
.
id
truck_id
=
item
.
EQUIPMENT_ID
truck_name
=
item
.
equipment_id
truck_name
=
item
.
EQUIPMENT_NAME
dump_uuid_to_name_dict
[
truck_id
]
=
truck_name
dump_uuid_to_name_dict
[
truck_id
]
=
truck_name
if
len
(
dump_uuid_to_name_dict
)
<
1
:
if
len
(
dump_uuid_to_name_dict
)
<
1
:
...
@@ -236,7 +236,7 @@ def update_total_truck():
...
@@ -236,7 +236,7 @@ def update_total_truck():
try
:
try
:
query
=
np
.
array
(
query
=
np
.
array
(
session_mysql
.
query
(
Equipment
)
session_mysql
.
query
(
Equipment
)
.
filter_by
(
device_type
=
1
,
isdeleted
=
0
)
.
filter_by
(
EQUIPMENT_TYPE_ID
=
1
,
DISABLED
=
0
)
.
all
()
.
all
()
)
)
# for item in query:
# for item in query:
...
@@ -245,7 +245,7 @@ def update_total_truck():
...
@@ -245,7 +245,7 @@ def update_total_truck():
# if is_online:
# if is_online:
# truck_list.append(item.id)
# truck_list.append(item.id)
for
item
in
query
:
for
item
in
query
:
truck_list
.
append
(
item
.
id
)
truck_list
.
append
(
item
.
EQUIPMENT_ID
)
if
len
(
truck_list
)
<
1
:
if
len
(
truck_list
)
<
1
:
raise
Exception
(
"无矿卡设备可用-矿卡集合读取异常"
)
raise
Exception
(
"无矿卡设备可用-矿卡集合读取异常"
)
...
@@ -311,7 +311,7 @@ def update_fixdisp_truck():
...
@@ -311,7 +311,7 @@ def update_fixdisp_truck():
try
:
try
:
query
=
np
.
array
(
query
=
np
.
array
(
session_mysql
.
query
(
Equipment
)
session_mysql
.
query
(
Equipment
)
.
filter_by
(
device_type
=
1
,
isdeleted
=
0
,
disabled
=
1
)
.
filter_by
(
EQUIPMENT_TYPE_ID
=
1
,
disabled
=
1
)
.
all
()
.
all
()
)
)
except
Exception
as
es
:
except
Exception
as
es
:
...
...
equipment/excavator.py
View file @
c6d18b36
...
@@ -148,10 +148,10 @@ class ExcavatorInfo(WalkManage):
...
@@ -148,10 +148,10 @@ class ExcavatorInfo(WalkManage):
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
try
:
try
:
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
excavator_id
)
.
first
()
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_ID
=
int
(
excavator_id
)
)
.
first
()
self
.
logger
.
info
(
"excavator_priority_coefficient"
)
self
.
logger
.
info
(
"excavator_priority_coefficient"
)
self
.
logger
.
info
(
self
.
excavator_priority_coefficient
)
self
.
logger
.
info
(
self
.
excavator_priority_coefficient
)
self
.
excavator_priority_coefficient
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
item
.
priority
+
1
self
.
excavator_priority_coefficient
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
item
.
PRIORITY
+
1
# 物料优先级控制
# 物料优先级控制
rule
=
2
rule
=
2
...
@@ -183,10 +183,10 @@ class ExcavatorInfo(WalkManage):
...
@@ -183,10 +183,10 @@ class ExcavatorInfo(WalkManage):
if
not
rule4
.
disabled
:
if
not
rule4
.
disabled
:
for
excavator_index
in
range
(
len
(
self
.
excavator_index_to_uuid_dict
)):
for
excavator_index
in
range
(
len
(
self
.
excavator_index_to_uuid_dict
)):
try
:
try
:
load_ability
=
session_mysql
.
query
(
EquipmentSpec
.
mining_abililty
)
.
\
load_ability
=
session_mysql
.
query
(
EquipmentSpec
.
MINING_ABILILTY
)
.
\
join
(
Equipment
,
Equipment
.
equipment_spec
==
EquipmentSpec
.
id
)
.
\
join
(
Equipment
,
Equipment
.
EQUIPMENT_MODEL_ID
==
EquipmentSpec
.
EQUIPMENT_MODEL_ID
)
.
\
filter
(
Equipment
.
id
==
self
.
excavator_index_to_uuid_dict
[
excavator_index
])
.
first
()
filter
(
Equipment
.
EQUIPMENT_ID
==
self
.
excavator_index_to_uuid_dict
[
excavator_index
])
.
first
()
self
.
excavator_strength
[
excavator_index
]
=
load_ability
.
mining_abililty
self
.
excavator_strength
[
excavator_index
]
=
load_ability
.
MINING_ABILILTY
# if load_ability.mining_abililty < 200:
# if load_ability.mining_abililty < 200:
# raise Exception("挖机装载能力异常")
# raise Exception("挖机装载能力异常")
...
...
equipment/truck.py
View file @
c6d18b36
...
@@ -153,16 +153,19 @@ class TruckInfo(WalkManage):
...
@@ -153,16 +153,19 @@ class TruckInfo(WalkManage):
else
:
else
:
continue
continue
if
device_type
==
1
:
if
device_type
==
1
:
if
truck_name_to_uuid_dict
[
item
]
in
self
.
dynamic_truck_set
:
if
item
not
in
truck_name_to_uuid_dict
:
# currentTask = int(key_value_dict[str_to_byte("currentTask")])
continue
currentTask
=
int
(
byte_to_str
(
key_value_dict
[
str_to_byte
(
"currentTask"
)]))
else
:
self
.
truck_current_task
[
if
truck_name_to_uuid_dict
[
item
]
in
self
.
dynamic_truck_set
:
truck_name_to_uuid_dict
[
item
]
# currentTask = int(key_value_dict[str_to_byte("currentTask")])
]
=
currentTask
currentTask
=
int
(
byte_to_str
(
key_value_dict
[
str_to_byte
(
"currentTask"
)]))
currentState
=
int
(
float
(
byte_to_str
(
key_value_dict
[
str_to_byte
(
"state"
)])))
self
.
truck_current_task
[
self
.
truck_current_state
[
truck_name_to_uuid_dict
[
item
]
truck_name_to_uuid_dict
[
item
]
]
=
currentTask
]
=
currentState
currentState
=
int
(
float
(
byte_to_str
(
key_value_dict
[
str_to_byte
(
"state"
)])))
self
.
truck_current_state
[
truck_name_to_uuid_dict
[
item
]
]
=
currentState
# except Exception as es:
# except Exception as es:
# self.logger.error("读取矿卡任务异常-reids读取异常")
# self.logger.error("读取矿卡任务异常-reids读取异常")
# self.logger.error(es)
# self.logger.error(es)
...
@@ -582,18 +585,18 @@ class TruckInfo(WalkManage):
...
@@ -582,18 +585,18 @@ class TruckInfo(WalkManage):
if
rule6
.
disabled
==
0
:
if
rule6
.
disabled
==
0
:
for
truck_id
in
self
.
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
try
:
try
:
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
truck_id
)
.
first
()
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_ID
=
int
(
truck_id
)
)
.
first
()
except
Exception
as
es
:
except
Exception
as
es
:
session_postgre
.
rollback
()
session_postgre
.
rollback
()
session_mysql
.
rollback
()
session_mysql
.
rollback
()
truck_index
=
self
.
truck_uuid_to_index_dict
[
truck_id
]
truck_index
=
self
.
truck_uuid_to_index_dict
[
truck_id
]
if
item
.
priority
==
0
:
if
item
.
PRIORITY
==
0
:
self
.
truck_priority
[
truck_index
]
=
0
self
.
truck_priority
[
truck_index
]
=
0
elif
item
.
priority
==
1
:
elif
item
.
PRIORITY
==
1
:
self
.
truck_priority
[
truck_index
]
=
2
self
.
truck_priority
[
truck_index
]
=
2
elif
item
.
priority
==
2
:
elif
item
.
PRIORITY
==
2
:
self
.
truck_priority
[
truck_index
]
=
5
self
.
truck_priority
[
truck_index
]
=
5
elif
item
.
priority
==
3
:
elif
item
.
PRIORITY
==
3
:
self
.
truck_priority
[
truck_index
]
=
10
self
.
truck_priority
[
truck_index
]
=
10
except
Exception
as
es
:
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆优先级更新异常"
)
self
.
logger
.
error
(
"车辆优先级更新异常"
)
...
@@ -626,9 +629,9 @@ class TruckInfo(WalkManage):
...
@@ -626,9 +629,9 @@ class TruckInfo(WalkManage):
if
rule5
.
disabled
==
0
:
if
rule5
.
disabled
==
0
:
self
.
truck_excavator_bind
=
{}
self
.
truck_excavator_bind
=
{}
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
excavator_id
)
.
first
()
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_ID
=
int
(
excavator_id
)
)
.
first
()
if
item
.
bind_list
is
not
None
:
if
item
.
BIND_LIST
is
not
None
:
for
truck_name
in
json
.
loads
(
item
.
bind_list
):
for
truck_name
in
json
.
loads
(
item
.
BIND_LIST
):
self
.
truck_excavator_bind
[
self
.
truck_excavator_bind
[
truck_name_to_uuid_dict
[
truck_name
]
truck_name_to_uuid_dict
[
truck_name
]
]
=
excavator_id
]
=
excavator_id
...
@@ -736,7 +739,7 @@ class TruckInfo(WalkManage):
...
@@ -736,7 +739,7 @@ class TruckInfo(WalkManage):
def
update_truck_spec
(
self
):
def
update_truck_spec
(
self
):
for
truck_id
in
self
.
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
try
:
try
:
self
.
size
[
truck_id
]
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
id
=
truck_id
)
.
first
()
.
equipment_spec
self
.
size
[
truck_id
]
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_ID
=
int
(
truck_id
))
.
first
()
.
EQUIPMENT_MODEL_ID
except
Exception
as
es
:
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆型号更新异常"
)
self
.
logger
.
error
(
"车辆型号更新异常"
)
self
.
logger
.
error
(
es
)
self
.
logger
.
error
(
es
)
...
@@ -748,8 +751,8 @@ class TruckInfo(WalkManage):
...
@@ -748,8 +751,8 @@ class TruckInfo(WalkManage):
for
truck_id
in
self
.
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
truck_spec_id
=
self
.
size
[
truck_id
]
truck_spec_id
=
self
.
size
[
truck_id
]
try
:
try
:
self
.
geo_length
[
truck_id
]
=
session_mysql
.
query
(
EquipmentSpec
)
.
filter_by
(
id
=
truck_spec_id
)
.
first
()
.
length
self
.
geo_length
[
truck_id
]
=
session_mysql
.
query
(
EquipmentSpec
)
.
filter_by
(
EQUIPMENT_MODEL_ID
=
truck_spec_id
)
.
first
()
.
LENGTH
self
.
geo_width
[
truck_spec_id
]
=
session_mysql
.
query
(
EquipmentSpec
)
.
filter_by
(
id
=
truck_spec_id
)
.
first
()
.
width
self
.
geo_width
[
truck_spec_id
]
=
session_mysql
.
query
(
EquipmentSpec
)
.
filter_by
(
EQUIPMENT_MODEL_ID
=
truck_spec_id
)
.
first
()
.
WIDTH
except
Exception
as
es
:
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆几何尺寸更新异常"
)
self
.
logger
.
error
(
"车辆几何尺寸更新异常"
)
self
.
logger
.
error
(
es
)
self
.
logger
.
error
(
es
)
...
@@ -760,8 +763,8 @@ class TruckInfo(WalkManage):
...
@@ -760,8 +763,8 @@ class TruckInfo(WalkManage):
for
truck_id
in
self
.
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
try
:
try
:
empty_speed
=
session_mysql
.
query
(
EquipmentSpec
)
.
\
empty_speed
=
session_mysql
.
query
(
EquipmentSpec
)
.
\
join
(
Equipment
,
EquipmentSpec
.
id
==
Equipment
.
equipment_spec
)
.
\
join
(
Equipment
,
EquipmentSpec
.
EQUIPMENT_MODEL_ID
==
Equipment
.
EQUIPMENT_MODEL_ID
)
.
\
filter
(
Equipment
.
id
==
truck_id
)
.
first
()
.
max_speed
filter
(
Equipment
.
EQUIPMENT_ID
==
truck_id
)
.
first
()
.
MAX_SPEED
if
(
empty_speed
<=
1
)
or
(
empty_speed
>=
50
)
or
(
empty_speed
is
None
):
if
(
empty_speed
<=
1
)
or
(
empty_speed
>=
50
)
or
(
empty_speed
is
None
):
self
.
empty_speed
[
truck_id
]
=
20
self
.
empty_speed
[
truck_id
]
=
20
...
@@ -769,8 +772,8 @@ class TruckInfo(WalkManage):
...
@@ -769,8 +772,8 @@ class TruckInfo(WalkManage):
self
.
empty_speed
[
truck_id
]
=
empty_speed
self
.
empty_speed
[
truck_id
]
=
empty_speed
heavy_speed
=
session_mysql
.
query
(
EquipmentSpec
)
.
\
heavy_speed
=
session_mysql
.
query
(
EquipmentSpec
)
.
\
join
(
Equipment
,
EquipmentSpec
.
id
==
Equipment
.
equipment_spec
)
.
\
join
(
Equipment
,
EquipmentSpec
.
EQUIPMENT_MODEL_ID
==
Equipment
.
EQUIPMENT_MODEL_ID
)
.
\
filter
(
Equipment
.
id
==
truck_id
)
.
first
()
.
max_speed
filter
(
Equipment
.
EQUIPMENT_MODID
==
truck_id
)
.
first
()
.
MAX_SPEED
if
(
heavy_speed
<=
1
)
or
(
heavy_speed
>=
50
)
or
(
heavy_speed
is
None
):
if
(
heavy_speed
<=
1
)
or
(
heavy_speed
>=
50
)
or
(
heavy_speed
is
None
):
self
.
heavy_speed
[
truck_id
]
=
20
self
.
heavy_speed
[
truck_id
]
=
20
...
@@ -784,8 +787,8 @@ class TruckInfo(WalkManage):
...
@@ -784,8 +787,8 @@ class TruckInfo(WalkManage):
def
update_truck_disable_list
(
self
)
->
List
:
def
update_truck_disable_list
(
self
)
->
List
:
try
:
try
:
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
device_type
=
1
,
disabled
=
1
)
.
all
():
for
item
in
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_TYPE_ID
=
1
,
DISABLED
=
1
)
.
all
():
self
.
truck_disable_list
.
append
(
item
.
equipment_id
)
self
.
truck_disable_list
.
append
(
item
.
EQUIPMENT_ID
)
except
Exception
as
es
:
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆禁止列表更新异常"
)
self
.
logger
.
error
(
"车辆禁止列表更新异常"
)
self
.
logger
.
error
(
es
)
self
.
logger
.
error
(
es
)
...
...
gothrough/gothrough_digging.py
View file @
c6d18b36
...
@@ -480,7 +480,7 @@ def get_excavator_state(excavator_id):
...
@@ -480,7 +480,7 @@ def get_excavator_state(excavator_id):
"""
"""
try
:
try
:
device_name
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
equipment_id
=
excavator_id
,
device_type
=
2
)
.
first
()
.
device_name
device_name
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_ID
=
int
(
excavator_id
),
EQUIPMENT_TYPE_ID
=
2
)
.
first
()
.
EQUIPMENT_NAME
key_value_dict
=
redis2
.
hgetall
(
device_name
)
key_value_dict
=
redis2
.
hgetall
(
device_name
)
is_online
=
key_value_dict
[
str_to_byte
(
'online'
)]
is_online
=
key_value_dict
[
str_to_byte
(
'online'
)]
...
...
settings.py
View file @
c6d18b36
...
@@ -27,7 +27,7 @@ with open(json_file) as f:
...
@@ -27,7 +27,7 @@ with open(json_file) as f:
para_config
=
json
.
load
(
f
)[
"para"
]
para_config
=
json
.
load
(
f
)[
"para"
]
with
open
(
json_file
)
as
f
:
with
open
(
json_file
)
as
f
:
mysql_config
=
json
.
load
(
f
)[
"m
y
sql"
]
mysql_config
=
json
.
load
(
f
)[
"m
s
sql"
]
with
open
(
json_file
)
as
f
:
with
open
(
json_file
)
as
f
:
postgre_config
=
json
.
load
(
f
)[
"postgresql"
]
postgre_config
=
json
.
load
(
f
)[
"postgresql"
]
...
...
tables.py
View file @
c6d18b36
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
# 存储数据库表结构
# 存储数据库表结构
from
sqlalchemy
import
Column
,
create_engine
from
sqlalchemy
import
Column
,
create_engine
from
sqlalchemy
import
VARCHAR
,
DateTime
,
Float
,
Integer
,
BOOLEAN
from
sqlalchemy
import
VARCHAR
,
DateTime
,
Float
,
Integer
,
BOOLEAN
,
DECIMAL
from
sqlalchemy.orm
import
sessionmaker
,
scoped_session
from
sqlalchemy.orm
import
sessionmaker
,
scoped_session
from
sqlalchemy.ext.declarative
import
declarative_base
from
sqlalchemy.ext.declarative
import
declarative_base
from
urllib.parse
import
quote
from
urllib.parse
import
quote
...
@@ -45,7 +45,6 @@ if mysql_config is not None:
...
@@ -45,7 +45,6 @@ if mysql_config is not None:
":"
+
mysql_config
[
"port"
]
+
"/"
+
mysql_config
[
"database"
])
":"
+
mysql_config
[
"port"
]
+
"/"
+
mysql_config
[
"database"
])
engine_mysql
=
create_engine
(
sql_str
%
quote
(
mysql_config
[
"password"
]))
engine_mysql
=
create_engine
(
sql_str
%
quote
(
mysql_config
[
"password"
]))
else
:
else
:
sql_str
=
str
(
"mssql+pymssql://"
+
sqlserver_config
[
"user"
]
+
":
%
s@"
+
sqlserver_config
[
"host"
]
+
\
sql_str
=
str
(
"mssql+pymssql://"
+
sqlserver_config
[
"user"
]
+
":
%
s@"
+
sqlserver_config
[
"host"
]
+
\
...
@@ -257,54 +256,91 @@ class WalkTimePark(Base):
...
@@ -257,54 +256,91 @@ class WalkTimePark(Base):
self
.
park_load_lanes
=
park_load_lanes
self
.
park_load_lanes
=
park_load_lanes
class
Equipment
(
Base
):
class
Equipment
(
Base
):
__tablename__
=
'sys_equipment'
__tablename__
=
'SYS_OBJECT_EQUIPMENT_INFO'
id
=
Column
(
VARCHAR
(
36
),
primary_key
=
True
)
EQUIPMENT_ID
=
Column
(
Integer
,
primary_key
=
True
)
equipment_id
=
Column
(
VARCHAR
(
64
))
EQUIPMENT_NAME
=
Column
(
VARCHAR
(
64
))
device_name
=
Column
(
VARCHAR
(
64
))
EQUIPMENT_TYPE_ID
=
Column
(
Integer
)
device_type
=
Column
(
VARCHAR
(
36
))
EQUIPMENT_MODEL_ID
=
Column
(
Integer
)
equipment_spec
=
Column
(
VARCHAR
(
36
))
DISABLED
=
Column
(
Integer
)
equipment_state
=
Column
(
Integer
)
BIND_LIST
=
Column
(
VARCHAR
(
1000
))
isdeleted
=
Column
(
Integer
)
ONLY_ALLOWED
=
Column
(
Integer
)
disabled
=
Column
(
Integer
)
PRIORITY
=
Column
(
Integer
)
bind_list
=
Column
(
VARCHAR
(
1000
))
only_allowed
=
Column
(
Integer
)
# id = Column(VARCHAR(36), primary_key=True)
priority
=
Column
(
Integer
)
# equipment_id = Column(VARCHAR(64))
# device_name = Column(VARCHAR(64))
def
__init__
(
self
,
id
,
equipment_id
,
device_name
,
device_type
,
equipment_spec
,
equipment_state
,
isdeleted
,
\
# device_type = Column(VARCHAR(36))
disabled
,
bind_list
,
only_allowed
,
priority
):
# equipment_spec = Column(VARCHAR(36))
self
.
id
=
id
# equipment_state = Column(Integer)
self
.
equipment_id
=
equipment_id
# isdeleted = Column(Integer)
self
.
device_name
=
device_name
# disabled = Column(Integer)
self
.
device_type
=
device_type
# bind_list = Column(VARCHAR(1000))
self
.
equipment_spec
=
equipment_spec
# only_allowed = Column(Integer)
self
.
equipment_state
=
equipment_state
# priority = Column(Integer)
self
.
isdeleted
=
isdeleted
self
.
disabled
=
disabled
def
__init__
(
self
,
EQUIPMENT_ID
,
EQUIPMENT_NAME
,
EQUIPMENT_TYPE_ID
,
EQUIPMENT_MODEL_ID
,
DISABLED
,
BIND_LIST
,
self
.
bind_list
=
bind_list
ONLY_ALLOWED
,
PRIORITY
):
self
.
only_allowed
=
only_allowed
self
.
EQUIPMENT_ID
=
EQUIPMENT_ID
self
.
priority
=
priority
self
.
EQUIPMENT_NAME
=
EQUIPMENT_NAME
self
.
EQUIPMENT_TYPE_ID
=
EQUIPMENT_TYPE_ID
self
.
EQUIPMENT_MODEL_ID
=
EQUIPMENT_MODEL_ID
self
.
DISABLED
=
DISABLED
self
.
BIND_LIST
=
BIND_LIST
self
.
ONLY_ALLOWED
=
ONLY_ALLOWED
self
.
PRIORITY
=
PRIORITY
# def __init__(self, id, equipment_id, device_name, device_type, equipment_spec, equipment_state, isdeleted,
# disabled, bind_list, only_allowed, priority):
# self.id = id
# self.equipment_id = equipment_id
# self.device_name = device_name
# self.device_type = device_type
# self.equipment_spec = equipment_spec
# self.equipment_state = equipment_state
# self.isdeleted = isdeleted
# self.disabled = disabled
# self.bind_list = bind_list
# self.only_allowed = only_allowed
# self.priority = priority
# class EquipmentSpec(Base):
# __tablename__ = 'sys_equipment_spec'
#
# id = Column(VARCHAR(36), primary_key=True)
# capacity = Column(Integer)
# mining_abililty = Column(Float)
# length = Column(Float)
# width = Column(Float)
# max_speed = Column(Float)
#
# def __init__(self, id, capacity, mining_abililty, length, width, max_speed):
# self.id = id
# self.capacity = capacity
# self.mining_abililty = mining_abililty
# self.length = length
# self.width = width
# self.max_speed = max_speed
class
EquipmentSpec
(
Base
):
class
EquipmentSpec
(
Base
):
__tablename__
=
'
sys_equipment_spec
'
__tablename__
=
'
SYS_SETTING_EQUIPMENT_MODEL_INFO
'
id
=
Column
(
VARCHAR
(
36
)
,
primary_key
=
True
)
EQUIPMENT_MODEL_ID
=
Column
(
Integer
,
primary_key
=
True
)
capacity
=
Column
(
Integer
)
CAPACITY
=
Column
(
Integer
)
mining_abililty
=
Column
(
Float
)
MINING_ABILILTY
=
Column
(
Float
)
length
=
Column
(
Float
)
LENGTH
=
Column
(
Float
)
width
=
Column
(
Float
)
WIDTH
=
Column
(
Float
)
max_speed
=
Column
(
Float
)
MAX_SPEED
=
Column
(
Float
)
def
__init__
(
self
,
id
,
capacity
,
mining_abililty
,
length
,
width
,
max_speed
):
def
__init__
(
self
,
EQUIPMENT_MODEL_ID
,
CAPACITY
,
MINING_ABILILTY
,
LENGTH
,
WIDTH
,
MAX_SPEED
):
self
.
id
=
id
self
.
EQUIPMENT_MODEL_ID
=
EQUIPMENT_MODEL_ID
self
.
capacity
=
capacity
self
.
CAPACITY
=
CAPACITY
self
.
mining_abililty
=
mining_abililty
self
.
MINING_ABILILTY
=
MINING_ABILILTY
self
.
length
=
length
self
.
LENGTH
=
LENGTH
self
.
width
=
width
self
.
WIDTH
=
WIDTH
self
.
max_speed
=
max_speed
self
.
MAX_SPEED
=
MAX_SPEED
class
LoadInfo
(
Base
):
class
LoadInfo
(
Base
):
...
@@ -419,14 +455,23 @@ class DispatchRule(Base):
...
@@ -419,14 +455,23 @@ class DispatchRule(Base):
self
.
disabled
=
disabled
self
.
disabled
=
disabled
# class Material(Base):
# __tablename__ = 'resource_metarials'
# id = Column(VARCHAR(40), primary_key=True)
# name = Column(VARCHAR(40))
#
# def __init__(self, id, name):
# self.id = id
# self.name = name
class
Material
(
Base
):
class
Material
(
Base
):
__tablename__
=
'
resource_metarials
'
__tablename__
=
'
SYS_OBJECT_GOODS_TYPE_INFO
'
id
=
Column
(
VARCHAR
(
40
)
,
primary_key
=
True
)
GOODS_TYPE_ID
=
Column
(
Integer
,
primary_key
=
True
)
name
=
Column
(
VARCHAR
(
4
0
))
GOODS_TYPE_NAME
=
Column
(
VARCHAR
(
5
0
))
def
__init__
(
self
,
id
,
name
):
def
__init__
(
self
,
GOODS_TYPE_ID
,
GOODS_TYPE_NAME
):
self
.
id
=
id
self
.
GOODS_TYPE_ID
=
GOODS_TYPE_ID
self
.
name
=
name
self
.
GOODS_TYPE_NAME
=
GOODS_TYPE_NAME
class
DispatchMode
(
Base
):
class
DispatchMode
(
Base
):
...
...
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