電站管理-設備管理: 修改控制器啟用時,會出現錯誤訊息的問題
This commit is contained in:
parent
d8e5c88c2a
commit
fa93bb4834
@ -2564,14 +2564,16 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
DBName = powerStation.SiteDB,
|
DBName = powerStation.SiteDB,
|
||||||
Enabled = post.Enabled,
|
Enabled = post.Enabled,
|
||||||
Status = post.Status
|
Status = post.Status,
|
||||||
|
Id = post.Id
|
||||||
};
|
};
|
||||||
|
|
||||||
List<string> propertiesForMasterInvs = new List<string>()
|
List<string> propertiesForMasterInvs = new List<string>()
|
||||||
{
|
{
|
||||||
"DBName",
|
"DBName",
|
||||||
"Enabled",
|
"Enabled",
|
||||||
"Status"
|
"Status",
|
||||||
|
"Id"
|
||||||
};
|
};
|
||||||
await powerStationRepository.UpdateMasterInverter(inverterForMasterInvs, propertiesForMasterInvs);
|
await powerStationRepository.UpdateMasterInverter(inverterForMasterInvs, propertiesForMasterInvs);
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -640,6 +640,7 @@ namespace SolarPower.Models.PowerStation
|
|||||||
public int Deleted { get; set; }//是否刪除
|
public int Deleted { get; set; }//是否刪除
|
||||||
public int Enabled { get; set; }//是否啟用
|
public int Enabled { get; set; }//是否啟用
|
||||||
public int Status { get; set; }//狀態
|
public int Status { get; set; }//狀態
|
||||||
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -2045,9 +2045,9 @@ namespace SolarPower.Repository.Implement
|
|||||||
conn.Open();
|
conn.Open();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = @$"SELECT id, InverterId
|
string sql = $@"SELECT a.InverterId
|
||||||
FROM {db_name}.inverter
|
FROM solar_master.inv_status a join {db_name}.inverter b on a.inverterid = b.inverterid
|
||||||
WHERE Deleted = 0 AND Id = {id}";
|
WHERE a.Deleted = 0 AND b.Id = {id}";
|
||||||
inverter = (await conn.QueryFirstOrDefaultAsync<InverterTable>(sql, commandTimeout: 600));
|
inverter = (await conn.QueryFirstOrDefaultAsync<InverterTable>(sql, commandTimeout: 600));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2630,7 +2630,11 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = GenerateUpdateQueryWithCustomTable(properties, "inv_status");
|
string sql = $@"UPDATE solar_master.inv_status a join {entity.DBName}.inverter b on a.inverterid = b.inverterid
|
||||||
|
SET
|
||||||
|
a.Enabled = {entity.Enabled},
|
||||||
|
a.Status = {entity.Status}
|
||||||
|
WHERE b.id = {entity.Id}";
|
||||||
|
|
||||||
count = await conn.ExecuteAsync(sql, entity, trans);
|
count = await conn.ExecuteAsync(sql, entity, trans);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user