This commit is contained in:
cesar liu 2022-06-13 12:19:02 +08:00
commit 466a0bde5b
5 changed files with 67 additions and 52 deletions

View File

@ -508,7 +508,7 @@ namespace SolarPower.Repository.Implement
FROM inverter_history_hour inv FROM inverter_history_hour inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y-%m-%d') = @Day AND DATE_FORMAT(inv.timestamp, '%Y-%m-%d') = @Day
ORDER BY inv.TIMESTAMP"; ORDER BY inv.INVERTERID, inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Day = day })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Day = day })).ToList();
} }
@ -533,7 +533,7 @@ namespace SolarPower.Repository.Implement
FROM inverter_history_day inv FROM inverter_history_day inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y-%m') = @Month AND DATE_FORMAT(inv.timestamp, '%Y-%m') = @Month
ORDER BY inv.TIMESTAMP"; ORDER BY inv.INVERTERID, inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Month = month })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Month = month })).ToList();
} }
@ -558,7 +558,7 @@ namespace SolarPower.Repository.Implement
FROM inverter_history_month inv FROM inverter_history_month inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y-%m') BETWEEN @StartMonth AND @EndMonth AND DATE_FORMAT(inv.timestamp, '%Y-%m') BETWEEN @StartMonth AND @EndMonth
ORDER BY inv.TIMESTAMP"; ORDER BY inv.INVERTERID, inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, StartMonth = startMonth, EndMonth = endMonth })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, StartMonth = startMonth, EndMonth = endMonth })).ToList();
} }
@ -583,7 +583,7 @@ namespace SolarPower.Repository.Implement
FROM inverter_history_month inv FROM inverter_history_month inv
WHERE inv.PowerStationId = @PowerStationId WHERE inv.PowerStationId = @PowerStationId
AND DATE_FORMAT(inv.timestamp, '%Y') = @Year AND DATE_FORMAT(inv.timestamp, '%Y') = @Year
ORDER BY inv.TIMESTAMP"; ORDER BY inv.INVERTERID, inv.TIMESTAMP";
result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Year = year })).ToList(); result = (await conn.QueryAsync<InverterHistory>(sql_power, new { PowerStationId = powerStationId, Year = year })).ToList();
} }

View File

@ -88,59 +88,59 @@ namespace SolarPower
options.IdleTimeout = TimeSpan.FromMinutes(loginExpireMinute); options.IdleTimeout = TimeSpan.FromMinutes(loginExpireMinute);
}); });
#region //#region 加入背景執
//services.AddHostedService<OperationScheduleBackgroundService>(); ////services.AddHostedService<OperationScheduleBackgroundService>();
//添加Quartz服務 ////添加Quartz服務
services.AddSingleton<IJobFactory, SingletonJobFactory>(); //services.AddSingleton<IJobFactory, SingletonJobFactory>();
services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>(); //services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
//添加Job ////添加Job
#region //#region 定期計
services.AddSingleton<OperationScheduleJob>(); //services.AddSingleton<OperationScheduleJob>();
services.AddSingleton( //services.AddSingleton(
new JobSchedule(jobType: typeof(OperationScheduleJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:OperationScheduleJob")) // new JobSchedule(jobType: typeof(OperationScheduleJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:OperationScheduleJob"))
); //);
#endregion //#endregion
#region (215) //#region 計算電站逆變器資訊(每整點2分開始執行15分鐘一個循環)
services.AddSingleton<CalcInverter15minJob>(); //services.AddSingleton<CalcInverter15minJob>();
services.AddSingleton( //services.AddSingleton(
new JobSchedule(jobType: typeof(CalcInverter15minJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcInverter15minJob")) // new JobSchedule(jobType: typeof(CalcInverter15minJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcInverter15minJob"))
); //);
#endregion //#endregion
#region (5) //#region 計算電站發電量等資訊(每整點5分執行)
services.AddSingleton<CalcPowerStationJob>(); //services.AddSingleton<CalcPowerStationJob>();
services.AddSingleton( //services.AddSingleton(
new JobSchedule(jobType: typeof(CalcPowerStationJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcPowerStationJob")) //new JobSchedule(jobType: typeof(CalcPowerStationJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcPowerStationJob"))
//new JobSchedule(jobType: typeof(CalcPowerStationJob), cronExpression: "0/10 * * * * ?") ////new JobSchedule(jobType: typeof(CalcPowerStationJob), cronExpression: "0/10 * * * * ?")
); //);
#endregion //#endregion
#region PRkWP 30(2) //#region 計算電站日照量、PR、kWP 30日平均、(每天凌晨2點執行)
services.AddSingleton<CalcAvgPowerStationJob>(); //services.AddSingleton<CalcAvgPowerStationJob>();
services.AddSingleton( //services.AddSingleton(
new JobSchedule(jobType: typeof(CalcAvgPowerStationJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:CalcAvgPowerStationJob")) //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: "0 03 7 ? * * *")
); //);
#endregion //#endregion
#region Email(2) //#region 寄送Email(每天凌晨2點執行)
services.AddSingleton<SendEmailJob>(); //services.AddSingleton<SendEmailJob>();
services.AddSingleton( //services.AddSingleton(
new JobSchedule(jobType: typeof(SendEmailJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:SendEmailJob")) //new JobSchedule(jobType: typeof(SendEmailJob), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:SendEmailJob"))
); //);
#endregion //#endregion
#region Email //#region 查詢異常新增至Email
services.AddSingleton<ExceptionSchedule>(); //services.AddSingleton<ExceptionSchedule>();
services.AddSingleton( //services.AddSingleton(
new JobSchedule(jobType: typeof(ExceptionSchedule), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:ExceptionSchedule")) //new JobSchedule(jobType: typeof(ExceptionSchedule), cronExpression: Configuration.GetValue<string>("BackgroundServiceCron:ExceptionSchedule"))
); //);
#endregion //#endregion
services.AddHostedService<QuartzHostedService>(); //services.AddHostedService<QuartzHostedService>();
#endregion //#endregion
services.AddApplicationInsightsTelemetry(); services.AddApplicationInsightsTelemetry();
} }

View File

@ -1070,6 +1070,9 @@
if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") { if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") {
if ($("#record-form").valid()) if ($("#record-form").valid())
{ {
// 鎖定按鈕
$("#save-record-btn").attr('disabled', true);
var url = "/Operation/SaveOperationRecord"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -1146,6 +1149,10 @@
} }
operationRecordTable.ajax.reload(); operationRecordTable.ajax.reload();
} }
alert("已修改完成");
// 取消鎖定按鈕
$("#save-record-btn").attr('disabled', false);
} }
}); });
} }

View File

@ -1672,9 +1672,12 @@
//#region 儲存表單資料(運維) //#region 儲存表單資料(運維)
function SaveRecord() { function SaveRecord() {
if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "")
{ {
if ($("#record-form").valid()) { if ($("#record-form").valid()) {
// 鎖定按鈕
$("#save-record-op-btn").attr('disabled', true);
var url = "/Operation/SaveOperationRecord"; var url = "/Operation/SaveOperationRecord";
var formData = new FormData(); var formData = new FormData();
@ -1698,6 +1701,7 @@
else { else {
formData.append("Emailcheck", 0); formData.append("Emailcheck", 0);
} }
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: url, url: url,
@ -1735,6 +1739,10 @@
operationRecordTable.ajax.reload(); operationRecordTable.ajax.reload();
} }
alert("已修改完成");
// 取消鎖定按鈕
$("#save-record-op-btn").attr('disabled', false);
} }
}); });
} }

View File

@ -197,7 +197,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="save-record-btn" onclick="SaveRecord()">確定</button> <button type="button" class="btn btn-primary" id="save-record-op-btn" onclick="SaveRecord()">確定</button>
</div> </div>
</div> </div>
</div> </div>