Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
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
0
Merge Requests
0
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
chaonan
unify_api2
Commits
21b257c1
Commit
21b257c1
authored
Jul 03, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
d2c161bf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
72 deletions
+76
-72
list_point.py
unify_api/modules/common/views/list_point.py
+19
-17
electric_dao.py
unify_api/modules/electric/dao/electric_dao.py
+2
-3
count_info_pds.py
unify_api/modules/home_page/procedures/count_info_pds.py
+55
-52
No files found.
unify_api/modules/common/views/list_point.py
View file @
21b257c1
...
...
@@ -23,21 +23,23 @@ async def post_list_point(req, body: ListPointRequest) -> ListPointResponse:
list_point
=
[]
points
=
{}
groups
=
{}
# 查询属于当前工厂下的监测点 + 其他工厂但是被复用到当前工厂的监测点
if
not
is_power_equipment
:
sql
=
"SELECT p.pid,p.mtid, p.name, p.add_to_company FROM point p "
\
"left join monitor_reuse m on p.mtid = m.mtid "
\
"WHERE p.cid=
%
s or m.cid =
%
s"
else
:
# 动力设备
sql
=
"SELECT p.pid,p.mtid, p.name, p.add_to_company FROM point p "
\
"left join monitor m on p.mtid = m.mtid "
\
"left join monitor_reuse mr on p.mtid = mr.mtid "
\
"WHERE m.demolished = 0 and m.is_power_equipment = 1 and ("
\
"p.cid=
%
s or mr.cid =
%
s)"
"WHERE m.demolished = 0 and (p.cid=
%
s or mr.cid =
%
s) "
# 查询属于当前工厂下的监测点 + 其他工厂但是被复用到当前工厂的监测点
if
is_power_equipment
:
# 动力设备
sql
+=
" and m.is_power_equipment = 1 "
async
with
MysqlUtil
()
as
conn
:
result
=
await
conn
.
fetchall
(
sql
,
args
=
(
cid
,
cid
))
if
not
result
:
return
ListPointResponse
(
points
=
list_point
,
inlines
=
[],
power_show_all
=
0
)
# 去调拆表的POINT
point_ids
=
[
point
[
"pid"
]
for
point
in
result
]
point_mid_map
,
point_count
=
await
point_to_mid
(
point_ids
)
...
...
unify_api/modules/electric/dao/electric_dao.py
View file @
21b257c1
...
...
@@ -75,12 +75,11 @@ async def get_elec_mtid_sid_by_cid(cid):
async
def
load_add_to_compy_ids
(
cid
):
if
not
isinstance
(
cid
,
(
list
,
tuple
)):
cid
=
[
cid
]
symbol
=
"in"
if
isinstance
(
cid
,
(
list
,
tuple
))
else
"="
db
=
SETTING
.
mysql_db
sql
=
f
"SELECT monitor.mtid, monitor.sid FROM {db}.monitor "
\
f
"INNER JOIN {db}.point ON point.mtid=monitor.mtid "
\
f
"WHERE monitor.cid
in
%
s AND point.add_to_company=1 "
\
f
"WHERE monitor.cid
{symbol}
%
s AND point.add_to_company=1 "
\
f
"AND monitor.demolished=0;"
async
with
MysqlUtil
()
as
conn
:
ids
=
await
conn
.
fetchall
(
sql
,
(
cid
,))
...
...
unify_api/modules/home_page/procedures/count_info_pds.py
View file @
21b257c1
...
...
@@ -187,7 +187,10 @@ async def normal_rate_of_location(cid):
async
def
real_time_load
(
cid
,
end_dt
=
None
):
"""实时负荷"""
td_tbls
=
[]
for
item
in
await
load_add_to_compy_ids
(
cid
):
add_to_compy_ids
=
await
load_add_to_compy_ids
(
cid
)
if
not
add_to_compy_ids
:
return
0
for
item
in
add_to_compy_ids
:
mtid
,
sid
=
item
[
"mtid"
],
item
[
"sid"
]
tbl
=
get_td_table_name
(
"electric"
,
mtid
)
td_tbls
.
append
(
tbl
)
...
...
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