diff --git a/SolarPower/Controllers/AnalysisInverterController.cs b/SolarPower/Controllers/AnalysisInverterController.cs index 4905b0d..6590fe8 100644 --- a/SolarPower/Controllers/AnalysisInverterController.cs +++ b/SolarPower/Controllers/AnalysisInverterController.cs @@ -165,7 +165,7 @@ namespace SolarPower.Controllers var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); 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.Values = new List(); foreach (var history in temp_item) @@ -183,7 +183,7 @@ namespace SolarPower.Controllers 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.Values = new List(); foreach (var history in temp_item) @@ -200,7 +200,7 @@ namespace SolarPower.Controllers series.Add(DCKW); 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.Values = new List(); foreach (var history in temp_item) @@ -217,7 +217,7 @@ namespace SolarPower.Controllers series.Add(ACKW); 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.Values = new List(); foreach (var history in temp_item) @@ -234,7 +234,7 @@ namespace SolarPower.Controllers series.Add(DC1V); 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.Values = new List(); foreach (var history in temp_item) @@ -251,7 +251,7 @@ namespace SolarPower.Controllers series.Add(DC1A); 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.Values = new List(); foreach (var history in temp_item) @@ -268,7 +268,7 @@ namespace SolarPower.Controllers series.Add(DC1KW); 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.Values = new List(); foreach (var history in temp_item) @@ -285,7 +285,7 @@ namespace SolarPower.Controllers series.Add(DC2V); 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.Values = new List(); foreach (var history in temp_item) @@ -302,7 +302,7 @@ namespace SolarPower.Controllers series.Add(DC2A); 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.Values = new List(); foreach (var history in temp_item) @@ -319,7 +319,7 @@ namespace SolarPower.Controllers series.Add(DC2KW); 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.Values = new List(); foreach (var history in temp_item) @@ -336,7 +336,7 @@ namespace SolarPower.Controllers series.Add(DC3V); 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.Values = new List(); foreach (var history in temp_item) @@ -353,7 +353,7 @@ namespace SolarPower.Controllers series.Add(DC3A); 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.Values = new List(); foreach (var history in temp_item) @@ -370,7 +370,7 @@ namespace SolarPower.Controllers series.Add(DC3KW); 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.Values = new List(); foreach (var history in temp_item) @@ -387,7 +387,7 @@ namespace SolarPower.Controllers series.Add(DC4V); 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.Values = new List(); foreach (var history in temp_item) @@ -404,7 +404,7 @@ namespace SolarPower.Controllers series.Add(DC4A); 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.Values = new List(); foreach (var history in temp_item) @@ -421,7 +421,7 @@ namespace SolarPower.Controllers series.Add(DC4KW); 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.Values = new List(); foreach (var history in temp_item) @@ -438,7 +438,7 @@ namespace SolarPower.Controllers series.Add(DC5V); 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.Values = new List(); foreach (var history in temp_item) @@ -455,7 +455,7 @@ namespace SolarPower.Controllers series.Add(DC5A); 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.Values = new List(); foreach (var history in temp_item) @@ -472,7 +472,7 @@ namespace SolarPower.Controllers series.Add(DC5KW); 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.Values = new List(); foreach (var history in temp_item) @@ -489,7 +489,7 @@ namespace SolarPower.Controllers series.Add(AC1V); 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.Values = new List(); foreach (var history in temp_item) @@ -506,7 +506,7 @@ namespace SolarPower.Controllers series.Add(AC2V); 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.Values = new List(); foreach (var history in temp_item) @@ -523,7 +523,7 @@ namespace SolarPower.Controllers series.Add(AC3V); 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.Values = new List(); foreach (var history in temp_item) @@ -540,7 +540,7 @@ namespace SolarPower.Controllers series.Add(AC1A); 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.Values = new List(); foreach (var history in temp_item) @@ -557,7 +557,7 @@ namespace SolarPower.Controllers series.Add(AC2A); 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.Values = new List(); foreach (var history in temp_item) @@ -574,7 +574,7 @@ namespace SolarPower.Controllers series.Add(AC3A); 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.Values = new List(); foreach (var history in temp_item) @@ -591,7 +591,7 @@ namespace SolarPower.Controllers series.Add(PR); 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.Values = new List(); foreach (var history in temp_item) @@ -608,7 +608,7 @@ namespace SolarPower.Controllers series.Add(RA1); 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.Values = new List(); foreach (var history in temp_item) @@ -625,7 +625,7 @@ namespace SolarPower.Controllers series.Add(RA2); 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.Values = new List(); foreach (var history in temp_item) @@ -642,7 +642,7 @@ namespace SolarPower.Controllers series.Add(RA3); 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.Values = new List(); foreach (var history in temp_item) @@ -659,7 +659,7 @@ namespace SolarPower.Controllers series.Add(RA4); 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.Values = new List(); foreach (var history in temp_item) @@ -684,8 +684,11 @@ namespace SolarPower.Controllers stationIdWithInverterIdsList = new List(); foreach (var ps in powerStation_Group) { + var powerStation = await powerStationRepository.GetOneAsync(ps.Key); + StationIdWithInverterIds stationIdWithInverterIds = new StationIdWithInverterIds(); stationIdWithInverterIds.PowerStationId = ps.Key; + stationIdWithInverterIds.SiteDBName = powerStation.SiteDB; stationIdWithInverterIds.InverterIds = ps.Select(x => x.InverterId).ToList(); stationIdWithInverterIdsList.Add(stationIdWithInverterIds); @@ -736,7 +739,7 @@ namespace SolarPower.Controllers var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); 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.Values = new List(); foreach (var history in temp_item) @@ -753,7 +756,7 @@ namespace SolarPower.Controllers series.Add(Irradiance); 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.Values = new List(); foreach (var history in temp_item) @@ -770,7 +773,7 @@ namespace SolarPower.Controllers series.Add(KWH); 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.Values = new List(); foreach (var history in temp_item) @@ -787,7 +790,7 @@ namespace SolarPower.Controllers series.Add(TodayKWH); 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.Values = new List(); foreach (var history in temp_item) @@ -805,7 +808,7 @@ namespace SolarPower.Controllers 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.Values = new List(); foreach (var history in temp_item) @@ -822,7 +825,7 @@ namespace SolarPower.Controllers series.Add(PR); 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.Values = new List(); foreach (var history in temp_item) @@ -839,7 +842,7 @@ namespace SolarPower.Controllers series.Add(RA1); 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.Values = new List(); foreach (var history in temp_item) @@ -856,7 +859,7 @@ namespace SolarPower.Controllers series.Add(RA2); 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.Values = new List(); foreach (var history in temp_item) @@ -873,7 +876,7 @@ namespace SolarPower.Controllers series.Add(RA3); 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.Values = new List(); foreach (var history in temp_item) @@ -890,7 +893,7 @@ namespace SolarPower.Controllers series.Add(RA4); 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.Values = new List(); foreach (var history in temp_item) diff --git a/SolarPower/Controllers/MyBaseController.cs b/SolarPower/Controllers/MyBaseController.cs index 272ff57..e481f88 100644 --- a/SolarPower/Controllers/MyBaseController.cs +++ b/SolarPower/Controllers/MyBaseController.cs @@ -97,16 +97,26 @@ namespace SolarPower.Controllers auth_arr.Add("PowerStation"); } + if (x.Contains("StationOverview") && !auth_arr.Contains("StationOverview")) + { + auth_arr.Add("StationOverview"); + } + auth_arr.Add(x); } } 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 { filterContext.Result = new RedirectToRouteResult( diff --git a/SolarPower/Controllers/UserController.cs b/SolarPower/Controllers/UserController.cs index 38dc272..dacaa37 100644 --- a/SolarPower/Controllers/UserController.cs +++ b/SolarPower/Controllers/UserController.cs @@ -105,7 +105,6 @@ namespace SolarPower.Controllers "Email", "Phone", "UpdatedBy", - "UpdatedAt", "Id" }; diff --git a/SolarPower/Models/AnalysisInverter.cs b/SolarPower/Models/AnalysisInverter.cs index 7358cab..0a9ab25 100644 --- a/SolarPower/Models/AnalysisInverter.cs +++ b/SolarPower/Models/AnalysisInverter.cs @@ -52,6 +52,7 @@ namespace SolarPower.Models public class StationIdWithInverterIds { public int PowerStationId { get; set; } + public string SiteDBName { get; set; } public List InverterIds { get; set; } } diff --git a/SolarPower/Repository/Implement/CompanyRepository.cs b/SolarPower/Repository/Implement/CompanyRepository.cs index f407c3e..a03065f 100644 --- a/SolarPower/Repository/Implement/CompanyRepository.cs +++ b/SolarPower/Repository/Implement/CompanyRepository.cs @@ -291,6 +291,7 @@ namespace SolarPower.Repository.Implement CASE WHEN cap_id.CompanyId IS NOT NULL THEN 1 ELSE 0 END AS CheckAuth FROM auth_page ap 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(sql, new { CompanyId = companyId })).ToList(); diff --git a/SolarPower/Repository/Implement/RepositoryBase.cs b/SolarPower/Repository/Implement/RepositoryBase.cs index 9b9e034..31ed10c 100644 --- a/SolarPower/Repository/Implement/RepositoryBase.cs +++ b/SolarPower/Repository/Implement/RepositoryBase.cs @@ -253,7 +253,7 @@ namespace SolarPower.Repository.Implement { try { - var sql = $"SELECT * FROM {tableName}"; + var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0"; result = (await conn.QueryAsync(sql)).ToList(); } @@ -277,7 +277,7 @@ namespace SolarPower.Repository.Implement { try { - var sql = $"SELECT * FROM {tableName} WHERE id = @Id"; + var sql = $"SELECT * FROM {tableName} WHERE id = @Id AND Deleted = 0"; result = await conn.QueryFirstOrDefaultAsync(sql, new { Id = id }); } diff --git a/SolarPower/Repository/Implement/RoleRepository.cs b/SolarPower/Repository/Implement/RoleRepository.cs index 72bfa81..ce59bfb 100644 --- a/SolarPower/Repository/Implement/RoleRepository.cs +++ b/SolarPower/Repository/Implement/RoleRepository.cs @@ -261,13 +261,14 @@ namespace SolarPower.Repository.Implement var sql = @$"SELECT ap2.AuthCode, ap2.MainName, ap2.SubName, ap2.TagName 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 LEFT JOIN auth_page ap ON cap.AuthCode = ap.AuthCode WHERE cap.CompanyId = @CompanyId ) ap2 LEFT JOIN role_auth ra ON ap2.AuthCode = ra.AuthCode AND ra.Id = @RoleId WHERE ra.AuthCode IS NULL + ORDER BY ap2.Priority "; result = (await conn.QueryAsync(sql, new { CompanyId = post.SelectedCompanyId, RoleId = post.SelectedRoleId})).ToList(); diff --git a/SolarPower/Services/Implement/MyPowerStationService.cs b/SolarPower/Services/Implement/MyPowerStationService.cs new file mode 100644 index 0000000..59c110a --- /dev/null +++ b/SolarPower/Services/Implement/MyPowerStationService.cs @@ -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 GetMyPowerStations(MyUser myUser, List CityIds = null, List Where = null, List Order_by = null) + //{ + // List powerStations = new List(); + // return powerStations; + //} + } +} diff --git a/SolarPower/Views/AnalysisInverter/Index.cshtml b/SolarPower/Views/AnalysisInverter/Index.cshtml index 6cabe57..f5ec7f5 100644 --- a/SolarPower/Views/AnalysisInverter/Index.cshtml +++ b/SolarPower/Views/AnalysisInverter/Index.cshtml @@ -157,9 +157,9 @@ var default_compare_col = []; var current_compare_col = []; var Single_day_compare_col = [ - { key: "Irradiance", title: "日照度", default: true }, - { key: "DCKW", title: "直流功率 (KW)", default: true }, - { key: "ACKW", title: "輸出功率 (KW)", default: true }, + { key: "Irradiance", title: "日照度", default: false }, + { key: "DCKW", title: "直流功率 (KW)", default: false }, + { key: "ACKW", title: "輸出功率 (KW)", default: false }, { key: "DC1V", title: "直流電壓1 (V)", default: false }, { key: "DC1A", title: "直流電流1 (A)", default: false }, { key: "DC1KW", title: "直流功率1 (KW)", default: false }, @@ -189,8 +189,8 @@ { key: "RA5", title: "RA5 (%)", default: false } ] var Range_compare_col = [ - { key: "Irradiance", title: "日照度", default: true }, - { key: "KWH", title: "KWH", default: true }, + { key: "Irradiance", title: "日照度", default: false }, + { key: "KWH", title: "KWH", default: false }, { key: "TodayKWH", title: "TodayKWH", default: false }, { key: "TotalKWH", title: "TotalKWH", default: false }, { key: "PR", title: "PR", default: false }, @@ -415,7 +415,7 @@ default_compare_col.push($(this).val()); } } 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); } } @@ -493,9 +493,9 @@ $('#js_list_accordion').append(str); $('#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[]"]').each(function () { if ($.inArray(this.value, selected_inverter) > -1) { diff --git a/SolarPower/Views/AnalysisStationInfo/Index.cshtml b/SolarPower/Views/AnalysisStationInfo/Index.cshtml index bde9d1d..e80c67e 100644 --- a/SolarPower/Views/AnalysisStationInfo/Index.cshtml +++ b/SolarPower/Views/AnalysisStationInfo/Index.cshtml @@ -123,7 +123,7 @@ var selected_device = []; var PWS_compare_col = [ { key: "KWH", title: "發電量", default: true }, - { key: "Irradiance", title: "日照度", default: true }, + { key: "Irradiance", title: "日照度", default: false }, { key: "KWHKWP", title: "發電小時", default: false }, { key: "PR", title: "PR %", 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"); - if (selected_device.length <= 0) { + @*if (selected_device.length <= 0) { $('input[name="selectedDeviceId[]"]').first().trigger("click"); - } + }*@ $('input[name="selectedDeviceId[]"]').each(function () { if ($.inArray(this.value, selected_device) > -1) { diff --git a/SolarPower/Views/Shared/_Layout.cshtml b/SolarPower/Views/Shared/_Layout.cshtml index 5ea45d4..2b832df 100644 --- a/SolarPower/Views/Shared/_Layout.cshtml +++ b/SolarPower/Views/Shared/_Layout.cshtml @@ -165,7 +165,14 @@ } - @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")) {
  • @@ -177,7 +184,14 @@
  • } - @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")) {
  • @@ -218,7 +232,10 @@
  • } - @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")) {
  • @@ -253,7 +270,11 @@
  • } - @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")) {
  • @@ -285,7 +306,7 @@
  • } - @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")) {
  • @@ -481,7 +502,7 @@
    - + diff --git a/SolarPower/Views/StationOverview/Index.cshtml b/SolarPower/Views/StationOverview/Index.cshtml index 3961919..36401b6 100644 --- a/SolarPower/Views/StationOverview/Index.cshtml +++ b/SolarPower/Views/StationOverview/Index.cshtml @@ -317,7 +317,7 @@ $('#citytest').empty(); for (var i = 0; i < rel.data.length; i++) { $('#citytest').append(""); ids.push(rel.data[i].cityId); diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 56074af..0804bf2 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -49,11 +49,14 @@
  • } - + @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_InverterInfo")) + { + + } @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Inverter")) { diff --git a/SolarPower/Views/User/Index.cshtml b/SolarPower/Views/User/Index.cshtml index 91f2b84..32d79c2 100644 --- a/SolarPower/Views/User/Index.cshtml +++ b/SolarPower/Views/User/Index.cshtml @@ -329,7 +329,7 @@ "autoWidth": false, "responsive": false, "deferLoading": 0, - "order": [[5, "desc"]], + "order": [[6, "desc"]], "columns": [{ "data": null, }, { @@ -425,7 +425,7 @@ "paging": true, "lengthChange": false, "searching": false, - "ordering": true, + "ordering": false, "info": true, "autoWidth": false, "responsive": false,