mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改台区电表参数
This commit is contained in:
@@ -896,7 +896,7 @@ Errcode HttpEntity::queryStationTodayU(const httplib::Request& req, njson& json,
|
||||
int n = Utils::timeDaySeconds() / 600;
|
||||
if (catogray == "1")
|
||||
{
|
||||
auto device = station->getDeviceByType(int(EDeviceType::E_METER), "2");
|
||||
auto device = station->getDeviceByType(int(EDeviceType::BMS), "1"); // 使用 BMS 的数据
|
||||
if (device) {
|
||||
jsondata["U"] = VectorToJsonArray(device->cacheU, n);
|
||||
jsondata["I"] = VectorToJsonArray(device->cacheI, n);
|
||||
@@ -1602,7 +1602,7 @@ Errcode HttpEntity::queryStatCharts(const httplib::Request& req, njson& json, st
|
||||
|
||||
njson jsondata;
|
||||
|
||||
std::string sql = R"(SELECT hd.*, d.`type` device_type, ddt.category FROM history_day hd
|
||||
std::string sql = R"(SELECT hd.*, d.`type` device_type, d.code, ddt.category FROM history_day hd
|
||||
LEFT JOIN device d ON d.device_id = hd.device_id
|
||||
LEFT JOIN def_device_type ddt ON d.`type` = ddt.device_type_id
|
||||
WHERE dt=')" + dt + "' AND d.station_id='" + stationId + "' AND ddt.category='" + category + "';";
|
||||
@@ -1621,6 +1621,16 @@ Errcode HttpEntity::queryStatCharts(const httplib::Request& req, njson& json, st
|
||||
{
|
||||
int datetype = fields.get<int>("datatype"); // 1: 电压,2:电流,3:功率
|
||||
std::string val = fields.value("value"); // JSON 数组(double)
|
||||
int deviceType = fields.get<int>("device_type");
|
||||
int deviceCode = fields.get<int>("code");
|
||||
if (category == "1")
|
||||
{
|
||||
if (!(deviceType == int(EDeviceType::BMS))) // 储能BMS(储能设备以BMS电池的数据作为总数据来展示)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
njson jsonval;
|
||||
if (JSON::parse(val, jsonval))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user