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
5c1c0772
Commit
5c1c0772
authored
Jul 05, 2023
by
lcn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
3e5aea6a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
syncretize_energy_services.py
...modules/elec_charge/service/syncretize_energy_services.py
+21
-14
No files found.
unify_api/modules/elec_charge/service/syncretize_energy_services.py
View file @
5c1c0772
...
...
@@ -110,7 +110,8 @@ async def pv_evaluate_compute_service(download=None, url=None, **body):
invest_capacity
=
total_capacity
*
body
.
get
(
"capacity_per_meter"
)
/
1000
if
not
invest_capacity
:
return
success_res
(
code
=
4008
,
msg
=
"场地面积/面积折算系数/单位面积容量不能为0"
)
return
success_res
(
code
=
4008
,
msg
=
"场地面积/面积折算系数/单位面积容量不能为0"
)
except
:
return
success_res
(
code
=
4008
,
msg
=
"工厂容器参数有误"
)
if
(
pendulum_end
-
pendulum_start
)
.
in_months
()
<
1
:
...
...
@@ -359,7 +360,8 @@ async def ess_evaluate_compute_service(download=None, url=None, **body):
elec_prices
=
await
get_elec_price_dao
(
body
.
get
(
"cid"
))
# elec_price = {key: ";".join(value) for key, value in elec_prices.items() if value}
if
not
elec_prices
:
log
.
error
(
f
"该厂还未设置电价, cid:{body.get('cid')}, table:price_policy"
)
log
.
error
(
f
"该厂还未设置电价, cid:{body.get('cid')}, table:price_policy"
)
return
success_res
(
code
=
4008
,
msg
=
"该厂还未设置电价"
)
section_time_range
=
get_section_time_range
(
elec_prices
[
"quarters"
])
# 获取工厂容量
...
...
@@ -375,6 +377,8 @@ async def ess_evaluate_compute_service(download=None, url=None, **body):
max_demand_list
=
[
json
.
loads
(
demand
[
"has_space"
])
for
demand
in
max_demand
if
demand
[
"has_space"
]]
for
demand
in
max_demand_list
:
if
len
(
demand
)
==
0
:
continue
if
demand
[
0
]
and
max_demand_flag
is
False
:
max_demand_flag
=
True
max_demand_pmax
+=
demand
[
1
]
...
...
@@ -388,9 +392,9 @@ async def ess_evaluate_compute_service(download=None, url=None, **body):
p_slots
=
{
"
%02
d:
%02
d:00"
%
(
i
,
j
):
[]
for
i
in
range
(
24
)
for
j
in
range
(
0
,
60
,
15
)}
for
data
in
datas
:
create_time
=
data
[
"create_time"
]
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
# 1全部 2工作日 3非工作日
if
body
.
get
(
"work_day"
)
==
"2"
:
create_time
=
data
[
"create_time"
]
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
if
ChineseCalendar
(
create_time
[:
10
])
.
is_workday
()
and
data
[
"p"
]:
p_slots
[
create_time
[
11
:
19
]]
.
append
(
...
...
@@ -531,7 +535,8 @@ async def electrovalence_setting_service(cid, price_md, price_tc, std_cos,
if
now_time
in
t
.
keys
():
print
(
now_time
)
print
(
t
)
return
success_res
(
code
=
400
,
msg
=
"电价配置信息有误,存在重叠时间"
)
return
success_res
(
code
=
400
,
msg
=
"电价配置信息有误,存在重叠时间"
)
t
[
now_time
]
=
elec
[
"name"
]
# 结束时间的分钟数不是0
elif
index
==
(
fina
-
1
)
and
end
[
1
]
!=
"00"
:
...
...
@@ -540,7 +545,8 @@ async def electrovalence_setting_service(cid, price_md, price_tc, std_cos,
if
now_time
in
t
.
keys
():
print
(
now_time
)
print
(
t
)
return
success_res
(
code
=
400
,
msg
=
"电价配置信息有误,存在重叠时间"
)
return
success_res
(
code
=
400
,
msg
=
"电价配置信息有误,存在重叠时间"
)
t
[
now_time
]
=
elec
[
"name"
]
else
:
for
j
in
range
(
0
,
60
,
15
):
...
...
@@ -548,7 +554,8 @@ async def electrovalence_setting_service(cid, price_md, price_tc, std_cos,
if
now_time
in
t
.
keys
():
print
(
now_time
)
print
(
t
)
return
success_res
(
code
=
400
,
msg
=
"电价配置信息有误,存在重叠时间"
)
return
success_res
(
code
=
400
,
msg
=
"电价配置信息有误,存在重叠时间"
)
t
[
now_time
]
=
elec
[
"name"
]
if
len
(
t
.
keys
())
!=
24
*
4
:
return
success_res
(
code
=
400
,
msg
=
"电价配置信息有误,缺少时间段"
)
...
...
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