mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
实现削峰套利策略的编辑页面
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "Station.h"
|
||||
|
||||
#include "database/DAO.h"
|
||||
#include "database/SQL.h"
|
||||
|
||||
Station::Station(int id) : id(id)
|
||||
{
|
||||
@@ -18,4 +19,28 @@ std::shared_ptr<Device> Station::getDevice(int deviceId)
|
||||
return iter->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Station::setWorkMode(int modeId)
|
||||
{
|
||||
std::string sql = SQL(SQL::TYPE::update).table(DMStation::TABLENAME)
|
||||
.update(DMStation::WORK_MODE_ID, std::to_string(modeId))
|
||||
.where(DMStation::STATION_ID + "=" + std::to_string(id)).str();
|
||||
Errcode err = DAO::exec(NULL, sql);
|
||||
if (err != Errcode::OK)
|
||||
{
|
||||
XLOGE() << "set station work mode failed.";
|
||||
}
|
||||
}
|
||||
|
||||
void Station::setPolicy(int policyId)
|
||||
{
|
||||
std::string sql = SQL(SQL::TYPE::update).table(DMStation::TABLENAME)
|
||||
.update(DMStation::POLICY_ID, std::to_string(policyId))
|
||||
.where(DMStation::STATION_ID + "=" + std::to_string(id)).str();
|
||||
Errcode err = DAO::exec(NULL, sql);
|
||||
if (err != Errcode::OK)
|
||||
{
|
||||
XLOGE() << "set station policy failed.";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user