diff --git a/SolarPower/Controllers/DataBackFillController.cs b/SolarPower/Controllers/DataBackFillController.cs new file mode 100644 index 0000000..3c70fe4 --- /dev/null +++ b/SolarPower/Controllers/DataBackFillController.cs @@ -0,0 +1,390 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SolarPower.Models; +using SolarPower.Models.PowerStation; +using SolarPower.Repository.Interface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace SolarPower.Controllers +{ + public class DataBackFillController : MyBaseController + { + private readonly IPowerStationRepository powerStationRepository; + private double carbonRate; + + public DataBackFillController(IPowerStationRepository powerStationRepository) : base() + { + this.powerStationRepository = powerStationRepository; + } + + public IActionResult Index() + { + return View(); + } + + public async Task> BackFillHistory() + { + ApiResult apiResult = new ApiResult(); + var dateTimeFormat = "yyyy-MM-dd"; + + try + { + var targetDay = 7; //預計範圍天數 + + var now = DateTime.Now; + var endDate = now.AddDays(-1); + var endDateStr = endDate.ToString(dateTimeFormat); + var startDate = endDate.AddDays(-1 * targetDay); + var startDateStr = startDate.ToString(dateTimeFormat); + var timeArray = new List() + { + "00:05", + "01:05", + "02:05", + "03:05", + "04:05", + "05:05", + "06:05", + "07:05", + "08:05", + "09:05", + "10:05", + "11:05", + "12:05", + "13:05", + "14:05", + "15:05", + "16:05", + "17:05", + "18:05", + "19:05", + "20:05", + "21:05", + "22:05", + "23:05" + }; + + #region step1. 找出所有電站 + var powerStations = await powerStationRepository.GetAllAsync(); + #endregion + + //電站歷史資料 + List powerStationHistoriesHour = new List(); + List pyrheliometerHistoriesHour = new List(); + List TempHistoriesHour = new List(); + + //逆變器歷史資料 + List inverterHistories = new List(); + + //5分鐘Sensor平均歷史資料 + List sensorAvgHistoryHour = new List(); + + #region 每小時歷史資料回填 + for (var i = 0; i < targetDay; i++) + { + var currentDateStr = startDate.AddDays(i).ToString(dateTimeFormat); + for (var j = 0; j < 24; j++) + { + var time = string.Format("{0}", j.ToString().PadLeft(2, '0')); + + var all_time = string.Format("{0} {1}", currentDateStr, time); + + foreach (var powerStation in powerStations) + { + #region step2. 電站歷史資料彙整(每小時) + var table_name = String.Format("s{1}01_station", powerStation.SiteDB, powerStation.Code); + var full_table_name = String.Format("`{0}`.`{1}`", powerStation.SiteDB, table_name); + var exist = await powerStationRepository.ExistTable(powerStation.SiteDB, table_name); + + if (!string.IsNullOrEmpty(exist)) + { + #region step2-1. 電站歷史資料 + var history = await powerStationRepository.GetPowerStationHistoryPerHour(all_time, full_table_name); + var lastmoneyhistorybyhour = await powerStationRepository.GetLastMoneyAndCarbonInHour(powerStation.Id, 0, all_time); + + if (history != null) + { + history.PowerStationId = powerStation.Id; + history.Timestamp = Convert.ToDateTime(history.Timestamp + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); + + carbonRate = Convert.ToDouble(await powerStationRepository.GetOneVariableByName("CarbonRate")); + + history.CARBON = history.KWH * carbonRate; + history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate; + history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate; + history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate; + history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate; + + powerStationHistoriesHour.Add(history); + } + #endregion + + #region step2-2. 取得該電站的當前這小時的日照度歷史資料 + //step2-2 1. 找出該電站所有日照計設備(包含共享 + var deviceInfos = await powerStationRepository.GetListPyrheliometerByPowerStationId(powerStation.Id, powerStation.SiteDB); + if (deviceInfos != null) + { + //step2-2 2. 計算該電站所有日照計設的每小時的平均在依照日照計數量平均 + var pyrheliometerHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(all_time, deviceInfos, 0); + + if (pyrheliometerHistory != null) + { + pyrheliometerHistory.Timestamp = Convert.ToDateTime(pyrheliometerHistory.Timestamp + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); + pyrheliometerHistory.PowerStationId = powerStation.Id; + pyrheliometerHistoriesHour.Add(pyrheliometerHistory); + } + } + #endregion + + #region step2-3. 取得該電站的當前這小時的溫度計歷史資料 + //step2-3 1. 找出該電站所有溫度計設備(包含共享 + var tempdeviceInfos = await powerStationRepository.GetListTempByPowerStationId(powerStation.Id, powerStation.SiteDB); + if (tempdeviceInfos != null) + { + //step2-3 2. 計算該電站所有溫度計設的每小時的平均在依照溫度計數量平均 + var tempHistory = await powerStationRepository.GetPyrheliometerHistoryPerHour(all_time, tempdeviceInfos, 1); + if (tempHistory != null) + { + tempHistory.Timestamp = Convert.ToDateTime(tempHistory.Timestamp + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); + tempHistory.PowerStationId = powerStation.Id; + TempHistoriesHour.Add(tempHistory); + } + } + #endregion + } + #endregion + + #region step3. 逆變器歷史資料彙整(每小時) + var controllers = await powerStationRepository.GetAllDeviceControllerId(powerStation.Id, powerStation.SiteDB); + var inverters = await powerStationRepository.InverterTable(controllers, powerStation.SiteDB); + var inverterIds = inverters.Where(x => x.Enabled == 1 && x.Status != 0).Select(x => x.InverterId).ToList(); + + var inverter_table_name = String.Format("s{0}01_inv", powerStation.Code); + var full_inverter_table_name = String.Format("`{0}`.`{1}`", powerStation.SiteDB, inverter_table_name); + var exist_inverter_table = await powerStationRepository.ExistTable(powerStation.SiteDB, inverter_table_name); + + if (!string.IsNullOrEmpty(exist_inverter_table)) + { + inverterHistories = await powerStationRepository.CalcInverterHisyortHourData(all_time, powerStation.SiteDB, full_inverter_table_name, inverterIds); + //取得日照計要找的欄位資訊 + var pyrheliometer = await powerStationRepository.GetFirstPyrheliometerInfo(powerStation.Id, powerStation.SiteDB); + var pyrheliometerValue = await powerStationRepository.GetFirstPyrheliometerValue(all_time, pyrheliometer.DBName, pyrheliometer.TableName, pyrheliometer.ColName); + foreach (var inverterHistory in inverterHistories) + { + inverterHistory.Irradiance = pyrheliometerValue; + inverterHistory.DC1KW = inverterHistory.DC1W / 1000; + inverterHistory.DC2KW = inverterHistory.DC2W / 1000; + inverterHistory.DC3KW = inverterHistory.DC3W / 1000; + inverterHistory.DC4KW = inverterHistory.DC4W / 1000; + inverterHistory.DC5KW = inverterHistory.DC5W / 1000; + + inverterHistory.DCKW = (inverterHistory.DC1W + inverterHistory.DC2W + inverterHistory.DC3W + inverterHistory.DC4W + inverterHistory.DC5W) / 1000; + inverterHistory.ACKW = (inverterHistory.AC1W + inverterHistory.AC2W + inverterHistory.AC3W) / 1000; + + inverterHistory.TIMESTAMP = Convert.ToDateTime(inverterHistory.TIMESTAMP + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); + inverterHistory.PowerStationId = powerStation.Id; + } + } + #endregion + + #region step4. 計算該電站所有sensoravg + var seneoravg_table_name = String.Format("s{0}01_sensoravg", powerStation.Code); + var full_seneoravg_table_name = String.Format("`{0}`.`{1}`", powerStation.SiteDB, seneoravg_table_name); + var exist_seneoravg_table = await powerStationRepository.ExistTable(powerStation.SiteDB, seneoravg_table_name); + if (!string.IsNullOrEmpty(exist_seneoravg_table)) + { + var sensorAvgHistory = await powerStationRepository.CalcSensorAvgHistory(all_time, full_seneoravg_table_name); + + if (sensorAvgHistory != null) + { + sensorAvgHistory.PowerStationId = powerStation.Id; + sensorAvgHistory.TIMESTAMP = Convert.ToDateTime(sensorAvgHistory.TIMESTAMP + ":00:00").ToString("yyyy-MM-dd HH:mm:ss"); + + sensorAvgHistoryHour.Add(sensorAvgHistory); + } + } + #endregion + } + } + } + + #region 刪除後新增該時間區間的電站歷史紀錄 + List history_properties = new List() + { + "PowerStationId", + "TIMESTAMP", + "SITEID", + "SITETYPE", + "KWH", + "TODAYKWH", + "TOTALKWH", + "KWHKWP", + "PR", + "MP", + "SolarHour", + "MONEY", + "CARBON", + "TODAYMONEY", + "TOTALMONEY", + "TODAYCARBON", + "TOTALCARBON" + }; + await powerStationRepository.AddAfterPurgePowerStationHistoryHour(startDateStr, endDateStr, powerStationHistoriesHour, history_properties); + #endregion + + #region 刪除後新增該時間區間的日照溫度歷史紀錄 + List pyrheliometer_history_properties = new List() + { + "PowerStationId", + "TIMESTAMP", + "Irradiance" + }; + await powerStationRepository.AddAfterPurgePyrheliometerHistoryHour(startDateStr, endDateStr, pyrheliometerHistoriesHour, pyrheliometer_history_properties); + + List Temp_history_properties = new List() + { + "PowerStationId", + "TIMESTAMP", + "Temperature" + }; + await powerStationRepository.AddTempHistory(TempHistoriesHour, Temp_history_properties); + #endregion + + #region 刪除後新增該時間區間的逆變器歷史紀錄 + List inverter_history_properties = new List() + { + "PowerStationId", + "INVERTERID", + "TIMESTAMP", + "Irradiance", + "AC1V", + "AC1A", + "AC1W", + "AC1F", + "AC1WH", + "AC2V", + "AC2A", + "AC2W", + "AC2F", + "AC2WH", + "AC3V", + "AC3A", + "AC3W", + "AC3F", + "AC3WH", + "DC1V", + "DC1A", + "DC1W", + "DC1KW", + "DC1WH", + "DC2V", + "DC2A", + "DC2W", + "DC2KW", + "DC2WH", + "DC3V", + "DC3A", + "DC3W", + "DC3KW", + "DC3WH", + "DC4V", + "DC4A", + "DC4W", + "DC4KW", + "DC4WH", + "DC5V", + "DC5A", + "DC5W", + "DC5KW", + "DC5WH", + "PR", + "RA1", + "RA2", + "RA3", + "RA4", + "RA5", + "DCKW", + "ACKW", + "KWH", + "TODAYKWH", + "TOTALKWH", + "KWHKWP", + }; + await powerStationRepository.AddAfterPurgeInverterHistoryHour(startDateStr, endDateStr, inverterHistories, inverter_history_properties); + #endregion + + #region 刪除後新增該時間區間的SensorAvg歷史紀錄 + List sensoravg_history_properties = new List() + { + "PowerStationId", + "TIMESTAMP", + "SENSORAVG01", + "SENSORAVG02", + "SENSORAVG03", + "SENSORAVG04", + "SENSORAVG05", + "SENSORAVG06", + "SENSORAVG07", + "SENSORAVG08", + "SENSORAVG09", + "SENSORAVG10", + "SENSORAVG11", + "SENSORAVG12", + "SENSORAVG13", + "SENSORAVG14", + "SENSORAVG15", + "SENSORAVG16", + "SENSORAVG17", + "SENSORAVG18", + "SENSORAVG19", + "SENSORAVG20", + "SENSORAVG21", + "SENSORAVG22", + "SENSORAVG23", + "SENSORAVG24", + "SENSORAVG25", + "SENSORAVG26", + "SENSORAVG27", + "SENSORAVG28", + "SENSORAVG29", + "SENSORAVG30", + "SENSORAVG31", + "SENSORAVG32", + "SENSORAVG33", + "SENSORAVG34", + "SENSORAVG35", + "SENSORAVG36", + "SENSORAVG37", + "SENSORAVG38", + "SENSORAVG39", + "SENSORAVG40", + "SENSORAVG41", + "SENSORAVG42", + "SENSORAVG43", + "SENSORAVG44", + "SENSORAVG45", + "SENSORAVG46", + "SENSORAVG47", + "SENSORAVG48", + "SENSORAVG49", + "SENSORAVG50", + }; + await powerStationRepository.AddAfterPurgeSensorAvgHistoryHour(startDateStr, endDateStr, sensorAvgHistoryHour, sensoravg_history_properties); + #endregion + + #endregion + } + catch (Exception exception) + { + apiResult.Code = "9999"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + apiResult.Msg = errorCode.GetString(apiResult.Code); + return apiResult; + } + } +} diff --git a/SolarPower/Controllers/MyBaseController.cs b/SolarPower/Controllers/MyBaseController.cs index dffc646..b728aaf 100644 --- a/SolarPower/Controllers/MyBaseController.cs +++ b/SolarPower/Controllers/MyBaseController.cs @@ -49,23 +49,35 @@ namespace SolarPower.Controllers public override void OnActionExecuting(ActionExecutingContext filterContext) { - base.OnActionExecuting(filterContext); + //base.OnActionExecuting(filterContext); EDFunction edFunction = new EDFunction(); var myAccount = edFunction.AESDecrypt(HttpContext.Session.GetString("MyAccount")); //取得登入後,該位使用者的Account controllerName = ControllerContext.RouteData.Values["controller"].ToString(); //controller名稱 actionName = ControllerContext.RouteData.Values["action"].ToString(); //action名稱 + + bool isAjaxCall = filterContext.HttpContext.Request.Headers["x-requested-with"] == "XMLHttpRequest"; if (string.IsNullOrEmpty(myAccount)) { - filterContext.Result = new RedirectToRouteResult( + + if (isAjaxCall) + { + filterContext.HttpContext.Response.Clear(); + filterContext.HttpContext.Response.StatusCode = 499; + return; + } + else + { + filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary { {"controller", "Login"}, {"action", "Index"} }); - return; + return; + } } //取得當前登入使用者資訊 diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index 8e4fa4a..9ae64c0 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -4123,7 +4123,7 @@ namespace SolarPower.Repository.Implement {where_date} ORDER BY ps.TIMESTAMP"; - result = (await conn.QueryAsync(sql, new { PowerStationId = entities})).ToList(); + result = (await conn.QueryAsync(sql, new { PowerStationId = entities })).ToList(); } catch (Exception exception) { @@ -4213,5 +4213,152 @@ namespace SolarPower.Repository.Implement return result; } } + + public async Task> GetPowerStationHistoryByDateRange(string startDate, string endDate) + { + List result; + using (IDbConnection conn = this._databaseHelper.GetConnection()) + { + try + { + var sql = $"SELECT * FROM power_station_history_hour WHERE DATE_FORMAT(TIMESTAMP, '%Y-%m-%d') BETWEEN @StartDate AND @EndDate"; + + result = (await conn.QueryAsync(sql, new { StartDate = startDate, EndDate = endDate })).ToList(); + } + catch (Exception exception) + { + throw exception; + } + return result; + } + } + + public async Task AddAfterPurgePowerStationHistoryHour(string startDate, string endDate, List entity, List properties) + { + int count; + + using (IDbConnection conn = this._databaseHelper.GetConnection()) + { + using (var trans = conn.BeginTransaction()) + { + try + { + var purge_sql = $"DELET FROM power_station_history_hour WHERE TIMESTAMP BETWEEN @StartDate AND @EndDate"; + await conn.ExecuteAsync(purge_sql, new { StartDate = startDate, EndDate = endDate}, trans); + + var insert_sql = GenerateInsertQueryWithCustomTable(properties, "power_station_history_hour"); + count = await conn.ExecuteAsync(insert_sql, entity, trans); + + trans.Commit(); + + } + catch (Exception exception) + { + trans.Rollback(); + throw exception; + } + finally + { + conn.Close(); + } + } + } + } + + public async Task AddAfterPurgePyrheliometerHistoryHour(string startDate, string endDate, List entity, List properties) + { + int count; + + using (IDbConnection conn = this._databaseHelper.GetConnection()) + { + using (var trans = conn.BeginTransaction()) + { + try + { + var purge_sql = $"DELET FROM sensor_history_hour WHERE TIMESTAMP BETWEEN @StartDate AND @EndDate"; + await conn.ExecuteAsync(purge_sql, new { StartDate = startDate, EndDate = endDate }, trans); + + var insert_sql = GenerateInsertQueryWithCustomTable(properties, "sensor_history_hour"); + count = await conn.ExecuteAsync(insert_sql, entity, trans); + + trans.Commit(); + + } + catch (Exception exception) + { + trans.Rollback(); + throw exception; + } + finally + { + conn.Close(); + } + } + } + } + + public async Task AddAfterPurgeInverterHistoryHour(string startDate, string endDate, List entity, List properties) + { + int count; + + using (IDbConnection conn = this._databaseHelper.GetConnection()) + { + using (var trans = conn.BeginTransaction()) + { + try + { + var purge_sql = $"DELET FROM inverter_history_hour WHERE TIMESTAMP BETWEEN @StartDate AND @EndDate"; + await conn.ExecuteAsync(purge_sql, new { StartDate = startDate, EndDate = endDate }, trans); + + var insert_sql = GenerateInsertQueryWithCustomTable(properties, "inverter_history_hour"); + count = await conn.ExecuteAsync(insert_sql, entity, trans); + + trans.Commit(); + + } + catch (Exception exception) + { + trans.Rollback(); + throw exception; + } + finally + { + conn.Close(); + } + } + } + } + + public async Task AddAfterPurgeSensorAvgHistoryHour(string startDate, string endDate, List entity, List properties) + { + int count; + + using (IDbConnection conn = this._databaseHelper.GetConnection()) + { + using (var trans = conn.BeginTransaction()) + { + try + { + var purge_sql = $"DELET FROM sensoravg_history_hour WHERE TIMESTAMP BETWEEN @StartDate AND @EndDate"; + await conn.ExecuteAsync(purge_sql, new { StartDate = startDate, EndDate = endDate }, trans); + + var insert_sql = GenerateInsertQueryWithCustomTable(properties, "sensoravg_history_hour"); + count = await conn.ExecuteAsync(insert_sql, entity, trans); + + trans.Commit(); + + } + catch (Exception exception) + { + trans.Rollback(); + throw exception; + } + finally + { + conn.Close(); + } + } + } + } } } diff --git a/SolarPower/Repository/Interface/IPowerStationRepository.cs b/SolarPower/Repository/Interface/IPowerStationRepository.cs index 32a55a8..51f1a64 100644 --- a/SolarPower/Repository/Interface/IPowerStationRepository.cs +++ b/SolarPower/Repository/Interface/IPowerStationRepository.cs @@ -502,7 +502,7 @@ namespace SolarPower.Repository.Interface Task> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name); Task> GetListTempByPowerStationId(int powerStationId, string db_name); - Task GetPyrheliometerHistoryPerHour(string dateTime, List deviceInfos,int Type); + Task GetPyrheliometerHistoryPerHour(string dateTime, List deviceInfos, int Type); Task AddTempHistory(List entity, List properties); Task AddPyrheliometerHistory(List entity, List properties); Task CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId); @@ -536,7 +536,7 @@ namespace SolarPower.Repository.Interface Task AddWeatherForecast(List entity, List properties); Task SelectNowWeather(int CityId); Task GetMoneyAndCarbonWithHistoryHour(int powerstationId, string dateTime, int type); - Task GetLastMoneyAndCarbonInHour(int powerstationId,int type,string time); + Task GetLastMoneyAndCarbonInHour(int powerstationId, int type, string time); Task ExistTable(string db_name, string table_name); Task CalcSensorAvgHistory(string dateTime, string table_name); Task AddSensorAvgHistory(List entity, List properties); @@ -552,12 +552,19 @@ namespace SolarPower.Repository.Interface Task> GetInverterHistoryRowData(string nowDay, List entities); Task> GetInverterHistoryByDate(string startDay, string endDay, List entities); Task> GetInverterHistoryByYear(string year, List entities); - Task> GetPowerStationsByCompanyIdWithfilter(int companyId,string filter); + Task> GetPowerStationsByCompanyIdWithfilter(int companyId, string filter); Task> GetPowerStationsAllWithfilter(string filter); Task> GetDeviceByPowerStationIdAndDeviceIds(string db_name, int powerStationId, List deviceIds); Task GetSensorAvgByDevices(string date, byte searchType, List devices); Task> GetPowerStationHistory(string date, byte searchType, List entities); Task> GetMeterHistory(string date, byte searchType, List entities); + + Task> GetPowerStationHistoryByDateRange(string startDate, string endDate); + + Task AddAfterPurgePowerStationHistoryHour(string startDate, string endDate, List entity, List properties); + Task AddAfterPurgePyrheliometerHistoryHour(string startDate, string endDate, List entity, List properties); + Task AddAfterPurgeInverterHistoryHour(string startDate, string endDate, List entity, List properties); + Task AddAfterPurgeSensorAvgHistoryHour(string startDate, string endDate, List entity, List properties); } } diff --git a/SolarPower/Views/AnalysisStationCombine/Index.cshtml b/SolarPower/Views/AnalysisStationCombine/Index.cshtml index d31325f..23d75bc 100644 --- a/SolarPower/Views/AnalysisStationCombine/Index.cshtml +++ b/SolarPower/Views/AnalysisStationCombine/Index.cshtml @@ -636,15 +636,16 @@ datasets: [{ type: 'line', label: '日照度(kWh/㎡)', - borderColor: 'rgba(190, 45, 45,1)', + borderColor: 'rgb(190, 45, 45)', + pointBackgroundColor: 'rgb(190, 45, 45)', + pointBorderColor: 'rgb(190, 45, 45)', pointRadius: 4, yAxisID: 'B', fill: false, data: listirradiance }, { type: 'bar', - borderColor: 'rgba(103, 180, 172, 1)', - backgroundColor: 'rgba(103, 180, 172, 0.2)', + backgroundColor: 'rgb(103, 180, 172)', borderWidth: 1, label: '發電量(kWh)', yAxisID: 'A', diff --git a/SolarPower/Views/PowerStation/_StationInfo.cshtml b/SolarPower/Views/PowerStation/_StationInfo.cshtml index e1d5e6d..088d8d9 100644 --- a/SolarPower/Views/PowerStation/_StationInfo.cshtml +++ b/SolarPower/Views/PowerStation/_StationInfo.cshtml @@ -165,7 +165,7 @@
+ +
+
+
+
- +
+
diff --git a/SolarPower/appsettings.Development.json b/SolarPower/appsettings.Development.json index f76111b..226ca35 100644 --- a/SolarPower/appsettings.Development.json +++ b/SolarPower/appsettings.Development.json @@ -26,7 +26,7 @@ "CalcAvgPowerStationJob": "0 0 2 * * ?", "OperationScheduleJob": "0 0 2 * * ?", "CalcInverter15minJob": "0 2/15 * * * ?", - "SendEmailJob": "0/10 * * * * ?" + "SendEmailJob": "0 15 2 * * ?" }, "SMTPConfig": { "Host": "smtp.gmail.com", diff --git a/SolarPower/appsettings.json b/SolarPower/appsettings.json index 93cb5bd..1c81efa 100644 --- a/SolarPower/appsettings.json +++ b/SolarPower/appsettings.json @@ -26,7 +26,8 @@ "CalcPowerStationJob": "0 5 * * * ?", "CalcAvgPowerStationJob": "0 0 2 * * ?", "OperationScheduleJob": "0 0 2 * * ?", - "CalcInverter15minJob": "0 2/15 * * * ?" + "CalcInverter15minJob": "0 2/15 * * * ?", + "SendEmailJob": "0 15 2 * * ?" }, "SMTPConfig": { "Host": "smtp.gmail.com", diff --git a/SolarPower/wwwroot/js/app.bundle.js b/SolarPower/wwwroot/js/app.bundle.js index c2c3ad2..a2e17eb 100644 --- a/SolarPower/wwwroot/js/app.bundle.js +++ b/SolarPower/wwwroot/js/app.bundle.js @@ -65,7 +65,7 @@ var myapp_config = { Activate last tab Stores the last tab in localstorage and activates it */ - activateLastTab: true, + activateLastTab: false, /* Primary menu anchor point #js-primary-nav This is the root anchor point where the menu script will begin its build diff --git a/SolarPower/wwwroot/js/site.js b/SolarPower/wwwroot/js/site.js index 444602c..16cc2b6 100644 --- a/SolarPower/wwwroot/js/site.js +++ b/SolarPower/wwwroot/js/site.js @@ -1,6 +1,16 @@  //#region 個人資訊表單驗證 $(function () { + $.ajaxSetup({ + //完成请求后触发。即在success或error触发后触发 + complete: function (XMLHttpRequest, status) { + if ('499' == XMLHttpRequest.status) { + window.location.href = "/Login/Index"; + } + }, + }) + + $("#personal-info-form").validate({ rules: { name_modal: {