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
032a739b
Commit
032a739b
authored
May 12, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wwr' into 'develop'
fix_录波详情 See merge request
!43
parents
9fad902b
53467480
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
49 deletions
+66
-49
scope_operations_cps.py
unify_api/modules/anshiu/components/scope_operations_cps.py
+20
-14
scope_operations_dao.py
unify_api/modules/anshiu/dao/scope_operations_dao.py
+16
-0
scope_operations_serv.py
unify_api/modules/anshiu/service/scope_operations_serv.py
+16
-14
scope_operations.py
unify_api/modules/anshiu/views/scope_operations.py
+14
-18
scope_operations_service.py
..._api/modules/zhiwei_u/service/scope_operations_service.py
+0
-3
No files found.
unify_api/modules/anshiu/components/scope_operations_cps.py
View file @
032a739b
...
...
@@ -515,22 +515,28 @@ class ScopeDetail(Model):
value
:
list
=
List
(
"值"
)
@
dataclass
class
ScopeDetails
(
Model
):
item
:
str
=
Str
(
"名称"
)
.
eg
(
"ia"
)
value_datas
:
list
=
List
(
"值"
)
@
dataclass
class
ScopeDetailResp
(
Model
):
name
:
str
=
Str
(
"监测点名称"
)
.
eg
(
"华侨新村270栋101"
)
point
:
str
=
Str
(
"监测点名称"
)
.
eg
(
"华侨新村270栋101"
)
ctnum
:
int
=
Int
(
"接线方式 2-两表法 3-三表法"
)
.
eg
(
1
)
sid
:
str
=
Str
(
"硬件编号"
)
.
eg
(
"A2270457094"
)
event_datetime
:
str
=
Str
(
"触发时间"
)
.
eg
(
"2022-05-26 15:55:03"
)
duration
:
str
=
Str
(
"录波时长"
)
.
eg
(
"400ms"
)
message
:
str
=
Str
(
"触发原因"
)
.
eg
(
"漏电流越限
"
)
check_dt
:
str
=
Str
(
"触发时间"
)
.
eg
(
"2022-05-26 15:55:03"
)
contin_time
:
str
=
Str
(
"录波时长"
)
.
eg
(
"400ms"
)
item
:
str
=
Str
(
"相限"
)
.
eg
(
"A相
"
)
scope_g
:
str
=
Str
(
"录波颗粒度 0.25ms/0.2s/2s"
)
.
eg
(
"0.25ms"
)
scope_
type
:
str
=
Str
(
"录波类型"
)
.
eg
(
"over_res_cur"
)
conclusion
:
str
=
Str
(
"分析结论"
)
.
eg
(
"xxxxxxx"
)
u_list
:
list
=
List
(
"电压曲线"
)
.
items
(
ScopeDetail
)
u_slots
:
list
=
List
(
"电压横坐标"
)
i
_list
:
list
=
List
(
"电流曲线"
)
.
items
(
ScopeDetail
)
i_slots
:
list
=
List
(
"电流横坐标"
)
lc_list
:
list
=
List
(
"漏电流曲线"
)
.
items
(
ScopeDetail
)
lc_slots
:
list
=
List
(
"漏电流横坐标"
)
p
ower_list
:
list
=
List
(
"功率曲线"
)
.
items
(
ScopeDetail
)
power_slots
:
list
=
List
(
"功率横坐标"
)
type
:
str
=
Str
(
"录波类型"
)
.
eg
(
"over_res_cur"
)
location
:
int
=
Int
(
"location触发点"
)
.
eg
(
0
)
v
:
list
=
List
(
"电压曲线"
)
.
items
(
ScopeDetails
)
i
:
list
=
List
(
"电流曲线"
)
.
items
(
ScopeDetails
)
residual_current
:
list
=
List
(
"漏电流曲线"
)
.
items
(
ScopeDetails
)
p
:
list
=
List
(
"功率曲线"
)
.
items
(
ScopeDetails
)
unify_api/modules/anshiu/dao/scope_operations_dao.py
View file @
032a739b
...
...
@@ -76,3 +76,19 @@ async def get_scope_url_by_pid(mtid, start_dt, end_dt):
async
with
MysqlUtil
()
as
conn
:
result
=
await
conn
.
fetchall
(
sql
,)
return
result
async
def
get_e_type_by_event_type
(
event_type
):
sql
=
f
"""
SELECT
`name` type
FROM
event_type
WHERE
e_type = '{event_type}'
"""
async
with
MysqlUtil
()
as
conn
:
result
=
await
conn
.
fetchone
(
sql
,)
return
result
unify_api/modules/anshiu/service/scope_operations_serv.py
View file @
032a739b
...
...
@@ -20,9 +20,10 @@ from pot_libs.utils.time_format import convert_dt_to_timestr, \
convert_to_es_str
,
time_str_to_str
from
unify_api.modules.anshiu.components.scope_operations_cps
import
\
ScopeListItem
,
ScopeContent
,
ScopeDetailsResp
,
GetScopeConfigList
,
\
init_scope_config_example
,
ScopeItemDownload
,
ScopeDetail
init_scope_config_example
,
ScopeItemDownload
,
ScopeDetail
,
ScopeDetails
from
unify_api.modules.anshiu.dao.scope_operations_dao
import
\
get_scope_event_by_event_id
,
get_scope_detail_by_pid
,
get_threshold_by_mtid
get_scope_event_by_event_id
,
get_scope_detail_by_pid
,
\
get_threshold_by_mtid
,
get_e_type_by_event_type
from
unify_api.modules.anshiu.procedures.scope_operations_pds
import
\
get_scope_config_by_pid
,
set_scope_config_by_pid
,
add_scope_config_by_pid
,
\
get_scope_list_by_pid
...
...
@@ -524,23 +525,18 @@ async def scope_detail_service(event_id):
for
k
,
v
in
wave_data
.
items
():
v
=
[
value
if
not
math
.
isnan
(
value
)
else
''
for
value
in
v
]
if
k
in
i_fields
:
i_list
.
append
(
ScopeDetail
(
name
=
k
,
value
=
v
))
i_list
.
append
(
ScopeDetail
s
(
item
=
k
,
value_datas
=
v
))
u_count
=
len
(
v
)
if
k
in
v_fields
:
u_list
.
append
(
ScopeDetail
(
name
=
k
,
value
=
v
))
u_list
.
append
(
ScopeDetail
s
(
item
=
k
,
value_datas
=
v
))
i_count
=
len
(
v
)
# 2s颗粒度的会有漏电流及功率
if
k
in
(
"lc"
,
"ileak_rms"
):
residual_current
.
append
(
ScopeDetail
(
name
=
'漏电流'
,
value
=
v
))
residual_current
.
append
(
ScopeDetail
s
(
item
=
'漏电流'
,
value_datas
=
v
))
lc_count
=
len
(
v
)
if
k
==
"pttl"
:
power
.
append
(
ScopeDetail
(
name
=
'总有功功率'
,
value
=
v
))
power
.
append
(
ScopeDetail
s
(
item
=
'总有功功率'
,
value_datas
=
v
))
power_count
=
len
(
v
)
u_slots
=
[
i
for
i
in
range
(
1
,
u_count
+
1
)]
i_slots
=
[
i
for
i
in
range
(
1
,
i_count
+
1
)]
lc_slots
=
[
i
for
i
in
range
(
1
,
lc_count
+
1
)]
power_slots
=
[
i
for
i
in
range
(
1
,
power_count
+
1
)]
# 结论分析
result
=
await
get_scope_conclusion
(
wave_data
,
event_type
,
mtid
,
sid
,
ctnum
)
...
...
@@ -560,10 +556,16 @@ async def scope_detail_service(event_id):
data
[
"message"
]
=
event_data
.
get
(
"message"
)
data
[
"conclusion"
]
=
result
data
[
"scope_g"
]
=
scope_g
data
[
"scope_type"
]
=
event_data
.
get
(
"event_type"
)
event_type
=
event_data
.
get
(
"event_type"
)
e_type
=
await
get_e_type_by_event_type
(
event_type
)
data
[
"type"
]
=
e_type
[
"type"
]
data
[
"ctnum"
]
=
ctnum
return
data
or
{},
u_list
,
i_list
,
residual_current
,
power
,
u_slots
,
\
i_slots
,
lc_slots
,
power_slots
data
[
"item"
]
=
event_data
[
"phase"
]
index_loc
=
json
.
loads
(
scope_data
.
get
(
"index_loc"
))
data
[
"location"
]
=
index_loc
[
f
"{data['item']}"
][
'location'
]
if
index_loc
.
get
(
data
[
'item'
])
else
index_loc
.
get
(
"index_loc"
)
return
data
or
{},
u_list
,
i_list
,
residual_current
,
power
,
async
def
get_scope_conclusion
(
wave_data
,
event_type
,
mtid
,
sid
,
ctnum
):
...
...
unify_api/modules/anshiu/views/scope_operations.py
View file @
032a739b
...
...
@@ -82,28 +82,24 @@ async def post_scope_detail(req, body: ScopeDetailRep) -> ScopeDetailResp:
event_id
=
body
.
id
# 2,获取信息
data
,
u_list
,
i_list
,
residual_current
,
power
,
u_slots
,
\
i_slots
,
lc_slots
,
power_slots
=
await
scope_detail_service
(
event_id
)
data
,
u_list
,
i_list
,
residual_current
,
power
=
await
scope_detail_service
(
event_id
)
# 3,返回信息
return
ScopeDetailResp
(
name
=
data
.
get
(
"name"
),
point
=
data
.
get
(
"name"
),
ctnum
=
data
.
get
(
"ctnum"
),
sid
=
data
.
get
(
"sid"
),
event_datetime
=
data
.
get
(
"event_datetime"
),
duration
=
data
.
get
(
"duration"
),
message
=
data
.
get
(
"message"
),
check_dt
=
data
.
get
(
"event_datetime"
),
contin_time
=
data
.
get
(
"duration"
),
item
=
data
.
get
(
"item"
),
scope_g
=
data
.
get
(
"scope_g"
),
scope_type
=
data
.
get
(
"scope_type"
),
conclusion
=
data
.
get
(
"conclusion"
),
u_list
=
u_list
,
u_slots
=
u_slots
,
i_list
=
i_list
,
i_slots
=
i_slots
,
lc_list
=
residual_current
,
lc_slots
=
lc_slots
,
power_list
=
power
,
power_slots
=
power_slots
,
type
=
data
.
get
(
"type"
),
v
=
u_list
,
location
=
data
.
get
(
"location"
),
i
=
i_list
,
residual_current
=
residual_current
,
p
=
power
,
)
...
...
unify_api/modules/zhiwei_u/service/scope_operations_service.py
View file @
032a739b
...
...
@@ -10,9 +10,6 @@ from unify_api.modules.zhiwei_u import config
from
unify_api.utils
import
time_format
from
pot_libs.utils.exc_util
import
DBException
from
dataclasses
import
fields
from
unify_api.modules.zhiwei_u.dao.data_es_dao
import
query_search_scope
,
\
query_search_scope_pids
from
unify_api.modules.zhiwei_u.dao.data_es_dao
import
get_scope_pids
,
\
get_search_scope
...
...
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