Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MyEMS
MyEMS能源管理系统
提交
5e975de3
M
MyEMS能源管理系统
项目概览
MyEMS
/
MyEMS能源管理系统
通知
46
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
MyEMS能源管理系统
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5e975de3
编写于
3月 01, 2023
作者:
C
caozhenhui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modified the non-working days consumption table on the storeenergycategory
上级
cd70802a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
358 addition
and
7 deletion
+358
-7
myems-api/excelexporters/storeenergycategory.py
myems-api/excelexporters/storeenergycategory.py
+124
-0
myems-api/reports/storeenergycategory.py
myems-api/reports/storeenergycategory.py
+89
-7
myems-web/src/components/MyEMS/Store/StoreEnergyCategory.js
myems-web/src/components/MyEMS/Store/StoreEnergyCategory.js
+145
-0
未找到文件。
myems-api/excelexporters/storeenergycategory.py
浏览文件 @
5e975de3
...
...
@@ -539,6 +539,130 @@ def generate_excel(report,
current_row_number
+=
1
####################################################################################################################
if
"non_working_days_subtotals"
not
in
report
[
'base_period'
].
keys
()
or
\
report
[
'base_period'
][
'non_working_days_subtotals'
]
is
None
or
\
len
(
report
[
'base_period'
][
'non_working_days_subtotals'
])
==
0
or
\
"working_days_subtotals"
not
in
report
[
'base_period'
].
keys
()
or
\
report
[
'base_period'
][
'working_days_subtotals'
]
is
None
or
\
len
(
report
[
'base_period'
][
'working_days_subtotals'
])
==
0
or
\
base_period_start_datetime_local
is
None
or
\
len
(
str
.
strip
(
base_period_start_datetime_local
))
==
0
or
\
base_period_end_datetime_local
is
None
or
\
len
(
str
.
strip
(
base_period_end_datetime_local
))
==
0
:
pass
else
:
ws
[
'B'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'B'
+
str
(
current_row_number
)]
=
name
+
' '
+
_
(
'Base Period Consumption'
)
current_row_number
+=
1
ws
.
row_dimensions
[
current_row_number
].
height
=
60
ws
[
'B'
+
str
(
current_row_number
)].
fill
=
table_fill
ws
[
'B'
+
str
(
current_row_number
)].
font
=
name_font
ws
[
'B'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'B'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)].
fill
=
table_fill
ws
[
'C'
+
str
(
current_row_number
)].
font
=
name_font
ws
[
'C'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'C'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)]
=
_
(
'Non Working Days'
)
+
_
(
'Consumption'
)
ws
[
'D'
+
str
(
current_row_number
)].
fill
=
table_fill
ws
[
'D'
+
str
(
current_row_number
)].
font
=
name_font
ws
[
'D'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'D'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'D'
+
str
(
current_row_number
)]
=
_
(
'Working Days'
)
+
_
(
'Consumption'
)
current_row_number
+=
1
ca_len
=
len
(
report
[
'base_period'
][
'names'
])
for
i
in
range
(
0
,
ca_len
):
ws
[
'B'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'B'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'B'
+
str
(
current_row_number
)]
=
report
[
'base_period'
][
'names'
][
i
]
+
" ("
+
report
[
'base_period'
][
'units'
][
i
]
+
")"
ws
[
'B'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'C'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'C'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)]
=
report
[
'base_period'
][
'non_working_days_subtotals'
][
i
]
if
\
len
(
report
[
'store'
][
'working_calendars'
])
>
0
and
\
report
[
'base_period'
][
'non_working_days_subtotals'
][
i
]
>
0
else
'-'
ws
[
'D'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'D'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'D'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'D'
+
str
(
current_row_number
)]
=
report
[
'base_period'
][
'working_days_subtotals'
][
i
]
if
\
len
(
report
[
'store'
][
'working_calendars'
])
>
0
and
\
report
[
'base_period'
][
'working_days_subtotals'
][
i
]
>
0
else
'-'
current_row_number
+=
1
current_row_number
+=
1
if
"non_working_days_subtotals"
not
in
report
[
'reporting_period'
].
keys
()
or
\
report
[
'reporting_period'
][
'non_working_days_subtotals'
]
is
None
or
\
len
(
report
[
'reporting_period'
][
'non_working_days_subtotals'
])
==
0
or
\
"working_days_subtotals"
not
in
report
[
'reporting_period'
].
keys
()
or
\
report
[
'reporting_period'
][
'working_days_subtotals'
]
is
None
or
\
len
(
report
[
'reporting_period'
][
'working_days_subtotals'
])
==
0
:
pass
else
:
ws
[
'B'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'B'
+
str
(
current_row_number
)]
=
name
+
' '
+
_
(
'Reporting Period Consumption'
)
current_row_number
+=
1
ws
.
row_dimensions
[
current_row_number
].
height
=
60
ws
[
'B'
+
str
(
current_row_number
)].
fill
=
table_fill
ws
[
'B'
+
str
(
current_row_number
)].
font
=
name_font
ws
[
'B'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'B'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)].
fill
=
table_fill
ws
[
'C'
+
str
(
current_row_number
)].
font
=
name_font
ws
[
'C'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'C'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)]
=
_
(
'Non Working Days'
)
+
_
(
'Consumption'
)
ws
[
'D'
+
str
(
current_row_number
)].
fill
=
table_fill
ws
[
'D'
+
str
(
current_row_number
)].
font
=
name_font
ws
[
'D'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'D'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'D'
+
str
(
current_row_number
)]
=
_
(
'Working Days'
)
+
_
(
'Consumption'
)
current_row_number
+=
1
ca_len
=
len
(
report
[
'reporting_period'
][
'names'
])
for
i
in
range
(
0
,
ca_len
):
ws
[
'B'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'B'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'B'
+
str
(
current_row_number
)]
=
report
[
'reporting_period'
][
'names'
][
i
]
+
" ("
+
report
[
'reporting_period'
][
'units'
][
i
]
+
")"
ws
[
'B'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'C'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'C'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'C'
+
str
(
current_row_number
)]
=
report
[
'reporting_period'
][
'non_working_days_subtotals'
][
i
]
if
\
len
(
report
[
'store'
][
'working_calendars'
])
>
0
and
\
report
[
'reporting_period'
][
'non_working_days_subtotals'
][
i
]
>
0
else
'-'
ws
[
'D'
+
str
(
current_row_number
)].
font
=
title_font
ws
[
'D'
+
str
(
current_row_number
)].
alignment
=
c_c_alignment
ws
[
'D'
+
str
(
current_row_number
)].
border
=
f_border
ws
[
'D'
+
str
(
current_row_number
)]
=
report
[
'reporting_period'
][
'working_days_subtotals'
][
i
]
if
\
len
(
report
[
'store'
][
'working_calendars'
])
>
0
and
\
report
[
'reporting_period'
][
'working_days_subtotals'
][
i
]
>
0
else
'-'
current_row_number
+=
1
current_row_number
+=
2
####################################################################################################################
# Fifth: Detailed Data
# current_row_number: title
...
...
myems-api/reports/storeenergycategory.py
浏览文件 @
5e975de3
...
...
@@ -28,11 +28,12 @@ class Reporting:
# Step 3: query energy categories
# Step 4: query associated sensors
# Step 5: query associated points
# Step 6: query base period energy input
# Step 7: query reporting period energy input
# Step 8: query tariff data
# Step 9: query associated sensors and points data
# Step 10: construct the report
# Step 6: query associated working calendars
# Step 7: query base period energy input
# Step 8: query reporting period energy input
# Step 9: query tariff data
# Step 10: query associated sensors and points data
# Step 11: construct the report
####################################################################################################################
@
staticmethod
def
on_get
(
req
,
resp
):
...
...
@@ -86,6 +87,7 @@ class Reporting:
base_period_start_datetime_local
=
str
.
strip
(
base_period_start_datetime_local
)
try
:
base_start_datetime_utc
=
datetime
.
strptime
(
base_period_start_datetime_local
,
'%Y-%m-%dT%H:%M:%S'
)
base_start_datetime_non_working_day
=
str
(
base_period_start_datetime_local
).
split
(
'T'
)[
0
]
except
ValueError
:
raise
falcon
.
HTTPError
(
falcon
.
HTTP_400
,
title
=
'API.BAD_REQUEST'
,
description
=
"API.INVALID_BASE_PERIOD_START_DATETIME"
)
...
...
@@ -102,6 +104,7 @@ class Reporting:
base_period_end_datetime_local
=
str
.
strip
(
base_period_end_datetime_local
)
try
:
base_end_datetime_utc
=
datetime
.
strptime
(
base_period_end_datetime_local
,
'%Y-%m-%dT%H:%M:%S'
)
base_end_datetime_non_working_day
=
str
(
base_period_end_datetime_local
).
split
(
'T'
)[
0
]
except
ValueError
:
raise
falcon
.
HTTPError
(
falcon
.
HTTP_400
,
title
=
'API.BAD_REQUEST'
,
description
=
"API.INVALID_BASE_PERIOD_END_DATETIME"
)
...
...
@@ -121,6 +124,7 @@ class Reporting:
try
:
reporting_start_datetime_utc
=
datetime
.
strptime
(
reporting_period_start_datetime_local
,
'%Y-%m-%dT%H:%M:%S'
)
reporting_start_datetime_non_working_day
=
str
(
reporting_period_start_datetime_local
).
split
(
'T'
)[
0
]
except
ValueError
:
raise
falcon
.
HTTPError
(
falcon
.
HTTP_400
,
title
=
'API.BAD_REQUEST'
,
description
=
"API.INVALID_REPORTING_PERIOD_START_DATETIME"
)
...
...
@@ -141,6 +145,7 @@ class Reporting:
reporting_end_datetime_utc
=
datetime
.
strptime
(
reporting_period_end_datetime_local
,
'%Y-%m-%dT%H:%M:%S'
).
replace
(
tzinfo
=
timezone
.
utc
)
-
\
timedelta
(
minutes
=
timezone_offset
)
reporting_end_datetime_non_working_day
=
str
(
reporting_period_end_datetime_local
).
split
(
'T'
)[
0
]
except
ValueError
:
raise
falcon
.
HTTPError
(
falcon
.
HTTP_400
,
title
=
'API.BAD_REQUEST'
,
description
=
"API.INVALID_REPORTING_PERIOD_END_DATETIME"
)
...
...
@@ -300,11 +305,42 @@ class Reporting:
for
row
in
rows_points
:
point_list
.
append
({
"id"
:
row
[
0
],
"name"
:
row
[
1
],
"units"
:
row
[
2
],
"object_type"
:
row
[
3
]})
################################################################################################################
# Step 6: query associated working calendars
################################################################################################################
working_calendar_list
=
list
()
cursor_system
.
execute
(
" SELECT swc.id "
" FROM tbl_stores s, tbl_stores_working_calendars swc "
" WHERE s.id = %s AND s.id = swc.store_id "
,
(
store
[
'id'
],
))
rows
=
cursor_system
.
fetchall
()
if
rows
is
not
None
and
len
(
rows
)
>
0
:
for
row
in
rows
:
working_calendar_list
.
append
(
row
[
0
])
################################################################################################################
# Step
6
: query base period energy input
# Step
7
: query base period energy input
################################################################################################################
base
=
dict
()
base
[
'non_working_days'
]
=
list
()
if
energy_category_set
is
not
None
and
len
(
energy_category_set
)
>
0
:
if
base_start_datetime_utc
is
not
None
and
base_end_datetime_utc
is
not
None
:
cursor_system
.
execute
(
" SELECT nwd.date_local "
" FROM tbl_stores s, tbl_stores_working_calendars swc, "
" tbl_working_calendars_non_working_days nwd "
" WHERE s.id = %s AND "
" s.id = swc.store_id AND "
" swc.working_calendar_id = nwd.working_calendar_id AND"
" nwd.date_local >= %s AND"
" nwd.date_local <= %s "
,
(
store
[
'id'
],
base_start_datetime_non_working_day
,
base_end_datetime_non_working_day
))
rows
=
cursor_system
.
fetchall
()
for
row
in
rows
:
row_datetime
=
row
[
0
].
strftime
(
'%Y-%m-%d'
)
base
[
'non_working_days'
].
append
(
row_datetime
)
for
energy_category_id
in
energy_category_set
:
kgce
=
energy_category_dict
[
energy_category_id
][
'kgce'
]
kgco2e
=
energy_category_dict
[
energy_category_id
][
'kgco2e'
]
...
...
@@ -315,6 +351,8 @@ class Reporting:
base
[
energy_category_id
][
'subtotal'
]
=
Decimal
(
0.0
)
base
[
energy_category_id
][
'subtotal_in_kgce'
]
=
Decimal
(
0.0
)
base
[
energy_category_id
][
'subtotal_in_kgco2e'
]
=
Decimal
(
0.0
)
base
[
energy_category_id
][
'non_working_days_subtotal'
]
=
Decimal
(
0.0
)
base
[
energy_category_id
][
'working_days_subtotal'
]
=
Decimal
(
0.0
)
cursor_energy
.
execute
(
" SELECT start_datetime_utc, actual_value "
" FROM tbl_store_input_category_hourly "
...
...
@@ -353,12 +391,32 @@ class Reporting:
base
[
energy_category_id
][
'subtotal'
]
+=
actual_value
base
[
energy_category_id
][
'subtotal_in_kgce'
]
+=
actual_value
*
kgce
base
[
energy_category_id
][
'subtotal_in_kgco2e'
]
+=
actual_value
*
kgco2e
if
current_datetime
in
base
[
'non_working_days'
]:
base
[
energy_category_id
][
'non_working_days_subtotal'
]
+=
actual_value
else
:
base
[
energy_category_id
][
'working_days_subtotal'
]
+=
actual_value
################################################################################################################
# Step 8: query reporting period energy input
################################################################################################################
reporting
=
dict
()
reporting
[
'non_working_days'
]
=
list
()
if
energy_category_set
is
not
None
and
len
(
energy_category_set
)
>
0
:
cursor_system
.
execute
(
" SELECT nwd.date_local "
" FROM tbl_stores s, tbl_stores_working_calendars swc, "
" tbl_working_calendars_non_working_days nwd "
" WHERE s.id = %s AND "
" s.id = swc.store_id AND "
" swc.working_calendar_id = nwd.working_calendar_id AND"
" nwd.date_local >= %s AND"
" nwd.date_local <= %s "
,
(
store
[
'id'
],
reporting_start_datetime_non_working_day
,
reporting_end_datetime_non_working_day
))
rows
=
cursor_system
.
fetchall
()
for
row
in
rows
:
row_datetime
=
row
[
0
].
strftime
(
'%Y-%m-%d'
)
reporting
[
'non_working_days'
].
append
(
row_datetime
)
for
energy_category_id
in
energy_category_set
:
kgce
=
energy_category_dict
[
energy_category_id
][
'kgce'
]
kgco2e
=
energy_category_dict
[
energy_category_id
][
'kgco2e'
]
...
...
@@ -373,6 +431,9 @@ class Reporting:
reporting
[
energy_category_id
][
'onpeak'
]
=
Decimal
(
0.0
)
reporting
[
energy_category_id
][
'midpeak'
]
=
Decimal
(
0.0
)
reporting
[
energy_category_id
][
'offpeak'
]
=
Decimal
(
0.0
)
reporting
[
energy_category_id
][
'non_working_days_subtotal'
]
=
Decimal
(
0.0
)
reporting
[
energy_category_id
][
'working_days_subtotal'
]
=
Decimal
(
0.0
)
cursor_energy
.
execute
(
" SELECT start_datetime_utc, actual_value "
" FROM tbl_store_input_category_hourly "
...
...
@@ -411,6 +472,10 @@ class Reporting:
reporting
[
energy_category_id
][
'subtotal'
]
+=
actual_value
reporting
[
energy_category_id
][
'subtotal_in_kgce'
]
+=
actual_value
*
kgce
reporting
[
energy_category_id
][
'subtotal_in_kgco2e'
]
+=
actual_value
*
kgco2e
if
current_datetime
in
reporting
[
'non_working_days'
]:
reporting
[
energy_category_id
][
'non_working_days_subtotal'
]
+=
actual_value
else
:
reporting
[
energy_category_id
][
'working_days_subtotal'
]
+=
actual_value
energy_category_tariff_dict
=
utilities
.
get_energy_category_peak_types
(
store
[
'cost_center_id'
],
energy_category_id
,
...
...
@@ -520,7 +585,7 @@ class Reporting:
parameters_data
[
'values'
].
append
(
point_values
)
################################################################################################################
# Step 1
2
: construct the report
# Step 1
1
: construct the report
################################################################################################################
if
cursor_system
:
cursor_system
.
close
()
...
...
@@ -542,6 +607,7 @@ class Reporting:
result
[
'store'
]
=
dict
()
result
[
'store'
][
'name'
]
=
store
[
'name'
]
result
[
'store'
][
'area'
]
=
store
[
'area'
]
result
[
'store'
][
'working_calendars'
]
=
working_calendar_list
result
[
'base_period'
]
=
dict
()
result
[
'base_period'
][
'names'
]
=
list
()
...
...
@@ -553,6 +619,10 @@ class Reporting:
result
[
'base_period'
][
'subtotals_in_kgco2e'
]
=
list
()
result
[
'base_period'
][
'total_in_kgce'
]
=
Decimal
(
0.0
)
result
[
'base_period'
][
'total_in_kgco2e'
]
=
Decimal
(
0.0
)
result
[
'base_period'
][
'non_working_days_subtotals'
]
=
list
()
result
[
'base_period'
][
'working_days_subtotals'
]
=
list
()
result
[
'base_period'
][
'non_working_days_total'
]
=
Decimal
(
0.0
)
result
[
'base_period'
][
'working_days_total'
]
=
Decimal
(
0.0
)
if
energy_category_set
is
not
None
and
len
(
energy_category_set
)
>
0
:
for
energy_category_id
in
energy_category_set
:
result
[
'base_period'
][
'names'
].
append
(
energy_category_dict
[
energy_category_id
][
'name'
])
...
...
@@ -564,6 +634,10 @@ class Reporting:
result
[
'base_period'
][
'subtotals_in_kgco2e'
].
append
(
base
[
energy_category_id
][
'subtotal_in_kgco2e'
])
result
[
'base_period'
][
'total_in_kgce'
]
+=
base
[
energy_category_id
][
'subtotal_in_kgce'
]
result
[
'base_period'
][
'total_in_kgco2e'
]
+=
base
[
energy_category_id
][
'subtotal_in_kgco2e'
]
result
[
'base_period'
][
'non_working_days_subtotals'
].
append
(
base
[
energy_category_id
][
'non_working_days_subtotal'
])
result
[
'base_period'
][
'working_days_subtotals'
].
append
(
base
[
energy_category_id
][
'working_days_subtotal'
])
result
[
'base_period'
][
'non_working_days_total'
]
+=
base
[
energy_category_id
][
'non_working_days_subtotal'
]
result
[
'base_period'
][
'working_days_total'
]
+=
base
[
energy_category_id
][
'working_days_subtotal'
]
result
[
'reporting_period'
]
=
dict
()
result
[
'reporting_period'
][
'names'
]
=
list
()
...
...
@@ -585,6 +659,10 @@ class Reporting:
result
[
'reporting_period'
][
'total_in_kgco2e'
]
=
Decimal
(
0.0
)
result
[
'reporting_period'
][
'increment_rate_in_kgce'
]
=
Decimal
(
0.0
)
result
[
'reporting_period'
][
'increment_rate_in_kgco2e'
]
=
Decimal
(
0.0
)
result
[
'reporting_period'
][
'non_working_days_subtotals'
]
=
list
()
result
[
'reporting_period'
][
'working_days_subtotals'
]
=
list
()
result
[
'reporting_period'
][
'non_working_days_total'
]
=
Decimal
(
0.0
)
result
[
'reporting_period'
][
'working_days_total'
]
=
Decimal
(
0.0
)
if
energy_category_set
is
not
None
and
len
(
energy_category_set
)
>
0
:
for
energy_category_id
in
energy_category_set
:
...
...
@@ -610,6 +688,10 @@ class Reporting:
if
base
[
energy_category_id
][
'subtotal'
]
>
0.0
else
None
)
result
[
'reporting_period'
][
'total_in_kgce'
]
+=
reporting
[
energy_category_id
][
'subtotal_in_kgce'
]
result
[
'reporting_period'
][
'total_in_kgco2e'
]
+=
reporting
[
energy_category_id
][
'subtotal_in_kgco2e'
]
result
[
'reporting_period'
][
'non_working_days_subtotals'
].
append
(
reporting
[
energy_category_id
][
'non_working_days_subtotal'
])
result
[
'reporting_period'
][
'working_days_subtotals'
].
append
(
reporting
[
energy_category_id
][
'working_days_subtotal'
])
result
[
'reporting_period'
][
'non_working_days_total'
]
+=
reporting
[
energy_category_id
][
'non_working_days_subtotal'
]
result
[
'reporting_period'
][
'working_days_total'
]
+=
reporting
[
energy_category_id
][
'working_days_subtotal'
]
rate
=
list
()
for
index
,
value
in
enumerate
(
reporting
[
energy_category_id
][
'values'
]):
...
...
myems-web/src/components/MyEMS/Store/StoreEnergyCategory.js
浏览文件 @
5e975de3
...
...
@@ -36,6 +36,7 @@ import AppContext from '../../../context/Context';
import
MultipleLineChart
from
'
../common/MultipleLineChart
'
;
const
DetailedDataTable
=
loadable
(()
=>
import
(
'
../common/DetailedDataTable
'
));
const
WorkingDaysConsumptionTable
=
loadable
(()
=>
import
(
'
../common/WorkingDaysConsumptionTable
'
));
const
StoreEnergyCategory
=
({
setRedirect
,
setRedirectUrl
,
t
})
=>
{
let
current_moment
=
moment
();
...
...
@@ -137,6 +138,9 @@ const StoreEnergyCategory = ({ setRedirect, setRedirectUrl, t }) => {
const
[
detailedDataTableColumns
,
setDetailedDataTableColumns
]
=
useState
([{
dataField
:
'
startdatetime
'
,
text
:
t
(
'
Datetime
'
),
sort
:
true
}]);
const
[
excelBytesBase64
,
setExcelBytesBase64
]
=
useState
(
undefined
);
const
[
workingDaysConsumptionTableData
,
setWorkingDaysConsumptionTableData
]
=
useState
([]);
const
[
workingDaysConsumptionTableColumns
,
setWorkingDaysConsumptionTableColumns
]
=
useState
([{
dataField
:
'
name
'
,
text
:
t
(
'
Energy Category
'
),
sort
:
true
}]);
useEffect
(()
=>
{
let
isResponseOK
=
false
;
fetch
(
APIBaseURL
+
'
/spaces/tree
'
,
{
...
...
@@ -596,6 +600,58 @@ const StoreEnergyCategory = ({ setRedirect, setRedirectUrl, t }) => {
});
});
setDetailedDataTableColumns
(
detailed_column_list
);
let
workding_days_table_column_list
=
[];
workding_days_table_column_list
.
push
({
dataField
:
'
name
'
,
text
:
t
(
'
Energy Category
'
),
sort
:
true
});
workding_days_table_column_list
.
push
({
dataField
:
'
b0
'
,
text
:
t
(
'
Reporting Period
'
)
+
'
-
'
+
t
(
'
Working Days
'
),
sort
:
false
,
formatter
:
function
(
decimalValue
)
{
if
(
typeof
decimalValue
===
'
number
'
)
{
if
(
decimalValue
===
0
)
{
return
'
-
'
}
return
decimalValue
.
toFixed
(
2
);
}
else
{
return
decimalValue
;
}
}
});
workding_days_table_column_list
.
push
({
dataField
:
'
b1
'
,
text
:
t
(
'
Reporting Period
'
)
+
'
-
'
+
t
(
'
Non Working Days
'
),
sort
:
false
,
formatter
:
function
(
decimalValue
)
{
if
(
typeof
decimalValue
===
'
number
'
)
{
if
(
decimalValue
===
0
)
{
return
'
-
'
}
return
decimalValue
.
toFixed
(
2
);
}
else
{
return
decimalValue
;
}
}
});
setWorkingDaysConsumptionTableColumns
(
workding_days_table_column_list
);
let
working_days_table_value_list
=
[];
json
[
'
reporting_period
'
][
'
names
'
].
forEach
((
currentValue
,
index
)
=>
{
let
working_days_table_value
=
{};
let
unit
=
json
[
'
reporting_period
'
][
'
units
'
][
index
];
working_days_table_value
[
'
name
'
]
=
currentValue
+
'
(
'
+
unit
+
'
)
'
;
working_days_table_value
[
'
b0
'
]
=
json
[
'
store
'
][
'
working_calendars
'
].
length
>
0
?
json
[
'
reporting_period
'
][
'
working_days_subtotals
'
][
index
]
:
"
-
"
;
working_days_table_value
[
'
b1
'
]
=
json
[
'
store
'
][
'
working_calendars
'
].
length
>
0
?
json
[
'
reporting_period
'
][
'
non_working_days_subtotals
'
][
index
]
:
"
-
"
;
working_days_table_value_list
.
push
(
working_days_table_value
);
});
setWorkingDaysConsumptionTableData
(
working_days_table_value_list
);
}
else
{
/*
* Tip:
...
...
@@ -681,6 +737,90 @@ const StoreEnergyCategory = ({ setRedirect, setRedirectUrl, t }) => {
setDetailedDataTableData
(
detailed_value_list
);
},
0
)
}
let
workding_days_table_column_list
=
[];
workding_days_table_column_list
.
push
({
dataField
:
'
name
'
,
text
:
t
(
'
Energy Category
'
),
sort
:
true
});
workding_days_table_column_list
.
push
({
dataField
:
'
a0
'
,
text
:
t
(
'
Base Period
'
)
+
'
-
'
+
t
(
'
Working Days
'
),
sort
:
false
,
formatter
:
function
(
decimalValue
)
{
if
(
typeof
decimalValue
===
'
number
'
)
{
if
(
decimalValue
===
0
)
{
return
'
-
'
}
return
decimalValue
.
toFixed
(
2
);
}
else
{
return
decimalValue
;
}
}
});
workding_days_table_column_list
.
push
({
dataField
:
'
a1
'
,
text
:
t
(
'
Base Period
'
)
+
'
-
'
+
t
(
'
Non Working Days
'
),
sort
:
false
,
formatter
:
function
(
decimalValue
)
{
if
(
typeof
decimalValue
===
'
number
'
)
{
if
(
decimalValue
===
0
)
{
return
'
-
'
}
return
decimalValue
.
toFixed
(
2
);
}
else
{
return
decimalValue
;
}
}
});
workding_days_table_column_list
.
push
({
dataField
:
'
b0
'
,
text
:
t
(
'
Reporting Period
'
)
+
'
-
'
+
t
(
'
Working Days
'
),
sort
:
false
,
formatter
:
function
(
decimalValue
)
{
if
(
typeof
decimalValue
===
'
number
'
)
{
if
(
decimalValue
===
0
)
{
return
'
-
'
}
return
decimalValue
.
toFixed
(
2
);
}
else
{
return
decimalValue
;
}
}
});
workding_days_table_column_list
.
push
({
dataField
:
'
b1
'
,
text
:
t
(
'
Reporting Period
'
)
+
'
-
'
+
t
(
'
Non Working Days
'
),
sort
:
false
,
formatter
:
function
(
decimalValue
)
{
if
(
typeof
decimalValue
===
'
number
'
)
{
if
(
decimalValue
===
0
)
{
return
'
-
'
}
return
decimalValue
.
toFixed
(
2
);
}
else
{
return
decimalValue
;
}
}
});
setWorkingDaysConsumptionTableColumns
(
workding_days_table_column_list
);
let
working_days_table_value_list
=
[];
json
[
'
base_period
'
][
'
names
'
].
forEach
((
currentValue
,
index
)
=>
{
let
working_days_table_value
=
{};
let
unit
=
json
[
'
base_period
'
][
'
units
'
][
index
];
working_days_table_value
[
'
name
'
]
=
currentValue
+
'
(
'
+
unit
+
'
)
'
;
working_days_table_value
[
'
a0
'
]
=
json
[
'
store
'
][
'
working_calendars
'
].
length
>
0
?
json
[
'
base_period
'
][
'
working_days_subtotals
'
][
index
]
:
"
-
"
;
working_days_table_value
[
'
a1
'
]
=
json
[
'
store
'
][
'
working_calendars
'
].
length
>
0
?
json
[
'
base_period
'
][
'
non_working_days_subtotals
'
][
index
]
:
"
-
"
;
working_days_table_value
[
'
b0
'
]
=
json
[
'
store
'
][
'
working_calendars
'
].
length
>
0
?
json
[
'
reporting_period
'
][
'
working_days_subtotals
'
][
index
]
:
"
-
"
;
working_days_table_value
[
'
b1
'
]
=
json
[
'
store
'
][
'
working_calendars
'
].
length
>
0
?
json
[
'
reporting_period
'
][
'
non_working_days_subtotals
'
][
index
]
:
"
-
"
;
working_days_table_value_list
.
push
(
working_days_table_value
);
});
setWorkingDaysConsumptionTableData
(
working_days_table_value_list
);
}
setExcelBytesBase64
(
json
[
'
excel_bytes_base64
'
]);
...
...
@@ -914,6 +1054,11 @@ const StoreEnergyCategory = ({ setRedirect, setRedirectUrl, t }) => {
options
=
{
parameterLineChartOptions
}
>
<
/MultipleLineChart
>
<
br
/>
<
WorkingDaysConsumptionTable
data
=
{
workingDaysConsumptionTableData
}
title
=
{
t
(
'
CATEGORY Consumption UNIT
'
,
{
'
CATEGORY
'
:
t
(
'
Working Days
'
)
+
'
/
'
+
t
(
'
Non Working Days
'
)
})}
columns
=
{
workingDaysConsumptionTableColumns
}
>
<
/WorkingDaysConsumptionTable
>
<
DetailedDataTable
data
=
{
detailedDataTableData
}
title
=
{
t
(
'
Detailed Data
'
)}
columns
=
{
detailedDataTableColumns
}
pagesize
=
{
50
}
>
<
/DetailedDataTable
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录