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