1. 回填資料

2. bug fix
This commit is contained in:
Kai 2021-08-03 12:00:58 +08:00
parent 69007218b5
commit daed2b450d
13 changed files with 665 additions and 21 deletions

View File

@ -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<DataBackFillController>
{
private readonly IPowerStationRepository powerStationRepository;
private double carbonRate;
public DataBackFillController(IPowerStationRepository powerStationRepository) : base()
{
this.powerStationRepository = powerStationRepository;
}
public IActionResult Index()
{
return View();
}
public async Task<ApiResult<string>> BackFillHistory()
{
ApiResult<string> apiResult = new ApiResult<string>();
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<string>()
{
"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<PowerStationHistory> powerStationHistoriesHour = new List<PowerStationHistory>();
List<PyrheliometerHistory> pyrheliometerHistoriesHour = new List<PyrheliometerHistory>();
List<PyrheliometerHistory> TempHistoriesHour = new List<PyrheliometerHistory>();
//逆變器歷史資料
List<InverterHistory> inverterHistories = new List<InverterHistory>();
//5分鐘Sensor平均歷史資料
List<SensorAvgHistory> sensorAvgHistoryHour = new List<SensorAvgHistory>();
#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<string> history_properties = new List<string>()
{
"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<string> pyrheliometer_history_properties = new List<string>()
{
"PowerStationId",
"TIMESTAMP",
"Irradiance"
};
await powerStationRepository.AddAfterPurgePyrheliometerHistoryHour(startDateStr, endDateStr, pyrheliometerHistoriesHour, pyrheliometer_history_properties);
List<string> Temp_history_properties = new List<string>()
{
"PowerStationId",
"TIMESTAMP",
"Temperature"
};
await powerStationRepository.AddTempHistory(TempHistoriesHour, Temp_history_properties);
#endregion
#region
List<string> inverter_history_properties = new List<string>()
{
"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<string> sensoravg_history_properties = new List<string>()
{
"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;
}
}
}

View File

@ -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;
}
}
//取得當前登入使用者資訊

View File

@ -4123,7 +4123,7 @@ namespace SolarPower.Repository.Implement
{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();
}
catch (Exception exception)
{
@ -4213,5 +4213,152 @@ namespace SolarPower.Repository.Implement
return result;
}
}
public async Task<List<PowerStationHistory>> GetPowerStationHistoryByDateRange(string startDate, string endDate)
{
List<PowerStationHistory> 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<PowerStationHistory>(sql, new { StartDate = startDate, EndDate = endDate })).ToList();
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
public async Task AddAfterPurgePowerStationHistoryHour(string startDate, string endDate, List<PowerStationHistory> entity, List<string> 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<PyrheliometerHistory> entity, List<string> 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<InverterHistory> entity, List<string> 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<SensorAvgHistory> entity, List<string> 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();
}
}
}
}
}
}

View File

@ -502,7 +502,7 @@ namespace SolarPower.Repository.Interface
Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name);
Task<List<DeviceInfo>> GetListTempByPowerStationId(int powerStationId, string db_name);
Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos,int Type);
Task<PyrheliometerHistory> GetPyrheliometerHistoryPerHour(string dateTime, List<DeviceInfo> deviceInfos, int Type);
Task<int> AddTempHistory(List<PyrheliometerHistory> entity, List<string> properties);
Task<int> AddPyrheliometerHistory(List<PyrheliometerHistory> entity, List<string> properties);
Task<AvgPyrheliometerHistory> CalcAvgPyrheliometerHistory30day(string nowDay, int powerStationId);
@ -536,7 +536,7 @@ namespace SolarPower.Repository.Interface
Task AddWeatherForecast(List<WeatherForecast> entity, List<string> properties);
Task<NowWeather> SelectNowWeather(int CityId);
Task<MoneyAndCarbon> GetMoneyAndCarbonWithHistoryHour(int powerstationId, string dateTime, int type);
Task<MoneyAndCarbon> GetLastMoneyAndCarbonInHour(int powerstationId,int type,string time);
Task<MoneyAndCarbon> GetLastMoneyAndCarbonInHour(int powerstationId, int type, string time);
Task<string> ExistTable(string db_name, string table_name);
Task<SensorAvgHistory> CalcSensorAvgHistory(string dateTime, string table_name);
Task<int> AddSensorAvgHistory(List<SensorAvgHistory> entity, List<string> properties);
@ -552,12 +552,19 @@ namespace SolarPower.Repository.Interface
Task<List<InverterHistory>> GetInverterHistoryRowData(string nowDay, List<StationCodeWithInverterIds> entities);
Task<List<InverterHistory>> GetInverterHistoryByDate(string startDay, string endDay, List<StationIdWithInverterIds> entities);
Task<List<InverterHistory>> GetInverterHistoryByYear(string year, List<StationIdWithInverterIds> entities);
Task<List<PowerStationIdAndCity>> GetPowerStationsByCompanyIdWithfilter(int companyId,string filter);
Task<List<PowerStationIdAndCity>> GetPowerStationsByCompanyIdWithfilter(int companyId, string filter);
Task<List<PowerStationIdAndCity>> GetPowerStationsAllWithfilter(string filter);
Task<List<Device>> GetDeviceByPowerStationIdAndDeviceIds(string db_name, int powerStationId, List<string> deviceIds);
Task<dynamic> GetSensorAvgByDevices(string date, byte searchType, List<Device> devices);
Task<List<PowerStationHistory>> GetPowerStationHistory(string date, byte searchType, List<int> entities);
Task<List<MeterHistory>> GetMeterHistory(string date, byte searchType, List<StationIdWithMeterIds> entities);
Task<List<PowerStationHistory>> GetPowerStationHistoryByDateRange(string startDate, string endDate);
Task AddAfterPurgePowerStationHistoryHour(string startDate, string endDate, List<PowerStationHistory> entity, List<string> properties);
Task AddAfterPurgePyrheliometerHistoryHour(string startDate, string endDate, List<PyrheliometerHistory> entity, List<string> properties);
Task AddAfterPurgeInverterHistoryHour(string startDate, string endDate, List<InverterHistory> entity, List<string> properties);
Task AddAfterPurgeSensorAvgHistoryHour(string startDate, string endDate, List<SensorAvgHistory> entity, List<string> properties);
}
}

View File

@ -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',

View File

@ -165,7 +165,7 @@
</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">

View File

@ -357,7 +357,7 @@
</a>
</li>
}
@if (ViewBag.auths.Contains("User"))
@*@if (ViewBag.auths.Contains("User"))
{
<li class="">
<a href="javascript:void(0);" title="功能清單" data-filter-tags="utilities disabled item">
@ -372,7 +372,7 @@
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">定時任務設定</span>
</a>
</li>
}
}*@
</ul>
</li>
}

View File

@ -165,6 +165,25 @@
GetPowerStationCollapse(filter);
});*@
//#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 即時資訊tab
var url = "/StationOverview/GetOneStationUpToDateInfo";
var send_data = {
@ -840,7 +859,7 @@
});
SelectAllInvert();
}, 'json');
//#endregion
@ -1220,7 +1239,7 @@
if (myDropzone.files.length > 0) {
selected_id = rel.data;
myDropzone.processQueue();
myDropzone.on("successmultiple", function (file, rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
@ -1589,6 +1608,29 @@
$("#power_station_operation_personnel").val(powerStationData.operationPersonnelIds).trigger("change");
$("#power_station_operation_personnel").attr("disabled", true);
$("#line_token_text").html(powerStationData.line_token);
$("#estimate_kwh_text").html(powerStationData.estimate_kwh);
$("#estimate_efficacy_text").html(powerStationData.estimateEfficacy);
@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);
$("#select_power_station_company").val(powerStationData.companyId).trigger("change");
</text>
}
else
{
<text>
$("#select_power_station_company_title").hide();
$("#select_power_station_company").hide();
$("#select_power_station_company").attr("disabled", true);
$("#select_power_station_company").val(powerStationData.companyId).trigger("change");
</text>
}
//光電板
$("#photovoltaic_panel_brand_text").html(powerStationData.photovoltaicPanelBrand);
$("#photovoltaic_panel_product_model_text").html(powerStationData.photovoltaicPanelProductModel);
@ -2225,7 +2267,7 @@
}
})

View File

@ -110,17 +110,51 @@
</div>
</div>
<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>
</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>
</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>
</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">
<label id="created_by_text" class="color-info-600"></label>
</div>
</div>
<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">
<label id="created_at_text" class="color-info-600"></label>
</div>
</div>
</div>
<div class="row">

View File

@ -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",

View File

@ -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",

View File

@ -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

View File

@ -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: {