1. bug fix

2. 電站交叉分析完成
This commit is contained in:
Kai 2021-07-30 20:11:40 +08:00
parent 64df5ae9d6
commit 4efe001136
17 changed files with 1011 additions and 346 deletions

View File

@ -97,14 +97,18 @@ namespace SolarPower.Controllers
List<InverterHistoryInfo> series = new List<InverterHistoryInfo>(); List<InverterHistoryInfo> series = new List<InverterHistoryInfo>();
var powerStation_Group = post.InverterIdInfos.GroupBy(x => x.PowerStationId).ToList(); var powerStation_Group = post.InverterIdInfos.GroupBy(x => x.PowerStationId).ToList();
if(post.SearchType == 0) if (post.SearchType == 0)
{ //單日 { //單日
var StationCodeWithInverterIdsList = new List<StationCodeWithInverterIds>(); var StationCodeWithInverterIdsList = new List<StationCodeWithInverterIds>();
foreach (var ps in powerStation_Group) foreach (var ps in powerStation_Group)
{ {
var powerStation = await powerStationRepository.GetOneAsync(ps.Key); var powerStation = await powerStationRepository.GetOneAsync(ps.Key);
//找出該電站所有日照計設備(包含共享
var deviceInfos = await powerStationRepository.GetListPyrheliometerByPowerStationId(powerStation.Id, powerStation.SiteDB);
StationCodeWithInverterIds stationCodeWithInverterIds = new StationCodeWithInverterIds(); StationCodeWithInverterIds stationCodeWithInverterIds = new StationCodeWithInverterIds();
stationCodeWithInverterIds.Sensor = deviceInfos.First().ColName;
stationCodeWithInverterIds.SiteDB = powerStation.SiteDB; stationCodeWithInverterIds.SiteDB = powerStation.SiteDB;
stationCodeWithInverterIds.Code = powerStation.Code; stationCodeWithInverterIds.Code = powerStation.Code;
stationCodeWithInverterIds.InverterIds = ps.Select(x => x.InverterId).ToList(); stationCodeWithInverterIds.InverterIds = ps.Select(x => x.InverterId).ToList();
@ -153,11 +157,31 @@ namespace SolarPower.Controllers
series = new List<InverterHistoryInfo>(); series = new List<InverterHistoryInfo>();
#region #region
foreach (var item in inverterHistories_Group) foreach (var item in inverterHistories_Group)
{ {
var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList(); var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList();
InverterHistoryInfo Irradiance = new InverterHistoryInfo();
Irradiance.Name = string.Format("{0}:{1}", item.Key, "日照度");
Irradiance.YaxesKey = "Irradiance";
Irradiance.Values = new List<double>();
foreach (var history in temp_item)
{
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{
Irradiance.Values.Add(Math.Round(history.Irradiance, 2));
}
else
{
Irradiance.Values.Add(0);
}
}
series.Add(Irradiance);
InverterHistoryInfo DCKW = new InverterHistoryInfo(); InverterHistoryInfo DCKW = new InverterHistoryInfo();
DCKW.Name = string.Format("{0}:{1}", item.Key, "直流功率 (KW)"); DCKW.Name = string.Format("{0}:{1}", item.Key, "直流功率 (KW)");
DCKW.YaxesKey = "DCKW"; DCKW.YaxesKey = "DCKW";
@ -166,7 +190,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DCKW.Values.Add(history.DCKW); DCKW.Values.Add(Math.Round(history.DCKW, 2));
} }
else else
{ {
@ -183,7 +207,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
ACKW.Values.Add(history.ACKW); ACKW.Values.Add(Math.Round(history.ACKW, 2));
} }
else else
{ {
@ -200,7 +224,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC1V.Values.Add(history.DC1V); DC1V.Values.Add(Math.Round(history.DC1V, 2));
} }
else else
{ {
@ -217,7 +241,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC1A.Values.Add(history.DC1A); DC1A.Values.Add(Math.Round(history.DC1A, 2));
} }
else else
{ {
@ -234,7 +258,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC1KW.Values.Add(history.DC1W / 1000); DC1KW.Values.Add(Math.Round(history.DC1W / 1000, 2));
} }
else else
{ {
@ -251,7 +275,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC2V.Values.Add(history.DC2V); DC2V.Values.Add(Math.Round(history.DC2V, 2));
} }
else else
{ {
@ -268,7 +292,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC2A.Values.Add(history.DC2A); DC2A.Values.Add(Math.Round(history.DC2A, 2));
} }
else else
{ {
@ -285,7 +309,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC2KW.Values.Add(history.DC2W / 1000); DC2KW.Values.Add(Math.Round(history.DC2W / 1000, 2));
} }
else else
{ {
@ -302,7 +326,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC3V.Values.Add(history.DC3V); DC3V.Values.Add(Math.Round(history.DC3V, 2));
} }
else else
{ {
@ -319,7 +343,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC3A.Values.Add(history.DC3A); DC3A.Values.Add(Math.Round(history.DC3A, 2));
} }
else else
{ {
@ -336,7 +360,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC3KW.Values.Add(history.DC3W / 1000); DC3KW.Values.Add(Math.Round(history.DC3W / 1000, 2));
} }
else else
{ {
@ -353,7 +377,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC4V.Values.Add(history.DC4V); DC4V.Values.Add(Math.Round(history.DC4V, 2));
} }
else else
{ {
@ -370,7 +394,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC4A.Values.Add(history.DC4A); DC4A.Values.Add(Math.Round(history.DC4A, 2));
} }
else else
{ {
@ -387,7 +411,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC4KW.Values.Add(history.DC4W / 1000); DC4KW.Values.Add(Math.Round(history.DC4W / 1000, 2));
} }
else else
{ {
@ -404,7 +428,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC5V.Values.Add(history.DC5V); DC5V.Values.Add(Math.Round(history.DC5V, 2));
} }
else else
{ {
@ -421,7 +445,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC5A.Values.Add(history.DC5A); DC5A.Values.Add(Math.Round(history.DC5A, 2));
} }
else else
{ {
@ -438,7 +462,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
DC5KW.Values.Add(history.DC5W / 1000); DC5KW.Values.Add(Math.Round(history.DC5W / 1000, 2));
} }
else else
{ {
@ -455,7 +479,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
AC1V.Values.Add(history.AC1V); AC1V.Values.Add(Math.Round(history.AC1V, 2));
} }
else else
{ {
@ -472,7 +496,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
AC2V.Values.Add(history.AC2V); AC2V.Values.Add(Math.Round(history.AC2V, 2));
} }
else else
{ {
@ -489,7 +513,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
AC3V.Values.Add(history.AC3V); AC3V.Values.Add(Math.Round(history.AC3V, 2));
} }
else else
{ {
@ -506,7 +530,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
AC1A.Values.Add(history.AC1A); AC1A.Values.Add(Math.Round(history.AC1A, 2));
} }
else else
{ {
@ -523,7 +547,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
AC2A.Values.Add(history.AC2A); AC2A.Values.Add(Math.Round(history.AC2A, 2));
} }
else else
{ {
@ -540,7 +564,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
AC3A.Values.Add(history.AC3A); AC3A.Values.Add(Math.Round(history.AC3A, 2));
} }
else else
{ {
@ -557,7 +581,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
PR.Values.Add(history.PR); PR.Values.Add(Math.Round(history.PR, 2));
} }
else else
{ {
@ -574,7 +598,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA1.Values.Add(history.RA1); RA1.Values.Add(Math.Round(history.RA1, 2));
} }
else else
{ {
@ -591,7 +615,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA2.Values.Add(history.RA2); RA2.Values.Add(Math.Round(history.RA2, 2));
} }
else else
{ {
@ -608,7 +632,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA3.Values.Add(history.RA3); RA3.Values.Add(Math.Round(history.RA3, 2));
} }
else else
{ {
@ -625,7 +649,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA4.Values.Add(history.RA4); RA4.Values.Add(Math.Round(history.RA4, 2));
} }
else else
{ {
@ -642,7 +666,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA5.Values.Add(history.RA5); RA5.Values.Add(Math.Round(history.RA5, 2));
} }
else else
{ {
@ -719,7 +743,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
Irradiance.Values.Add(history.Irradiance); Irradiance.Values.Add(Math.Round(history.Irradiance, 2));
} }
else else
{ {
@ -736,7 +760,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
KWH.Values.Add(history.KWH); KWH.Values.Add(Math.Round(history.KWH, 2));
} }
else else
{ {
@ -753,7 +777,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
TodayKWH.Values.Add(history.TODAYKWH); TodayKWH.Values.Add(Math.Round(history.TODAYKWH, 2));
} }
else else
{ {
@ -770,7 +794,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
TotalKWH.Values.Add(history.TOTALKWH); TotalKWH.Values.Add(Math.Round(history.TOTALKWH, 2));
} }
else else
{ {
@ -788,7 +812,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
PR.Values.Add(history.PR); PR.Values.Add(Math.Round(history.PR, 2));
} }
else else
{ {
@ -805,7 +829,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA1.Values.Add(history.RA1); RA1.Values.Add(Math.Round(history.RA1, 2));
} }
else else
{ {
@ -822,7 +846,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA2.Values.Add(history.RA2); RA2.Values.Add(Math.Round(history.RA2, 2));
} }
else else
{ {
@ -839,7 +863,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA3.Values.Add(history.RA3); RA3.Values.Add(Math.Round(history.RA3, 2));
} }
else else
{ {
@ -856,7 +880,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA4.Values.Add(history.RA4); RA4.Values.Add(Math.Round(history.RA4, 2));
} }
else else
{ {
@ -873,7 +897,7 @@ namespace SolarPower.Controllers
{ {
if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1) if (analysisInverter.XAxis.IndexOf(history.TIMESTAMP) > -1)
{ {
RA5.Values.Add(history.RA5); RA5.Values.Add(Math.Round(history.RA5, 2));
} }
else else
{ {

View File

@ -114,6 +114,7 @@ namespace SolarPower.Controllers
//先將欲查詢的設備找出設備的資料庫欄位 //先將欲查詢的設備找出設備的資料庫欄位
var device_powerStationId_Group = post.DeviceIdInfos.GroupBy(x => x.PowerStationId).ToList(); var device_powerStationId_Group = post.DeviceIdInfos.GroupBy(x => x.PowerStationId).ToList();
Dictionary<int, List<Device>> deviceDic = new Dictionary<int, List<Device>>(); Dictionary<int, List<Device>> deviceDic = new Dictionary<int, List<Device>>();
List<StationIdWithMeterIds> meterDic = new List<StationIdWithMeterIds>();
List<int> selected_powerStationIds = new List<int>(); List<int> selected_powerStationIds = new List<int>();
foreach (var psId_Group in device_powerStationId_Group) foreach (var psId_Group in device_powerStationId_Group)
{ {
@ -121,7 +122,18 @@ namespace SolarPower.Controllers
//區分電站總覽or設備 //區分電站總覽or設備
selected_powerStationIds = psId_Group.Where(x => x.DeviceType == "PWS").Select(x => Convert.ToInt32(x.DeviceId)).ToList(); selected_powerStationIds = psId_Group.Where(x => x.DeviceType == "PWS").Select(x => Convert.ToInt32(x.DeviceId)).ToList();
var selected_device = psId_Group.Where(x => x.DeviceType != "PWS").Select(x => x.DeviceId).ToList(); var selected_meter = psId_Group.Where(x => x.DeviceType == "PWR").Select(x => x.DeviceId).ToList();
var selected_device = psId_Group.Where(x => x.DeviceType != "PWS" && x.DeviceType != "PWR").Select(x => x.DeviceId).ToList();
var temp_meter = await powerStationRepository.GetDeviceByPowerStationIdAndDeviceIds(powerStation.SiteDB, powerStation.Id, selected_meter);
if (temp_meter.Count() > 0)
{
StationIdWithMeterIds stationIdWithMeterIds = new StationIdWithMeterIds();
stationIdWithMeterIds.PowerStationId = psId_Group.Key;
stationIdWithMeterIds.MeterIds = temp_meter.Select(x => x.UID).ToList();
meterDic.Add(stationIdWithMeterIds);
}
var temp_device = await powerStationRepository.GetDeviceByPowerStationIdAndDeviceIds(powerStation.SiteDB, powerStation.Id, selected_device); var temp_device = await powerStationRepository.GetDeviceByPowerStationIdAndDeviceIds(powerStation.SiteDB, powerStation.Id, selected_device);
if (temp_device.Count() > 0) if (temp_device.Count() > 0)
@ -142,11 +154,21 @@ namespace SolarPower.Controllers
{ "Humidity", "濕度"}, { "Humidity", "濕度"},
{ "Vane", "風速"}, { "Vane", "風速"},
{ "Dust", "落塵%"}, { "Dust", "落塵%"},
{ "OUTPUT_KWH", "輸出發電量(kWh)"},
{ "INPUT_KWH", "輸入發電量(kWh)"},
{ "V_AB", "電壓 AB(V)"},
{ "V_BC", "電壓 BC(V)"},
{ "V_CA", "電壓 CA(V)"},
{ "I_A", "電流 A(A)"},
{ "I_B", "電流 B(A)"},
{ "I_C", "電流 C(A)"},
{ "P", "有效功率(kW)"},
{ "F", "頻率(Hz)"},
}; };
var XAxis = new List<string>(); var XAxis = new List<string>();
//電站資料 #region
var powerStationHistories = await powerStationRepository.GetPowerStationHistory(post.SelectedDate, post.SearchType, selected_powerStationIds); var powerStationHistories = await powerStationRepository.GetPowerStationHistory(post.SelectedDate, post.SearchType, selected_powerStationIds);
XAxis.AddRange(powerStationHistories.Select(x => x.Timestamp).Distinct().ToList()); XAxis.AddRange(powerStationHistories.Select(x => x.Timestamp).Distinct().ToList());
@ -261,8 +283,193 @@ namespace SolarPower.Controllers
} }
analysisDevice.Series.Add(modelTemperature); analysisDevice.Series.Add(modelTemperature);
} }
#endregion
//設備資料 #region
var meterHistories = await powerStationRepository.GetMeterHistory(post.SelectedDate, post.SearchType, meterDic);
XAxis.AddRange(meterHistories.Select(x => x.TIMESTAMP).Distinct().ToList());
var meterHistories_Id_Group = meterHistories.GroupBy(x => x.METERID).ToList();
foreach (var item in meterHistories_Id_Group)
{
var temp_item = item.OrderBy(x => x.TIMESTAMP).ToList();
DeviceHistoryInfo OUTPUT_KWH = new DeviceHistoryInfo();
OUTPUT_KWH.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["OUTPUT_KWH"]);
OUTPUT_KWH.YaxesKey = "OUTPUT_KWH";
OUTPUT_KWH.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
OUTPUT_KWH.Values.Add(Math.Round(history.OUTPUT_KWH, 2));
}
else
{
OUTPUT_KWH.Values.Add(0);
}
}
analysisDevice.Series.Add(OUTPUT_KWH);
DeviceHistoryInfo INPUT_KWH = new DeviceHistoryInfo();
INPUT_KWH.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["INPUT_KWH"]);
INPUT_KWH.YaxesKey = "INPUT_KWH";
INPUT_KWH.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
INPUT_KWH.Values.Add(Math.Round(history.INPUT_KWH, 2));
}
else
{
INPUT_KWH.Values.Add(0);
}
}
analysisDevice.Series.Add(INPUT_KWH);
DeviceHistoryInfo V_AB = new DeviceHistoryInfo();
V_AB.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["V_AB"]);
V_AB.YaxesKey = "V_AB";
V_AB.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
V_AB.Values.Add(Math.Round(history.V_AB, 2));
}
else
{
V_AB.Values.Add(0);
}
}
analysisDevice.Series.Add(V_AB);
DeviceHistoryInfo V_BC = new DeviceHistoryInfo();
V_BC.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["V_BC"]);
V_BC.YaxesKey = "V_BC";
V_BC.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
V_BC.Values.Add(Math.Round(history.V_BC, 2));
}
else
{
V_BC.Values.Add(0);
}
}
analysisDevice.Series.Add(V_BC);
DeviceHistoryInfo V_CA = new DeviceHistoryInfo();
V_CA.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["V_BC"]);
V_CA.YaxesKey = "V_CA";
V_CA.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
V_CA.Values.Add(Math.Round(history.V_CA, 2));
}
else
{
V_CA.Values.Add(0);
}
}
analysisDevice.Series.Add(V_CA);
DeviceHistoryInfo I_A = new DeviceHistoryInfo();
I_A.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["I_A"]);
I_A.YaxesKey = "I_A";
I_A.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
I_A.Values.Add(Math.Round(history.I_A, 2));
}
else
{
I_A.Values.Add(0);
}
}
analysisDevice.Series.Add(I_A);
DeviceHistoryInfo I_B = new DeviceHistoryInfo();
I_B.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["I_B"]);
I_B.YaxesKey = "I_B";
I_B.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
I_B.Values.Add(Math.Round(history.I_B, 2));
}
else
{
I_B.Values.Add(0);
}
}
analysisDevice.Series.Add(I_B);
DeviceHistoryInfo I_C = new DeviceHistoryInfo();
I_C.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["I_C"]);
I_C.YaxesKey = "I_C";
I_C.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
I_C.Values.Add(Math.Round(history.I_C, 2));
}
else
{
I_C.Values.Add(0);
}
}
analysisDevice.Series.Add(I_C);
DeviceHistoryInfo P = new DeviceHistoryInfo();
P.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["P"]);
P.YaxesKey = "P";
P.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
P.Values.Add(Math.Round(history.P, 2));
}
else
{
P.Values.Add(0);
}
}
analysisDevice.Series.Add(P);
DeviceHistoryInfo F = new DeviceHistoryInfo();
F.Name = string.Format("{0}:{1}", item.Key, analysisDevice.MultipleYaxes["F"]);
F.YaxesKey = "F";
F.Values = new List<double>();
foreach (var history in temp_item)
{
if (XAxis.IndexOf(history.TIMESTAMP) > -1)
{
F.Values.Add(Math.Round(history.F, 2));
}
else
{
F.Values.Add(0);
}
}
analysisDevice.Series.Add(F);
}
#endregion
#region
foreach (var devices in deviceDic) foreach (var devices in deviceDic)
{ {
var result = await powerStationRepository.GetSensorAvgByDevices(post.SelectedDate, post.SearchType, devices.Value); var result = await powerStationRepository.GetSensorAvgByDevices(post.SelectedDate, post.SearchType, devices.Value);
@ -328,6 +535,7 @@ namespace SolarPower.Controllers
analysisDevice.Series.Add(deviceHistoryInfo); analysisDevice.Series.Add(deviceHistoryInfo);
} }
} }
#endregion
analysisDevice.XAxis = XAxis.Distinct().ToList(); analysisDevice.XAxis = XAxis.Distinct().ToList();

View File

@ -90,7 +90,7 @@ namespace SolarPower.Controllers
new RouteValueDictionary new RouteValueDictionary
{ {
{"controller", "Login"}, {"controller", "Login"},
{"action", "Index"} {"action", "SignOut"}
}); });
return; return;
} }

View File

@ -239,7 +239,7 @@ namespace SolarPower.Controllers
powerStation = await powerStationRepository.GetOneAsync(post.Id); powerStation = await powerStationRepository.GetOneAsync(post.Id);
//取得該公司DB Name //取得該公司DB Name
var company = await companyRepository.GetOneAsync(myUser.CompanyId); var company = await companyRepository.GetOneAsync(post.CompanyId);
if (powerStation == null) if (powerStation == null)
{ {
@ -263,7 +263,7 @@ namespace SolarPower.Controllers
powerStation = new PowerStation() powerStation = new PowerStation()
{ {
CompanyId = myUser.CompanyId, CompanyId = post.CompanyId,
CityId = post.CityId, CityId = post.CityId,
AreaId = post.AreaId, AreaId = post.AreaId,
Address = post.Address, Address = post.Address,
@ -286,6 +286,9 @@ namespace SolarPower.Controllers
PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount, PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount,
SiteDB = company.SiteDB, SiteDB = company.SiteDB,
SolarType = post.SolarType, SolarType = post.SolarType,
line_token = post.line_token,
Estimate_kwh = post.Estimate_kwh,
EstimateEfficacy = post.EstimateEfficacy,
CreatedBy = myUser.Id CreatedBy = myUser.Id
}; };
@ -314,6 +317,9 @@ namespace SolarPower.Controllers
"PhotovoltaicPanelAmount", "PhotovoltaicPanelAmount",
"SiteDB", "SiteDB",
"SolarType", "SolarType",
"line_token",
"Estimate_kwh",
"EstimateEfficacy",
"CreatedBy" "CreatedBy"
}; };
@ -404,6 +410,9 @@ namespace SolarPower.Controllers
PhotovoltaicPanelSpecification = post.PhotovoltaicPanelSpecification, PhotovoltaicPanelSpecification = post.PhotovoltaicPanelSpecification,
PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount, PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount,
SolarType = post.SolarType, SolarType = post.SolarType,
line_token = post.line_token,
Estimate_kwh = post.Estimate_kwh,
EstimateEfficacy = post.EstimateEfficacy,
UpdatedBy = myUser.Id UpdatedBy = myUser.Id
}; };
@ -429,6 +438,9 @@ namespace SolarPower.Controllers
"PhotovoltaicPanelSpecification", "PhotovoltaicPanelSpecification",
"PhotovoltaicPanelAmount", "PhotovoltaicPanelAmount",
"SolarType", "SolarType",
"line_token",
"Estimate_kwh",
"EstimateEfficacy",
"UpdatedBy", "UpdatedBy",
}; };

View File

@ -825,7 +825,7 @@ CREATE TABLE IF NOT EXISTS `variable` (
DELETE FROM `variable`; DELETE FROM `variable`;
/*!40000 ALTER TABLE `variable` DISABLE KEYS */; /*!40000 ALTER TABLE `variable` DISABLE KEYS */;
INSERT INTO `variable` (`id`, `name`, `value`, `remark`) VALUES INSERT INTO `variable` (`id`, `name`, `value`, `remark`) VALUES
(1, 'Type', '{"Type":[{"Name":"日照計","EName":"PYR"},{"Name":"模組溫度計","EName":"MTR"},{"Name":"環境溫度計","EName":"ETR"},{"Name":"環境濕度計","EName":"EMM"},{"Name":"風速計","EName":"VAN"},{"Name":" 電","EName":"PWR"}]}', '裝置類型'); (1, 'Type', '{"Type":[{"Name":"日照計","EName":"PYR"},{"Name":"模組溫度計","EName":"MTR"},{"Name":"環境溫度計","EName":"ETR"},{"Name":"環境濕度計","EName":"EMM"},{"Name":"風速計","EName":"VAN"},{"Name":" 電","EName":"PWR"}]}', '裝置類型');
/*!40000 ALTER TABLE `variable` ENABLE KEYS */; /*!40000 ALTER TABLE `variable` ENABLE KEYS */;
@ -1983,6 +1983,105 @@ ALTER TABLE `inverter_history_day`
ALTER TABLE `inverter_history_month` ALTER TABLE `inverter_history_month`
ADD COLUMN `TOTALKWH` DOUBLE NULL DEFAULT NULL AFTER `TODAYKWH`; ADD COLUMN `TOTALKWH` DOUBLE NULL DEFAULT NULL AFTER `TODAYKWH`;
-- 加入電錶每小時歷史紀錄 20210730
CREATE TABLE `meter_history_hour` (
`Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`PowerStationId` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`METERID` VARCHAR(500) NULL DEFAULT NULL COMMENT '電錶ID' COLLATE 'utf8mb4_unicode_ci',
`V_A` DOUBLE NULL DEFAULT NULL COMMENT '電壓A',
`V_B` DOUBLE NULL DEFAULT NULL COMMENT '電壓B',
`V_C` DOUBLE NULL DEFAULT NULL COMMENT '電壓C',
`V_AB` DOUBLE NULL DEFAULT NULL COMMENT '電壓AB',
`V_BC` DOUBLE NULL DEFAULT NULL COMMENT '電壓BC',
`V_CA` DOUBLE NULL DEFAULT NULL COMMENT '電壓CA',
`I_A` DOUBLE NULL DEFAULT NULL COMMENT '電流A ',
`I_B` DOUBLE NULL DEFAULT NULL COMMENT '電流B',
`I_C` DOUBLE NULL DEFAULT NULL COMMENT '電流C',
`I_AB` DOUBLE NULL DEFAULT NULL COMMENT '電流AB',
`I_BC` DOUBLE NULL DEFAULT NULL COMMENT '電流BC',
`I_CA` DOUBLE NULL DEFAULT NULL COMMENT '電流CA',
`P` DOUBLE NULL DEFAULT NULL COMMENT '有效功率',
`VAR` DOUBLE NULL DEFAULT NULL COMMENT '虛功率',
`S` DOUBLE NULL DEFAULT NULL COMMENT '視在功率',
`F` DOUBLE NULL DEFAULT NULL COMMENT '頻率',
`OUTPUT_KWH` DOUBLE NULL DEFAULT NULL COMMENT '輸出發電量',
`INPUT_KWH` DOUBLE NULL DEFAULT NULL COMMENT '出入發電量',
PRIMARY KEY (`Id`) USING BTREE,
INDEX `IDX_01` (`PowerStationId`) USING BTREE
)
COMMENT='電錶每小時歷史紀錄'
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
;
-- 加入電錶每天歷史紀錄 20210730
CREATE TABLE `meter_history_day` (
`Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`PowerStationId` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`METERID` VARCHAR(500) NULL DEFAULT NULL COMMENT '電錶ID' COLLATE 'utf8mb4_unicode_ci',
`V_A` DOUBLE NULL DEFAULT NULL COMMENT '電壓A',
`V_B` DOUBLE NULL DEFAULT NULL COMMENT '電壓B',
`V_C` DOUBLE NULL DEFAULT NULL COMMENT '電壓C',
`V_AB` DOUBLE NULL DEFAULT NULL COMMENT '電壓AB',
`V_BC` DOUBLE NULL DEFAULT NULL COMMENT '電壓BC',
`V_CA` DOUBLE NULL DEFAULT NULL COMMENT '電壓CA',
`I_A` DOUBLE NULL DEFAULT NULL COMMENT '電流A ',
`I_B` DOUBLE NULL DEFAULT NULL COMMENT '電流B',
`I_C` DOUBLE NULL DEFAULT NULL COMMENT '電流C',
`I_AB` DOUBLE NULL DEFAULT NULL COMMENT '電流AB',
`I_BC` DOUBLE NULL DEFAULT NULL COMMENT '電流BC',
`I_CA` DOUBLE NULL DEFAULT NULL COMMENT '電流CA',
`P` DOUBLE NULL DEFAULT NULL COMMENT '有效功率',
`VAR` DOUBLE NULL DEFAULT NULL COMMENT '虛功率',
`S` DOUBLE NULL DEFAULT NULL COMMENT '視在功率',
`F` DOUBLE NULL DEFAULT NULL COMMENT '頻率',
`OUTPUT_KWH` DOUBLE NULL DEFAULT NULL COMMENT '輸出發電量',
`INPUT_KWH` DOUBLE NULL DEFAULT NULL COMMENT '出入發電量',
PRIMARY KEY (`Id`) USING BTREE,
INDEX `IDX_01` (`PowerStationId`) USING BTREE
)
COMMENT='電錶每天歷史紀錄'
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
;
-- 加入電錶每月歷史紀錄 20210730
CREATE TABLE `meter_history_month` (
`Id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`PowerStationId` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
`METERID` VARCHAR(500) NULL DEFAULT NULL COMMENT '電錶ID' COLLATE 'utf8mb4_unicode_ci',
`V_A` DOUBLE NULL DEFAULT NULL COMMENT '電壓A',
`V_B` DOUBLE NULL DEFAULT NULL COMMENT '電壓B',
`V_C` DOUBLE NULL DEFAULT NULL COMMENT '電壓C',
`V_AB` DOUBLE NULL DEFAULT NULL COMMENT '電壓AB',
`V_BC` DOUBLE NULL DEFAULT NULL COMMENT '電壓BC',
`V_CA` DOUBLE NULL DEFAULT NULL COMMENT '電壓CA',
`I_A` DOUBLE NULL DEFAULT NULL COMMENT '電流A ',
`I_B` DOUBLE NULL DEFAULT NULL COMMENT '電流B',
`I_C` DOUBLE NULL DEFAULT NULL COMMENT '電流C',
`I_AB` DOUBLE NULL DEFAULT NULL COMMENT '電流AB',
`I_BC` DOUBLE NULL DEFAULT NULL COMMENT '電流BC',
`I_CA` DOUBLE NULL DEFAULT NULL COMMENT '電流CA',
`P` DOUBLE NULL DEFAULT NULL COMMENT '有效功率',
`VAR` DOUBLE NULL DEFAULT NULL COMMENT '虛功率',
`S` DOUBLE NULL DEFAULT NULL COMMENT '視在功率',
`F` DOUBLE NULL DEFAULT NULL COMMENT '頻率',
`OUTPUT_KWH` DOUBLE NULL DEFAULT NULL COMMENT '輸出發電量',
`INPUT_KWH` DOUBLE NULL DEFAULT NULL COMMENT '出入發電量',
PRIMARY KEY (`Id`) USING BTREE,
INDEX `IDX_01` (`PowerStationId`) USING BTREE
)
COMMENT='電錶每月歷史紀錄'
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;

View File

@ -29,6 +29,7 @@ namespace SolarPower.Models
public class StationCodeWithInverterIds public class StationCodeWithInverterIds
{ {
public string Sensor { get; set; }
public string SiteDB { get; set; } public string SiteDB { get; set; }
public string Code { get; set; } public string Code { get; set; }
public List<string> InverterIds { get; set; } public List<string> InverterIds { get; set; }
@ -53,4 +54,10 @@ namespace SolarPower.Models
public int PowerStationId { get; set; } public int PowerStationId { get; set; }
public List<string> InverterIds { get; set; } public List<string> InverterIds { get; set; }
} }
public class StationIdWithMeterIds
{
public int PowerStationId { get; set; }
public List<string> MeterIds { get; set; }
}
} }

View File

@ -131,6 +131,9 @@ namespace SolarPower.Models.PowerStation
public double TodayWeatherTemp { get; set; } //今日溫度 public double TodayWeatherTemp { get; set; } //今日溫度
public string WeathersStationId { get; set; }//氣象站編號 public string WeathersStationId { get; set; }//氣象站編號
public string RateOfRain { get; set; }//降雨機率 public string RateOfRain { get; set; }//降雨機率
public string line_token { get; set; }//line_token
public double Estimate_kwh { get; set; }//預估發電度數
public double EstimateEfficacy { get; set; }//預估發電效能
public string CreatorName { get; set; } //創建者名稱 public string CreatorName { get; set; } //創建者名稱
} }
@ -195,6 +198,10 @@ namespace SolarPower.Models.PowerStation
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格 public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格 public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public byte SolarType { get; set; } //電站類型 public byte SolarType { get; set; } //電站類型
public string line_token { get; set; }//line_token
public double Estimate_kwh { get; set; }//預估發電度數
public double EstimateEfficacy { get; set; }//預估發電效能
public int CompanyId { get; set; }
} }
public class UpdatePowerStationInfo : Updated public class UpdatePowerStationInfo : Updated
@ -218,6 +225,9 @@ namespace SolarPower.Models.PowerStation
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格 public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格 public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public byte SolarType { get; set; } //電站類型 public byte SolarType { get; set; } //電站類型
public string line_token { get; set; }//line_token
public double Estimate_kwh { get; set; }//預估發電度數
public double EstimateEfficacy { get; set; }//預估發電效能
} }
public class PostBoETPCInfo public class PostBoETPCInfo
@ -886,5 +896,30 @@ namespace SolarPower.Models.PowerStation
} }
public class MeterHistory
{
public string TIMESTAMP { get; set; }
public int PowerStationId { get; set; }
public string METERID { get; set; }
public double V_A { get; set; }
public double V_B { get; set; }
public double V_C { get; set; }
public double V_AB { get; set; }
public double V_BC { get; set; }
public double V_CA { get; set; }
public double I_A { get; set; }
public double I_B { get; set; }
public double I_C { get; set; }
public double I_AB { get; set; }
public double I_BC { get; set; }
public double I_CA { get; set; }
public double P { get; set; }
public double VAR { get; set; }
public double S { get; set; }
public double F { get; set; }
public double OUTPUT_KWH { get; set; }
public double INPUT_KWH { get; set; }
}
} }

View File

@ -1,4 +1,6 @@
using Microsoft.Extensions.Logging; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using Quartz; using Quartz;
using SolarPower.Models.PowerStation; using SolarPower.Models.PowerStation;
@ -17,12 +19,18 @@ namespace SolarPower.Quartz.Jobs
private readonly ILogger<CalcPowerStationJob> logger; private readonly ILogger<CalcPowerStationJob> logger;
private readonly IPowerStationRepository powerStationRepository; private readonly IPowerStationRepository powerStationRepository;
public IWebHostEnvironment environment;
private double carbonRate; private double carbonRate;
public CalcPowerStationJob(ILogger<CalcPowerStationJob> logger, IPowerStationRepository powerStationRepository) public CalcPowerStationJob(
ILogger<CalcPowerStationJob> logger,
IPowerStationRepository powerStationRepository,
IWebHostEnvironment environment)
{ {
this.logger = logger; this.logger = logger;
this.powerStationRepository = powerStationRepository; this.powerStationRepository = powerStationRepository;
this.environment = environment;
} }
public async Task Execute(IJobExecutionContext context) public async Task Execute(IJobExecutionContext context)
@ -32,7 +40,10 @@ namespace SolarPower.Quartz.Jobs
var DateTimeNow = DateTime.Now; var DateTimeNow = DateTime.Now;
var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH"); var dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
dateTime = "2021-07-26 16"; if (this.environment.IsDevelopment())
{
dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
}
logger.LogInformation("【CalcPowerStationJob】【任務開始】"); logger.LogInformation("【CalcPowerStationJob】【任務開始】");
@ -286,13 +297,17 @@ namespace SolarPower.Quartz.Jobs
double shortLocation = 9999; double shortLocation = 9999;
foreach (var Location in observation.Records.Location) foreach (var Location in observation.Records.Location)
{ {
var powerLocation = powerStation.Coordinate.Split(',');
var nowLocation = Math.Sqrt(Math.Pow(Convert.ToDouble(powerLocation[0]) - Convert.ToDouble(Location.Lat), 2) + Math.Pow(Convert.ToDouble(powerLocation[1]) - Convert.ToDouble(Location.Lon), 2)); if(powerStation.Coordinate != null)
if (nowLocation < shortLocation)
{ {
shortLocation = nowLocation; var powerLocation = powerStation.Coordinate.Split(',');
weatherStationId = Location.StationId; var nowLocation = Math.Sqrt(Math.Pow(Convert.ToDouble(powerLocation[0]) - Convert.ToDouble(Location.Lat), 2) + Math.Pow(Convert.ToDouble(powerLocation[1]) - Convert.ToDouble(Location.Lon), 2));
calcPowerStation.TodayWeatherTemp = Convert.ToDouble(Location.WeatherElement[0].ElementValue); if (nowLocation < shortLocation)
{
shortLocation = nowLocation;
weatherStationId = Location.StationId;
calcPowerStation.TodayWeatherTemp = Convert.ToDouble(Location.WeatherElement[0].ElementValue);
}
} }
} }

View File

@ -3748,11 +3748,13 @@ namespace SolarPower.Repository.Implement
foreach (var entity in entities) foreach (var entity in entities)
{ {
var table_name = string.Format("`{0}`.`s{1}01_inv`", entity.SiteDB, entity.Code); var table_name = string.Format("`{0}`.`s{1}01_inv`", entity.SiteDB, entity.Code);
var sensor_table_name = string.Format("`{0}`.`s{1}01_sensoravg`", entity.SiteDB, entity.Code);
var inverterIds = string.Join("','", entity.InverterIds); var inverterIds = string.Join("','", entity.InverterIds);
var temp_sql = $@"SELECT var temp_sql = $@"SELECT
FROM_UNIXTIME(inv.TIMESTAMP/1000, '%H:%i') AS TIMESTAMP, FROM_UNIXTIME(inv.TIMESTAMP/1000, '%H:%i') AS TIMESTAMP,
inv.INVERTERID, inv.INVERTERID,
sen.{entity.Sensor} AS Irradiance,
((inv.DC1W + inv.DC2W + inv.DC3W + inv.DC4W + inv.DC5W) / 1000) AS DCKW, ((inv.DC1W + inv.DC2W + inv.DC3W + inv.DC4W + inv.DC5W) / 1000) AS DCKW,
((inv.AC1W + inv.AC2W + inv.AC3W) / 1000) AS ACKW, ((inv.AC1W + inv.AC2W + inv.AC3W) / 1000) AS ACKW,
inv.AC1V, inv.AC1V,
@ -3797,6 +3799,7 @@ namespace SolarPower.Repository.Implement
inv.RA4, inv.RA4,
inv.RA5 inv.RA5
FROM {table_name} inv FROM {table_name} inv
LEFT JOIN {sensor_table_name} sen ON FROM_UNIXTIME(inv.TIMESTAMP/1000, '%Y-%m-%d %H:%i') = FROM_UNIXTIME(sen.TIMESTAMP/1000, '%Y-%m-%d %H:%i')
WHERE FROM_UNIXTIME(inv.TIMESTAMP/1000, '%Y-%m-%d') = @NowDay WHERE FROM_UNIXTIME(inv.TIMESTAMP/1000, '%Y-%m-%d') = @NowDay
AND INVERTERID IN ('{inverterIds}')"; AND INVERTERID IN ('{inverterIds}')";
@ -4041,7 +4044,7 @@ namespace SolarPower.Repository.Implement
} }
var select_col = string.Join(", ", sql_select_col); var select_col = string.Join(", ", sql_select_col);
var sql = $"SELECT {select_col} " + sql_sub; var sql = $"SELECT {select_col} " + sql_sub + " ORDER BY sen.TIMESTAMP";
result = await conn.QueryAsync<dynamic>(sql); result = await conn.QueryAsync<dynamic>(sql);
} }
@ -4117,7 +4120,8 @@ namespace SolarPower.Repository.Implement
FROM {table_name} ps FROM {table_name} ps
LEFT JOIN {letf_join_table} sen ON ps.PowerStationId = sen.PowerStationId AND ps.TIMESTAMP = sen.TIMESTAMP LEFT JOIN {letf_join_table} sen ON ps.PowerStationId = sen.PowerStationId AND ps.TIMESTAMP = sen.TIMESTAMP
WHERE ps.PowerStationId IN @PowerStationId WHERE ps.PowerStationId IN @PowerStationId
{where_date}"; {where_date}
ORDER BY ps.TIMESTAMP";
result = (await conn.QueryAsync<PowerStationHistory>(sql, new { PowerStationId = entities})).ToList(); result = (await conn.QueryAsync<PowerStationHistory>(sql, new { PowerStationId = entities})).ToList();
} }
@ -4128,5 +4132,86 @@ namespace SolarPower.Repository.Implement
return result; return result;
} }
} }
public async Task<List<MeterHistory>> GetMeterHistory(string date, byte searchType, List<StationIdWithMeterIds> entities)
{
List<MeterHistory> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var date_format = "";
var table_name = "";
var where_date = "";
var start_date = "";
var end_date = "";
switch (searchType)
{
case 0:
date_format = "%H:%i";
table_name = "meter_history_hour";
where_date = $" AND DATE_FORMAT(m.TIMESTAMP, '%Y-%m-%d') = '{date}'";
break;
case 1:
date_format = "%Y-%m-%d";
table_name = "meter_history_day";
var date_split = date.Split('-');
start_date = Convert.ToDateTime(date_split[0].Trim()).ToString("yyyy-MM-dd");
end_date = Convert.ToDateTime(date_split[1].Trim()).ToString("yyyy-MM-dd");
where_date = $" AND DATE_FORMAT(m.TIMESTAMP, '%Y-%m-%d') BETWEEN '{start_date}' AND '{end_date}'";
break;
case 2:
date_format = "%Y-%m-%d";
table_name = "power_station_history_day";
start_date = Convert.ToDateTime(date).ToString("yyyy-MM-dd");
end_date = Convert.ToDateTime(date).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
where_date = $" AND DATE_FORMAT(m.TIMESTAMP, '%Y-%m-%d') BETWEEN '{start_date}' AND '{end_date}'";
break;
case 3:
date_format = "%Y-%m";
table_name = "power_station_history_month";
where_date = $" AND DATE_FORMAT(m.TIMESTAMP, '%Y') = '{date}'";
break;
}
List<string> sql_perSiteDB = new List<string>();
var sql = "";
foreach (var entity in entities)
{
var meterIds = string.Join("','", entity.MeterIds);
var temp_sql = $@"SELECT
DATE_FORMAT(m.TIMESTAMP, '{date_format}') AS TIMESTAMP,
m.METERID,
m.V_AB,
m.V_BC,
m.V_CA,
m.I_A,
m.I_B,
m.I_C,
m.P,
m.F,
m.OUTPUT_KWH,
m.INPUT_KWH
FROM {table_name} m
WHERE m.PowerStationId = {entity.PowerStationId}
AND m.METERID IN ('{meterIds}')
{where_date}
ORDER BY m.TIMESTAMP";
sql_perSiteDB.Add(temp_sql);
}
sql = string.Join(" UNION ", sql_perSiteDB);
result = (await conn.QueryAsync<MeterHistory>(sql)).ToList();
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
} }
} }

View File

@ -557,5 +557,7 @@ namespace SolarPower.Repository.Interface
Task<List<Device>> GetDeviceByPowerStationIdAndDeviceIds(string db_name, int powerStationId, List<string> deviceIds); Task<List<Device>> GetDeviceByPowerStationIdAndDeviceIds(string db_name, int powerStationId, List<string> deviceIds);
Task<dynamic> GetSensorAvgByDevices(string date, byte searchType, List<Device> devices); Task<dynamic> GetSensorAvgByDevices(string date, byte searchType, List<Device> devices);
Task<List<PowerStationHistory>> GetPowerStationHistory(string date, byte searchType, List<int> entities); Task<List<PowerStationHistory>> GetPowerStationHistory(string date, byte searchType, List<int> entities);
Task<List<MeterHistory>> GetMeterHistory(string date, byte searchType, List<StationIdWithMeterIds> entities);
} }
} }

View File

@ -76,7 +76,7 @@
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">選擇比較欄位</button> <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown">選擇比較欄位</button>
<ul class="dropdown-menu" id="compare-dropdown-menu" style="width:10vw;overflow-x:hidden; max-height:50vh"> <ul class="dropdown-menu" id="compare-dropdown-menu" style="width:10vw;overflow-x:hidden; max-height:50vh">
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option1" tabIndex="-1">日照度<input type="checkbox" class="float-right" name="compare_col[]" value="Irradiance" /></a></li> @*<li><a href="javascript:void(0)" class="dropdown-item" data-value="option1" tabIndex="-1">日照度<input type="checkbox" class="float-right" name="compare_col[]" value="Irradiance" /></a></li>
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option2" tabIndex="-1">直流功率 (KW)<input type="checkbox" class="float-right" name="compare_col[]" value="DCKW" /></a></li> <li><a href="javascript:void(0)" class="dropdown-item" data-value="option2" tabIndex="-1">直流功率 (KW)<input type="checkbox" class="float-right" name="compare_col[]" value="DCKW" /></a></li>
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option3" tabIndex="-1">輸出功率 (KW)<input type="checkbox" class="float-right" name="compare_col[]" value="ACKW" /></a></li> <li><a href="javascript:void(0)" class="dropdown-item" data-value="option3" tabIndex="-1">輸出功率 (KW)<input type="checkbox" class="float-right" name="compare_col[]" value="ACKW" /></a></li>
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option4" tabIndex="-1">直流電壓1 (V)<input type="checkbox" class="float-right" name="compare_col[]" value="DC1V" /></a></li> <li><a href="javascript:void(0)" class="dropdown-item" data-value="option4" tabIndex="-1">直流電壓1 (V)<input type="checkbox" class="float-right" name="compare_col[]" value="DC1V" /></a></li>
@ -105,7 +105,7 @@
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA2 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA2" /></a></li> <li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA2 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA2" /></a></li>
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA3 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA3" /></a></li> <li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA3 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA3" /></a></li>
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA4 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA4" /></a></li> <li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA4 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA4" /></a></li>
<li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA5 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA5" /></a></li> <li><a href="javascript:void(0)" class="dropdown-item" data-value="option6" tabIndex="-1">RA5 (%)<input type="checkbox" class="float-right" name="compare_col[]" value="RA5" /></a></li>*@
</ul> </ul>
</div> </div>
</div> </div>
@ -151,52 +151,51 @@
var analysisInverter; var analysisInverter;
var myXAxis = []; var myYAxis = []; var mySeries = []; var myXAxis = []; var myYAxis = []; var mySeries = [];
var chart; var chart;
var default_compare_row_data = ["ACKW"] var default_compare_col = [];
var compare_row_data = [ var current_compare_col = [];
{ key: "Irradiance", title: "日照度"}, var Single_day_compare_col = [
{ key: "DCKW", title: "直流功率 (KW)"}, { key: "Irradiance", title: "日照度", default: true },
{ key: "ACKW", title: "輸出功率 (KW)"}, { key: "DCKW", title: "直流功率 (KW)", default: true },
{ key: "DC1V", title: "直流電壓1 (V)"}, { key: "ACKW", title: "輸出功率 (KW)", default: true },
{ key: "DC1A", title: "直流電流1 (A)"}, { key: "DC1V", title: "直流電壓1 (V)", default: false },
{ key: "DC1KW", title: "直流功率1 (KW)"}, { key: "DC1A", title: "直流電流1 (A)", default: false },
{ key: "DC2V", title: "直流電壓2 (V)"}, { key: "DC1KW", title: "直流功率1 (KW)", default: false },
{ key: "DC2A", title: "直流電流2 (A)"}, { key: "DC2V", title: "直流電壓2 (V)", default: false },
{ key: "DC2KW", title: "直流功率2 (KW)"}, { key: "DC2A", title: "直流電流2 (A)", default: false },
{ key: "DC3V", title: "直流電壓3 (V)"}, { key: "DC2KW", title: "直流功率2 (KW)", default: false },
{ key: "DC3A", title: "直流電流3 (A)"}, { key: "DC3V", title: "直流電壓3 (V)", default: false },
{ key: "DC3KW", title: "直流功率3 (KW)"}, { key: "DC3A", title: "直流電流3 (A)", default: false },
{ key: "DC4V", title: "直流電壓4 (V)"}, { key: "DC3KW", title: "直流功率3 (KW)", default: false },
{ key: "DC4A", title: "直流電流4 (A)"}, { key: "DC4V", title: "直流電壓4 (V)", default: false },
{ key: "DC4KW", title: "直流功率4 (KW)"}, { key: "DC4A", title: "直流電流4 (A)", default: false },
{ key: "DC5V", title: "直流電壓5 (V)"}, { key: "DC4KW", title: "直流功率4 (KW)", default: false },
{ key: "DC5A", title: "直流電流5 (A)"}, { key: "DC5V", title: "直流電壓5 (V)", default: false },
{ key: "DC5KW", title: "直流功率5 (KW)"}, { key: "DC5A", title: "直流電流5 (A)", default: false },
{ key: "AC1V", title: "交流電壓A (V)"}, { key: "DC5KW", title: "直流功率5 (KW)", default: false },
{ key: "AC2V", title: "交流電壓B (V)"}, { key: "AC1V", title: "交流電壓A (V)", default: false },
{ key: "AC3V", title: "交流電壓C (V)"}, { key: "AC2V", title: "交流電壓B (V)", default: false },
{ key: "AC1A", title: "交流電流A (A)"}, { key: "AC3V", title: "交流電壓C (V)", default: false },
{ key: "AC2A", title: "交流電流B (A)"}, { key: "AC1A", title: "交流電流A (A)", default: false },
{ key: "AC3A", title: "交流電流C (A)"}, { key: "AC2A", title: "交流電流B (A)", default: false },
{ key: "PR", title: "PR"}, { key: "AC3A", title: "交流電流C (A)", default: false },
{ key: "RA1", title: "RA1 (%)"}, { key: "PR", title: "PR", default: false },
{ key: "RA2", title: "RA2 (%)"}, { key: "RA1", title: "RA1 (%)", default: false },
{ key: "RA3", title: "RA3 (%)"}, { key: "RA2", title: "RA2 (%)", default: false },
{ key: "RA4", title: "RA4 (%)"}, { key: "RA3", title: "RA3 (%)", default: false },
{ key: "RA5", title: "RA5 (%)"} { key: "RA4", title: "RA4 (%)", default: false },
{ key: "RA5", title: "RA5 (%)", default: false }
] ]
var Range_compare_col = [
var default_compare_date = ["KWH"] { key: "Irradiance", title: "日照度", default: true },
var compare_date = [ { key: "KWH", title: "KWH", default: true },
{ key: "Irradiance", title: "日照度"}, { key: "TodayKWH", title: "TodayKWH", default: false },
{ key: "KWH", title: "KWH"}, { key: "TotalKWH", title: "TotalKWH", default: false },
{ key: "TodayKWH", title: "TodayKWH"}, { key: "PR", title: "PR", default: false },
{ key: "TotalKWH", title: "TotalKWH"}, { key: "RA1", title: "RA1 (%)", default: false },
{ key: "PR", title: "PR"}, { key: "RA2", title: "RA2 (%)", default: false },
{ key: "RA1", title: "RA1 (%)"}, { key: "RA3", title: "RA3 (%)", default: false },
{ key: "RA2", title: "RA2 (%)"}, { key: "RA4", title: "RA4 (%)", default: false },
{ key: "RA3", title: "RA3 (%)"}, { key: "RA5", title: "RA5 (%)", default: false }
{ key: "RA4", title: "RA4 (%)"},
{ key: "RA5", title: "RA5 (%)"}
] ]
$(function () { $(function () {
@ -215,6 +214,7 @@
//#endregion //#endregion
PushSpecifyCurrentCompareCol(Single_day_compare_col);
}) })
function myfunc(div) { function myfunc(div) {
@ -243,12 +243,7 @@
var today = new Date().toISOString().substring(0, 10); var today = new Date().toISOString().substring(0, 10);
$('#DateGet').val(today); $('#DateGet').val(today);
$("#compare-dropdown-menu").empty(); PushSpecifyCurrentCompareCol(Single_day_compare_col);
var str = "";
$.each(compare_row_data, function (index, item) {
str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>'
});
$("#compare-dropdown-menu").append(str);
break; break;
case 1: case 1:
@ -284,12 +279,7 @@
//#endregion //#endregion
$('#DateGettext').val(dateLimit_format + ' - ' + today_format); $('#DateGettext').val(dateLimit_format + ' - ' + today_format);
$("#compare-dropdown-menu").empty(); PushSpecifyCurrentCompareCol(Range_compare_col);
var str = "";
$.each(compare_date, function (index, item) {
str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>'
});
$("#compare-dropdown-menu").append(str);
break; break;
case 2: $('#DateGet').prop({ 'type': 'month' }); case 2: $('#DateGet').prop({ 'type': 'month' });
@ -298,12 +288,7 @@
var now_month = new Date().toISOString().substring(0, 7); var now_month = new Date().toISOString().substring(0, 7);
$('#DateGet').val(now_month); $('#DateGet').val(now_month);
$("#compare-dropdown-menu").empty(); PushSpecifyCurrentCompareCol(Range_compare_col);
var str = "";
$.each(compare_date, function (index, item) {
str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>'
});
$("#compare-dropdown-menu").append(str);
break; break;
case 3: case 3:
@ -313,12 +298,7 @@
$('#DateGet').prop({ 'type': 'number', 'min': 1900, 'max': now_year, 'step': 1 }); $('#DateGet').prop({ 'type': 'number', 'min': 1900, 'max': now_year, 'step': 1 });
$('#DateGet').val(now_year); $('#DateGet').val(now_year);
$("#compare-dropdown-menu").empty(); PushSpecifyCurrentCompareCol(Range_compare_col);
var str = "";
$.each(compare_date, function (index, item) {
str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>'
});
$("#compare-dropdown-menu").append(str);
break; break;
} }
@ -416,7 +396,6 @@
selected_inverter.splice($.inArray({ powerStationId: powerStationId, InverterId: this.value }, selected_inverter), 1); selected_inverter.splice($.inArray({ powerStationId: powerStationId, InverterId: this.value }, selected_inverter), 1);
} }
} }
console.log(selected_inverter);
}); });
$('#js_list_accordion').on("change", 'input[name="selectedInverterLayer2[]"]', function (event) { $('#js_list_accordion').on("change", 'input[name="selectedInverterLayer2[]"]', function (event) {
@ -427,11 +406,15 @@
} }
}); });
$('#compare-dropdown-menu').on('change','input[name="compare_col[]"]', function (e) { $('#compare-dropdown-menu').on('change', 'input[name="compare_col[]"]', function (e) {
if (this.checked) { if (this.checked) {
selected_YAxis.push($(this).val()); if ($.inArray($(this).val(), default_compare_col) == -1) {
default_compare_col.push($(this).val());
}
} else { } else {
selected_YAxis.splice($.inArray($(this).val(), selected_YAxis), 1); if ($.inArray($(this).val(), default_compare_col) > 0) {
default_compare_col.splice($.inArray($(this).val(), default_compare_col), 1);
}
} }
ReloadHighCharts(); ReloadHighCharts();
@ -518,6 +501,48 @@
}, 'json'); }, 'json');
} }
//#region 加入已勾選的設備所要顯示得比較欄位
function PushSpecifyCurrentCompareCol(compare_col) {
default_compare_col = []; current_compare_col = [];
$.each(compare_col, function (index, item) {
if (!current_compare_col.some(x => x.key == item.key)) {
item.count = 1;
current_compare_col.push(item);
} else {
current_compare_col.find(function (obj, index) {
if (obj.key == item.key) {
current_compare_col[index].count += 1;
}
});
}
if (item.default) {
default_compare_col.push(item.key);
}
});
console.log("default_compare_col", default_compare_col);
ChangeCompareSelectOption();
}
//#endregion
function ChangeCompareSelectOption() {
$("#compare-dropdown-menu").empty();
var str = "";
$.each(current_compare_col, function (index, item) {
str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>'
});
$("#compare-dropdown-menu").append(str);
$('input[name="compare_col[]"]').each(function () {
if ($.inArray(this.value, default_compare_col) > -1) {
$(this).prop('checked', true);
}
});
}
function GetAnalysisInverter() { function GetAnalysisInverter() {
var date; var date;
@ -543,20 +568,11 @@
analysisInverter = rel.data; analysisInverter = rel.data;
if (searchType != 0) { $('input[name="compare_col[]"]').each(function () {
$('input[name="compare_col[]"]').each(function () { if ($.inArray(this.value, default_compare_col) > -1) {
if ($.inArray(this.value, default_compare_date) > -1) { $(this).prop('checked', true).trigger('change');
$(this).prop('checked', true).trigger('change'); }
} });
});
}
else {
$('input[name="compare_col[]"]').each(function () {
if ($.inArray(this.value, default_compare_row_data) > -1) {
$(this).prop('checked', true).trigger('change');
}
});
}
ReloadHighCharts(); ReloadHighCharts();
}, 'json'); }, 'json');
@ -564,6 +580,13 @@
function ReloadHighCharts() { function ReloadHighCharts() {
if (analysisInverter == undefined) {
return;
}
//彙整出 有被選擇的 要顯示的覽位
selected_YAxis = default_compare_col.filter(obj1 => current_compare_col.some(obj2 => obj1 == obj2.key));
myYAxis = []; mySeries = []; myYAxis = []; mySeries = [];
myXAxis = analysisInverter.xAxis myXAxis = analysisInverter.xAxis
@ -601,67 +624,57 @@
chart.destroy(); chart.destroy();
} }
chart = new Highcharts.Chart({ if (myYAxis != undefined && myXAxis != undefined && mySeries != undefined) {
lang: { //匯出相關中文名稱配置 chart = new Highcharts.Chart({
printChart: '列印圖表', lang: { //匯出相關中文名稱配置
downloadJPEG: '下載JPEG檔案', printChart: '列印圖表',
downloadPDF: '下載PDF檔案', downloadJPEG: '下載JPEG檔案',
downloadPNG: '下載PNG檔案', downloadPDF: '下載PDF檔案',
downloadSVG: '下載SVG檔案', downloadPNG: '下載PNG檔案',
downloadCSV: '下載CSV檔案', downloadSVG: '下載SVG檔案',
downloadXLS: '下載XLS檔案', downloadCSV: '下載CSV檔案',
viewData: '檢視資料表格', downloadXLS: '下載XLS檔案',
viewFullscreen: '全屏檢視' viewData: '檢視資料表格',
}, viewFullscreen: '全屏檢視'
chart: { },
renderTo: 'container', chart: {
height: 600, renderTo: 'container',
animation: false height: 600,
}, animation: false
title: { },
text: '交叉分析圖表' title: {
}, text: '交叉分析圖表'
tooltip: { },
formatter: function () { tooltip: {
return '<b>' + this.series.name + '</b><br>' +
'<span>' + this.x + '</span><br>' +
'<b style = "color:rgb(103, 180, 172);" >' + this.point.y + '</b>';
}
},
xAxis: {
categories: myXAxis,
labels: {
step: 1,
formatter: function () { formatter: function () {
if (searchType == 0) { return '<b>' + this.series.name + '</b><br>' +
var aa = this.value.substr(-2); '<span>' + this.x + '</span><br>' +
if (aa == "00") { '<b style = "color:rgb(103, 180, 172);" >' + this.point.y + '</b>';
return '<span>' + this.value + '</span>'; }
},
xAxis: {
categories: myXAxis,
labels: {
step: 1,
formatter: function () {
if (searchType == 0) {
var aa = this.value.substr(-2);
if (aa == "00") {
return '<span>' + this.value + '</span>';
} else {
return '<span style="display:none">' + this.value + '</span>';
}
} else { } else {
return '<span style="display:none">' + this.value + '</span>'; return this.value
} }
} else {
return this.value
} }
} }
} },
}, yAxis: myYAxis,
yAxis: myYAxis,
series: mySeries, series: mySeries,
}); });
}
@*$("#container").highcharts({
chart: {
height: 600
},
xAxis: {
categories: myXAxis
},
yAxis: myYAxis,
series: mySeries,
});*@
} }
</script> </script>
} }

View File

@ -119,19 +119,31 @@
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: true },
{ key: "KWHKWP", title: "發電小時", default: false }, { key: "KWHKWP", title: "發電小時", default: false },
{ key: "PR", title: "PR %", default: false }, { key: "PR", title: "PR %", default: false },
{ key: "ModelTemperature", title: "模組溫度", default: false }, { key: "ModelTemperature", title: "模組溫度", default: false },
{ key: "SolarHour", title: "日照小時", default: false } { key: "SolarHour", title: "日照小時", default: false }
] ]
var PWR_compare_col = [
{ key: "OUTPUT_KWH", title: "輸出發電量(kWh)", default: true },
{ key: "Irradiance", title: "輸入發電量(kWh)", default: true },
{ key: "V_AB", title: "電壓 AB(V)", default: false },
{ key: "V_BC", title: "電壓 BC(V)", default: false },
{ key: "V_CA", title: "電壓 CA(V)", default: false },
{ key: "I_A", title: "電流 A(A)", default: false },
{ key: "I_B", title: "電流 B(A)", default: false },
{ key: "I_C", title: "電流 C(A)", default: false },
{ key: "P", title: "有效功率(kW)", default: false },
{ key: "F", title: "頻率(Hz)", default: false }
]
var PYR_compare_col = [{ key: "Irradiance", title: "日照度", default: true }]; var PYR_compare_col = [{ key: "Irradiance", title: "日照度", default: true }];
var ETR_compare_col = [{ key: "Temperature", title: "環境溫度計", default: true }]; var ETR_compare_col = [{ key: "Temperature", title: "環境溫度計", default: true }];
var MTR_compare_col = [{ key: "ModelTemperature", title: "模組溫度", default: true }]; var MTR_compare_col = [{ key: "ModelTemperature", title: "模組溫度", default: true }];
var EMM_compare_col = [{ key: "Humidity", title: "濕度", default: true }]; var EMM_compare_col = [{ key: "Humidity", title: "濕度", default: true }];
var VAN_compare_col = [{ key: "Vane", title: "風速", default: true }]; var VAN_compare_col = [{ key: "Vane", title: "風速", default: true }];
var FOM_compare_col = [{ key: "Dust", title: "落塵%", default: true }]; var FOM_compare_col = [{ key: "Dust", title: "落塵%", default: true }];
var all_selected_compare_col = []; var current_compare_col = [];
var default_compare_col = []; var default_compare_col = [];
var selected_YAxis = []; var selected_YAxis = [];
var analysisStationInfo; var analysisStationInfo;
@ -325,28 +337,28 @@
switch (type) { switch (type) {
case 'PWS': case 'PWS':
PushAllSelectedCompareCol(PWS_compare_col); PushSpecifyCurrentCompareCol(PWS_compare_col);
break; break;
case 'PWR': //電錶 case 'PWR': //電錶
PushSpecifyCurrentCompareCol(PWR_compare_col);
break; break;
case 'PYR': //日照計 case 'PYR': //日照計
PushAllSelectedCompareCol(PYR_compare_col); PushSpecifyCurrentCompareCol(PYR_compare_col);
break; break;
case 'ETR': //環境溫度計 case 'ETR': //環境溫度計
PushAllSelectedCompareCol(ETR_compare_col); PushSpecifyCurrentCompareCol(ETR_compare_col);
break; break;
case 'MTR': //模組溫度計 case 'MTR': //模組溫度計
PushAllSelectedCompareCol(MTR_compare_col); PushSpecifyCurrentCompareCol(MTR_compare_col);
break; break;
case 'VAN': //風速計 case 'VAN': //風速計
PushAllSelectedCompareCol(VAN_compare_col); PushSpecifyCurrentCompareCol(VAN_compare_col);
break; break;
case 'FOM': //落塵計 case 'FOM': //落塵計
PushAllSelectedCompareCol(FOM_compare_col); PushSpecifyCurrentCompareCol(FOM_compare_col);
break; break;
case 'EMM': //環境濕度計 case 'EMM': //環境濕度計
PushAllSelectedCompareCol(EMM_compare_col); PushSpecifyCurrentCompareCol(EMM_compare_col);
break; break;
} }
} }
@ -368,36 +380,35 @@
switch (type) { switch (type) {
case 'PWS': case 'PWS':
RemoveAllSelectedCompareCol(PWS_compare_col); RemoveSpecifyCurrentCompareCol(PWS_compare_col);
break; break;
case 'PWR': //電錶 case 'PWR': //電錶
RemoveSpecifyCurrentCompareCol(PWR_compare_col);
break; break;
case 'PYR': //日照計 case 'PYR': //日照計
RemoveAllSelectedCompareCol(PYR_compare_col); RemoveSpecifyCurrentCompareCol(PYR_compare_col);
break; break;
case 'ETR': //環境溫度計 case 'ETR': //環境溫度計
RemoveAllSelectedCompareCol(ETR_compare_col); RemoveSpecifyCurrentCompareCol(ETR_compare_col);
break; break;
case 'MTR': //模組溫度計 case 'MTR': //模組溫度計
RemoveAllSelectedCompareCol(MTR_compare_col); RemoveSpecifyCurrentCompareCol(MTR_compare_col);
break; break;
case 'VAN': //風速計 case 'VAN': //風速計
RemoveAllSelectedCompareCol(VAN_compare_col); RemoveSpecifyCurrentCompareCol(VAN_compare_col);
break; break;
case 'FOM': //落塵計 case 'FOM': //落塵計
RemoveAllSelectedCompareCol(VAN_compare_col); RemoveSpecifyCurrentCompareCol(VAN_compare_col);
break; break;
case 'EMM': //環境濕度計 case 'EMM': //環境濕度計
RemoveAllSelectedCompareCol(EMM_compare_col); RemoveSpecifyCurrentCompareCol(EMM_compare_col);
break; break;
} }
all_selected_compare_col = all_selected_compare_col.filter(x => x.count > 0); current_compare_col = current_compare_col.filter(x => x.count > 0);
} }
} }
console.log("all_selected_compare_col", all_selected_compare_col);
ChangeCompareSelectOption() ChangeCompareSelectOption()
}); });
@ -411,21 +422,15 @@
$('#compare-dropdown-menu').on('change', 'input[name="compare_col[]"]', function (e) { $('#compare-dropdown-menu').on('change', 'input[name="compare_col[]"]', function (e) {
if (this.checked) { if (this.checked) {
selected_YAxis.push($(this).val());
if ($.inArray($(this).val(), default_compare_col) == -1) { if ($.inArray($(this).val(), default_compare_col) == -1) {
default_compare_col.push($(this).val()); default_compare_col.push($(this).val());
} }
} else { } else {
selected_YAxis.splice($.inArray($(this).val(), selected_YAxis), 1); if ($.inArray($(this).val(), default_compare_col) > 0) {
if ($.inArray($(this).val(), default_compare_col) >0) {
default_compare_col.splice($.inArray($(this).val(), default_compare_col), 1); default_compare_col.splice($.inArray($(this).val(), default_compare_col), 1);
} }
} }
console.log("default_compare_col", default_compare_col)
console.log("selected_YAxis", selected_YAxis)
ReloadHighCharts(); ReloadHighCharts();
}); });
@ -539,16 +544,16 @@
}, 'json'); }, 'json');
} }
//#region 將設備欄位加入要顯示得比較欄位 //#region 加入已勾選的設備所要顯示得比較欄位
function PushAllSelectedCompareCol(compare_col) { function PushSpecifyCurrentCompareCol(compare_col) {
$.each(compare_col, function (index, item) { $.each(compare_col, function (index, item) {
if (!all_selected_compare_col.some(x => x.key == item.key)) { if (!current_compare_col.some(x => x.key == item.key)) {
item.count = 1; item.count = 1;
all_selected_compare_col.push(item); current_compare_col.push(item);
} else { } else {
all_selected_compare_col.find(function (obj, index) { current_compare_col.find(function (obj, index) {
if (obj.key == item.key) { if (obj.key == item.key) {
all_selected_compare_col[index].count += 1; current_compare_col[index].count += 1;
} }
}); });
} }
@ -558,35 +563,33 @@
} }
}); });
console.log("default_compare_col", default_compare_col);
} }
//#endregion //#endregion
//#region 將設備欄位移除要顯示得比較欄位 //#region 將設備欄位移除要顯示得比較欄位
function RemoveAllSelectedCompareCol(compare_col) { function RemoveSpecifyCurrentCompareCol(compare_col) {
$.each(compare_col, function (index, item) { $.each(compare_col, function (index, item) {
all_selected_compare_col.find(function (obj, index) { current_compare_col.find(function (obj, index) {
if (obj.key == item.key) { if (obj.key == item.key) {
all_selected_compare_col[index].count -= 1; current_compare_col[index].count -= 1;
} }
}); });
}); });
$.each(all_selected_compare_col, function (index, item) { $.each(current_compare_col, function (index, item) {
if (item.count <= 0) { if (item.count <= 0) {
if ($.inArray(item.key, default_compare_col) > -1) if ($.inArray(item.key, default_compare_col) > -1)
default_compare_col.splice($.inArray(item.key, default_compare_col), 1); default_compare_col.splice($.inArray(item.key, default_compare_col), 1);
} }
}); });
console.log("default_compare_col", default_compare_col);
} }
//#endregion //#endregion
function ChangeCompareSelectOption() { function ChangeCompareSelectOption() {
$("#compare-dropdown-menu").empty(); $("#compare-dropdown-menu").empty();
var str = ""; var str = "";
$.each(all_selected_compare_col, function (index, item) { $.each(current_compare_col, function (index, item) {
str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>' str += '<li><a href="javascript:void(0)" class="dropdown-item" tabIndex="-1">' + item.title + '<input type="checkbox" class="float-right" name="compare_col[]" value="' + item.key + '" /></a></li>'
}); });
$("#compare-dropdown-menu").append(str); $("#compare-dropdown-menu").append(str);
@ -622,30 +625,30 @@
analysisStationInfo = rel.data; analysisStationInfo = rel.data;
if (searchType != 0) { $('input[name="compare_col[]"]').each(function () {
$('input[name="compare_col[]"]').each(function () { if ($.inArray(this.value, default_compare_col) > -1) {
if ($.inArray(this.value, default_compare_col) > -1) { $(this).prop('checked', true).trigger('change');
$(this).prop('checked', true).trigger('change'); }
} });
});
}
else {
$('input[name="compare_col[]"]').each(function () {
if ($.inArray(this.value, default_compare_col) > -1) {
$(this).prop('checked', true).trigger('change');
}
});
}
}, 'json'); }, 'json');
} }
function ReloadHighCharts() { function ReloadHighCharts() {
if (analysisStationInfo == undefined) {
return;
}
//彙整出 有被選擇的 要顯示的覽位
selected_YAxis = default_compare_col.filter(obj1 => current_compare_col.some(obj2 => obj1 == obj2.key));
myYAxis = []; mySeries = []; myYAxis = []; mySeries = [];
myXAxis = analysisStationInfo.xAxis myXAxis = analysisStationInfo.xAxis
Object.keys(analysisStationInfo.multipleYaxes).map(function (key, index) { Object.keys(analysisStationInfo.multipleYaxes).map(function (key, index) {
if (selected_YAxis.indexOf(key) > -1) { if (selected_YAxis.indexOf(key) > -1) {
@ -679,55 +682,57 @@
chart.destroy(); chart.destroy();
} }
chart = new Highcharts.Chart({ if (myYAxis != undefined && myXAxis != undefined && mySeries != undefined) {
lang: { //匯出相關中文名稱配置 chart = new Highcharts.Chart({
printChart: '列印圖表', lang: { //匯出相關中文名稱配置
downloadJPEG: '下載JPEG檔案', printChart: '列印圖表',
downloadPDF: '下載PDF檔案', downloadJPEG: '下載JPEG檔案',
downloadPNG: '下載PNG檔案', downloadPDF: '下載PDF檔案',
downloadSVG: '下載SVG檔案', downloadPNG: '下載PNG檔案',
downloadCSV: '下載CSV檔案', downloadSVG: '下載SVG檔案',
downloadXLS: '下載XLS檔案', downloadCSV: '下載CSV檔案',
viewData: '檢視資料表格', downloadXLS: '下載XLS檔案',
viewFullscreen: '全屏檢視' viewData: '檢視資料表格',
}, viewFullscreen: '全屏檢視'
chart: { },
renderTo: 'container', chart: {
height: 600, renderTo: 'container',
animation: false height: 600,
}, animation: false
title: { },
text: '交叉分析圖表' title: {
}, text: '交叉分析圖表'
tooltip: { },
formatter: function () { tooltip: {
return '<b>' + this.series.name + '</b><br>' +
'<span>' + this.x + '</span><br>' +
'<b style = "color:rgb(103, 180, 172);" >' + this.point.y + '</b>';
}
},
xAxis: {
categories: myXAxis,
labels: {
step: 1,
formatter: function () { formatter: function () {
if (searchType == 0) { return '<b>' + this.series.name + '</b><br>' +
var aa = this.value.substr(-2); '<span>' + this.x + '</span><br>' +
if (aa == "00") { '<b style = "color:rgb(103, 180, 172);" >' + this.point.y + '</b>';
return '<span>' + this.value + '</span>'; }
},
xAxis: {
categories: myXAxis,
labels: {
step: 1,
formatter: function () {
if (searchType == 0) {
var aa = this.value.substr(-2);
if (aa == "00") {
return '<span>' + this.value + '</span>';
} else {
return '<span style="display:none">' + this.value + '</span>';
}
} else { } else {
return '<span style="display:none">' + this.value + '</span>'; return this.value
} }
} else {
return this.value
} }
} }
} },
}, yAxis: myYAxis,
yAxis: myYAxis,
series: mySeries, series: mySeries,
}); });
}
} }
</script> </script>
} }

View File

@ -3,11 +3,13 @@
ViewData["SubNum"] = "1"; ViewData["SubNum"] = "1";
ViewData["Title"] = "電站管理"; ViewData["Title"] = "電站管理";
} }
@using SolarPower.Models.Role
@model RoleLayerEnum
<ol class="breadcrumb page-breadcrumb"> <ol class="breadcrumb page-breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);">總覽</a></li> <li class="breadcrumb-item"><a href="javascript:void(0);">總覽</a></li>
<li class="breadcrumb-item">@ViewData["Title"]</li> <li class="breadcrumb-item">@ViewData["Title"]</li>
<li class="breadcrumb-item city-name" >新竹市</li> <li class="breadcrumb-item city-name">新竹市</li>
<li class="breadcrumb-item power-station-name active">新竹巨城站</li> <li class="breadcrumb-item power-station-name active">新竹巨城站</li>
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li> <li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
</ol> </ol>
@ -97,6 +99,25 @@
var url = new URL(location.href); var url = new URL(location.href);
stationId = url.searchParams.get('stationId'); stationId = url.searchParams.get('stationId');
//#region 預先載入公司下拉式選單select_option
var url_company_select_option = "/Company/GetCompanySelectOptionList";
$.get(url_company_select_option, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#select_power_station_company").empty();
$.each(rel.data, function (index, val) {
$("#select_power_station_company").append($("<option />").val(val.value).text(val.text));
});
//預設查詢自己的公司
$("#select_power_station_company").val(@ViewBag.myUser.CompanyId).trigger('change');
});
//#endregion
//#region 電站資料 view 控制 //#region 電站資料 view 控制
if (stationId == 'new') { if (stationId == 'new') {
//#region 電站基本資料 //#region 電站基本資料
@ -105,14 +126,21 @@
$("#power_station_name_text").hide(); $("#power_station_name_text").hide();
$("#electricity_meter_at_text").hide(); $("#electricity_meter_at_text").hide();
$("#estimated_recovery_time_text").hide(); $("#estimated_recovery_time_text").hide();
$("#created_by_title").hide();
$("#created_by_text").hide(); $("#created_by_text").hide();
$("#generating_capacity_text").hide(); $("#generating_capacity_text").hide();
$("#escrow_name_text").hide(); $("#escrow_name_text").hide();
$("#power_rate_text").hide(); $("#power_rate_text").hide();
$("#coordinate_text").hide(); $("#coordinate_text").hide();
$("#created_at_title").hide();
$("#created_at_text").hide(); $("#created_at_text").hide();
$("#line_token_text").hide();
$("#estimate_kwh_text").hide();
$("#estimate_efficacy_text").hide();
//逆變器 //逆變器
$("#inverter_brand_text").hide(); $("#inverter_brand_text").hide();
$("#inverter_product_model_text").hide(); $("#inverter_product_model_text").hide();
@ -130,6 +158,22 @@
$("#check_escrow").attr('disabled', false); $("#check_escrow").attr('disabled', false);
$("#select_solar_tpye").attr('disabled', false); $("#select_solar_tpye").attr('disabled', false);
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformUser)
{
<text>
$("#select_power_station_company_title").show();
$("#select_power_station_company").show();
$("#select_power_station_company").attr('disabled', false);
</text>
}
else
{
<text>
$("#select_power_station_company_title").hide();
$("#select_power_station_company").hide();
$("#select_power_station_company").attr('disabled', true);
</text>
}
$(".city-name").hide(); $(".city-name").hide();
$(".power-station-name").html("新增電站"); $(".power-station-name").html("新增電站");
@ -140,6 +184,7 @@
$("#tablist").hide(); $("#tablist").hide();
$("#tablist").find(".nav-item > a").first().click(); $("#tablist").find(".nav-item > a").first().click();
} else { } else {
var url = "/PowerStation/GetOnePowerStation" var url = "/PowerStation/GetOnePowerStation"
@ -754,7 +799,7 @@
} }
}); });
} }
//#endregion //#endregion
$('#ShareDevice_PowerStationId_modal').change(function () { $('#ShareDevice_PowerStationId_modal').change(function () {
@ -866,11 +911,11 @@
$.each(rel.data, function (index, val) { $.each(rel.data, function (index, val) {
$("#ShareDevice_UID_modal").append($("<option />").val(val.value).text(val.text)); $("#ShareDevice_UID_modal").append($("<option />").val(val.value).text(val.text));
}); });
} }
}); });
} }
//#endregion //#endregion
@ -896,7 +941,7 @@
$.each(rel.data, function (index, val) { $.each(rel.data, function (index, val) {
$("#Inverter_Pyrheliometer_modal").append($("<option />").val(val.value).text(val.text)); $("#Inverter_Pyrheliometer_modal").append($("<option />").val(val.value).text(val.text));
}); });
} }
}); });
@ -928,7 +973,11 @@
PhotovoltaicPanelSpecification: $("#photovoltaic_panel_specification").val(), PhotovoltaicPanelSpecification: $("#photovoltaic_panel_specification").val(),
PhotovoltaicPanelAmount: $("#photovoltaic_panel_amount").val(), PhotovoltaicPanelAmount: $("#photovoltaic_panel_amount").val(),
PhotovoltaicPanelProductModel: $("#photovoltaic_panel_product_model").val(), PhotovoltaicPanelProductModel: $("#photovoltaic_panel_product_model").val(),
SolarType: $("#select_solar_tpye").val() SolarType: $("#select_solar_tpye").val(),
line_token: $("#line_token").val(),
Estimate_kwh: $("#estimate_kwh").val(),
EstimateEfficacy: $("#estimate_efficacy").val(),
CompanyId: $("#select_power_station_company").val(),
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
@ -1041,14 +1090,20 @@
$("#power_station_name_text").show(); $("#power_station_name_text").show();
$("#electricity_meter_at_text").show(); $("#electricity_meter_at_text").show();
$("#estimated_recovery_time_text").show(); $("#estimated_recovery_time_text").show();
$("#created_by_title").show();
$("#created_by_text").show(); $("#created_by_text").show();
$("#generating_capacity_text").show(); $("#generating_capacity_text").show();
$("#escrow_name_text").show(); $("#escrow_name_text").show();
$("#power_rate_text").show(); $("#power_rate_text").show();
$("#coordinate_text").show(); $("#coordinate_text").show();
$("#created_at_title").show();
$("#created_at_text").show(); $("#created_at_text").show();
$("#line_token_text").show();
$("#estimate_kwh_text").show();
$("#estimate_efficacy_text").show();
//逆變器 //逆變器
$("#inverter_brand_text").show(); $("#inverter_brand_text").show();
$("#inverter_product_model_text").show(); $("#inverter_product_model_text").show();
@ -1078,6 +1133,27 @@
$("#coordinate").hide(); $("#coordinate").hide();
$("#power_station_operation_personnel").attr("disabled", true); $("#power_station_operation_personnel").attr("disabled", true);
$("#line_token").hide();
$("#estimate_kwh").hide();
$("#estimate_efficacy").hide();
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformUser)
{
<text>
$("#select_power_station_company_title").show();
$("#select_power_station_company").show();
$("#select_power_station_company").attr("disabled", true);
</text>
}
else
{
<text>
$("#select_power_station_company_title").hide();
$("#select_power_station_company").hide();
$("#select_power_station_company").attr("disabled", true);
</text>
}
//逆變器 //逆變器
$("#inverter_brand").hide(); $("#inverter_brand").hide();
$("#inverter_product_model").hide(); $("#inverter_product_model").hide();
@ -1103,6 +1179,7 @@
$("#power_station_name_text").hide(); $("#power_station_name_text").hide();
$("#electricity_meter_at_text").hide(); $("#electricity_meter_at_text").hide();
$("#estimated_recovery_time_text").hide(); $("#estimated_recovery_time_text").hide();
$("#created_by_title").hide();
$("#created_by_text").hide(); $("#created_by_text").hide();
$("#generating_capacity_text").hide(); $("#generating_capacity_text").hide();
@ -1110,6 +1187,11 @@
$("#power_rate_text").hide(); $("#power_rate_text").hide();
$("#coordinate_text").hide(); $("#coordinate_text").hide();
$("#created_at_text").hide(); $("#created_at_text").hide();
$("#created_at_title").hide();
$("#line_token_text").hide();
$("#estimate_kwh_text").hide();
$("#estimate_efficacy_text").hide();
//逆變器 //逆變器
$("#inverter_brand_text").hide(); $("#inverter_brand_text").hide();
@ -1140,6 +1222,27 @@
$("#coordinate").show(); $("#coordinate").show();
$("#power_station_operation_personnel").attr("disabled", false); $("#power_station_operation_personnel").attr("disabled", false);
$("#line_token").show();
$("#estimate_kwh").show();
$("#estimate_efficacy").show();
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformUser)
{
<text>
$("#select_power_station_company_title").show();
$("#select_power_station_company").show();
$("#select_power_station_company").attr("disabled", true);
</text>
}
else
{
<text>
$("#select_power_station_company_title").hide();
$("#select_power_station_company").hide();
$("#select_power_station_company").attr("disabled", true);
</text>
}
//逆變器 //逆變器
$("#inverter_brand").show(); $("#inverter_brand").show();
$("#inverter_product_model").show(); $("#inverter_product_model").show();
@ -1175,7 +1278,9 @@
$("#TPC_purchase_electricity_at_text").show(); $("#TPC_purchase_electricity_at_text").show();
$("#TPC_sell_electricity_at_text").show(); $("#TPC_sell_electricity_at_text").show();
$("#BOE_TPC_created_by_title").show();
$("#BOE_TPC_created_by_text").show(); $("#BOE_TPC_created_by_text").show();
$("#BOE_TPC_created_at_title").show();
$("#BOE_TPC_created_at_text").show(); $("#BOE_TPC_created_at_text").show();
//#endregion //#endregion
@ -1213,8 +1318,10 @@
$("#TPC_purchase_electricity_at_text").hide(); $("#TPC_purchase_electricity_at_text").hide();
$("#TPC_sell_electricity_at_text").hide(); $("#TPC_sell_electricity_at_text").hide();
@*$("#BOE_TPC_created_by_text").hide(); $("#BOE_TPC_created_by_title").hide();
$("#BOE_TPC_created_at_text").hide();*@ $("#BOE_TPC_created_by_text").hide();
$("#BOE_TPC_created_at_title").hide();
$("#BOE_TPC_created_at_text").hide();
//#endregion //#endregion
//#region 能源局與台電資料 input //#region 能源局與台電資料 input
@ -1249,7 +1356,9 @@
$("#land_building_landowner_text_" + selectedLandBuildingId).show(); $("#land_building_landowner_text_" + selectedLandBuildingId).show();
$("#land_building_phone_text_" + selectedLandBuildingId).show(); $("#land_building_phone_text_" + selectedLandBuildingId).show();
$("#land_building_purpose_text_" + selectedLandBuildingId).show(); $("#land_building_purpose_text_" + selectedLandBuildingId).show();
$("#land_building_created_by_title_" + selectedLandBuildingId).show();
$("#land_building_created_by_text_" + selectedLandBuildingId).show(); $("#land_building_created_by_text_" + selectedLandBuildingId).show();
$("#land_building_created_at_title_" + selectedLandBuildingId).show();
$("#land_building_created_at_text_" + selectedLandBuildingId).show(); $("#land_building_created_at_text_" + selectedLandBuildingId).show();
//#endregion //#endregion
@ -1279,7 +1388,9 @@
$("#land_building_landowner_text_" + selectedLandBuildingId).hide(); $("#land_building_landowner_text_" + selectedLandBuildingId).hide();
$("#land_building_phone_text_" + selectedLandBuildingId).hide(); $("#land_building_phone_text_" + selectedLandBuildingId).hide();
$("#land_building_purpose_text_" + selectedLandBuildingId).hide(); $("#land_building_purpose_text_" + selectedLandBuildingId).hide();
$("#land_building_created_by_title_" + selectedLandBuildingId).hide();
$("#land_building_created_by_text_" + selectedLandBuildingId).hide(); $("#land_building_created_by_text_" + selectedLandBuildingId).hide();
$("#land_building_created_at_title_" + selectedLandBuildingId).hide();
$("#land_building_created_at_text_" + selectedLandBuildingId).hide(); $("#land_building_created_at_text_" + selectedLandBuildingId).hide();
//#endregion //#endregion
@ -1329,6 +1440,12 @@
$("#created_at_text").html(powerStationData.createdAt); $("#created_at_text").html(powerStationData.createdAt);
$("#power_station_operation_personnel").val(powerStationData.operationPersonnelIds).trigger("change"); $("#power_station_operation_personnel").val(powerStationData.operationPersonnelIds).trigger("change");
$("#line_token_text").html(powerStationData.line_token);
$("#estimate_kwh_text").html(powerStationData.estimate_kwh);
$("#estimate_efficacy_text").html(powerStationData.estimateEfficacy);
$("#select_power_station_company").val(powerStationData.companyId).trigger("change");
//逆變器 //逆變器
$("#inverter_brand_text").html(powerStationData.inverterBrand); $("#inverter_brand_text").html(powerStationData.inverterBrand);
$("#inverter_product_model_text").html(powerStationData.inverterProductModel); $("#inverter_product_model_text").html(powerStationData.inverterProductModel);
@ -1354,6 +1471,10 @@
$("#power_rate").val(powerStationData.powerRate); $("#power_rate").val(powerStationData.powerRate);
$("#coordinate").val(powerStationData.coordinate); $("#coordinate").val(powerStationData.coordinate);
$("#line_token").val(powerStationData.line_token);
$("#estimate_kwh").val(powerStationData.estimate_kwh);
$("#estimate_efficacy").val(powerStationData.estimateEfficacy);
//逆變器 //逆變器
$("#inverter_brand").val(powerStationData.inverterBrand); $("#inverter_brand").val(powerStationData.inverterBrand);
$("#inverter_product_model").val(powerStationData.inverterProductModel); $("#inverter_product_model").val(powerStationData.inverterProductModel);
@ -1512,13 +1633,13 @@
'</div>' + '</div>' +
'<div class="col-xl">' + '<div class="col-xl">' +
'<div class="row mb-3">' + '<div class="row mb-3">' +
'<label class="col-xl-4 form-label">資料建立</label>' + '<label class="col-xl-4 form-label" id="land_building_created_by_title_' + value.id + '">資料建立</label>' +
'<div class="col-xl-8">' + '<div class="col-xl-8">' +
'<label id="land_building_created_by_text_' + value.id + '" class="color-info-600">' + value.creatorName + '</label>' + '<label id="land_building_created_by_text_' + value.id + '" class="color-info-600">' + value.creatorName + '</label>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<div class="row">' + '<div class="row">' +
'<label class="col-xl-4 form-label">建立時間</label>' + '<label class="col-xl-4 form-label" id="land_building_created_at_title_' + value.id + '">建立時間</label>' +
'<div class="col-xl-8">' + '<div class="col-xl-8">' +
'<label id="land_building_created_at_text_' + value.id + '" class="color-info-600">' + value.createdAt + '</label>' + '<label id="land_building_created_at_text_' + value.id + '" class="color-info-600">' + value.createdAt + '</label>' +
'</div>' + '</div>' +
@ -1608,13 +1729,13 @@
'</div>' + '</div>' +
'<div class="col-xl">' + '<div class="col-xl">' +
'<div class="row mb-3">' + '<div class="row mb-3">' +
'<label class="col-xl-4 form-label">資料建立</label>' + '<label class="col-xl-4 form-label" id="land_building_created_by_title_0">資料建立</label>' +
'<div class="col-xl-8">' + '<div class="col-xl-8">' +
'<label id="land_building_created_by_text_0" class="color-info-600"></label>' + '<label id="land_building_created_by_text_0" class="color-info-600"></label>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<div class="row">' + '<div class="row">' +
'<label class="col-xl-4 form-label">建立時間</label>' + '<label class="col-xl-4 form-label" id="land_building_created_at_title_0">建立時間</label>' +
'<div class="col-xl-8">' + '<div class="col-xl-8">' +
'<label id="land_building_created_at_text_0" class="color-info-600"></label>' + '<label id="land_building_created_at_text_0" class="color-info-600"></label>' +
'</div>' + '</div>' +
@ -1859,7 +1980,7 @@
selected_id = 0; selected_id = 0;
$("#Inverter-modal .modal-title").html("逆變器資料 - 新增"); $("#Inverter-modal .modal-title").html("逆變器資料 - 新增");
$("#Inverter-form").trigger("reset"); $("#Inverter-form").trigger("reset");
document.getElementById('Inverter_Status_modal').disabled = true; document.getElementById('Inverter_Status_modal').disabled = true;
document.getElementById('Inverter_Enabled_modal').disabled = true; document.getElementById('Inverter_Enabled_modal').disabled = true;
PyrheliometerList(stationId); PyrheliometerList(stationId);
@ -1920,7 +2041,7 @@
} }
}); });
}); });
//#endregion //#endregion
//#region 儲存控制器資料 //#region 儲存控制器資料
function SaveController() { function SaveController() {

View File

@ -35,7 +35,8 @@
</div> </div>
</div> </div>
<div class="col-xl-3 row align-items-center"> <div class="col-xl-3 row align-items-center">
<div class="col-12"> <label class="col-xl-4 form-label" id="area_label">地址</label>
<div class="col-xl-8">
<label id="address_detail_text" class="color-info-600"></label> <label id="address_detail_text" class="color-info-600"></label>
<input type="text" id="address_detail" name="address_detail" class="form-control"> <input type="text" id="address_detail" name="address_detail" class="form-control">
</div> </div>
@ -134,47 +135,86 @@
</div> </div>
</div> </div>
<div class="col-xl-3 row justify-content-center align-items-center"> <div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label">資料建立</label> <label class="col-xl-4 form-label" id="coordinate_label" for="coordinate">Line Token</label>
<div class="col-xl-8">
<label id="line_token_text" class="color-info-600"></label>
<input type="text" id="line_token" name="line_token" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="coordinate_label" for="coordinate">
預估發電度數(kW/日)
</label>
<div class="col-xl-8">
<label id="estimate_kwh_text" class="color-info-600"></label>
<input type="number" step="0.01" id="estimate_kwh" name="estimate_kwh" class="form-control">
</div>
</div>
</div>
<div class="row mb-5 d-flex justify-content-between ">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="coordinate_label" for="coordinate">
預估發電度數(kW/日)
</label>
<div class="col-xl-8">
<label id="estimate_efficacy_text" class="color-info-600"></label>
<input type="number" step="0.01" id="estimate_efficacy" name="estimate_efficacy" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="select_power_station_company_title">
電站歸屬客戶
</label>
<div class="col-xl-8">
<select class="form-control" id="select_power_station_company">
</select>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="created_by_title">資料建立</label>
<div class="col-xl-8"> <div class="col-xl-8">
<label id="created_by_text" class="color-info-600"></label> <label id="created_by_text" class="color-info-600"></label>
</div> </div>
</div> </div>
<div class="col-xl-3 row justify-content-center align-items-center"> <div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label">建立時間</label> <label class="col-xl-4 form-label" id="created_at_title">建立時間</label>
<div class="col-xl-8"> <div class="col-xl-8">
<label id="created_at_text" class="color-info-600"></label> <label id="created_at_text" class="color-info-600"></label>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@* @*
<div class="col-xl-6"> <div class="col-xl-6">
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">逆變器</h5> <h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">逆變器</h5>
<div class="row d-flex justify-content-between px-5"> <div class="row d-flex justify-content-between px-5">
<div class="col-xl-4 row"> <div class="col-xl-4 row">
<label class="col-xl-4 form-label" id="inverter_brand_label" for="inverter_brand">廠牌</label> <label class="col-xl-4 form-label" id="inverter_brand_label" for="inverter_brand">廠牌</label>
<div class="col-xl-8"> <div class="col-xl-8">
<label id="inverter_brand_text" class="color-info-600"></label> <label id="inverter_brand_text" class="color-info-600"></label>
<input type="text" id="inverter_brand" name="inverter_brand" class="form-control"> <input type="text" id="inverter_brand" name="inverter_brand" class="form-control">
</div>
</div>
<div class="col-xl-4 row">
<label class="col-xl-4 form-label" id="inverter_product_model_label" for="inverter_product_model">型號</label>
<div class="col-xl-8">
<label id="inverter_product_model_text" class="color-info-600"></label>
<input type="text" id="inverter_product_model" name="inverter_product_model" class="form-control">
</div>
</div>
<div class="col-xl-4 row">
<label class="col-xl-4 form-label" id="inverter_amount_label" for="inverter_amount">數量</label>
<div class="col-xl-8">
<label id="inverter_amount_text" class="color-info-600"></label>
<input type="text" id="inverter_amount" name="inverter_amount" class="form-control">
</div>
</div>
</div>
</div> </div>
</div>
<div class="col-xl-4 row">
<label class="col-xl-4 form-label" id="inverter_product_model_label" for="inverter_product_model">型號</label>
<div class="col-xl-8">
<label id="inverter_product_model_text" class="color-info-600"></label>
<input type="text" id="inverter_product_model" name="inverter_product_model" class="form-control">
</div>
</div>
<div class="col-xl-4 row">
<label class="col-xl-4 form-label" id="inverter_amount_label" for="inverter_amount">數量</label>
<div class="col-xl-8">
<label id="inverter_amount_text" class="color-info-600"></label>
<input type="text" id="inverter_amount" name="inverter_amount" class="form-control">
</div>
</div>
</div>
</div>
*@ *@
<div class="col-xl-6"> <div class="col-xl-6">
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5> <h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
@ -315,12 +355,12 @@
</div> </div>
<div class="row d-flex justify-content-end px-5"> <div class="row d-flex justify-content-end px-5">
<div class="col-xl-6 mb-3 row justify-content-end align-items-center"> <div class="col-xl-6 mb-3 row justify-content-end align-items-center">
<label class="col-xl-12 text-right">資料建立 <span id="BOE_TPC_created_by_text" class="ml-3 color-info-600"></span></label> <label class="col-xl-12 text-right" id="BOE_TPC_created_by_title">資料建立 <span id="BOE_TPC_created_by_text" class="ml-3 color-info-600"></span></label>
</div> </div>
</div> </div>
<div class="row d-flex justify-content-end px-5"> <div class="row d-flex justify-content-end px-5">
<div class="col-xl-6 mb-3 row justify-content-end align-items-center"> <div class="col-xl-6 mb-3 row justify-content-end align-items-center">
<label class="col-xl-12 text-right">建立時間 <span id="BOE_TPC_created_at_text" class="ml-3 color-info-600"></span></label> <label class="col-xl-12 text-right" id="BOE_TPC_created_at_title">建立時間 <span id="BOE_TPC_created_at_text" class="ml-3 color-info-600"></span></label>
</div> </div>
</div> </div>
</div> </div>

View File

@ -305,7 +305,7 @@
<span class="nav-link-text" data-i18n="nav.category">運維管理</span> <span class="nav-link-text" data-i18n="nav.category">運維管理</span>
</a> </a>
<ul> <ul>
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStationManager")) @if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("PowerStation"))
{ {
<li class="@(ViewData["MainNum"] == "6" && ViewData["SubNum"].ToString() == "1" ? "active" : "")"> <li class="@(ViewData["MainNum"] == "6" && ViewData["SubNum"].ToString() == "1" ? "active" : "")">
<a asp-controller="PowerStation" asp-action="Index" title="電站管理" data-filter-tags="utilities disabled item"> <a asp-controller="PowerStation" asp-action="Index" title="電站管理" data-filter-tags="utilities disabled item">

View File

@ -135,7 +135,6 @@
</div> </div>
@section Scripts{ @section Scripts{
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/heatmap.js"></script> <script src="https://code.highcharts.com/modules/heatmap.js"></script>
<script> <script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB