增加歷史資料日期選擇與PR值計算

This commit is contained in:
cesar liu 2022-05-23 16:37:35 +08:00
parent eb96541dd4
commit b26baf574c
13 changed files with 265 additions and 223 deletions

View File

@ -808,6 +808,7 @@ namespace SolarPower.Controllers
a.TIMESTAMP = Convert.ToDateTime(a.TIMESTAMP).ToString("HH tt", CultureInfo.InvariantCulture);
break;
case 1:
case 4:
a.TOTALTIME = Convert.ToDateTime(a.TIMESTAMP).ToString("yyyy-MM");
a.TIMESTAMP = Convert.ToDateTime(a.TIMESTAMP).ToString("yyyy-MM-dd");
break;

View File

@ -36,6 +36,14 @@ namespace SolarPower.Helper
var databaseStr = ed.AESDecrypt(dbConfig.Database);
var rootStr = ed.AESDecrypt(dbConfig.Root);
var passwordStr = ed.AESDecrypt(dbConfig.Password);
// FIC 測試機 1
//var serverStr = ed.AESEncrypt("localhost"); MWAxcj1mgmbZ8tB6NgApnQ==
//var portStr = ed.AESEncrypt("3306"); CY1x+1WYXRCBab3wKnBCOQ==
// var databaseStr = ed.AESEncrypt("solar_master"); CEyYZnO8B5+yTXQcFSsiBA==
//var rootStr = ed.AESEncrypt("root"); 4koIJVzfp6veImONCwQy3A==
//var passwordStr = ed.AESEncrypt("P@ssw0rd"); y4uPqlH9ncTgR/I07qpwaA==
// FIC 測試機 2
//var serverStr = ed.AESEncrypt("localhost");
//var portStr = ed.AESEncrypt("3306");
//var databaseStr = ed.AESEncrypt("solar_master");

View File

@ -182,10 +182,17 @@ namespace SolarPower.Models
public double SOLARHOUR { get; set; }
public double Irradiance { get; set; }
public double PR { get; set; }
/// <summary>
/// 總計PR
/// </summary>
public double avgPR { get; set; }
public double Temp { get; set; }
public double DiffSOLARHOUR { get; set; }
public string TOTALTIME { get; set; }
public double KWHKWP { get; set; }
/// <summary>
/// 累計日照
/// </summary>
public double IrrDay { get; set; }
}

View File

@ -654,7 +654,7 @@ namespace SolarPower.Repository.Implement
//pyrdb = "sensor_history_month";
//timeGroup = "%Y-%m";
//range = "";
//out_group = " GROUP BY DATE_FORMAT(V.TIMESTAMP,'%Y')";
//out_group = " GROUP BY DATE_FORMAT(V.TIMESTAMP,'%Y')";4
select = "DATE_FORMAT(c.TIMESTAMP,'%Y') AS TIMESTAMP, MAX(KWH) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, 0 AS DiffSOLARHOUR, AVG(PR) AS PR, AVG(Irradiance) AS Irradiance, AVG(Temp) AS Temp ,AVG(KWHKWP) AS KWHKWP ";
kwh = "C.TOTALKWH";
usedb = "power_station_history_month";
@ -664,37 +664,78 @@ namespace SolarPower.Repository.Implement
out_group = " GROUP BY DATE_FORMAT(V.TIMESTAMP,'%Y')";
break;
}
string sql = string.Empty;
try
{
switch (post.GroupType)
{
case 0: // today - hour
sql = $@" SELECT C.TIMESTAMP, C.KWH AS KWH,C.SOLARHOUR, C.PR,
P.Irradiance, P.Temperature AS Temp , C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR
FROM power_station_history_hour C
LEFT JOIN sensor_history_hour P ON P.`TIMESTAMP` =C.`TIMESTAMP` AND P.PowerStationId = C.PowerStationId
WHERE C.PowerStationId = {post.PowerstationId}{range2} "; break;
case 1: // day
case 2: // month
sql = $@" SELECT C.TIMESTAMP, {kwh} AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR
FROM {usedb} C
LEFT JOIN {pyrdb} P ON DATE_FORMAT(P.TIMESTAMP,'{timeGroup}') = DATE_FORMAT(C.TIMESTAMP,'{timeGroup}') AND P.PowerStationId = C.PowerStationId
WHERE C.PowerStationId = {post.PowerstationId}{range}"; break;
case 0: // today - hour - 選擇同一天
case 4: // date-range 選擇不同天
if (!string.IsNullOrEmpty(post.HistoryRange))
{
string d1 = post.HistoryRange.Substring(0, 10).Replace("/", "-");
string d2 = post.HistoryRange.Substring(13, 10).Replace("/", "-");
if (d1 == d2)
{ // range 查詢同一天
range2 = @$" AND DATE_FORMAT(C.`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{ d1 }' AND '{ d2 }'";
sql = $@" SELECT C.TIMESTAMP, C.KWH AS KWH,C.SOLARHOUR, C.PR,
P.Irradiance, P.Temperature AS Temp , C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR
FROM power_station_history_hour C
LEFT JOIN sensor_history_hour P ON P.`TIMESTAMP` =C.`TIMESTAMP` AND P.PowerStationId = C.PowerStationId
WHERE C.PowerStationId = {post.PowerstationId}{range2} ";
}
else
{ // range 查詢不同天
//string endDate = DateTime.Parse(d2).AddDays(1).ToString("yyyy-MM-dd");
range = @$" AND DATE_FORMAT(C.`TIMESTAMP`,'%Y-%m-%d') BETWEEN '{ d1 }' AND '{ d2 }'";
case 3: // yeat
//sql = $@"SELECT left(c.`TIMESTAMP`, 4) AS `TIMESTAMP`, round(avg(monthKWH), 3) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, 0 AS DiffSOLARHOUR, AVG(PR) AS PR, round(AVG(KWHKWP), 3) AS KWHKWP
// FROM power_station_history_month C
// LEFT JOIN sensor_history_month P ON P.`TIMESTAMP` = C.`TIMESTAMP` AND P.PowerStationId = C.PowerStationId
// WHERE C.PowerStationId = C.PowerStationId = {post.PowerstationId}
// GROUP BY left(c.`TIMESTAMP`, 4) ORDER BY C.`TIMESTAMP` ";
sql = $@"
SELECT left(c.`TIMESTAMP`, 4) AS `TIMESTAMP`, sum(monthKWH) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, 0 AS DiffSOLARHOUR, AVG(PR) AS PR,
AVG(Irradiance) AS Irradiance, AVG(Temperature) AS Temp ,AVG(KWHKWP) AS KWHKWP
FROM power_station_history_month C
LEFT JOIN sensor_history_month P ON P.`TIMESTAMP` = C.`TIMESTAMP` AND P.PowerStationId = C.PowerStationId
WHERE C.PowerStationId = {post.PowerstationId}
GROUP BY left(c.`TIMESTAMP`, 4) ORDER BY C.`TIMESTAMP` "; break;
//sql = $@" SELECT left(C.`TIMESTAMP`, 10) `TIMESTAMP`, C.TODAYKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR
// FROM power_station_history_day C
// LEFT JOIN sensor_history_day P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m-%d') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m-%d') AND P.PowerStationId = C.PowerStationId
// join power_station_history_month m on DATE_FORMAT(P.TIMESTAMP, '%Y-%m') = DATE_FORMAT(m.TIMESTAMP, '%Y-%m') AND m.PowerStationId = C.PowerStationId
// WHERE C.PowerStationId = {post.PowerstationId}{range} order by C.TIMESTAMP";
sql = $@" SELECT C.TIMESTAMP, C.TODAYKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR
FROM power_station_history_day C
LEFT JOIN sensor_history_day P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m-%d') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m-%d') AND P.PowerStationId = C.PowerStationId
WHERE C.PowerStationId = {post.PowerstationId}{range} order by C.TIMESTAMP"; break;
}
}
break;
case 1: // day 沒有 dateRange - 月
sql = $@" SELECT C.TIMESTAMP, {kwh} AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR
FROM {usedb} C
LEFT JOIN {pyrdb} P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m-%d') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m-%d') AND P.PowerStationId = C.PowerStationId
WHERE C.PowerStationId = {post.PowerstationId}{range} order by C.TIMESTAMP"; break;
case 2: // month 單月
//sql = $@" SELECT C.TIMESTAMP, C.MONTHKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR
// FROM power_station_history_month C
// LEFT JOIN sensor_history_month P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m') AND P.PowerStationId = C.PowerStationId
// WHERE C.PowerStationId = {post.PowerstationId}{range}";
sql = $@" SELECT C.TIMESTAMP, C.MONTHKWH AS KWH, C.SOLARHOUR, C.PR, P.Irradiance, P.Temperature AS Temp ,C.KWHKWP, P.IrrDay, 0 AS DiffSOLARHOUR, C.PR avgPR
FROM power_station_history_month C
LEFT JOIN sensor_history_month P ON DATE_FORMAT(P.TIMESTAMP, '%Y-%m') = DATE_FORMAT(C.TIMESTAMP, '%Y-%m') AND P.PowerStationId = C.PowerStationId
WHERE C.PowerStationId = {post.PowerstationId}{range}";
break;
case 3: // year
//sql = $@"SELECT left(c.`TIMESTAMP`, 4) AS `TIMESTAMP`, round(avg(monthKWH), 3) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, 0 AS DiffSOLARHOUR, AVG(PR) AS PR, round(AVG(KWHKWP), 3) AS KWHKWP
// FROM power_station_history_month C
// LEFT JOIN sensor_history_month P ON P.`TIMESTAMP` = C.`TIMESTAMP` AND P.PowerStationId = C.PowerStationId
// WHERE C.PowerStationId = C.PowerStationId = {post.PowerstationId}
// GROUP BY left(c.`TIMESTAMP`, 4) ORDER BY C.`TIMESTAMP` ";
//sql = $@" SELECT left(c.`TIMESTAMP`, 4) AS `TIMESTAMP`, sum(monthKWH) AS KWH, SUM(SOLARHOUR) AS SOLARHOUR, 0 AS DiffSOLARHOUR, AVG(PR) AS PR,
// AVG(Irradiance) AS Irradiance, AVG(Temperature) AS Temp ,AVG(KWHKWP) AS KWHKWP
// FROM power_station_history_month C
// LEFT JOIN sensor_history_month P ON P.`TIMESTAMP` = C.`TIMESTAMP` AND P.PowerStationId = C.PowerStationId
// WHERE C.PowerStationId = {post.PowerstationId}
// GROUP BY left(c.`TIMESTAMP`, 4) ORDER BY C.`TIMESTAMP` ";
sql = $@" select left(c.`TIMESTAMP`, 4) AS `TIMESTAMP`, sum(monthKWH) AS KWH, round(AVG(PR), 2) AS PR , round(AVG(PR), 2) AS avgPR
FROM power_station_history_month C
WHERE C.PowerStationId = {post.PowerstationId}
group by left(c.`TIMESTAMP`, 4) ";
break;
}

View File

@ -121,8 +121,8 @@ namespace SolarPower
#region PRkWP 30(2)
services.AddSingleton<CalcAvgPowerStationJob>();
services.AddSingleton(
//new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcAvgPowerStationJob"))
new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0 03 7 ? * * *")
new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcAvgPowerStationJob"))
//new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: "0 03 7 ? * * *")
);
#endregion

View File

@ -184,6 +184,40 @@
GetPowerStationCollapse(filter);
});*@
//#region Date-Picker add by jiahao 2022-05-21
datepicker = $('#date-range-history').daterangepicker({
autoUpdateInput: false,
locale: { format: 'YYYY-MM-DD' },
//miniDate: new Date(Date.setDate(Date.getDate() - 30)),
//maxDate: Date.getDate(),
opens: 'left'
}, function (start, end, label) {
});
$('#date-range-history').on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('YYYY-MM-DD') + ' ~ ' + picker.endDate.format('YYYY-MM-DD'));
$(this).trigger('change');
});
$('#date-range-history').on('cancel.daterangepicker', function (ev, picker) {
$(this).val('');
$(this).trigger('change');
});
//#endregion
//#region 預設近今天
var today = new Date();
//var dateLimit = new Date(new Date().setDate(today.getDate() - 7));
var today_format = today.toISOString().slice(0, 10).replace(/-/g, "/");
//var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "/");
//datepicker.data('daterangepicker').setStartDate(dateLimit_format);
datepicker.data('daterangepicker').setStartDate(today_format);
datepicker.data('daterangepicker').setEndDate(today_format);
//$('#date-range-history').val(dateLimit_format + ' - ' + today_format);
$('#date-range-history').val(today_format + ' ~ ' + today_format);
//alert(" date-range-history = "+$('#date-range-history').val());
//#endregion
//#region 預先載入公司下拉式選單select_option
var url_company_select_option = "/Company/GetCompanySelectOptionList";
$.get(url_company_select_option, function (rel) {
@ -682,11 +716,11 @@
//#endregion
$('#carouselExampleIndicators').carousel({
interval: 10000
interval: 11000
})
$('#carousel-chart').carousel({
interval: 10000
interval: 11000
})
//#endregion
@ -789,7 +823,7 @@
});
$('#date-range-record').on('apply.daterangepicker', function (ev, picker) {
$(this).val(picker.startDate.format('YYYY/MM/DD') + ' - ' + picker.endDate.format('YYYY/MM/DD'));
$(this).val(picker.startDate.format('YYYY/MM/DD') + ' ~ ' + picker.endDate.format('YYYY/MM/DD'));
$(this).trigger('change');
});
@ -2308,13 +2342,16 @@
document.getElementById("ToMonth").style.display = "none";//隱藏
document.getElementById("ToYear").style.display = "none";//隱藏
document.getElementById("DateGet").style.display = "";//隱藏
//document.getElementById("DateGet").style.display = "";//隱藏
document.getElementById("date-range-history").style.display = "";//隱藏
document.getElementById("MonthGet").style.display = "none";//隱藏
document.getElementById("YearGet").style.display = "none";//隱藏
var today = new Date();
var today_format = today.toISOString().slice(0, 10).replace(/-/g, "-");
$('#DateGet').val(today_format);
historyRange = $('#DateGet').val();
//$('#DateGet').val(today_format);
//historyRange = $('#DateGet').val();
$('#date-range-history').val(today_format + ' - ' + today_format);
historyRange = $('#date-range-history').val();
groupType = type;
getTable();
break;
@ -2323,7 +2360,8 @@
document.getElementById("ToMonth").style.display = "";//隱藏
document.getElementById("ToYear").style.display = "none";//隱藏
document.getElementById("DateGet").style.display = "none";//隱藏
//document.getElementById("DateGet").style.display = "none";//隱藏
document.getElementById("date-range-history").style.display = "none";//隱藏
document.getElementById("MonthGet").style.display = "";//隱藏
document.getElementById("YearGet").style.display = "none";//隱藏
var today = new Date();
@ -2338,7 +2376,8 @@
document.getElementById("ToMonth").style.display = "none";//隱藏
document.getElementById("ToYear").style.display = "";//隱藏
document.getElementById("DateGet").style.display = "none";//隱藏
//document.getElementById("DateGet").style.display = "none";//隱藏
document.getElementById("date-range-history").style.display = "none";//隱藏
document.getElementById("MonthGet").style.display = "none";//隱藏
document.getElementById("YearGet").style.display = "";//隱藏
var today = new Date();
@ -2353,7 +2392,8 @@
document.getElementById("ToMonth").style.display = "none";//隱藏
document.getElementById("ToYear").style.display = "none";//隱藏
document.getElementById("DateGet").style.display = "none";//隱藏
//document.getElementById("DateGet").style.display = "none";//隱藏
document.getElementById("date-range-history").style.display = "none";//隱藏
document.getElementById("MonthGet").style.display = "none";//隱藏
document.getElementById("YearGet").style.display = "none";//隱藏
@ -2371,19 +2411,21 @@
//#region 選擇今昨日
function getday(post)
{
if (post == 0) {
if (post == 0) { //今天
var today = new Date();
var today_format = today.toISOString().slice(0, 10).replace(/-/g, "-");
$('#DateGet').val(today_format);
//$('#DateGet').val(today_format);
$('#date-range-history').val(today_format + ' - ' + today_format);
}
else
{
{ // 昨天
var today = new Date();
var dateLimit = new Date(new Date().setDate(today.getDate() - 1));
var dateLimit_format = dateLimit.toISOString().slice(0, 10).replace(/-/g, "-");
$('#DateGet').val(dateLimit_format);
//$('#DateGet').val(dateLimit_format);
$('#date-range-history').val(dateLimit_format + ' - ' + dateLimit_format);
}
historyRange = $('#DateGet').val();
historyRange = $('#date-range-history').val();
getTable();
}
//#endregion
@ -2424,16 +2466,30 @@
}
//#endregion
console.log("date-range-history = " + $('#date-range-history').val());
function Historyclick() {
switch (groupType) {
case 0: historyRange = $('#DateGet').val(); break;
case 0:
timeAll = $('#date-range-history').val().split('~');
time1 = timeAll[0].trim();
time2 = timeAll[1].trim();
historyRange = time1 + ' - ' + time2;
//alert("historyRange = " + historyRange);
if (time1 != time2) {
groupType = 4; // 採用 月報格式
// alert("groupType = " + groupType);
}
break;
case 1: historyRange = $('#MonthGet').val(); break;
case 2: historyRange = $('#YearGet').val(); break;
case 4: timeAll = $('#date-range-history').val().split('~');
time1 = timeAll[0].trim();
time2 = timeAll[1].trim();
historyRange = time1 + ' - ' + time2; break;
}
getTable();
}
console.log(" before onChange event");
//$('#DateGet').on('change', function () {
// console.log(" in onChange event");
// historyRange = $('#DateGet').val();
@ -2457,8 +2513,10 @@
{
var today = new Date();
var today_format = today.toISOString().slice(0, 10).replace(/-/g, "-");
$('#DateGet').val(today_format);
historyRange = $('#DateGet').val();
//$('#DateGet').val(today_format);
//historyRange = $('#DateGet').val();
$('#date-range-history').val(today_format + ' - ' + today_format);
historyRange = $('#date-range-history').val();
}
var send_data = {
@ -2466,7 +2524,7 @@
HistoryRange: historyRange,
PowerstationId: stationId
}
//0:日 1:月 2:年 3:歷年
//0:日 1:月 2:年 3:歷年 4:dateRange 選擇不同天(採用月的方式顯示)
var Nurl = "/StationOverview/GetTotalTableToHistory";
$.post(Nurl, send_data, function (rel) {
if (rel.code != "0000") {
@ -2479,7 +2537,8 @@
var kwhALL = 0;
var diffSOLARHOURALL = 0;
var irradianceALL = 0;
var prALL;
var pr = 0;
var avgPR = 0;
var tempALL = 0;
var listmonth = new Array(0);
var listkwh = new Array(0);
@ -2498,12 +2557,23 @@
$.each(rel.data, function (index, val) {
// console.log('回傳 = ' + val);
TimestampALL = val.totaltime;
kwhALL += val.kwh;
//diffSOLARHOURALL += val.diffSOLARHOUR;
irradianceALL += val.irradiance;
irr_day = val.irrDay;
prALL = val.pr;
pr = val.pr;
avgPR += val.pr;
//rowCT++;
//console.log('avgPR = ' + avgPR) + ' rowCT = ' + rowCT;;
//if (typeof (val) == 'object') {
//if (val && typeof (val) != "undefined") {
// alert('val.PR = ' + val.pr);
// avgPR += val.pr;
// rowCT++;
//}
tempALL += val.temp;
//暫時先執行到這--->取kwhkwp
@ -2526,7 +2596,7 @@
'<td>' + val.kwh.toFixed(2) + '</td>' +
'<td>' + val.kwhkwp.toFixed(2) + '</td>' +
'<td>' + val.irrDay.toFixed(2) + '</td>' +
'<td>' + val.irradiance.toFixed(2) + '</td>' +
//'<td>' + val.irradiance.toFixed(2) + '</td>' +
'<td>' + val.pr.toFixed(2) + '</td>' +
'<td>' + val.temp.toFixed(2) + '</td>' +
'</tr>');
@ -2556,7 +2626,7 @@
'<td>' + val.kwh.toFixed(2) + '</td>' +
'<td>' + val.kwhkwp.toFixed(2) + '</td>' +
'<td>' + val.irradiance.toFixed(2) + '</td>' +
//'<td>' + val.irradiance.toFixed(2) + '</td>' +
'<td>' + val.pr.toFixed(2) + '</td>' +
'<td>' + val.temp.toFixed(2) + '</td>' +
'</tr>');
@ -2673,134 +2743,12 @@
}],
});
@*$('#history-kWh-convas-div').empty();
$('#history-kWh-convas-div').append('<canvas id="history-kWh"></canvas>');
var ctx_history_kWh = document.getElementById('history-kWh').getContext('2d');
var myhistorykwh = new Chart(ctx_history_kWh, {
type: 'bar',
data: {
labels: listmonth,
datasets: [
{
type: 'line',
label: '溫度(℃)',
yAxisID: 'E',
borderColor: 'rgb(255, 192, 0)',
pointBackgroundColor: 'rgb(255, 192, 0)',
pointBorderColor: 'rgb(255, 192, 0)',
pointBorderWidth: 1,
borderWidth: 2,
pointRadius: 4,
pointHoverRadius: 5,
fill: false,
data: listtemperature
}, {
type: 'line',
label: '日照度(kWh/㎡)',
yAxisID: 'B',
borderColor: 'rgba(190, 45, 45,1)',
pointBackgroundColor: 'rgb(190, 45, 45,1)',
pointBorderColor: 'rgb(190, 45, 45,1)',
pointBorderWidth: 1,
borderWidth: 2,
pointRadius: 4,
pointHoverRadius: 5,
fill: false,
data: listirradiance
},{
type: 'bar',
label: 'PR(%)',
yAxisID: 'D',
backgroundColor: 'rgba(68, 114, 196)',
borderWidth: 1,
data: listpr
},{
type: 'bar',
label: '日均發電度數',
yAxisID: 'C',
backgroundColor: 'rgba(165, 165, 165)',
borderWidth: 1,
data: listkwhkwp
},{
type: 'bar',
backgroundColor: 'rgba(103, 180, 172, 1)',
borderWidth: 1,
label: '發電量(kWh)',
yAxisID: 'A',
data: listkwh
}]
},
options: {
title: {
display: true,
text: '發電量及日照度'
},
legend: {
display: true,
position: 'bottom'
},
scales: {
yAxes: [{
id: 'A',
type: 'linear',
position: 'left',
ticks: {
min: 0
},
scaleLabel: {
display: true,
labelString: 'kWh'
}
}, {
id: 'B',
type: 'linear',
position: 'right',
ticks: {
min: 0
},
scaleLabel: {
display: true,
labelString: 'kWh/㎡'
}
}, {
id: 'C',
type: 'linear',
position: 'right',
ticks: {
min: 0
},
scaleLabel: {
display: true,
labelString: 'hr'
}
}, {
id: 'D',
type: 'linear',
position: 'right',
ticks: {
min: 0
},
scaleLabel: {
display: true,
labelString: 'PR(%)'
}
}, {
id: 'E',
type: 'linear',
position: 'right',
ticks: {
min: 0
},
scaleLabel: {
display: true,
labelString: '℃'
}
}]
}
}
});*@
if (groupType == 0) {
avgPR = pr;
} else {
avgPR = avgPR / rel.data.length;
}
//alert('avgPR = ' + avgPR + ' rowCT=' + rel.data.length);
if (rel.data.length == 0) {
$('#HistoryTotalTable').append('<tr>' + '<td colspan="6" style="text-align:center;">' + '無資料' + '</td>' + '</tr>');
@ -2814,7 +2762,7 @@
'<td>' + kwhkwp + '</td>' +
//'<td>' + irradianceALL.toFixed(2) + '</td>' + // 改成累積日照 by jiahao 2022-04-30 00:444
'<td>' + irr_day.toFixed(2) + '</td>' +
'<td>' + prALL.toFixed(2) + '</td>' +
'<td>' + avgPR.toFixed(2) + '</td>' +
'<td>' + tempALL.toFixed(2) + '</td>' +
'</tr>');
}
@ -2883,7 +2831,7 @@
}
catch (e) { }
if (!xmlhttp) {
window.alert("");
// window.alert("");
}
}

View File

@ -25,20 +25,21 @@
<div class="btn-group" id="js-demo-nesting" role="group" aria-label="Button group with nested dropdown">
@*<button type="button" class="btn btn-secondary waves-effect waves-themed"> &lt; </button>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary dropdown-toggle waves-effect waves-themed" data-toggle="dropdown">2021 五月 </button>
<div class="dropdown-menu">
<a class="dropdown-item" href="javascript:void(0)">2021 四月</a>
<a class="dropdown-item" href="javascript:void(0)">2021 三月</a>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-secondary dropdown-toggle waves-effect waves-themed" data-toggle="dropdown">2021 五月 </button>
<div class="dropdown-menu">
<a class="dropdown-item" href="javascript:void(0)">2021 四月</a>
<a class="dropdown-item" href="javascript:void(0)">2021 三月</a>
</div>
</div>
<button type="button" class="btn btn-secondary waves-effect waves-themed"> &gt; </button>*@
<input type="date" class="form-control" id="DateGet" />
<button type="button" class="btn btn-secondary waves-effect waves-themed"> &gt; </button>
<input type="date" class="form-control" id="DateGet" />*@
<input class="form-control" id="date-range-history" type="text" name="date" value="">
<input type="month" class="form-control" id="MonthGet" style="display:none" />
<input type="number" class="form-control" min="1900" max="2099" step="1" id="YearGet" style="display:none" />
<input type="number" class="form-control" min="2000" max="2030" step="1" id="YearGet" style="display:none" />
</div>
</div>
@ -85,7 +86,7 @@
<th>發電量(kWh)</th>
<th>有效發電小時</th>
<th>累積日照量(W/m2)</th>
<th>日照量(W/m2)</th>
@*<th>日照量(W/m2)</th>*@
<th>PR(%)</th>
<th>溫度(℃)</th>
</tr>

View File

@ -16,12 +16,21 @@
// "Password": "y4uPqlH9ncTgR/I07qpwaA=="
//},
"mySql": "server=210.61.91.43;user=idafenweb;Database=solar_master;Port=10068;password=P@ssw0rd;charset='utf8';pooling=true;sslmode=none;",
//¥¿¦¡Àô¹Ò
//"DBConfig": {
// "Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
// "port": "CrEmevYrUsSo7Mkb7Gxn8A==",
// "Database": "CEyYZnO8B5+yTXQcFSsiBA==",
// "Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
// "Password": "8WMHBEWuT0XoAB4kzduQHA=="
//},
// FIC ¹wµo§GÀô¹Ò
"DBConfig": {
"Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
"port": "CrEmevYrUsSo7Mkb7Gxn8A==",
"Server": "MWAxcj1mgmbZ8tB6NgApnQ==",
"port": "CY1x+1WYXRCBab3wKnBCOQ==",
"Database": "CEyYZnO8B5+yTXQcFSsiBA==",
"Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
"Password": "8WMHBEWuT0XoAB4kzduQHA=="
"Root": "4koIJVzfp6veImONCwQy3A==",
"Password": "y4uPqlH9ncTgR/I07qpwaA=="
},
"BackgroundServiceCron": {
"CalcPowerStationJob": "0 5 * * * ?",

View File

@ -10,6 +10,7 @@
"LoginExpireMinute": 60, //()
"GoBackDay": 1, //(())
"mySql": "server=60.251.164.103;user=webuser;Database=solar_master;Port=11306;password=FICadmin99;charset='utf8';pooling=true;sslmode=none;",
//"DBConfig": {
// "Server": "MVgHWzR3rGDgD57TUoFunA==",
// "port": "r4AoXMUDodcQjIzofGNCcg==",
@ -17,13 +18,22 @@
// "Root": "mWlR2HshQNhRRE34jg4kdg==",
// "Password": "y4uPqlH9ncTgR/I07qpwaA=="
//},
// FIC ¹wµo§GÀô¹Ò
"DBConfig": {
"Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
"port": "CrEmevYrUsSo7Mkb7Gxn8A==",
"Server": "MWAxcj1mgmbZ8tB6NgApnQ==",
"port": "CY1x+1WYXRCBab3wKnBCOQ==",
"Database": "CEyYZnO8B5+yTXQcFSsiBA==",
"Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
"Password": "8WMHBEWuT0XoAB4kzduQHA=="
"Root": "pBX64+ALGFnLiHGRFXNh7w==",
"Password": "bOlWkSFsV3qNLkZTJ3UPog=="
},
// ¥¿¦¡
//"DBConfig": {
// "Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
// "port": "CrEmevYrUsSo7Mkb7Gxn8A==",
// "Database": "CEyYZnO8B5+yTXQcFSsiBA==",
// "Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
// "Password": "8WMHBEWuT0XoAB4kzduQHA=="
//},
"BackgroundServiceCron": {
"CalcPowerStationJob": "0 5 * * * ?",
"CalcAvgPowerStationJob": "0 0 2 * * ?",

View File

@ -2,7 +2,8 @@
<configuration>
<connectionStrings>
<add name="mySql" connectionString="server=60.251.164.103;user=webuser;Database=solar_master;Port=11306;password=FICadmin99;charset='utf8';pooling=true;sslmode=none;;Connection Timeout=6000" providerName="MySql.Data.MySqlClient" />
<!--<add name="mySql" connectionString="server=60.251.164.103;user=webuser;Database=solar_master;Port=11306;password=FICadmin99;charset='utf8';pooling=true;sslmode=none;;Connection Timeout=6000" providerName="MySql.Data.MySqlClient" />-->
<add name="mySql" connectionString="server=localhost;user=root;Database=solar_master;Port=11306;password=P@ssw0rd;charset='utf8';pooling=true;sslmode=none;;Connection Timeout=6000" providerName="MySql.Data.MySqlClient" />
<!--<add name="mySql" connectionString="server=localhost;user=root;Database=solar_master;Port=3306;password=zxcvb123;charset='utf8';pooling=true;sslmode=none;" providerName="MySql.Data.MySqlClient" />-->
<!-- kai -->
<!--<add name="mySql" connectionString="server=210.61.91.43;port=10068;user=idafenweb;Database=solar_power_test;Port=3306;password=P@ssw0rd;charset='utf8';pooling=true;sslmode=none;" providerName="MySql.Data.MySqlClient" />-->

View File

@ -29,11 +29,13 @@ namespace solarApp
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.bt_lackStation = new System.Windows.Forms.Button();
this.bt_sensor_lackData = new System.Windows.Forms.Button();
this.btInvDay_oldData = new System.Windows.Forms.Button();
this.bt_rpt_invDay = new System.Windows.Forms.Button();
@ -71,7 +73,7 @@ namespace solarApp
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.bt_lackStation = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@ -149,6 +151,18 @@ namespace solarApp
this.splitContainer1.SplitterWidth = 10;
this.splitContainer1.TabIndex = 0;
//
// bt_lackStation
//
this.bt_lackStation.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.bt_lackStation.Location = new System.Drawing.Point(300, 735);
this.bt_lackStation.Name = "bt_lackStation";
this.bt_lackStation.Size = new System.Drawing.Size(107, 44);
this.bt_lackStation.TabIndex = 15;
this.bt_lackStation.Text = "LackData";
this.bt_lackStation.UseVisualStyleBackColor = true;
this.bt_lackStation.Visible = false;
this.bt_lackStation.Click += new System.EventHandler(this.bt_lackStation_Click);
//
// bt_sensor_lackData
//
this.bt_sensor_lackData.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
@ -158,6 +172,7 @@ namespace solarApp
this.bt_sensor_lackData.TabIndex = 14;
this.bt_sensor_lackData.Text = "LackData";
this.bt_sensor_lackData.UseVisualStyleBackColor = true;
this.bt_sensor_lackData.Visible = false;
this.bt_sensor_lackData.Click += new System.EventHandler(this.bt_sensor_lackData_Click);
//
// btInvDay_oldData
@ -309,8 +324,8 @@ namespace solarApp
//
this.gv_inv_detail.AllowUserToAddRows = false;
this.gv_inv_detail.AllowUserToDeleteRows = false;
dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.gv_inv_detail.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.gv_inv_detail.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.gv_inv_detail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gv_inv_detail.Dock = System.Windows.Forms.DockStyle.Fill;
this.gv_inv_detail.Location = new System.Drawing.Point(768, 75);
@ -326,8 +341,8 @@ namespace solarApp
//
this.gv_rpt_invDay.AllowUserToAddRows = false;
this.gv_rpt_invDay.AllowUserToDeleteRows = false;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.gv_rpt_invDay.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.gv_rpt_invDay.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2;
this.gv_rpt_invDay.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gv_rpt_invDay.Dock = System.Windows.Forms.DockStyle.Left;
this.gv_rpt_invDay.Location = new System.Drawing.Point(0, 75);
@ -564,17 +579,6 @@ namespace solarApp
this.label4.TabIndex = 9;
this.label4.Text = "Site_Name";
//
// bt_lackStation
//
this.bt_lackStation.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.bt_lackStation.Location = new System.Drawing.Point(300, 735);
this.bt_lackStation.Name = "bt_lackStation";
this.bt_lackStation.Size = new System.Drawing.Size(107, 44);
this.bt_lackStation.TabIndex = 15;
this.bt_lackStation.Text = "LackData";
this.bt_lackStation.UseVisualStyleBackColor = true;
this.bt_lackStation.Click += new System.EventHandler(this.bt_lackStation_Click);
//
// fmArchive
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
@ -652,5 +656,6 @@ namespace solarApp
private System.Windows.Forms.Button btInvDay_oldData;
private System.Windows.Forms.Button bt_sensor_lackData;
private System.Windows.Forms.Button bt_lackStation;
private System.Windows.Forms.Timer timer1;
}
}

View File

@ -71,6 +71,14 @@ namespace solarApp
// dtselect_station1.Value = DateTime.Today.AddDays(-1);
dtSelect1.Value = System.DateTime.Today.AddDays(-1);
dtSelect2.Value = System.DateTime.Today.AddDays(-1);
//#region 自動執行
// Run this procedure in an appropriate event.
//counter = 0;
//timer1.Interval = 600;
//timer1.Enabled = true;
// Hook up timer's tick event handler.
//#endregion
}
private void rb_site_CheckedChanged(object sender, EventArgs e)

View File

@ -57,4 +57,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>