1.啟用電站 - 設備檢查 - 含共用設備
2.啟用電站 - 設備檢查 - 含累計日照計檢查
This commit is contained in:
parent
0bd4791496
commit
5c58b583d7
@ -1,5 +1,12 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"isRoot": true,
|
"isRoot": true,
|
||||||
"tools": {}
|
"tools": {
|
||||||
|
"dotnet-ef": {
|
||||||
|
"version": "6.0.5",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-ef"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -3254,7 +3254,7 @@ namespace SolarPower.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var powerStation = await powerStationRepository.GetOneAsync(Id);
|
var powerStation = await powerStationRepository.GetOneAsync(Id);
|
||||||
status = await powerStationRepository.CheckStationStatus(powerStation.Code, powerStation.SiteDB);
|
status = await powerStationRepository.CheckStationStatus(powerStation.Code, powerStation.SiteDB, powerStation.Id.ToString());
|
||||||
if(status.Count > 0)
|
if(status.Count > 0)
|
||||||
{
|
{
|
||||||
apiResult.Code = "0099";
|
apiResult.Code = "0099";
|
||||||
|
|||||||
@ -5552,7 +5552,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<string>> CheckStationStatus(string code, string DBname)
|
public async Task<List<string>> CheckStationStatus(string code, string DBname, string powerStationID)
|
||||||
{
|
{
|
||||||
List<string> result;
|
List<string> result;
|
||||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||||
@ -5562,12 +5562,24 @@ namespace SolarPower.Repository.Implement
|
|||||||
List<PowerstationOption> devices = new List<PowerstationOption>
|
List<PowerstationOption> devices = new List<PowerstationOption>
|
||||||
{
|
{
|
||||||
new PowerstationOption{Text="日照計",Value="PYR"},
|
new PowerstationOption{Text="日照計",Value="PYR"},
|
||||||
new PowerstationOption{Text="模組溫度計",Value="MTR"}
|
new PowerstationOption{Text="模組溫度計",Value="MTR"},
|
||||||
|
new PowerstationOption{Text="累計日照計",Value="TPY"}
|
||||||
};
|
};
|
||||||
// devices.Add(new PowerstationOption { Text = "電表", Value = "PWR" });
|
// devices.Add(new PowerstationOption { Text = "電表", Value = "PWR" });
|
||||||
var sql2 = "";
|
var sql2 = "";
|
||||||
foreach (var device in devices)
|
foreach (var device in devices)
|
||||||
{
|
{
|
||||||
|
//sql2 += @$"#檢查是否存在設備({device.Text})#
|
||||||
|
// set @qry1:= concat('insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
|
||||||
|
// select ', siteID ,', ''device'', ''device_Type_{device.Value}'',
|
||||||
|
// case when count(*) > 0 then 0 else 1 end isError,
|
||||||
|
// now(),
|
||||||
|
// case when count(*) > 0 then Null else ''電站無正常啟用{device.Text}'' end error_reason
|
||||||
|
// from {DBname}.device b
|
||||||
|
// join power_station a on a.Id = b.PowerStationId
|
||||||
|
// where b.Deleted = 0 and b.Enabled = 1 and b.Status = 1 and b.Type = ''{device.Value}'' and a.`Code` = ', siteID );
|
||||||
|
// prepare stmt from @qry1 ;
|
||||||
|
// execute stmt ;";
|
||||||
sql2 += @$"#檢查是否存在設備({device.Text})#
|
sql2 += @$"#檢查是否存在設備({device.Text})#
|
||||||
set @qry1:= concat('insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
|
set @qry1:= concat('insert power_station_enable_check(siteID, check_type, check_item, isError, check_Date, error_reason)
|
||||||
select ', siteID ,', ''device'', ''device_Type_{device.Value}'',
|
select ', siteID ,', ''device'', ''device_Type_{device.Value}'',
|
||||||
@ -5575,8 +5587,9 @@ namespace SolarPower.Repository.Implement
|
|||||||
now(),
|
now(),
|
||||||
case when count(*) > 0 then Null else ''電站無正常啟用{device.Text}'' end error_reason
|
case when count(*) > 0 then Null else ''電站無正常啟用{device.Text}'' end error_reason
|
||||||
from {DBname}.device b
|
from {DBname}.device b
|
||||||
join power_station a on a.Id = b.PowerStationId
|
left join {DBname}.sharedevice c on b.id = c.DeviceId
|
||||||
where b.Deleted = 0 and b.Enabled = 1 and b.Status = 1 and b.Type = ''{device.Value}'' and a.`Code` = ', siteID );
|
where (b.PowerStationId = {powerStationID} or c.PowerStationId = {powerStationID})
|
||||||
|
and b.Deleted = 0 and b.Enabled = 1 and b.Status = 1 and b.Type = ''{device.Value}'' );
|
||||||
prepare stmt from @qry1 ;
|
prepare stmt from @qry1 ;
|
||||||
execute stmt ;";
|
execute stmt ;";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -610,7 +610,7 @@ namespace SolarPower.Repository.Interface
|
|||||||
Task<List<string>> GetShareDevicePowerstationName(int Id, string DBname);
|
Task<List<string>> GetShareDevicePowerstationName(int Id, string DBname);
|
||||||
Task DropShareDevice(int powerstationId, string DBname);
|
Task DropShareDevice(int powerstationId, string DBname);
|
||||||
Task DeleteALLPowerStationOperationPersonnel(int stationId);
|
Task DeleteALLPowerStationOperationPersonnel(int stationId);
|
||||||
Task<List<string>> CheckStationStatus(string code, string DBname);
|
Task<List<string>> CheckStationStatus(string code, string DBname, string powerStationID);
|
||||||
Task StationStatus(int stationId, int status, string subDB = "");
|
Task StationStatus(int stationId, int status, string subDB = "");
|
||||||
Task UpdateInvStatus(string siteDB, List<string> codes, List<string> inverterIds = null, byte status = 0);
|
Task UpdateInvStatus(string siteDB, List<string> codes, List<string> inverterIds = null, byte status = 0);
|
||||||
Task<List<InvStatusErr>> GetInvStatusErr(List<string> codes);
|
Task<List<InvStatusErr>> GetInvStatusErr(List<string> codes);
|
||||||
|
|||||||
@ -175,9 +175,12 @@ namespace solarApp.Service
|
|||||||
|
|
||||||
#region 獲取 Sensor 類別
|
#region 獲取 Sensor 類別
|
||||||
//沒有被刪除、啟用中、狀態正常的 才可列入計算
|
//沒有被刪除、啟用中、狀態正常的 才可列入計算
|
||||||
sql = @"select a.id, CONCAT( left(UID, 9) ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname
|
//sql = @"select a.id, CONCAT( left(UID, 9) ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname
|
||||||
from " + _siteDB + @".device a
|
// from " + _siteDB + @".device a
|
||||||
where left(UID, 11) = @siteID and deleted = 0 and enabled = 1 and `status` = 1 ";
|
// where left(UID, 11) = @siteID and deleted = 0 and enabled = 1 and `status` = 1 ";
|
||||||
|
sql = @$"select a.id, CONCAT( {_siteID} ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname
|
||||||
|
from {_siteDB}.device a join {_siteDB}.sharedevice b on a.id = b.deviceID
|
||||||
|
where (left(UID, 11) = @siteID or b.PowerStationID = {_powerStationID}) and deleted = 0 and enabled = 1 and `status` = 1 ";
|
||||||
List<sensor_model> ds_sensor = conn.Query<sensor_model>(sql, new { siteID = _siteID01 }).AsList<sensor_model>();
|
List<sensor_model> ds_sensor = conn.Query<sensor_model>(sql, new { siteID = _siteID01 }).AsList<sensor_model>();
|
||||||
|
|
||||||
//欄位處理
|
//欄位處理
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user