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
6c411fe4
Commit
6c411fe4
authored
May 31, 2024
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event type name support multi lang 2024-05-30
parent
1599f549
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
7 deletions
+119
-7
constants.py
unify_api/constants.py
+112
-4
list_alarm_service.py
...y_api/modules/alarm_manager/service/list_alarm_service.py
+2
-2
multi_lang.py
unify_api/modules/common/procedures/multi_lang.py
+5
-1
No files found.
unify_api/constants.py
View file @
6c411fe4
...
@@ -123,6 +123,114 @@ EVENT_TYPE_MAP = {
...
@@ -123,6 +123,114 @@ EVENT_TYPE_MAP = {
"over_rms_i"
:
"电流越限"
,
"over_rms_i"
:
"电流越限"
,
}
}
E_TYPE_NAME_LANG
=
{
"overU"
:
{
"zh_CN"
:
"过压"
,
"en_US"
:
"Overvoltage"
,
"de_DE"
:
"Überspannung"
},
"overI"
:
{
"zh_CN"
:
"过流"
,
"en_US"
:
"Overcurrent"
,
"de_DE"
:
"Überstrom"
},
"overPR"
:
{
"zh_CN"
:
"负载率越限"
,
"en_US"
:
"Overload Limit Exceeded"
,
"de_DE"
:
"Überlastungsrate überschreitet Grenzwert"
},
"overResidualCurrent"
:
{
"zh_CN"
:
"漏电流越限"
,
"en_US"
:
"Leakage Current Exceeded Limit"
,
"de_DE"
:
"Fehlerstrom überschreitet Grenzwert"
},
"overTemp"
:
{
"zh_CN"
:
"温度越限"
,
"en_US"
:
"Temperature Exceeded Limit"
,
"de_DE"
:
"Temperatur überschreitet Grenzwert"
},
"overTempRange1min"
:
{
"zh_CN"
:
"温升1分越限"
,
"en_US"
:
"Temperature Rise Exceeds Limit by 1 Degree"
,
"de_DE"
:
"Temperaturanstieg überschreitet 1-Minuten-Grenzwert"
},
"overTempRange15min"
:
{
"zh_CN"
:
"温升15分越限"
,
"en_US"
:
"Temperature Rise Exceeds Limit by 15 Degrees"
,
"de_DE"
:
"Temperaturanstieg überschreitet 15-Minuten-Grenzwert"
},
"overTempTrendDaily"
:
{
"zh_CN"
:
"温度日前预警"
,
"en_US"
:
"Advance Temperature Warning"
,
"de_DE"
:
"Temperaturvorwarnung für den Tag"
},
"overTempTrendQuarterly"
:
{
"zh_CN"
:
"温度实时预警"
,
"en_US"
:
"Real-time Temperature Alert"
,
"de_DE"
:
"Echtzeit-Temperaturwarnung"
},
"overTHDU"
:
{
"zh_CN"
:
"电压总谐波畸变率越限"
,
"en_US"
:
"Total Harmonic Distortion (THD) of Voltage Exceeds Limit"
,
"de_DE"
:
"Gesamtharmonische Spannungsverzerrung überschreitet Grenzwert"
},
"overTHDI"
:
{
"zh_CN"
:
"电流总谐波有效值越限"
,
"en_US"
:
"Total Harmonic Distortion (THD) of Current Exceeds Limit"
,
"de_DE"
:
"Gesamtharmonische Stromverzerrung überschreitet Grenzwert"
},
"unbalanceU"
:
{
"zh_CN"
:
"三相电压不平衡度"
,
"en_US"
:
"Three-phase Voltage Imbalance"
,
"de_DE"
:
"Dreiphasige Spannungsungleichgewicht"
},
"unbalanceI"
:
{
"zh_CN"
:
"三相电流不平衡度"
,
"en_US"
:
"Three-phase Current Imbalance"
,
"de_DE"
:
"Dreiphasige Stromungleichgewicht"
},
"underPhasePF"
:
{
"zh_CN"
:
"某相功率因数越下限"
,
"en_US"
:
"Power Factor of a Phase Falls Below the Lower Limit"
,
"de_DE"
:
"Unterschreitung des Leistungsfaktors einer Phase"
},
"underTotalPF"
:
{
"zh_CN"
:
"总功率因数越下限"
,
"en_US"
:
"Total Power Factor Falls Below the Lower Limit"
,
"de_DE"
:
"Unterschreitung des Gesamtleistungsfaktors"
},
"underU"
:
{
"zh_CN"
:
"欠压"
,
"en_US"
:
"Undervoltage"
,
"de_DE"
:
"Unterspannung"
},
"over_rms_u"
:
{
"zh_CN"
:
"电压越上限"
,
"en_US"
:
"Voltage Above Upper Limit"
,
"de_DE"
:
"Überschreiten der Spannungsgrenze"
},
"under_rms_u"
:
{
"zh_CN"
:
"电压越下限"
,
"en_US"
:
"Voltage Below Lower Limit"
,
"de_DE"
:
"Unterschreiten der Spannungsgrenze"
},
"over_gap_u"
:
{
"zh_CN"
:
"电压波动"
,
"en_US"
:
"Voltage Fluctuatio"
,
"de_DE"
:
"Spannungsschwankung"
},
"over_gap_i"
:
{
"zh_CN"
:
"电流波动"
,
"en_US"
:
"Current Fluctuation"
,
"de_DE"
:
"Stromschwankung"
},
"over_rms_i"
:
{
"zh_CN"
:
"电流越限"
,
"en_US"
:
"Current Exceeds Limit"
,
"de_DE"
:
"Strom überschreitet Grenzwert"
},
}
EVENT_TYPE_UNIT_MAP
=
{
EVENT_TYPE_UNIT_MAP
=
{
"overI"
:
'
%
'
,
"overI"
:
'
%
'
,
"overPR"
:
'
%
'
,
"overPR"
:
'
%
'
,
...
@@ -619,20 +727,20 @@ E_TYPE_LANG = {
...
@@ -619,20 +727,20 @@ E_TYPE_LANG = {
PHASE_LINE_LANG
=
{
PHASE_LINE_LANG
=
{
"A相"
:
{
"A相"
:
{
"en_US"
:
"Phase A"
,
"en_US"
:
"Phase A"
,
"de_DE"
:
""
"de_DE"
:
"
Phase A
"
},
},
"B相"
:
{
"B相"
:
{
"en_US"
:
"Phase B"
,
"en_US"
:
"Phase B"
,
"de_DE"
:
""
"de_DE"
:
"
Phase B
"
},
},
"C相"
:
{
"C相"
:
{
"en_US"
:
"Phase C"
,
"en_US"
:
"Phase C"
,
"de_DE"
:
""
"de_DE"
:
"
Phase C
"
},
},
"N线"
:
{
"N线"
:
{
"en_US"
:
"Neutral Line"
,
"en_US"
:
"Neutral Line"
,
"de_DE"
:
""
"de_DE"
:
"
N-Leitung
"
},
},
}
}
unify_api/modules/alarm_manager/service/list_alarm_service.py
View file @
6c411fe4
...
@@ -17,7 +17,7 @@ from unify_api.modules.common.dao.common_dao import (
...
@@ -17,7 +17,7 @@ from unify_api.modules.common.dao.common_dao import (
load_user_lang
,
load_monitor_names
load_user_lang
,
load_monitor_names
)
)
from
unify_api.modules.common.procedures.multi_lang
import
(
from
unify_api.modules.common.procedures.multi_lang
import
(
load_event_msg
,
load_phase_line
load_event_msg
,
load_phase_line
,
load_e_type_name
)
)
...
@@ -253,7 +253,7 @@ async def pack_alarm_records(records, pid, lang):
...
@@ -253,7 +253,7 @@ async def pack_alarm_records(records, pid, lang):
for
r
in
records
:
for
r
in
records
:
event_type
=
r
.
get
(
"event_type"
)
event_type
=
r
.
get
(
"event_type"
)
event_duration
=
r
.
get
(
"event_duration"
)
event_duration
=
r
.
get
(
"event_duration"
)
type_str
=
constants
.
EVENT_TYPE_MAP
.
get
(
event_type
)
type_str
=
load_e_type_name
(
event_type
,
lang
)
es_id
=
r
.
get
(
"id"
)
es_id
=
r
.
get
(
"id"
)
if
pid
and
r
.
get
(
"event_mode"
)
==
"scope"
:
if
pid
and
r
.
get
(
"event_mode"
)
==
"scope"
:
url
,
redirect_type
=
f
"/scope_details?doc_id={es_id}"
,
"scope"
url
,
redirect_type
=
f
"/scope_details?doc_id={es_id}"
,
"scope"
...
...
unify_api/modules/common/procedures/multi_lang.py
View file @
6c411fe4
...
@@ -4,7 +4,7 @@ DATE:2024/5/30 11:34
...
@@ -4,7 +4,7 @@ DATE:2024/5/30 11:34
"""
"""
from
pot_libs.logger
import
log
from
pot_libs.logger
import
log
from
unify_api.constants
import
E_TYPE_LANG
,
PHASE_LINE_LANG
from
unify_api.constants
import
E_TYPE_LANG
,
PHASE_LINE_LANG
,
E_TYPE_NAME_LANG
def
load_event_msg
(
e_type
,
event_param
,
lang
):
def
load_event_msg
(
e_type
,
event_param
,
lang
):
...
@@ -29,3 +29,7 @@ def load_phase_line(mtr_name, lang):
...
@@ -29,3 +29,7 @@ def load_phase_line(mtr_name, lang):
return
PHASE_LINE_LANG
.
get
(
lst
[
-
1
],
{})
.
get
(
lang
)
return
PHASE_LINE_LANG
.
get
(
lst
[
-
1
],
{})
.
get
(
lang
)
return
""
return
""
def
load_e_type_name
(
e_type
,
lang
=
"zh_CN"
):
return
E_TYPE_NAME_LANG
.
get
(
e_type
,
{})
.
get
(
lang
,
""
)
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