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
27dab62a
Commit
27dab62a
authored
Jun 14, 2022
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. tables.py 加入sys_dispatch_setting_v
parent
e85b1be3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
94 deletions
+44
-94
settings.py
settings.py
+0
-53
tables.py
tables.py
+44
-41
No files found.
settings.py
View file @
27dab62a
...
@@ -94,59 +94,6 @@ pool2 = ConnectionPool(host=redis_config["host"], db=2, port=6379, password=redi
...
@@ -94,59 +94,6 @@ pool2 = ConnectionPool(host=redis_config["host"], db=2, port=6379, password=redi
redis2
=
StrictRedis
(
connection_pool
=
pool2
)
redis2
=
StrictRedis
(
connection_pool
=
pool2
)
# 数据库连接设置
########################################################################################################################
# 创建对象的基类:
Base
=
declarative_base
()
sql_str
=
str
(
"mysql+mysqlconnector://"
+
mysql_config
[
"user"
]
+
":
%
s@"
+
mysql_config
[
"host"
]
+
\
":"
+
mysql_config
[
"port"
]
+
"/"
+
mysql_config
[
"database"
])
postgre_str
=
str
(
"postgresql://"
+
postgre_config
[
"user"
]
+
":
%
s@"
+
postgre_config
[
"host"
]
+
\
":"
+
postgre_config
[
"port"
]
+
"/"
+
postgre_config
[
"database"
])
try
:
engine_mysql
=
create_engine
(
# "mysql+mysqlconnector://root:%s@192.168.28.111:3306/waytous"
# % quote("Huituo@123")
# "mysql+mysqlconnector://" + mysql_config["user"] + ":" + mysql_config["password"] + "@" + mysql_config[
# "host"] + ":" + mysql_config["port"] + "/" + mysql_config["database"]
sql_str
%
quote
(
mysql_config
[
"password"
])
)
engine_postgre
=
create_engine
(
# "postgresql://postgres:%s@192.168.28.111:5432/shenbao_2021520"
# % quote("Huituo@123")
# "postgresql://" + postgre_config["user"] + ":" + postgre_config["password"] + "@" + postgre_config[
# "host"] + ":" + postgre_config["port"] + "/" + postgre_config["database"]
postgre_str
%
quote
(
postgre_config
[
"password"
])
)
# 创建DBsession_mysql类型:
DBsession_mysql
=
sessionmaker
(
bind
=
engine_mysql
)
DBsession_mysql
=
scoped_session
(
DBsession_mysql
)
DBsession_postgre
=
sessionmaker
(
bind
=
engine_postgre
)
DBsession_postgre
=
scoped_session
(
DBsession_postgre
)
# 创建session_mysql对象:
session_mysql
=
DBsession_mysql
()
session_mysql
.
expire_on_commit
=
False
session_postgre
=
DBsession_postgre
()
session_postgre
.
expire_on_commit
=
False
except
Exception
as
es
:
logger
.
error
(
"数据库连接失败"
)
logger
.
error
(
es
)
def
str_to_byte
(
item
):
def
str_to_byte
(
item
):
return
bytes
(
item
,
encoding
=
'utf8'
)
return
bytes
(
item
,
encoding
=
'utf8'
)
...
...
tables.py
View file @
27dab62a
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
# 存储数据库表结构
# 存储数据库表结构
from
settings
import
*
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
from
sqlalchemy.orm
import
sessionmaker
,
scoped_session
from
sqlalchemy.orm
import
sessionmaker
,
scoped_session
...
@@ -278,16 +277,6 @@ class EquipmentPair(Base):
...
@@ -278,16 +277,6 @@ class EquipmentPair(Base):
self
.
createtime
=
createtime
self
.
createtime
=
createtime
# class Lane(Base):
# # 表的名字
# __tablename__ = 'Geo_Node'
# Id = Column(VARCHAR(36), primary_key=True)
# LaneIds = Column(VARCHAR(100))
#
# def __init__(self, Id, LaneIds):
# self.Id = Id
# self.LaneIds = LaneIds
class
Lane
(
Base
):
class
Lane
(
Base
):
# 表的名字
# 表的名字
__tablename__
=
'Geo_Lane'
__tablename__
=
'Geo_Lane'
...
@@ -344,36 +333,42 @@ class Dispatch(Base):
...
@@ -344,36 +333,42 @@ class Dispatch(Base):
self
.
deletor
=
deletor
self
.
deletor
=
deletor
self
.
deletetime
=
deletetime
self
.
deletetime
=
deletetime
# class DispatchSetting(Base):
class
DispatchSetting
(
Base
):
# __tablename__ = 'sys_dispatch_setting_v'
__tablename__
=
'sys_dispatch_setting_v'
#
# group_name = Column(VARCHAR(36))
id
=
Column
(
VARCHAR
(
36
),
primary_key
=
True
)
# group_id = Column(VARCHAR(36))
mode_name
=
Column
(
VARCHAR
(
36
))
# group_code = Column(VARCHAR(36))
mode_code
=
Column
(
VARCHAR
(
36
))
# group_type = Column(Integer)
group_name
=
Column
(
VARCHAR
(
36
))
# load_area_id = Column(VARCHAR(36))
group_id
=
Column
(
VARCHAR
(
36
))
# exactor_id = Column(VARCHAR(36))
group_code
=
Column
(
VARCHAR
(
36
))
# unload_area_id = Column(VARCHAR(36))
group_type
=
Column
(
Integer
)
# dump_id = Column(VARCHAR(36))
load_area_id
=
Column
(
VARCHAR
(
36
))
# isauto = Column(BOOLEAN)
exactor_id
=
Column
(
VARCHAR
(
36
))
# truck_id = Column(VARCHAR(36))
unload_area_id
=
Column
(
VARCHAR
(
36
))
# team_id = Column(VARCHAR(36))
dump_id
=
Column
(
VARCHAR
(
36
))
# isdeleted = Column(BOOLEAN)
isauto
=
Column
(
BOOLEAN
)
# proportion_id = Column(VARCHAR(36))
truck_id
=
Column
(
VARCHAR
(
36
))
#
team_id
=
Column
(
VARCHAR
(
36
))
# def __init__(self, group_name, group_id, group_code, group_type, load_area_id, exactor_id, unload_area_id, dump_id, isauto, truck_id, remark, proportion_id):
isdeleted
=
Column
(
BOOLEAN
)
# self.group_name = group_name
proportion_id
=
Column
(
VARCHAR
(
36
))
# self.group_id = group_id
# self.group_code = group_code
def
__init__
(
self
,
id
,
mode_name
,
mode_code
,
group_name
,
group_id
,
group_code
,
group_type
,
load_area_id
,
exactor_id
,
unload_area_id
,
dump_id
,
isauto
,
truck_id
,
remark
,
proportion_id
):
# self.group_type = group_type
self
.
id
=
id
# self.load_area_id = load_area_id
self
.
mode_name
# self.exactor_id = exactor_id
self
.
mode_code
# self.unload_area_id = unload_area_id
self
.
group_name
=
group_name
# self.dump_id = dump_id
self
.
group_id
=
group_id
# self.isauto = isauto
self
.
group_code
=
group_code
# self.truck_id = truck_id
self
.
group_type
=
group_type
# self.proportion_id = proportion_id
self
.
load_area_id
=
load_area_id
# self.remark = remark
self
.
exactor_id
=
exactor_id
self
.
unload_area_id
=
unload_area_id
self
.
dump_id
=
dump_id
self
.
isauto
=
isauto
self
.
truck_id
=
truck_id
self
.
proportion_id
=
proportion_id
self
.
remark
=
remark
class
WalkTimePark
(
Base
):
class
WalkTimePark
(
Base
):
...
@@ -395,6 +390,14 @@ class WalkTimePark(Base):
...
@@ -395,6 +390,14 @@ class WalkTimePark(Base):
self
.
park_load_lanes
=
park_load_lanes
self
.
park_load_lanes
=
park_load_lanes
# class DispatchSetting(Base):
# __tablename__ = 'sys_dispatch_setting_v'
# id = Column(VARCHAR(36), primary_key=True)
#
# def __init__(self, id):
# self.id = id
class
Equipment
(
Base
):
class
Equipment
(
Base
):
__tablename__
=
'sys_equipment'
__tablename__
=
'sys_equipment'
...
...
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