1. bug fix

2. 修改權限
3. 電站交叉分析 不預設
This commit is contained in:
Kai 2021-08-30 15:50:43 +08:00
parent 3060aa64ce
commit 821599ce31
14 changed files with 135 additions and 70 deletions

View File

@ -165,7 +165,7 @@ namespace SolarPower.Controllers
var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList();
InverterHistoryInfo Irradiance = new InverterHistoryInfo(); InverterHistoryInfo Irradiance = new InverterHistoryInfo();
Irradiance.Name = string.Format("{0}:{1}", item.Key, "日照度"); Irradiance.Name = string.Format("{0}:{1}", item.First().INVERTERName, "日照度");
Irradiance.YaxesKey = "Irradiance"; Irradiance.YaxesKey = "Irradiance";
Irradiance.Values = new List<double>(); Irradiance.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -183,7 +183,7 @@ namespace SolarPower.Controllers
InverterHistoryInfo DCKW = new InverterHistoryInfo(); InverterHistoryInfo DCKW = new InverterHistoryInfo();
DCKW.Name = string.Format("{0}:{1}", item.Key, "直流功率 (KW)"); DCKW.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流功率 (KW)");
DCKW.YaxesKey = "DCKW"; DCKW.YaxesKey = "DCKW";
DCKW.Values = new List<double>(); DCKW.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -200,7 +200,7 @@ namespace SolarPower.Controllers
series.Add(DCKW); series.Add(DCKW);
InverterHistoryInfo ACKW = new InverterHistoryInfo(); InverterHistoryInfo ACKW = new InverterHistoryInfo();
ACKW.Name = string.Format("{0}:{1}", item.Key, "輸出功率 (KW)"); ACKW.Name = string.Format("{0}:{1}", item.First().INVERTERName, "輸出功率 (KW)");
ACKW.YaxesKey = "ACKW"; ACKW.YaxesKey = "ACKW";
ACKW.Values = new List<double>(); ACKW.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -217,7 +217,7 @@ namespace SolarPower.Controllers
series.Add(ACKW); series.Add(ACKW);
InverterHistoryInfo DC1V = new InverterHistoryInfo(); InverterHistoryInfo DC1V = new InverterHistoryInfo();
DC1V.Name = string.Format("{0}:{1}", item.Key, "直流電壓1 (V)"); DC1V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電壓1 (V)");
DC1V.YaxesKey = "DC1V"; DC1V.YaxesKey = "DC1V";
DC1V.Values = new List<double>(); DC1V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -234,7 +234,7 @@ namespace SolarPower.Controllers
series.Add(DC1V); series.Add(DC1V);
InverterHistoryInfo DC1A = new InverterHistoryInfo(); InverterHistoryInfo DC1A = new InverterHistoryInfo();
DC1A.Name = string.Format("{0}:{1}", item.Key, "直流電流1 (A)"); DC1A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電流1 (A)");
DC1A.YaxesKey = "DC1A"; DC1A.YaxesKey = "DC1A";
DC1A.Values = new List<double>(); DC1A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -251,7 +251,7 @@ namespace SolarPower.Controllers
series.Add(DC1A); series.Add(DC1A);
InverterHistoryInfo DC1KW = new InverterHistoryInfo(); InverterHistoryInfo DC1KW = new InverterHistoryInfo();
DC1KW.Name = string.Format("{0}:{1}", item.Key, "直流功率1 (KW)"); DC1KW.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流功率1 (KW)");
DC1KW.YaxesKey = "DC1KW"; DC1KW.YaxesKey = "DC1KW";
DC1KW.Values = new List<double>(); DC1KW.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -268,7 +268,7 @@ namespace SolarPower.Controllers
series.Add(DC1KW); series.Add(DC1KW);
InverterHistoryInfo DC2V = new InverterHistoryInfo(); InverterHistoryInfo DC2V = new InverterHistoryInfo();
DC2V.Name = string.Format("{0}:{1}", item.Key, "直流電壓2 (V)"); DC2V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電壓2 (V)");
DC2V.YaxesKey = "DC2V"; DC2V.YaxesKey = "DC2V";
DC2V.Values = new List<double>(); DC2V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -285,7 +285,7 @@ namespace SolarPower.Controllers
series.Add(DC2V); series.Add(DC2V);
InverterHistoryInfo DC2A = new InverterHistoryInfo(); InverterHistoryInfo DC2A = new InverterHistoryInfo();
DC2A.Name = string.Format("{0}:{1}", item.Key, "直流電流2 (A)"); DC2A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電流2 (A)");
DC2A.YaxesKey = "DC2A"; DC2A.YaxesKey = "DC2A";
DC2A.Values = new List<double>(); DC2A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -302,7 +302,7 @@ namespace SolarPower.Controllers
series.Add(DC2A); series.Add(DC2A);
InverterHistoryInfo DC2KW = new InverterHistoryInfo(); InverterHistoryInfo DC2KW = new InverterHistoryInfo();
DC2KW.Name = string.Format("{0}:{1}", item.Key, "直流功率2 (KW)"); DC2KW.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流功率2 (KW)");
DC2KW.YaxesKey = "DC2KW"; DC2KW.YaxesKey = "DC2KW";
DC2KW.Values = new List<double>(); DC2KW.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -319,7 +319,7 @@ namespace SolarPower.Controllers
series.Add(DC2KW); series.Add(DC2KW);
InverterHistoryInfo DC3V = new InverterHistoryInfo(); InverterHistoryInfo DC3V = new InverterHistoryInfo();
DC3V.Name = string.Format("{0}:{1}", item.Key, "直流電壓3 (V)"); DC3V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電壓3 (V)");
DC3V.YaxesKey = "DC3V"; DC3V.YaxesKey = "DC3V";
DC3V.Values = new List<double>(); DC3V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -336,7 +336,7 @@ namespace SolarPower.Controllers
series.Add(DC3V); series.Add(DC3V);
InverterHistoryInfo DC3A = new InverterHistoryInfo(); InverterHistoryInfo DC3A = new InverterHistoryInfo();
DC3A.Name = string.Format("{0}:{1}", item.Key, "直流電流3 (A)"); DC3A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電流3 (A)");
DC3A.YaxesKey = "DC3A"; DC3A.YaxesKey = "DC3A";
DC3A.Values = new List<double>(); DC3A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -353,7 +353,7 @@ namespace SolarPower.Controllers
series.Add(DC3A); series.Add(DC3A);
InverterHistoryInfo DC3KW = new InverterHistoryInfo(); InverterHistoryInfo DC3KW = new InverterHistoryInfo();
DC3KW.Name = string.Format("{0}:{1}", item.Key, "直流功率3 (KW)"); DC3KW.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流功率3 (KW)");
DC3KW.YaxesKey = "DC3KW"; DC3KW.YaxesKey = "DC3KW";
DC3KW.Values = new List<double>(); DC3KW.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -370,7 +370,7 @@ namespace SolarPower.Controllers
series.Add(DC3KW); series.Add(DC3KW);
InverterHistoryInfo DC4V = new InverterHistoryInfo(); InverterHistoryInfo DC4V = new InverterHistoryInfo();
DC4V.Name = string.Format("{0}:{1}", item.Key, "直流電壓4 (V)"); DC4V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電壓4 (V)");
DC4V.YaxesKey = "DC4V"; DC4V.YaxesKey = "DC4V";
DC4V.Values = new List<double>(); DC4V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -387,7 +387,7 @@ namespace SolarPower.Controllers
series.Add(DC4V); series.Add(DC4V);
InverterHistoryInfo DC4A = new InverterHistoryInfo(); InverterHistoryInfo DC4A = new InverterHistoryInfo();
DC4A.Name = string.Format("{0}:{1}", item.Key, "直流電流4 (A)"); DC4A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電流4 (A)");
DC4A.YaxesKey = "DC4A"; DC4A.YaxesKey = "DC4A";
DC4A.Values = new List<double>(); DC4A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -404,7 +404,7 @@ namespace SolarPower.Controllers
series.Add(DC4A); series.Add(DC4A);
InverterHistoryInfo DC4KW = new InverterHistoryInfo(); InverterHistoryInfo DC4KW = new InverterHistoryInfo();
DC4KW.Name = string.Format("{0}:{1}", item.Key, "直流功率4 (KW)"); DC4KW.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流功率4 (KW)");
DC4KW.YaxesKey = "DC4KW"; DC4KW.YaxesKey = "DC4KW";
DC4KW.Values = new List<double>(); DC4KW.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -421,7 +421,7 @@ namespace SolarPower.Controllers
series.Add(DC4KW); series.Add(DC4KW);
InverterHistoryInfo DC5V = new InverterHistoryInfo(); InverterHistoryInfo DC5V = new InverterHistoryInfo();
DC5V.Name = string.Format("{0}:{1}", item.Key, "直流電壓5 (V)"); DC5V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電壓5 (V)");
DC5V.YaxesKey = "DC5V"; DC5V.YaxesKey = "DC5V";
DC5V.Values = new List<double>(); DC5V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -438,7 +438,7 @@ namespace SolarPower.Controllers
series.Add(DC5V); series.Add(DC5V);
InverterHistoryInfo DC5A = new InverterHistoryInfo(); InverterHistoryInfo DC5A = new InverterHistoryInfo();
DC5A.Name = string.Format("{0}:{1}", item.Key, "直流電流5 (A)"); DC5A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流電流5 (A)");
DC5A.YaxesKey = "DC5A"; DC5A.YaxesKey = "DC5A";
DC5A.Values = new List<double>(); DC5A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -455,7 +455,7 @@ namespace SolarPower.Controllers
series.Add(DC5A); series.Add(DC5A);
InverterHistoryInfo DC5KW = new InverterHistoryInfo(); InverterHistoryInfo DC5KW = new InverterHistoryInfo();
DC5KW.Name = string.Format("{0}:{1}", item.Key, "直流功率5 (KW)"); DC5KW.Name = string.Format("{0}:{1}", item.First().INVERTERName, "直流功率5 (KW)");
DC5KW.YaxesKey = "DC5KW"; DC5KW.YaxesKey = "DC5KW";
DC5KW.Values = new List<double>(); DC5KW.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -472,7 +472,7 @@ namespace SolarPower.Controllers
series.Add(DC5KW); series.Add(DC5KW);
InverterHistoryInfo AC1V = new InverterHistoryInfo(); InverterHistoryInfo AC1V = new InverterHistoryInfo();
AC1V.Name = string.Format("{0}:{1}", item.Key, "交流電壓A (V)"); AC1V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "交流電壓A (V)");
AC1V.YaxesKey = "AC1V"; AC1V.YaxesKey = "AC1V";
AC1V.Values = new List<double>(); AC1V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -489,7 +489,7 @@ namespace SolarPower.Controllers
series.Add(AC1V); series.Add(AC1V);
InverterHistoryInfo AC2V = new InverterHistoryInfo(); InverterHistoryInfo AC2V = new InverterHistoryInfo();
AC2V.Name = string.Format("{0}:{1}", item.Key, "交流電壓B (V)"); AC2V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "交流電壓B (V)");
AC2V.YaxesKey = "AC2V"; AC2V.YaxesKey = "AC2V";
AC2V.Values = new List<double>(); AC2V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -506,7 +506,7 @@ namespace SolarPower.Controllers
series.Add(AC2V); series.Add(AC2V);
InverterHistoryInfo AC3V = new InverterHistoryInfo(); InverterHistoryInfo AC3V = new InverterHistoryInfo();
AC3V.Name = string.Format("{0}:{1}", item.Key, "交流電壓C (V)"); AC3V.Name = string.Format("{0}:{1}", item.First().INVERTERName, "交流電壓C (V)");
AC3V.YaxesKey = "AC3V"; AC3V.YaxesKey = "AC3V";
AC3V.Values = new List<double>(); AC3V.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -523,7 +523,7 @@ namespace SolarPower.Controllers
series.Add(AC3V); series.Add(AC3V);
InverterHistoryInfo AC1A = new InverterHistoryInfo(); InverterHistoryInfo AC1A = new InverterHistoryInfo();
AC1A.Name = string.Format("{0}:{1}", item.Key, "交流電流A (A)"); AC1A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "交流電流A (A)");
AC1A.YaxesKey = "AC1A"; AC1A.YaxesKey = "AC1A";
AC1A.Values = new List<double>(); AC1A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -540,7 +540,7 @@ namespace SolarPower.Controllers
series.Add(AC1A); series.Add(AC1A);
InverterHistoryInfo AC2A = new InverterHistoryInfo(); InverterHistoryInfo AC2A = new InverterHistoryInfo();
AC2A.Name = string.Format("{0}:{1}", item.Key, "交流電流B (A)"); AC2A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "交流電流B (A)");
AC2A.YaxesKey = "AC2A"; AC2A.YaxesKey = "AC2A";
AC2A.Values = new List<double>(); AC2A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -557,7 +557,7 @@ namespace SolarPower.Controllers
series.Add(AC2A); series.Add(AC2A);
InverterHistoryInfo AC3A = new InverterHistoryInfo(); InverterHistoryInfo AC3A = new InverterHistoryInfo();
AC3A.Name = string.Format("{0}:{1}", item.Key, "交流電流C (A)"); AC3A.Name = string.Format("{0}:{1}", item.First().INVERTERName, "交流電流C (A)");
AC3A.YaxesKey = "AC3A"; AC3A.YaxesKey = "AC3A";
AC3A.Values = new List<double>(); AC3A.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -574,7 +574,7 @@ namespace SolarPower.Controllers
series.Add(AC3A); series.Add(AC3A);
InverterHistoryInfo PR = new InverterHistoryInfo(); InverterHistoryInfo PR = new InverterHistoryInfo();
PR.Name = string.Format("{0}:{1}", item.Key, "PR"); PR.Name = string.Format("{0}:{1}", item.First().INVERTERName, "PR");
PR.YaxesKey = "PR"; PR.YaxesKey = "PR";
PR.Values = new List<double>(); PR.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -591,7 +591,7 @@ namespace SolarPower.Controllers
series.Add(PR); series.Add(PR);
InverterHistoryInfo RA1 = new InverterHistoryInfo(); InverterHistoryInfo RA1 = new InverterHistoryInfo();
RA1.Name = string.Format("{0}:{1}", item.Key, "RA1 (%)"); RA1.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA1 (%)");
RA1.YaxesKey = "RA1"; RA1.YaxesKey = "RA1";
RA1.Values = new List<double>(); RA1.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -608,7 +608,7 @@ namespace SolarPower.Controllers
series.Add(RA1); series.Add(RA1);
InverterHistoryInfo RA2 = new InverterHistoryInfo(); InverterHistoryInfo RA2 = new InverterHistoryInfo();
RA2.Name = string.Format("{0}:{1}", item.Key, "RA2 (%)"); RA2.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA2 (%)");
RA2.YaxesKey = "RA2"; RA2.YaxesKey = "RA2";
RA2.Values = new List<double>(); RA2.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -625,7 +625,7 @@ namespace SolarPower.Controllers
series.Add(RA2); series.Add(RA2);
InverterHistoryInfo RA3 = new InverterHistoryInfo(); InverterHistoryInfo RA3 = new InverterHistoryInfo();
RA3.Name = string.Format("{0}:{1}", item.Key, "RA3 (%)"); RA3.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA3 (%)");
RA3.YaxesKey = "RA3"; RA3.YaxesKey = "RA3";
RA3.Values = new List<double>(); RA3.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -642,7 +642,7 @@ namespace SolarPower.Controllers
series.Add(RA3); series.Add(RA3);
InverterHistoryInfo RA4 = new InverterHistoryInfo(); InverterHistoryInfo RA4 = new InverterHistoryInfo();
RA4.Name = string.Format("{0}:{1}", item.Key, "RA4 (%)"); RA4.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA4 (%)");
RA4.YaxesKey = "RA4"; RA4.YaxesKey = "RA4";
RA4.Values = new List<double>(); RA4.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -659,7 +659,7 @@ namespace SolarPower.Controllers
series.Add(RA4); series.Add(RA4);
InverterHistoryInfo RA5 = new InverterHistoryInfo(); InverterHistoryInfo RA5 = new InverterHistoryInfo();
RA5.Name = string.Format("{0}:{1}", item.Key, "RA5 (%)"); RA5.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA5 (%)");
RA5.YaxesKey = "RA5"; RA5.YaxesKey = "RA5";
RA5.Values = new List<double>(); RA5.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -684,8 +684,11 @@ namespace SolarPower.Controllers
stationIdWithInverterIdsList = new List<StationIdWithInverterIds>(); stationIdWithInverterIdsList = new List<StationIdWithInverterIds>();
foreach (var ps in powerStation_Group) foreach (var ps in powerStation_Group)
{ {
var powerStation = await powerStationRepository.GetOneAsync(ps.Key);
StationIdWithInverterIds stationIdWithInverterIds = new StationIdWithInverterIds(); StationIdWithInverterIds stationIdWithInverterIds = new StationIdWithInverterIds();
stationIdWithInverterIds.PowerStationId = ps.Key; stationIdWithInverterIds.PowerStationId = ps.Key;
stationIdWithInverterIds.SiteDBName = powerStation.SiteDB;
stationIdWithInverterIds.InverterIds = ps.Select(x => x.InverterId).ToList(); stationIdWithInverterIds.InverterIds = ps.Select(x => x.InverterId).ToList();
stationIdWithInverterIdsList.Add(stationIdWithInverterIds); stationIdWithInverterIdsList.Add(stationIdWithInverterIds);
@ -736,7 +739,7 @@ namespace SolarPower.Controllers
var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList();
InverterHistoryInfo Irradiance = new InverterHistoryInfo(); InverterHistoryInfo Irradiance = new InverterHistoryInfo();
Irradiance.Name = string.Format("{0}:{1}", item.Key, "日照度"); Irradiance.Name = string.Format("{0}:{1}", item.First().INVERTERName, "日照度");
Irradiance.YaxesKey = "Irradiance"; Irradiance.YaxesKey = "Irradiance";
Irradiance.Values = new List<double>(); Irradiance.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -753,7 +756,7 @@ namespace SolarPower.Controllers
series.Add(Irradiance); series.Add(Irradiance);
InverterHistoryInfo KWH = new InverterHistoryInfo(); InverterHistoryInfo KWH = new InverterHistoryInfo();
KWH.Name = string.Format("{0}:{1}", item.Key, "KWH"); KWH.Name = string.Format("{0}:{1}", item.First().INVERTERName, "KWH");
KWH.YaxesKey = "KWH"; KWH.YaxesKey = "KWH";
KWH.Values = new List<double>(); KWH.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -770,7 +773,7 @@ namespace SolarPower.Controllers
series.Add(KWH); series.Add(KWH);
InverterHistoryInfo TodayKWH = new InverterHistoryInfo(); InverterHistoryInfo TodayKWH = new InverterHistoryInfo();
TodayKWH.Name = string.Format("{0}:{1}", item.Key, "TodayKWH"); TodayKWH.Name = string.Format("{0}:{1}", item.First().INVERTERName, "TodayKWH");
TodayKWH.YaxesKey = "TodayKWH"; TodayKWH.YaxesKey = "TodayKWH";
TodayKWH.Values = new List<double>(); TodayKWH.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -787,7 +790,7 @@ namespace SolarPower.Controllers
series.Add(TodayKWH); series.Add(TodayKWH);
InverterHistoryInfo TotalKWH = new InverterHistoryInfo(); InverterHistoryInfo TotalKWH = new InverterHistoryInfo();
TotalKWH.Name = string.Format("{0}:{1}", item.Key, "TotalKWH"); TotalKWH.Name = string.Format("{0}:{1}", item.First().INVERTERName, "TotalKWH");
TotalKWH.YaxesKey = "TotalKWH"; TotalKWH.YaxesKey = "TotalKWH";
TotalKWH.Values = new List<double>(); TotalKWH.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -805,7 +808,7 @@ namespace SolarPower.Controllers
InverterHistoryInfo PR = new InverterHistoryInfo(); InverterHistoryInfo PR = new InverterHistoryInfo();
PR.Name = string.Format("{0}:{1}", item.Key, "PR"); PR.Name = string.Format("{0}:{1}", item.First().INVERTERName, "PR");
PR.YaxesKey = "PR"; PR.YaxesKey = "PR";
PR.Values = new List<double>(); PR.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -822,7 +825,7 @@ namespace SolarPower.Controllers
series.Add(PR); series.Add(PR);
InverterHistoryInfo RA1 = new InverterHistoryInfo(); InverterHistoryInfo RA1 = new InverterHistoryInfo();
RA1.Name = string.Format("{0}:{1}", item.Key, "RA1 (%)"); RA1.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA1 (%)");
RA1.YaxesKey = "RA1"; RA1.YaxesKey = "RA1";
RA1.Values = new List<double>(); RA1.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -839,7 +842,7 @@ namespace SolarPower.Controllers
series.Add(RA1); series.Add(RA1);
InverterHistoryInfo RA2 = new InverterHistoryInfo(); InverterHistoryInfo RA2 = new InverterHistoryInfo();
RA2.Name = string.Format("{0}:{1}", item.Key, "RA2 (%)"); RA2.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA2 (%)");
RA2.YaxesKey = "RA2"; RA2.YaxesKey = "RA2";
RA2.Values = new List<double>(); RA2.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -856,7 +859,7 @@ namespace SolarPower.Controllers
series.Add(RA2); series.Add(RA2);
InverterHistoryInfo RA3 = new InverterHistoryInfo(); InverterHistoryInfo RA3 = new InverterHistoryInfo();
RA3.Name = string.Format("{0}:{1}", item.Key, "RA3 (%)"); RA3.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA3 (%)");
RA3.YaxesKey = "RA3"; RA3.YaxesKey = "RA3";
RA3.Values = new List<double>(); RA3.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -873,7 +876,7 @@ namespace SolarPower.Controllers
series.Add(RA3); series.Add(RA3);
InverterHistoryInfo RA4 = new InverterHistoryInfo(); InverterHistoryInfo RA4 = new InverterHistoryInfo();
RA4.Name = string.Format("{0}:{1}", item.Key, "RA4 (%)"); RA4.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA4 (%)");
RA4.YaxesKey = "RA4"; RA4.YaxesKey = "RA4";
RA4.Values = new List<double>(); RA4.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)
@ -890,7 +893,7 @@ namespace SolarPower.Controllers
series.Add(RA4); series.Add(RA4);
InverterHistoryInfo RA5 = new InverterHistoryInfo(); InverterHistoryInfo RA5 = new InverterHistoryInfo();
RA5.Name = string.Format("{0}:{1}", item.Key, "RA5 (%)"); RA5.Name = string.Format("{0}:{1}", item.First().INVERTERName, "RA5 (%)");
RA5.YaxesKey = "RA5"; RA5.YaxesKey = "RA5";
RA5.Values = new List<double>(); RA5.Values = new List<double>();
foreach (var history in temp_item) foreach (var history in temp_item)

View File

@ -97,16 +97,26 @@ namespace SolarPower.Controllers
auth_arr.Add("PowerStation"); auth_arr.Add("PowerStation");
} }
if (x.Contains("StationOverview") && !auth_arr.Contains("StationOverview"))
{
auth_arr.Add("StationOverview");
}
auth_arr.Add(x); auth_arr.Add(x);
} }
} }
if (myUser.Role.Layer != (int)RoleLayerEnum.PlatformAdmin && !auth_arr.Contains(controllerName)) if (myUser.Role.Layer != (int)RoleLayerEnum.PlatformAdmin && !auth_arr.Contains(controllerName))
{ {
//排除條件
if (auth_arr.Contains("StationOverview") && !auth_arr.Contains("PowerStation")) if (auth_arr.Contains("StationOverview") && !auth_arr.Contains("PowerStation"))
{ {
//只有電站總覽 且未包含 電站管理 //只有電站總覽 且未包含 電站管理
} }
else if(controllerName == "User" && (actionName == "ChangePassword" || actionName == "GetPersonalInfo" || actionName == "SavePersonalInfo"))
{
//查詢個人 資訊 及密碼
}
else else
{ {
filterContext.Result = new RedirectToRouteResult( filterContext.Result = new RedirectToRouteResult(

View File

@ -105,7 +105,6 @@ namespace SolarPower.Controllers
"Email", "Email",
"Phone", "Phone",
"UpdatedBy", "UpdatedBy",
"UpdatedAt",
"Id" "Id"
}; };

View File

@ -52,6 +52,7 @@ namespace SolarPower.Models
public class StationIdWithInverterIds public class StationIdWithInverterIds
{ {
public int PowerStationId { get; set; } public int PowerStationId { get; set; }
public string SiteDBName { get; set; }
public List<string> InverterIds { get; set; } public List<string> InverterIds { get; set; }
} }

View File

@ -291,6 +291,7 @@ namespace SolarPower.Repository.Implement
CASE WHEN cap_id.CompanyId IS NOT NULL THEN 1 ELSE 0 END AS CheckAuth CASE WHEN cap_id.CompanyId IS NOT NULL THEN 1 ELSE 0 END AS CheckAuth
FROM auth_page ap FROM auth_page ap
LEFT JOIN (SELECT * FROM company_auth_page WHERE CompanyId = @CompanyId) cap_id ON ap.AuthCode = cap_id.AuthCode LEFT JOIN (SELECT * FROM company_auth_page WHERE CompanyId = @CompanyId) cap_id ON ap.AuthCode = cap_id.AuthCode
ORDER BY ap.Priority
"; ";
result = (await conn.QueryAsync<CompanyAuthDataTable>(sql, new { CompanyId = companyId })).ToList(); result = (await conn.QueryAsync<CompanyAuthDataTable>(sql, new { CompanyId = companyId })).ToList();

View File

@ -253,7 +253,7 @@ namespace SolarPower.Repository.Implement
{ {
try try
{ {
var sql = $"SELECT * FROM {tableName}"; var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0";
result = (await conn.QueryAsync<T>(sql)).ToList(); result = (await conn.QueryAsync<T>(sql)).ToList();
} }
@ -277,7 +277,7 @@ namespace SolarPower.Repository.Implement
{ {
try try
{ {
var sql = $"SELECT * FROM {tableName} WHERE id = @Id"; var sql = $"SELECT * FROM {tableName} WHERE id = @Id AND Deleted = 0";
result = await conn.QueryFirstOrDefaultAsync<T>(sql, new { Id = id }); result = await conn.QueryFirstOrDefaultAsync<T>(sql, new { Id = id });
} }

View File

@ -261,13 +261,14 @@ namespace SolarPower.Repository.Implement
var sql = @$"SELECT ap2.AuthCode, ap2.MainName, ap2.SubName, ap2.TagName var sql = @$"SELECT ap2.AuthCode, ap2.MainName, ap2.SubName, ap2.TagName
FROM FROM
( (
SELECT cap.CompanyId, cap.AuthCode, ap.MainName, ap.SubName, ap.TagName , ap.ControlName SELECT cap.CompanyId, cap.AuthCode, ap.MainName, ap.SubName, ap.TagName , ap.ControlName, ap.Priority
FROM company_auth_page cap FROM company_auth_page cap
LEFT JOIN auth_page ap ON cap.AuthCode = ap.AuthCode LEFT JOIN auth_page ap ON cap.AuthCode = ap.AuthCode
WHERE cap.CompanyId = @CompanyId WHERE cap.CompanyId = @CompanyId
) ap2 ) ap2
LEFT JOIN role_auth ra ON ap2.AuthCode = ra.AuthCode AND ra.Id = @RoleId LEFT JOIN role_auth ra ON ap2.AuthCode = ra.AuthCode AND ra.Id = @RoleId
WHERE ra.AuthCode IS NULL WHERE ra.AuthCode IS NULL
ORDER BY ap2.Priority
"; ";
result = (await conn.QueryAsync<AuthPage>(sql, new { CompanyId = post.SelectedCompanyId, RoleId = post.SelectedRoleId})).ToList(); result = (await conn.QueryAsync<AuthPage>(sql, new { CompanyId = post.SelectedCompanyId, RoleId = post.SelectedRoleId})).ToList();

View File

@ -0,0 +1,26 @@
using SolarPower.Models;
using SolarPower.Models.PowerStation;
using SolarPower.Repository.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SolarPower.Services.Implement
{
public class MyPowerStationService
{
private readonly IPowerStationRepository powerStationRepository;
public MyPowerStationService(IPowerStationRepository powerStationRepository)
{
this.powerStationRepository = powerStationRepository;
}
//public List<PowerStation> GetMyPowerStations(MyUser myUser, List<int> CityIds = null, List<string> Where = null, List<OrderBy> Order_by = null)
//{
// List<PowerStation> powerStations = new List<PowerStation>();
// return powerStations;
//}
}
}

View File

@ -157,9 +157,9 @@
var default_compare_col = []; var default_compare_col = [];
var current_compare_col = []; var current_compare_col = [];
var Single_day_compare_col = [ var Single_day_compare_col = [
{ key: "Irradiance", title: "日照度", default: true }, { key: "Irradiance", title: "日照度", default: false },
{ key: "DCKW", title: "直流功率 (KW)", default: true }, { key: "DCKW", title: "直流功率 (KW)", default: false },
{ key: "ACKW", title: "輸出功率 (KW)", default: true }, { key: "ACKW", title: "輸出功率 (KW)", default: false },
{ key: "DC1V", title: "直流電壓1 (V)", default: false }, { key: "DC1V", title: "直流電壓1 (V)", default: false },
{ key: "DC1A", title: "直流電流1 (A)", default: false }, { key: "DC1A", title: "直流電流1 (A)", default: false },
{ key: "DC1KW", title: "直流功率1 (KW)", default: false }, { key: "DC1KW", title: "直流功率1 (KW)", default: false },
@ -189,8 +189,8 @@
{ key: "RA5", title: "RA5 (%)", default: false } { key: "RA5", title: "RA5 (%)", default: false }
] ]
var Range_compare_col = [ var Range_compare_col = [
{ key: "Irradiance", title: "日照度", default: true }, { key: "Irradiance", title: "日照度", default: false },
{ key: "KWH", title: "KWH", default: true }, { key: "KWH", title: "KWH", default: false },
{ key: "TodayKWH", title: "TodayKWH", default: false }, { key: "TodayKWH", title: "TodayKWH", default: false },
{ key: "TotalKWH", title: "TotalKWH", default: false }, { key: "TotalKWH", title: "TotalKWH", default: false },
{ key: "PR", title: "PR", default: false }, { key: "PR", title: "PR", default: false },
@ -415,7 +415,7 @@
default_compare_col.push($(this).val()); default_compare_col.push($(this).val());
} }
} else { } else {
if ($.inArray($(this).val(), default_compare_col) > 0) { if ($.inArray($(this).val(), default_compare_col) > -1) {
default_compare_col.splice($.inArray($(this).val(), default_compare_col), 1); default_compare_col.splice($.inArray($(this).val(), default_compare_col), 1);
} }
} }
@ -493,9 +493,9 @@
$('#js_list_accordion').append(str); $('#js_list_accordion').append(str);
$('#js_list_accordion').find('.card').first().addClass(" border-top-left-radius-0 border-top-right-radius-0"); $('#js_list_accordion').find('.card').first().addClass(" border-top-left-radius-0 border-top-right-radius-0");
if (selected_inverter.length <= 0) { @*if (selected_inverter.length <= 0) {
$('input[name="selectedInverterId[]"]').first().trigger("click"); $('input[name="selectedInverterId[]"]').first().trigger("click");
} }*@
$('input[name="selectedInverterId[]"]').each(function () { $('input[name="selectedInverterId[]"]').each(function () {
if ($.inArray(this.value, selected_inverter) > -1) { if ($.inArray(this.value, selected_inverter) > -1) {

View File

@ -123,7 +123,7 @@
var selected_device = []; var selected_device = [];
var PWS_compare_col = [ var PWS_compare_col = [
{ key: "KWH", title: "發電量", default: true }, { key: "KWH", title: "發電量", default: true },
{ key: "Irradiance", title: "日照度", default: true }, { key: "Irradiance", title: "日照度", default: false },
{ key: "KWHKWP", title: "發電小時", default: false }, { key: "KWHKWP", title: "發電小時", default: false },
{ key: "PR", title: "PR %", default: false }, { key: "PR", title: "PR %", default: false },
{ key: "Temperature", title: "模組溫度", default: false }, { key: "Temperature", title: "模組溫度", default: false },
@ -536,9 +536,9 @@
$('#js_list_accordion').find('.card').first().addClass(" border-top-left-radius-0 border-top-right-radius-0"); $('#js_list_accordion').find('.card').first().addClass(" border-top-left-radius-0 border-top-right-radius-0");
if (selected_device.length <= 0) { @*if (selected_device.length <= 0) {
$('input[name="selectedDeviceId[]"]').first().trigger("click"); $('input[name="selectedDeviceId[]"]').first().trigger("click");
} }*@
$('input[name="selectedDeviceId[]"]').each(function () { $('input[name="selectedDeviceId[]"]').each(function () {
if ($.inArray(this.value, selected_device) > -1) { if ($.inArray(this.value, selected_device) > -1) {

View File

@ -165,7 +165,14 @@
</a> </a>
</li> </li>
} }
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview")) @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin
|| ViewBag.auths.Contains("StationOverview_UpToDate")
|| ViewBag.auths.Contains("StationOverview_Info")
|| ViewBag.auths.Contains("StationOverview_InverterInfo")
|| ViewBag.auths.Contains("StationOverview_Inverter")
|| ViewBag.auths.Contains("StationOverview_History")
|| ViewBag.auths.Contains("StationOverview_Exception")
|| ViewBag.auths.Contains("StationOverview_OperationRecord"))
{ {
<li class="@(ViewData["MainNum"] == "1" && ViewData["SubNum"] == "2" ? "active" : "")"> <li class="@(ViewData["MainNum"] == "1" && ViewData["SubNum"] == "2" ? "active" : "")">
<a asp-controller="StationOverview" asp-action="Index" title="電站總覽" data-filter-tags="utilities disabled item"> <a asp-controller="StationOverview" asp-action="Index" title="電站總覽" data-filter-tags="utilities disabled item">
@ -177,7 +184,14 @@
</li> </li>
} }
<!-- Example of open and active states --> <!-- Example of open and active states -->
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStationInfo")) @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin
|| ViewBag.auths.Contains("StationOverview_UpToDate")
|| ViewBag.auths.Contains("StationOverview_Info")
|| ViewBag.auths.Contains("StationOverview_InverterInfo")
|| ViewBag.auths.Contains("StationOverview_Inverter")
|| ViewBag.auths.Contains("StationOverview_History")
|| ViewBag.auths.Contains("StationOverview_Exception")
|| ViewBag.auths.Contains("StationOverview_OperationRecord"))
{ {
<li class="@(ViewData["MainNum"] == "2" ? "active open" : "")"> <li class="@(ViewData["MainNum"] == "2" ? "active open" : "")">
<a href="javascript:void(0);" title="Category" data-filter-tags="category"> <a href="javascript:void(0);" title="Category" data-filter-tags="category">
@ -218,7 +232,10 @@
</ul> </ul>
</li> </li>
} }
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("AnalysisStationCombine") || ViewBag.auths.Contains("AnalysisStationInfo") || ViewBag.auths.Contains("AnalysisInverter")) @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin
|| ViewBag.auths.Contains("AnalysisStationCombine")
|| ViewBag.auths.Contains("AnalysisStationInfo")
|| ViewBag.auths.Contains("AnalysisInverter"))
{ {
<li class="@(ViewData["MainNum"] == "3" ? "active open" : "")"> <li class="@(ViewData["MainNum"] == "3" ? "active open" : "")">
<a href="#" title="Category" data-filter-tags="category"> <a href="#" title="Category" data-filter-tags="category">
@ -253,7 +270,11 @@
</ul> </ul>
</li> </li>
} }
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStation"))@*TODO:修改成報表的權限*@ @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin
|| ViewBag.auths.Contains("StationReport")
|| ViewBag.auths.Contains("ElectricitySoldRecord")
|| ViewBag.auths.Contains("PowerGeneration")
|| ViewBag.auths.Contains("NoticeSchedule"))
{ {
<li class="@(ViewData["MainNum"] == "4" ? "active open" : "")"> <li class="@(ViewData["MainNum"] == "4" ? "active open" : "")">
<a href="#" title="Category" data-filter-tags="category"> <a href="#" title="Category" data-filter-tags="category">
@ -285,7 +306,7 @@
</li> </li>
} }
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStation"))@*TODO:修改成即時告警的權限*@ @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("ExceptionRecord"))
{ {
<li class="@(ViewData["MainNum"] == "5" ? "active open" : "")"> <li class="@(ViewData["MainNum"] == "5" ? "active open" : "")">
<a href="#" title="Category" data-filter-tags="category"> <a href="#" title="Category" data-filter-tags="category">
@ -481,7 +502,7 @@
</a> </a>
<!-- app notification --> <!-- app notification -->
<div> <div>
<a href="#" class="header-icon" data-toggle="dropdown" title="You got 11 notifications"> <a href="#" class="header-icon" data-toggle="dropdown" title="You got 11 notifications" style="display:none">
<i class="fal fa-bell"></i> <i class="fal fa-bell"></i>
<span class="badge badge-icon">11</span> <span class="badge badge-icon">11</span>
</a> </a>

View File

@ -317,7 +317,7 @@
$('#citytest').empty(); $('#citytest').empty();
for (var i = 0; i < rel.data.length; i++) { for (var i = 0; i < rel.data.length; i++) {
$('#citytest').append("<button type='button' class='btn btn-success waves-effect waves-themed ml-2' id='" + 'cityID_' + rel.data[i].cityId + "'>" + $('#citytest').append("<button type='button' class='btn btn-success waves-effect waves-themed ml-2' id='" + 'cityID_' + rel.data[i].cityId + "'>" +
rel.data[i].city + rel.data[i].cityName +
"<span class= 'badge bg-success-700 ml-2' >" + rel.data[i].amount + "</span >" + "<span class= 'badge bg-success-700 ml-2' >" + rel.data[i].amount + "</span >" +
"</button >"); "</button >");
ids.push(rel.data[i].cityId); ids.push(rel.data[i].cityId);

View File

@ -49,11 +49,14 @@
</li> </li>
} }
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_InverterInfo"))
{
<li class="nav-item"> <li class="nav-item">
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-InverterInfo" role="tab"> <a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-InverterInfo" role="tab">
<i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1">逆變器監控</span> <i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1">逆變器監控</span>
</a> </a>
</li> </li>
}
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Inverter")) @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Inverter"))
{ {

View File

@ -329,7 +329,7 @@
"autoWidth": false, "autoWidth": false,
"responsive": false, "responsive": false,
"deferLoading": 0, "deferLoading": 0,
"order": [[5, "desc"]], "order": [[6, "desc"]],
"columns": [{ "columns": [{
"data": null, "data": null,
}, { }, {
@ -425,7 +425,7 @@
"paging": true, "paging": true,
"lengthChange": false, "lengthChange": false,
"searching": false, "searching": false,
"ordering": true, "ordering": false,
"info": true, "info": true,
"autoWidth": false, "autoWidth": false,
"responsive": false, "responsive": false,