Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nengyuanzhang committed May 31, 2024
2 parents 130f3db + 35fc07c commit 8e6be3d
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 21 deletions.
2 changes: 2 additions & 0 deletions database/install/myems_system_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_energy_storage_power_stations`
`cost_center_id` BIGINT NOT NULL,
`svg` LONGTEXT NOT NULL,
`is_cost_data_displayed` BOOL NOT NULL,
`phase_of_lifecycle` VARCHAR(255) NOT NULL,
`description` VARCHAR(255),
PRIMARY KEY (`id`));
CREATE INDEX `tbl_energy_storage_power_stations_index_1`
Expand Down Expand Up @@ -856,6 +857,7 @@ CREATE TABLE IF NOT EXISTS `myems_system_db`.`tbl_microgrids` (
`serial_number` VARCHAR(255) NOT NULL,
`svg` LONGTEXT NOT NULL,
`is_cost_data_displayed` BOOL NOT NULL,
`phase_of_lifecycle` VARCHAR(255) NOT NULL,
`description` VARCHAR(255),
PRIMARY KEY (`id`));
CREATE INDEX `tbl_microgrids_index_1` ON `myems_system_db`.`tbl_microgrids` (`name`);
Expand Down
3 changes: 3 additions & 0 deletions database/upgrade/upgrade4.6.0RC.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ ALTER TABLE myems_system_db.tbl_energy_storage_containers_power_conversion_syste
ALTER TABLE myems_system_db.tbl_energy_storage_containers_power_conversion_systems ADD `today_discharge_energy_point_id` BIGINT NOT NULL AFTER `rated_output_power`;
ALTER TABLE myems_system_db.tbl_energy_storage_containers_power_conversion_systems ADD `today_charge_energy_point_id` BIGINT NOT NULL AFTER `rated_output_power`;

ALTER TABLE myems_system_db.tbl_energy_storage_power_stations ADD `phase_of_lifecycle` VARCHAR(255) NOT NULL AFTER `is_cost_data_displayed`;
ALTER TABLE myems_system_db.tbl_microgrids ADD `phase_of_lifecycle` VARCHAR(255) NOT NULL AFTER `is_cost_data_displayed`;

-- UPDATE VERSION NUMBER
UPDATE `myems_system_db`.`tbl_versions` SET version='4.6.0RC', release_date='2024-06-18' WHERE id=1;

Expand Down
7 changes: 4 additions & 3 deletions myems-api/reports/energystoragepowerstationdashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ def on_get(req, resp):
for row in rows_spaces:
space_dict[row[0]] = row[1]
print(space_dict)
# Get energy storage power station
# Get energy storage power stations
query = (" SELECT m.id, m.name, m.uuid, "
" m.address, m.postal_code, m.latitude, m.longitude, "
" m.rated_capacity, m.rated_power, m.description "
" m.rated_capacity, m.rated_power, m.description, m.phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations m, tbl_energy_storage_power_stations_users mu "
" WHERE m.id = mu.energy_storage_power_station_id AND mu.user_id = %s "
" ORDER BY name ")
" ORDER BY m.phase_of_lifecycle, m.id ")
cursor_system_db.execute(query, (user['id'],))
rows_energy_storage_power_stations = cursor_system_db.fetchall()

Expand Down Expand Up @@ -125,6 +125,7 @@ def on_get(req, resp):
"rated_capacity": row[7],
"rated_power": row[8],
"description": row[9],
"phase_of_lifecycle": row[10],
"status": 'online' if is_online else 'offline'}
energy_storage_power_station_list.append(meta_result)
################################################################################################################
Expand Down
5 changes: 3 additions & 2 deletions myems-api/reports/energystoragepowerstationdetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ def on_get(req, resp):
if energy_storage_power_station_id is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE id = %s ")
cursor_system.execute(query, (energy_storage_power_station_id,))
row = cursor_system.fetchone()
elif energy_storage_power_station_uuid is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE uuid = %s ")
cursor_system.execute(query, (energy_storage_power_station_uuid,))
Expand All @@ -138,6 +138,7 @@ def on_get(req, resp):
"cost_center": cost_center_dict.get(row[10], None),
"svg": row[11],
"description": row[12],
"phase_of_lifecycle": row[13],
"qrcode": 'energystoragepowerstation:' + row[2]}

point_list = list()
Expand Down
8 changes: 5 additions & 3 deletions myems-api/reports/energystoragepowerstationitembilling.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ def on_get(req, resp):
if energy_storage_power_station_id is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE id = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_id,))
row = cursor_system_db.fetchone()
elif energy_storage_power_station_uuid is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE uuid = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_uuid,))
Expand All @@ -116,7 +116,9 @@ def on_get(req, resp):
"longitude": row[6],
"rated_capacity": row[7],
"rated_power": row[8],
"description": row[9]}
"description": row[9],
"phase_of_lifecycle": row[10]
}

################################################################################################################
# Step 3: query charge billing data in 7 days
Expand Down
7 changes: 4 additions & 3 deletions myems-api/reports/energystoragepowerstationitemcarbon.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ def on_get(req, resp):
if energy_storage_power_station_id is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE id = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_id,))
row = cursor_system_db.fetchone()
elif energy_storage_power_station_uuid is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE uuid = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_uuid,))
Expand All @@ -116,7 +116,8 @@ def on_get(req, resp):
"longitude": row[6],
"rated_capacity": row[7],
"rated_power": row[8],
"description": row[9]}
"description": row[9],
"phase_of_lifecycle": row[10]}

################################################################################################################
# Step 3: query charge billing data in 7 days
Expand Down
7 changes: 4 additions & 3 deletions myems-api/reports/energystoragepowerstationitemdashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ def on_get(req, resp):
if energy_storage_power_station_id is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE id = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_id,))
row = cursor_system_db.fetchone()
elif energy_storage_power_station_uuid is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE uuid = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_uuid,))
Expand All @@ -114,7 +114,8 @@ def on_get(req, resp):
"longitude": row[6],
"rated_capacity": row[7],
"rated_power": row[8],
"description": row[9]}
"description": row[9],
"phase_of_lifecycle": row[10]}

################################################################################################################
# Step 3: query charge energy data
Expand Down
7 changes: 4 additions & 3 deletions myems-api/reports/energystoragepowerstationitemenergy.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ def on_get(req, resp):
if energy_storage_power_station_id is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE id = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_id,))
row = cursor_system_db.fetchone()
elif energy_storage_power_station_uuid is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE uuid = %s ")
cursor_system_db.execute(query, (energy_storage_power_station_uuid,))
Expand All @@ -116,7 +116,8 @@ def on_get(req, resp):
"longitude": row[6],
"rated_capacity": row[7],
"rated_power": row[8],
"description": row[9]}
"description": row[9],
"phase_of_lifecycle": row[10]}

################################################################################################################
# Step 3: query charge energy data in 7 days
Expand Down
5 changes: 3 additions & 2 deletions myems-api/reports/energystoragepowerstationlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def on_get(req, resp):
# get energy storage power stations
query = (" SELECT m.id, m.name, m.uuid, "
" m.address, m.postal_code, m.latitude, m.longitude, m.rated_capacity, m.rated_power, "
" m.contact_id, m.cost_center_id, m.description "
" m.contact_id, m.cost_center_id, m.description, m.phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations m, tbl_energy_storage_power_stations_users mu "
" WHERE m.id = mu.energy_storage_power_station_id AND mu.user_id = %s "
" ORDER BY id ")
" ORDER BY m.phase_of_lifecycle, m.id ")
cursor_system_db.execute(query, (user_id, ))
rows_energy_storage_power_stations = cursor_system_db.fetchall()

Expand Down Expand Up @@ -255,6 +255,7 @@ def on_get(req, resp):
"contact": contact_dict.get(row[9], None),
"cost_center": cost_center_dict.get(row[10], None),
"description": row[11],
"phase_of_lifecycle": row[12],
"qrcode": 'energystoragepowerstation:' + row[2],
"is_online": is_online,
"pcs_run_state": pcs_run_state,
Expand Down
5 changes: 3 additions & 2 deletions myems-api/reports/energystoragepowerstationreporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ def on_get(req, resp):
if energy_storage_power_station_id is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE id = %s ")
cursor_system.execute(query, (energy_storage_power_station_id,))
row = cursor_system.fetchone()
elif energy_storage_power_station_uuid is not None:
query = (" SELECT id, name, uuid, "
" address, postal_code, latitude, longitude, rated_capacity, rated_power, "
" contact_id, cost_center_id, svg, description "
" contact_id, cost_center_id, svg, description, phase_of_lifecycle "
" FROM tbl_energy_storage_power_stations "
" WHERE uuid = %s ")
cursor_system.execute(query, (energy_storage_power_station_uuid,))
Expand All @@ -262,6 +262,7 @@ def on_get(req, resp):
"cost_center": cost_center_dict.get(row[10], None),
"svg": row[11],
"description": row[12],
"phase_of_lifecycle": row[13],
"qrcode": 'energy_storage_power_station:' + row[2]}

point_list = list()
Expand Down

0 comments on commit 8e6be3d

Please sign in to comment.