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
WHERE inv.PowerStationId = @PowerStationId
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();
}
@ -533,7 +533,7 @@ namespace SolarPower.Repository.Implement
FROM inverter_history_day inv
WHERE inv.PowerStationId = @PowerStationId
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();
}
@ -558,7 +558,7 @@ namespace SolarPower.Repository.Implement
FROM inverter_history_month inv
WHERE inv.PowerStationId = @PowerStationId
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();
}
@ -583,7 +583,7 @@ namespace SolarPower.Repository.Implement
FROM inverter_history_month inv
WHERE inv.PowerStationId = @PowerStationId
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();
}

View File

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

View File

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

View File

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

View File

@ -197,7 +197,7 @@
</div>
<div class="modal-footer">
<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>