Merge branch 'master' of https://dev.azure.com/MjmTechDev/solarPower/_git/solarPower
This commit is contained in:
commit
a759f1e58d
@ -12,6 +12,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SolarPower.Controllers
|
||||
{
|
||||
@ -676,30 +677,36 @@ namespace SolarPower.Controllers
|
||||
_ => ""
|
||||
};
|
||||
var user = await userRepository.GetOneAsync(person);
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
UserId = person,
|
||||
RecipientName = user.Name,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
noticeSchedules.Add(schedule);
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
UserId = person,
|
||||
RecipientName = user.Name,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
noticeSchedules.Add(schedule);
|
||||
}
|
||||
}
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
if (noticeSchedules.Count > 0)
|
||||
{
|
||||
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
||||
}
|
||||
}
|
||||
|
||||
if (post.FixFirm != 0)
|
||||
@ -714,27 +721,31 @@ namespace SolarPower.Controllers
|
||||
};
|
||||
//var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
if (firm.Email != null && IsValidEmail(firm.Email))
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
RecipientName = firm.Name,
|
||||
RecipientEmail = firm.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
RecipientName = firm.Name,
|
||||
RecipientEmail = firm.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
||||
}
|
||||
}
|
||||
}
|
||||
//using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Suppress))
|
||||
@ -898,30 +909,36 @@ namespace SolarPower.Controllers
|
||||
_ => ""
|
||||
};
|
||||
var user = await userRepository.GetOneAsync(person);
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
UserId = person,
|
||||
RecipientName = user.Name,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
noticeSchedules.Add(schedule);
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
UserId = person,
|
||||
RecipientName = user.Name,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
noticeSchedules.Add(schedule);
|
||||
}
|
||||
}
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
if (noticeSchedules.Count > 0)
|
||||
{
|
||||
await noticeScheduleRepository.AddAnyThing<List<NoticeSchedule>>(noticeSchedules, properties, "notice_schedule");
|
||||
}
|
||||
}
|
||||
if (post.FixFirm != 0)
|
||||
{
|
||||
@ -935,29 +952,31 @@ namespace SolarPower.Controllers
|
||||
};
|
||||
// var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId);
|
||||
var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync<OperationInfo>(post.FixFirm, powerstations.SiteDB, "operation_firm");
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
if (firm.Email != null && IsValidEmail(firm.Email))
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
RecipientName = firm.Name,
|
||||
RecipientEmail = firm.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
||||
|
||||
NoticeSchedule schedule = new NoticeSchedule()
|
||||
{
|
||||
EmailType = 3,
|
||||
Type = 1,
|
||||
RecipientName = firm.Name,
|
||||
RecipientEmail = firm.Email,
|
||||
Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime,
|
||||
Content = "維修項目:" + post.FixDo + "</br>注意事項 :" + post.Notice,
|
||||
};
|
||||
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Content",
|
||||
"RecipientName",
|
||||
"Type",
|
||||
"ExceptionId"
|
||||
};
|
||||
await noticeScheduleRepository.AddAnyThing<NoticeSchedule>(schedule, properties, "notice_schedule");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1325,5 +1344,11 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValidEmail(string strIn)
|
||||
{
|
||||
// Return true if strIn is in valid e-mail format.
|
||||
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1177,7 +1177,9 @@ namespace SolarPower.Controllers
|
||||
"Status",
|
||||
"Enabled",
|
||||
"InstallDate",
|
||||
"BrandNum"
|
||||
"BrandNum",
|
||||
"SensorTypeId",
|
||||
"SensorTypeDetailId"
|
||||
};
|
||||
if (Device.WarrantyDate != "0001-01-01")
|
||||
{
|
||||
@ -1246,7 +1248,9 @@ namespace SolarPower.Controllers
|
||||
"Status",
|
||||
"Enabled",
|
||||
"InstallDate",
|
||||
"BrandNum"
|
||||
"BrandNum",
|
||||
"SensorTypeId",
|
||||
"SensorTypeDetailId"
|
||||
};
|
||||
if (Device.WarrantyDate != "0001-01-01")
|
||||
{
|
||||
@ -2474,6 +2478,27 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
await powerStationRepository.AddInverter(inverter, properties, powerStation.SiteDB);
|
||||
|
||||
#region 在master底下的inv_Status 新增inverter
|
||||
InverterForMaster inverterForMasterInvs = new InverterForMaster()
|
||||
{
|
||||
DBName = powerStation.SiteDB,
|
||||
InverterId = deviceController.ControllerId + Newnum,
|
||||
Deleted = 0,
|
||||
Enabled = post.Enabled,
|
||||
Status = post.Status
|
||||
};
|
||||
|
||||
List<string> propertiesForMasterInvs = new List<string>()
|
||||
{
|
||||
"DBName",
|
||||
"InverterId",
|
||||
"Deleted",
|
||||
"Enabled",
|
||||
"Status"
|
||||
};
|
||||
await powerStationRepository.AddMasterInverter(inverterForMasterInvs, propertiesForMasterInvs);
|
||||
#endregion
|
||||
|
||||
BackFillSchedule backFillSchedule = new BackFillSchedule()
|
||||
{
|
||||
UID = deviceController.ControllerId + Newnum,
|
||||
@ -2537,6 +2562,26 @@ namespace SolarPower.Controllers
|
||||
properties.Add("WarrantyDate");
|
||||
}
|
||||
await powerStationRepository.UpdateInverter(inverter, properties, powerStation.SiteDB);
|
||||
|
||||
#region 在master底下的inv_Status更新inverter
|
||||
InverterForMaster inverterForMasterInvs = new InverterForMaster()
|
||||
{
|
||||
DBName = powerStation.SiteDB,
|
||||
Enabled = post.Enabled,
|
||||
Status = post.Status,
|
||||
Id = post.Id
|
||||
};
|
||||
|
||||
List<string> propertiesForMasterInvs = new List<string>()
|
||||
{
|
||||
"DBName",
|
||||
"Enabled",
|
||||
"Status",
|
||||
"Id"
|
||||
};
|
||||
await powerStationRepository.UpdateMasterInverter(inverterForMasterInvs, propertiesForMasterInvs);
|
||||
#endregion
|
||||
|
||||
await powerStationRepository.StationStatus(post.PowerStationId, 0);
|
||||
await powerStationRepository.StationStatus(post.PowerStationId, 0, powerStation.SiteDB + ".");
|
||||
apiResult.Code = "0000";
|
||||
@ -2659,6 +2704,15 @@ namespace SolarPower.Controllers
|
||||
|
||||
await powerStationRepository.DeleteOneByIdWithCustomDBNameAndTable(post.SelectedId, powerStation.SiteDB, "inverter");
|
||||
|
||||
var inverter = await powerStationRepository.GetOneMasterInverter(post.SelectedId, powerStation.SiteDB);
|
||||
if (inverter == null )
|
||||
{
|
||||
apiResult.Code = "0001";
|
||||
apiResult.Msg = "該電站沒有啟用的逆變器";
|
||||
return apiResult;
|
||||
}
|
||||
await powerStationRepository.DeleteOneMasterInverter(inverter.InverterId, "inv_status");
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "刪除成功";
|
||||
}
|
||||
@ -2997,7 +3051,7 @@ namespace SolarPower.Controllers
|
||||
apiResult.Msg = "該電站沒有啟用的逆變器";
|
||||
return apiResult;
|
||||
}
|
||||
var inverterIds = inverters.Where(x => x.Enabled == 1).Select(x => new { InverterId = x.InverterId, Type = x.Status,Name = x.InverterName}).ToList();
|
||||
var inverterIds = inverters.Where(x => x.Enabled == 1).Select(x => new { InverterId = x.InverterId, Type = x.InverterStatus, Name = x.InverterName}).ToList();
|
||||
var inverterIdsname = inverterIds.Select(x => x.InverterId).ToList();
|
||||
if (inverterIds.Count > 0)
|
||||
{
|
||||
@ -3271,7 +3325,7 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
status.Add($"s{powerStation.Code}01_inv SITEID錯誤");
|
||||
}
|
||||
if (powerStation.Code + "01" != sitecheck.Inv_inveter.Substring(0,11) && sitecheck.Inv_inveter != null)
|
||||
if (sitecheck.Inv_inveter != null && powerStation.Code + "01" != sitecheck.Inv_inveter.Substring(0,11))
|
||||
{
|
||||
status.Add($"s{powerStation.Code}01_Inv inveter格式錯誤");
|
||||
}
|
||||
|
||||
@ -267,24 +267,32 @@ namespace SolarPower.Controllers
|
||||
#region 顯示body //RowPosition = 1
|
||||
RowPosition++;
|
||||
var thour = ""; var tpr = ""; var tkwh = ""; var kWhkwp = ""; var ntd = ""; var ntdone = "";var GeneratingCapacity = "";var AverageDailyProfit = "";
|
||||
int vForDataCount = 0;
|
||||
foreach (dynamic body in Formbody.Result.Data)
|
||||
{
|
||||
index = 0;
|
||||
var dbody = body as IDictionary<string, object>;
|
||||
thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString());
|
||||
tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString());
|
||||
tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString());
|
||||
kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString());
|
||||
ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString());
|
||||
GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
|
||||
double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh);
|
||||
if (double.IsNaN(onemoney))
|
||||
if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆(總計),不須取值
|
||||
{
|
||||
onemoney = 0;
|
||||
vForDataCount++;
|
||||
thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString());
|
||||
tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString());
|
||||
tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString());
|
||||
kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString());
|
||||
ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString());
|
||||
GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
|
||||
double kwp = Convert.ToDouble(tkwh) / Convert.ToDouble(GeneratingCapacity);
|
||||
kWhkwp = Checknull(Math.Round(kwp, 2).ToString());
|
||||
|
||||
double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh);
|
||||
if (double.IsNaN(onemoney))
|
||||
{
|
||||
onemoney = 0;
|
||||
}
|
||||
ntdone = Checknull(Math.Round(onemoney, 2).ToString());
|
||||
AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString());
|
||||
}
|
||||
ntdone = Checknull(Math.Round(onemoney, 4).ToString());
|
||||
AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString());
|
||||
|
||||
row = sheet.CreateRow(RowPosition);
|
||||
cell = row.CreateCell(index);
|
||||
@ -302,7 +310,7 @@ namespace SolarPower.Controllers
|
||||
List<string> bodynames = new List<string>(){
|
||||
"hourKWH",
|
||||
"hourKWHp",
|
||||
"irradiance",
|
||||
"irrDayHour",
|
||||
"temperature"
|
||||
};
|
||||
if (Formhead.Result.Data.ShowMoney == 1)
|
||||
@ -467,18 +475,27 @@ namespace SolarPower.Controllers
|
||||
var monthGeneratingCapacity = "";
|
||||
var check_hire = false;
|
||||
var sitedb = "";
|
||||
vForDataCount = 0;
|
||||
foreach (dynamic body in Formbody.Result.Data)
|
||||
{
|
||||
index2 = 0;
|
||||
var dbody = body as IDictionary<string, object>;
|
||||
if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆(總計),不須取值
|
||||
{
|
||||
vForDataCount++;
|
||||
avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
|
||||
avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
|
||||
avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
|
||||
monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString();
|
||||
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
|
||||
monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString();
|
||||
monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
|
||||
|
||||
double kwp = Convert.ToDouble(monthKWH) / Convert.ToDouble(monthGeneratingCapacity);
|
||||
avgKWHKWP = Checknull(Math.Round(kwp, 2).ToString());
|
||||
}
|
||||
|
||||
avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
|
||||
avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
|
||||
avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
|
||||
monthKWH = dbody["monthKWH"] == null ? "0": dbody["monthKWH"].ToString();
|
||||
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
|
||||
monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString();
|
||||
monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用
|
||||
{
|
||||
check_hire = true;
|
||||
@ -533,7 +550,7 @@ namespace SolarPower.Controllers
|
||||
#region 顯示總量//RowPosition = body + 2
|
||||
RowPosition += 2;//空兩行
|
||||
index = 0;
|
||||
var Useday = Formbody.Result.Data.Count;
|
||||
var Useday = (Formbody.Result.Data.Count - 1);//最後一筆為總計,故減1
|
||||
row = sheet.CreateRow(RowPosition);
|
||||
|
||||
//cell = row.CreateCell(index);
|
||||
@ -610,7 +627,7 @@ namespace SolarPower.Controllers
|
||||
if (Formhead.Result.Data.ShowMoney == 1)
|
||||
{
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 3));
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 2));
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
@ -618,7 +635,7 @@ namespace SolarPower.Controllers
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 4));
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2));
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
@ -741,18 +758,24 @@ namespace SolarPower.Controllers
|
||||
check_hire = false;
|
||||
sitedb = "";
|
||||
monthGeneratingCapacity = "";
|
||||
string days = "0";
|
||||
vForDataCount = 0;
|
||||
foreach (dynamic body in Formbody.Result.Data)
|
||||
{
|
||||
index3 = 0;
|
||||
var dbody = body as IDictionary<string, object>;
|
||||
|
||||
avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
|
||||
avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
|
||||
avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
|
||||
monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString();
|
||||
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
|
||||
monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString();
|
||||
monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆(總計),不須取值
|
||||
{
|
||||
vForDataCount++;
|
||||
avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
|
||||
avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
|
||||
avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
|
||||
monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString();
|
||||
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
|
||||
monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString();
|
||||
monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
days = Checknull(Math.Round(Convert.ToDouble(dbody["Days"])).ToString());
|
||||
}
|
||||
if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用
|
||||
{
|
||||
check_hire = true;
|
||||
@ -807,7 +830,7 @@ namespace SolarPower.Controllers
|
||||
#region 顯示總量//RowPosition = body + 2
|
||||
RowPosition += 2;//空兩行
|
||||
index = 0;
|
||||
Useday = Formbody.Result.Data.Count;
|
||||
Useday = (Formbody.Result.Data.Count - 1);//最後一筆為總計,故減1
|
||||
row = sheet.CreateRow(RowPosition);
|
||||
|
||||
cell = row.CreateCell(index);
|
||||
@ -819,6 +842,10 @@ namespace SolarPower.Controllers
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue("裝置容量");
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue("發電量平均(kWh)(月)");
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
@ -856,7 +883,11 @@ namespace SolarPower.Controllers
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(avgKWHKWP) / Useday, 2));
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthKWH) / Convert.ToDouble(monthGeneratingCapacity), 2));
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthGeneratingCapacity), 2));///
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
@ -878,7 +909,7 @@ namespace SolarPower.Controllers
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity) / Useday / 30, 2));//一個月為30天
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity) / Convert.ToDouble(days), 2));//一個月為30天 Useday / 30
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
}
|
||||
@ -976,7 +1007,10 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
AllowClose = false
|
||||
};
|
||||
string companyName = postObject.PowerStation[0].Name;
|
||||
|
||||
int powerStationId = int.Parse(postObject.PowerStation[0].Value);
|
||||
var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId);
|
||||
string companyName = getCompany.Result;
|
||||
workbook.Write(ms);
|
||||
ms.Flush();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
@ -1073,7 +1107,7 @@ namespace SolarPower.Controllers
|
||||
var getinvsql = k.Result[0] as IDictionary<string, object>;
|
||||
if (getinvsql["mySelect"] == null)
|
||||
{
|
||||
if(postObject.PowerStation.Count > 1)
|
||||
if(postObject.PowerStation.Count > 1)//因為有總計 所以最少會有一筆
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1084,7 +1118,7 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
var sheet = workbook.CreateSheet(powerstationid.Name);
|
||||
var Formbody = GetForm(select_Table);//取body
|
||||
if(Formbody.Result.Data.Count == 0)
|
||||
if(Formbody.Result.Data.Count <= 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1139,25 +1173,32 @@ namespace SolarPower.Controllers
|
||||
#region 顯示body //RowPosition = 1
|
||||
RowPosition++;
|
||||
var thour = ""; var tpr = ""; var tkwh = ""; var kWhkwp = ""; var ntd = ""; var ntdone = ""; var GeneratingCapacity = ""; var AverageDailyProfit = "";
|
||||
int vForDataCount = 0;
|
||||
foreach (dynamic body in Formbody.Result.Data)
|
||||
{
|
||||
|
||||
index = 0;
|
||||
var dbody = body as IDictionary<string, object>;
|
||||
thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString());
|
||||
tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString());
|
||||
tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString());
|
||||
kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString());
|
||||
ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString());
|
||||
GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
|
||||
double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh);
|
||||
if (double.IsNaN(onemoney))
|
||||
if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆為總計,不須取值
|
||||
{
|
||||
onemoney = 0;
|
||||
vForDataCount++;
|
||||
thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString());
|
||||
tpr = Checknull(Math.Round(Convert.ToDouble(dbody["pr"]), 2).ToString());
|
||||
tkwh = Checknull(Math.Round(Convert.ToDouble(dbody["totKWH"]), 2).ToString());
|
||||
kWhkwp = Checknull(Math.Round(Convert.ToDouble(dbody["totKWHKWP"]), 2).ToString());
|
||||
ntd = Checknull(Math.Round(Convert.ToDouble(dbody["totmoney"]), 2).ToString());
|
||||
GeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
|
||||
double kwp = Convert.ToDouble(tkwh) / Convert.ToDouble(GeneratingCapacity);
|
||||
kWhkwp = Checknull(Math.Round(kwp, 2).ToString());
|
||||
|
||||
double onemoney = Convert.ToDouble(ntd) / Convert.ToDouble(tkwh);
|
||||
if (double.IsNaN(onemoney))
|
||||
{
|
||||
onemoney = 0;
|
||||
}
|
||||
ntdone = Checknull(Math.Round(onemoney, 2).ToString());
|
||||
AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString());
|
||||
}
|
||||
ntdone = Checknull(Math.Round(onemoney, 4).ToString());
|
||||
AverageDailyProfit = Checknull(Math.Round((Convert.ToDouble(ntd) / Convert.ToDouble(GeneratingCapacity)), 2).ToString());
|
||||
|
||||
row = sheet.CreateRow(RowPosition);
|
||||
cell = row.CreateCell(index);
|
||||
@ -1175,7 +1216,7 @@ namespace SolarPower.Controllers
|
||||
List<string> bodynames = new List<string>(){
|
||||
"hourKWH",
|
||||
"hourKWHp",
|
||||
"irradiance",
|
||||
"irrDayHour",
|
||||
"temperature"
|
||||
};
|
||||
if (Formhead.Result.Data.ShowMoney == 1)
|
||||
@ -1341,18 +1382,26 @@ namespace SolarPower.Controllers
|
||||
var monthGeneratingCapacity = "";
|
||||
var check_hire = false;
|
||||
var sitedb = "";
|
||||
vForDataCount = 0;
|
||||
foreach (dynamic body in Formbody.Result.Data)
|
||||
{
|
||||
index2 = 0;
|
||||
var dbody = body as IDictionary<string, object>;
|
||||
if (vForDataCount < (Formbody.Result.Data.Count - 1))//最後一筆為總計,不須取值
|
||||
{
|
||||
vForDataCount++;
|
||||
avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
|
||||
avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
|
||||
avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
|
||||
monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString();
|
||||
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
|
||||
monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString();
|
||||
monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
|
||||
double kwp = Convert.ToDouble(monthKWH) / Convert.ToDouble(monthGeneratingCapacity);
|
||||
avgKWHKWP = Checknull(Math.Round(kwp, 2).ToString());
|
||||
}
|
||||
|
||||
avghour = (Convert.ToDouble(dbody["tothour"].ToString()) + Convert.ToDouble(avghour)).ToString();
|
||||
avgKWHKWP = (Convert.ToDouble(dbody["KWHKWP"].ToString()) + Convert.ToDouble(avgKWHKWP)).ToString();
|
||||
avgdayKWH = (Convert.ToDouble(dbody["dayKWH"].ToString()) + Convert.ToDouble(avgdayKWH)).ToString();
|
||||
monthKWH = dbody["monthKWH"] == null ? "0" : dbody["monthKWH"].ToString();
|
||||
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
|
||||
monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString();
|
||||
monthGeneratingCapacity = Checknull(Math.Round(Convert.ToDouble(dbody["GeneratingCapacity"]), 2).ToString());
|
||||
if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用
|
||||
{
|
||||
check_hire = true;
|
||||
@ -1407,7 +1456,7 @@ namespace SolarPower.Controllers
|
||||
#region 顯示總量//RowPosition = body + 2
|
||||
RowPosition += 2;//空兩行
|
||||
index = 0;
|
||||
var Useday = Formbody.Result.Data.Count;
|
||||
var Useday = (Formbody.Result.Data.Count - 1);//最後一筆為總計,故減1
|
||||
row = sheet.CreateRow(RowPosition);
|
||||
|
||||
//cell = row.CreateCell(index);
|
||||
@ -1484,7 +1533,7 @@ namespace SolarPower.Controllers
|
||||
if (Formhead.Result.Data.ShowMoney == 1)
|
||||
{
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 3));
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoney) / Convert.ToDouble(monthGeneratingCapacity), 2));
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
@ -1492,7 +1541,7 @@ namespace SolarPower.Controllers
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 4));
|
||||
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2));
|
||||
cell.CellStyle = styleLine12;
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
@ -1591,7 +1640,9 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename));
|
||||
}
|
||||
string companyName = postObject.PowerStation[0].Name;
|
||||
int powerStationId = int.Parse(postObject.PowerStation[0].Value);
|
||||
var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId);
|
||||
string companyName = getCompany.Result;
|
||||
var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, companyName + "_" + name + "報表" + "_" + postObject.Userid + Datename + ".xlsx");
|
||||
FileStream FS = new FileStream(n, FileMode.Create, FileAccess.Write);
|
||||
workbook.Write(FS);
|
||||
@ -1732,7 +1783,7 @@ namespace SolarPower.Controllers
|
||||
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(form.AvgKWHKWP, 2));//日均發電度數
|
||||
cell.SetCellValue(Math.Round((form.Kwh/form.GeneratingCapacity), 2));//日均發電度數
|
||||
cell.CellStyle = styleLine12;
|
||||
|
||||
index++;
|
||||
@ -1797,7 +1848,7 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
City = form.CityName,
|
||||
Count = 1,
|
||||
Kwh = form.TotalKWH,
|
||||
Kwh = form.Kwh,
|
||||
SolarHour = form.SolarHour,
|
||||
Kwhkwp = form.AvgKWHKWP,
|
||||
GeneratingCapacity = form.GeneratingCapacity
|
||||
@ -1829,7 +1880,7 @@ namespace SolarPower.Controllers
|
||||
"電站類型",
|
||||
"掛錶日期",
|
||||
"躉售費率",
|
||||
"每kw日均獲利",
|
||||
"日均獲利",
|
||||
"日均發電度數",
|
||||
"發電量",
|
||||
//"平均日照",
|
||||
@ -1879,7 +1930,7 @@ namespace SolarPower.Controllers
|
||||
|
||||
index++;
|
||||
cell = row.CreateCell(index);
|
||||
cell.SetCellValue(Math.Round(cityArray.Kwh, 3));
|
||||
cell.SetCellValue(Math.Round(cityArray.Kwh, 2));
|
||||
cell.CellStyle = styleLine12;
|
||||
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
||||
sheet.AddMergedRegion(region);
|
||||
@ -2017,7 +2068,9 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
AllowClose = false
|
||||
};
|
||||
string companyName = postObject.PowerStation[0].Name;
|
||||
int powerStationId = int.Parse(postObject.PowerStation[0].Value);
|
||||
var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId);
|
||||
string companyName = getCompany.Result;
|
||||
workbook.Write(ms);
|
||||
ms.Flush();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
@ -2236,7 +2289,7 @@ namespace SolarPower.Controllers
|
||||
"電站類型",
|
||||
"掛錶日期",
|
||||
"躉售費率",
|
||||
"每kw日均獲利",
|
||||
"日均獲利",
|
||||
"日均發電度數",
|
||||
"發電量",
|
||||
//"平均日照",
|
||||
@ -2428,7 +2481,9 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename));
|
||||
}
|
||||
string companyName = postObject.PowerStation[0].Name;
|
||||
int powerStationId = int.Parse(postObject.PowerStation[0].Value);
|
||||
var getCompany = stationReportRepository.GetCompanyNameByPowerStationId(powerStationId);
|
||||
string companyName = getCompany.Result;
|
||||
var n = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "report", Datename, companyName + "_" + "綜合比較" + "_" + postObject.Userid + Datename + ".xlsx");
|
||||
FileStream FS = new FileStream(n, FileMode.Create, FileAccess.Write);
|
||||
workbook.Write(FS);
|
||||
|
||||
@ -204,6 +204,8 @@ namespace SolarPower.Models
|
||||
/// </summary>
|
||||
public double IrrDay { get; set; }
|
||||
public double IrrDayHour { get; set; }
|
||||
public double GeneratingCapacity { get; set; }
|
||||
public int days { get; set; }
|
||||
}
|
||||
|
||||
public class ExceptionEmailInfo
|
||||
|
||||
@ -442,6 +442,8 @@ namespace SolarPower.Models.PowerStation
|
||||
public string InstallDate { get { return Convert.ToDateTime(installDate).ToString("yyyy-MM-dd"); } set { installDate = value; } } //安裝日期
|
||||
public string BrandNum { get; set; }//廠商序號
|
||||
public string WarrantyDate { get { return Convert.ToDateTime(warrantyDate).ToString("yyyy-MM-dd"); } set { warrantyDate = value; } } //保固日期
|
||||
public int SensorTypeId { get; set; }
|
||||
public int SensorTypeDetailId { get; set; }
|
||||
}
|
||||
|
||||
public class Device : DeviceInfo
|
||||
@ -627,7 +629,22 @@ namespace SolarPower.Models.PowerStation
|
||||
public string EnabledName { get; set; }
|
||||
public string StatusName { get; set; }
|
||||
public string PyrheliometerName { get; set; }
|
||||
public int InverterStatus { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Master底下的逆變器資料表
|
||||
/// </summary>
|
||||
public class InverterForMaster
|
||||
{
|
||||
public string DBName { get; set; }//資料庫名稱
|
||||
public string InverterId { get; set; }//逆變器id
|
||||
public int Deleted { get; set; }//是否刪除
|
||||
public int Enabled { get; set; }//是否啟用
|
||||
public int Status { get; set; }//狀態
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下拉式選單用
|
||||
/// </summary>
|
||||
|
||||
@ -53,7 +53,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
logger.LogInformation("【CalcPowerStationJob】【開始取得電站資料】");
|
||||
var powerStations = await powerStationRepository.GetAllAsync();
|
||||
logger.LogInformation("【CalcPowerStationJob】【取得成功電站資料】");
|
||||
logger.LogInformation("【CalcPowerStationJob】【電站資料】 - {0}", System.Text.Json.JsonSerializer.Serialize(powerStations));
|
||||
logger.LogInformation("【CalcPowerStationJob】【電站資料");
|
||||
#endregion
|
||||
|
||||
List<PowerStationHistory> powerStationHistoriesHour = new List<PowerStationHistory>();
|
||||
@ -269,7 +269,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
#endregion
|
||||
|
||||
#region 計算單一電站每小時發電量、發電金額等資料 for calcPowerStation
|
||||
var dateTimeforPowerStation = DateTime.Now.ToString("yyyy-MM-dd");//取當天
|
||||
var dateTimeforPowerStation = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd");//取當天
|
||||
logger.LogInformation("【CalcPowerStationJob】【開始取得電站[{0}]在{1}的每小時歷史資料 for calcPowerStation】", powerStation.Code, dateTimeforPowerStation);
|
||||
var history_for_powerStation = await powerStationRepository.GetPowerStationHistoryPerHourForPowerStation(dateTimeforPowerStation, full_table_name);
|
||||
if (history_for_powerStation == null)
|
||||
@ -608,14 +608,31 @@ namespace SolarPower.Quartz.Jobs
|
||||
sensorHistory.IrrDay = TPYHistory.IrrDay;
|
||||
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的累計日照量的平均值】", powerStation.Code, dateTime);
|
||||
logger.LogInformation("【CalcPowerStationJob】【開始計算電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
|
||||
var ss = await powerStationRepository.CalcIrrDayHourHistoryPerHour(dateTime, powerStation.Id);
|
||||
if (ss != null)
|
||||
var twoHourAgoIrrDay = await powerStationRepository.CalcIrrDayHistoryPerTwoHour(dateTime, powerStation.Id);
|
||||
if (twoHourAgoIrrDay != null)
|
||||
{
|
||||
sensorHistory.IrrDayHour = double.Parse(ss);
|
||||
|
||||
if (DateTimeNow.AddHours(-1).Hour == 0)//半夜12點的值
|
||||
{
|
||||
sensorHistory.IrrDayHour = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sensorHistory.IrrDayHour = sensorHistory.IrrDay - double.Parse(twoHourAgoIrrDay);// 前一小時的IrrDay - 前兩小時的IrrDay
|
||||
}
|
||||
logger.LogInformation("【CalcPowerStationJob】【計算完成電站[{0}]在{1}的相減的累計日照量】", powerStation.Code, dateTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
sensorHistory.IrrDayHour = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sensorHistory.IrrDay = 0;
|
||||
sensorHistory.IrrDayHour = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -1073,98 +1090,5 @@ namespace SolarPower.Quartz.Jobs
|
||||
}
|
||||
}
|
||||
|
||||
public async Task setHistoryPerHourForPowerStation(string dateTime, string full_table_name, PowerStation powerStation)
|
||||
{
|
||||
var calcPowerStation = new PowerStation();
|
||||
calcPowerStation.Id = powerStation.Id;
|
||||
var history_for_powerStation = await powerStationRepository.GetPowerStationHistoryPerHourForPowerStation(dateTime, full_table_name);
|
||||
if (history_for_powerStation == null)
|
||||
{
|
||||
//logger.LogWarning("【CalcPowerStationJob】【查無電站[{0}]在{1}的每小時歷史資料】", powerStation.Code, dateTime);
|
||||
//每小時發電量(直接填寫
|
||||
calcPowerStation.kwh = 0;
|
||||
//今日發電量(直接填寫
|
||||
calcPowerStation.Today_kWh = 0;
|
||||
//總發電量(直接填寫
|
||||
calcPowerStation.Total_kWh = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//每小時發電量(直接填寫
|
||||
calcPowerStation.kwh = history_for_powerStation.KWH;
|
||||
//今日發電量(直接填寫
|
||||
calcPowerStation.Today_kWh = history_for_powerStation.TodayKWh;
|
||||
//總發電量(直接填寫
|
||||
calcPowerStation.Total_kWh = history_for_powerStation.TotalKWH;
|
||||
|
||||
#region 發電金額
|
||||
|
||||
history_for_powerStation.MONEY = history_for_powerStation.KWH * powerStation.PowerRate;
|
||||
history_for_powerStation.TODAYMONEY = history_for_powerStation.TodayKWh * powerStation.PowerRate;
|
||||
history_for_powerStation.TOTALMONEY = history_for_powerStation.TotalKWH * powerStation.PowerRate;
|
||||
|
||||
//即時發電金額
|
||||
switch (powerStation.SolarType)
|
||||
{
|
||||
case (int)SolarTypeEnum.SelfSold: //自建躉售
|
||||
|
||||
//今日發電金額 計算方式:todaykWh * 授電費率
|
||||
calcPowerStation.Today_Money = history_for_powerStation.TodayKWh * powerStation.PowerRate;
|
||||
|
||||
////總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = history_for_powerStation.TotalKWH * powerStation.PowerRate;
|
||||
break;
|
||||
case (int)SolarTypeEnum.HireSold: //租建躉售
|
||||
//找出該電站的所有土地房屋資訊
|
||||
var landBuildings = await powerStationRepository.GetAllLandBuildingInfoByPowerStationId(powerStation.Id, powerStation.SiteDB);
|
||||
var sumLeaseRate = 0.00;
|
||||
var avgLeaseRate = 0.00;
|
||||
|
||||
foreach (var landBuilding in landBuildings)
|
||||
{
|
||||
sumLeaseRate += landBuilding.LeaseRate;
|
||||
}
|
||||
|
||||
calcPowerStation.Today_Money = history_for_powerStation.TodayKWh * powerStation.PowerRate * sumLeaseRate / 100;
|
||||
calcPowerStation.Total_Money = history_for_powerStation.TotalKWH * powerStation.PowerRate * sumLeaseRate / 100;
|
||||
|
||||
break;
|
||||
case (int)SolarTypeEnum.SelfUse: //自建自用
|
||||
|
||||
//今日發電金額 計算方式:todaykWh * 授電費率
|
||||
calcPowerStation.Today_Money = history_for_powerStation.TodayKWh * powerStation.PowerRate;
|
||||
|
||||
//總發電金額 計算方式:totalkWh * 授電費率
|
||||
calcPowerStation.Total_Money = history_for_powerStation.TotalKWH * powerStation.PowerRate;
|
||||
break;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PR
|
||||
//直接填寫
|
||||
calcPowerStation.Today_PR = history_for_powerStation.PR;
|
||||
#endregion
|
||||
|
||||
#region 減碳量
|
||||
carbonRate = Convert.ToDouble(await powerStationRepository.GetOneVariableByName("CarbonRate"));
|
||||
|
||||
history_for_powerStation.CARBON = history_for_powerStation.KWH * carbonRate;
|
||||
history_for_powerStation.TODAYCARBON = history_for_powerStation.TodayKWh * carbonRate;
|
||||
history_for_powerStation.TOTALCARBON = history_for_powerStation.TotalKWH * carbonRate;
|
||||
|
||||
//今日減碳量( 今日發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Today_Carbon = history_for_powerStation.TodayKWh * carbonRate;
|
||||
|
||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||
calcPowerStation.Total_Carbon = history_for_powerStation.TotalKWH * carbonRate;
|
||||
|
||||
#endregion
|
||||
|
||||
#region 發電時間
|
||||
calcPowerStation.SolarHour = history_for_powerStation.SolarHour;
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SolarPower.Quartz.Jobs
|
||||
{
|
||||
@ -249,27 +250,30 @@ namespace SolarPower.Quartz.Jobs
|
||||
var stationReportName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(dayexcel, Formatting.Indented));
|
||||
if (stationReportName != "")
|
||||
{
|
||||
NoticeSchedule DaySchedule = new NoticeSchedule()
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
UserId = user.Id,
|
||||
EmailType = 0,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "日報表",
|
||||
Attachment = stationReportName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Attachment",
|
||||
"RecipientName",
|
||||
"Type"
|
||||
};
|
||||
await noticeScheduleRepository.AddOneAsync(DaySchedule, properties);
|
||||
NoticeSchedule DaySchedule = new NoticeSchedule()
|
||||
{
|
||||
UserId = user.Id,
|
||||
EmailType = 0,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "日報表",
|
||||
Attachment = stationReportName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Attachment",
|
||||
"RecipientName",
|
||||
"Type"
|
||||
};
|
||||
await noticeScheduleRepository.AddOneAsync(DaySchedule, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
//綜合報表 每日
|
||||
@ -284,17 +288,19 @@ namespace SolarPower.Quartz.Jobs
|
||||
Userid = user.Id
|
||||
};
|
||||
var stationMaxReportName = stationReportController.ExportExcelmaxtableBackDownload(JsonConvert.SerializeObject(maxdayexcel, Formatting.Indented));
|
||||
NoticeSchedule MaxSchedule = new NoticeSchedule()
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
UserId = user.Id,
|
||||
EmailType = 2,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "綜合報表",
|
||||
Attachment = stationMaxReportName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
NoticeSchedule MaxSchedule = new NoticeSchedule()
|
||||
{
|
||||
UserId = user.Id,
|
||||
EmailType = 2,
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "綜合報表",
|
||||
Attachment = stationMaxReportName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
@ -304,7 +310,8 @@ namespace SolarPower.Quartz.Jobs
|
||||
"RecipientName",
|
||||
"Type"
|
||||
};
|
||||
await noticeScheduleRepository.AddOneAsync(MaxSchedule, properties);
|
||||
await noticeScheduleRepository.AddOneAsync(MaxSchedule, properties);
|
||||
}
|
||||
|
||||
if (DateTime.Now.ToString("dd") == "01")
|
||||
{
|
||||
@ -317,27 +324,30 @@ namespace SolarPower.Quartz.Jobs
|
||||
Userid = user.Id
|
||||
};
|
||||
var stationReportmaxmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(maxmonthexcel, Formatting.Indented));
|
||||
NoticeSchedule MaxmonthSchedule = new NoticeSchedule()
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "綜合報表",
|
||||
Attachment = stationReportmaxmonthName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1,
|
||||
UserId = user.Id,
|
||||
EmailType = 2
|
||||
};
|
||||
List<string> properties2 = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Attachment",
|
||||
"RecipientName",
|
||||
"Type"
|
||||
};
|
||||
await noticeScheduleRepository.AddOneAsync(MaxmonthSchedule, properties2);
|
||||
NoticeSchedule MaxmonthSchedule = new NoticeSchedule()
|
||||
{
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "綜合報表",
|
||||
Attachment = stationReportmaxmonthName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1,
|
||||
UserId = user.Id,
|
||||
EmailType = 2
|
||||
};
|
||||
List<string> properties2 = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Attachment",
|
||||
"RecipientName",
|
||||
"Type"
|
||||
};
|
||||
await noticeScheduleRepository.AddOneAsync(MaxmonthSchedule, properties2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -360,27 +370,30 @@ namespace SolarPower.Quartz.Jobs
|
||||
var stationReportmonthName = stationReportController.ExportExcelBackDownload(JsonConvert.SerializeObject(monthexcel, Formatting.Indented));
|
||||
if (stationReportmonthName != "")
|
||||
{
|
||||
NoticeSchedule MonthSchedule = new NoticeSchedule()
|
||||
if (user.Email != null && IsValidEmail(user.Email))
|
||||
{
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "月報表",
|
||||
Attachment = stationReportmonthName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1,
|
||||
UserId = user.Id,
|
||||
EmailType = 1
|
||||
};
|
||||
List<string> properties2 = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Attachment",
|
||||
"RecipientName",
|
||||
"Type"
|
||||
};
|
||||
await noticeScheduleRepository.AddOneAsync(MonthSchedule, properties2);
|
||||
NoticeSchedule MonthSchedule = new NoticeSchedule()
|
||||
{
|
||||
RecipientEmail = user.Email,
|
||||
Subject = "月報表",
|
||||
Attachment = stationReportmonthName,
|
||||
RecipientName = user.Name,
|
||||
Type = 1,
|
||||
UserId = user.Id,
|
||||
EmailType = 1
|
||||
};
|
||||
List<string> properties2 = new List<string>()
|
||||
{
|
||||
"UserId",
|
||||
"EmailType",
|
||||
"RecipientEmail",
|
||||
"Subject",
|
||||
"Attachment",
|
||||
"RecipientName",
|
||||
"Type"
|
||||
};
|
||||
await noticeScheduleRepository.AddOneAsync(MonthSchedule, properties2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -437,5 +450,11 @@ namespace SolarPower.Quartz.Jobs
|
||||
return tempSerialNumber.ToString().Trim().PadRight(pad, '0');
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValidEmail(string strIn)
|
||||
{
|
||||
// Return true if strIn is in valid e-mail format.
|
||||
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SolarPower.Quartz.Jobs
|
||||
{
|
||||
@ -43,46 +44,48 @@ namespace SolarPower.Quartz.Jobs
|
||||
var updateNoticeSchedules = new List<NoticeSchedule>();
|
||||
foreach (var notice in noticeSchedules)
|
||||
{
|
||||
var attachments = new List<string>();
|
||||
var recipientEmails = new List<string>()
|
||||
{
|
||||
notice.RecipientEmail
|
||||
};
|
||||
if (!string.IsNullOrEmpty(notice.Attachment))
|
||||
{
|
||||
attachments = notice.Attachment.Split(',').ToList();
|
||||
if (notice.RecipientEmail != null && IsValidEmail(notice.RecipientEmail)) {
|
||||
var attachments = new List<string>();
|
||||
var recipientEmails = new List<string>()
|
||||
{
|
||||
notice.RecipientEmail
|
||||
};
|
||||
if (!string.IsNullOrEmpty(notice.Attachment))
|
||||
{
|
||||
attachments = notice.Attachment.Split(',').ToList();
|
||||
}
|
||||
|
||||
var result = Send(recipientEmails, notice.Subject, notice.Content, attachments);
|
||||
|
||||
if (result.CompareTo("成功") == 0)
|
||||
{
|
||||
NoticeSchedule noticeSchedule = new NoticeSchedule();
|
||||
noticeSchedule.Id = notice.Id;
|
||||
noticeSchedule.IsDelivery = 1;
|
||||
noticeSchedule.DeliveryAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
updateNoticeSchedules.Add(noticeSchedule);
|
||||
}
|
||||
else
|
||||
{
|
||||
NoticeSchedule noticeSchedule = new NoticeSchedule();
|
||||
noticeSchedule.Id = notice.Id;
|
||||
noticeSchedule.IsDelivery = 2;
|
||||
noticeSchedule.DeliveryAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
noticeSchedule.Reason = result;
|
||||
|
||||
updateNoticeSchedules.Add(noticeSchedule);
|
||||
}
|
||||
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"Id",
|
||||
"IsDelivery",
|
||||
"DeliveryAt"
|
||||
};
|
||||
|
||||
await noticeScheduleRepository.UpdateList(updateNoticeSchedules, properties);
|
||||
}
|
||||
|
||||
var result = Send(recipientEmails, notice.Subject, notice.Content, attachments);
|
||||
|
||||
if (result.CompareTo("成功") == 0)
|
||||
{
|
||||
NoticeSchedule noticeSchedule = new NoticeSchedule();
|
||||
noticeSchedule.Id = notice.Id;
|
||||
noticeSchedule.IsDelivery = 1;
|
||||
noticeSchedule.DeliveryAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
updateNoticeSchedules.Add(noticeSchedule);
|
||||
}
|
||||
else
|
||||
{
|
||||
NoticeSchedule noticeSchedule = new NoticeSchedule();
|
||||
noticeSchedule.Id = notice.Id;
|
||||
noticeSchedule.IsDelivery = 2;
|
||||
noticeSchedule.DeliveryAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
noticeSchedule.Reason = result;
|
||||
|
||||
updateNoticeSchedules.Add(noticeSchedule);
|
||||
}
|
||||
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"Id",
|
||||
"IsDelivery",
|
||||
"DeliveryAt"
|
||||
};
|
||||
|
||||
await noticeScheduleRepository.UpdateList(updateNoticeSchedules, properties);
|
||||
}
|
||||
logger.LogInformation("【SendEmailJob】【任務完成】");
|
||||
|
||||
@ -160,5 +163,12 @@ namespace SolarPower.Quartz.Jobs
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool IsValidEmail(string strIn)
|
||||
{
|
||||
// Return true if strIn is in valid e-mail format.
|
||||
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SolarPower.Repository.Implement
|
||||
{
|
||||
@ -648,15 +649,20 @@ namespace SolarPower.Repository.Implement
|
||||
List<string> value = new List<string>();
|
||||
foreach (MyUser a in personal)
|
||||
{
|
||||
value.Add($@"(1,'{a.Name}','{a.Email}','{Title}','{content}',{a.Id}, {emailType})");
|
||||
if (a.Email != null && IsValidEmail(a.Email))
|
||||
{
|
||||
value.Add($@"(1,'{a.Name}','{a.Email}','{Title}','{content}',{a.Id}, {emailType})");
|
||||
}
|
||||
}
|
||||
string values = string.Join(",", value.ToArray());
|
||||
if (value.Count > 0)
|
||||
{
|
||||
var sql = $"INSERT INTO `notice_schedule` (`Type`, `RecipientName`, `RecipientEmail`, `Subject`, `Content`,`UserId`,`EmailType`) VALUES {values};";
|
||||
|
||||
var sql = $"INSERT INTO `notice_schedule` (`Type`, `RecipientName`, `RecipientEmail`, `Subject`, `Content`,`UserId`,`EmailType`) VALUES {values};";
|
||||
|
||||
await conn.ExecuteAsync(sql, trans);
|
||||
|
||||
trans.Commit();
|
||||
await conn.ExecuteAsync(sql, trans);
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@ -797,5 +803,11 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
|
||||
bool IsValidEmail(string strIn)
|
||||
{
|
||||
// Return true if strIn is in valid e-mail format.
|
||||
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -731,12 +731,18 @@ namespace SolarPower.Repository.Implement
|
||||
// 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 ,
|
||||
ifnull(avg( P.IrrDay), 0) irrDay, avg(P.Temperature) AS Temp
|
||||
FROM power_station_history_month C
|
||||
LEFT JOIN sensor_history_month P ON DATE_FORMAT(P.TIMESTAMP, '%Y') = DATE_FORMAT(C.TIMESTAMP, '%Y') AND P.PowerStationId = C.PowerStationId
|
||||
WHERE C.PowerStationId = {post.PowerstationId}
|
||||
group by left(c.`TIMESTAMP`, 4) ";
|
||||
sql = $@"select * from (
|
||||
select left(c.`TIMESTAMP`, 4) AS `TIMESTAMP`, sum(monthKWH) AS KWH, round(AVG(PR), 2) AS PR , round(AVG(PR), 2) AS avgPR ,
|
||||
ifnull(avg( P.IrrDay), 0) irrDay, avg(P.Temperature) AS Temp, ps.GeneratingCapacity AS GeneratingCapacity
|
||||
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
|
||||
LEFT JOIN power_station ps ON ps.id = C.PowerStationId
|
||||
WHERE C.PowerStationId = {post.PowerstationId}
|
||||
group by left(c.`TIMESTAMP`, 4)
|
||||
)x join
|
||||
(
|
||||
select year(timestamp) yyyy, count(*) days from sensor_history_day where PowerStationId = {post.PowerstationId} group by year(timestamp)
|
||||
)y on x.`TIMESTAMP` = y.yyyy";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1018,6 +1018,10 @@ namespace SolarPower.Repository.Implement
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
string getSensorTypeId = $@"SELECT id from sensor_type
|
||||
WHERE SensorEName = '{DeviceInfo.Type}' AND Deleted = 0";
|
||||
DeviceInfo.SensorTypeId = await conn.QueryFirstOrDefaultAsync<int>(getSensorTypeId);
|
||||
DeviceInfo.SensorTypeDetailId = DeviceInfo.SensorTypeId;
|
||||
|
||||
string sql = GenerateInsertQueryWithCustomDBNameAndTable(properties, db_name, "device");
|
||||
await conn.ExecuteAsync(sql, DeviceInfo);
|
||||
@ -1050,6 +1054,11 @@ namespace SolarPower.Repository.Implement
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
string getSensorTypeId = $@"SELECT id from sensor_type
|
||||
WHERE SensorEName = '{DeviceInfo.Type}' AND Deleted = 0";
|
||||
DeviceInfo.SensorTypeId = await conn.QueryFirstOrDefaultAsync<int>(getSensorTypeId);
|
||||
DeviceInfo.SensorTypeDetailId = DeviceInfo.SensorTypeId;
|
||||
|
||||
var updateQuery = GenerateUpdateQueryWithCustomDBNameAndTable(properties, db_name, "device");
|
||||
await conn.ExecuteAsync(updateQuery.ToString(), DeviceInfo, trans);
|
||||
trans.Commit();
|
||||
@ -1906,6 +1915,34 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在master.inv_status資料表中 新增逆變器
|
||||
/// </summary>
|
||||
/// <param name="inverter"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
public async Task AddMasterInverter(InverterForMaster inverter, List<string> properties)
|
||||
{
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
int count;
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
var sql = GenerateInsertQueryWithCustomTable(properties, "inv_status");
|
||||
count = await conn.ExecuteAsync(sql, inverter);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得控制器所有id
|
||||
/// </summary>
|
||||
@ -1980,11 +2017,12 @@ namespace SolarPower.Repository.Implement
|
||||
try
|
||||
{
|
||||
string sql = @$"SELECT
|
||||
inv.*, con.ControllerId AS ControllerName,user.Name As CreatedName,de.UID AS PyrheliometerName
|
||||
inv.*, con.ControllerId AS ControllerName,user.Name As CreatedName,de.UID AS PyrheliometerName, invs.status AS InverterStatus
|
||||
FROM {db_name}.inverter inv
|
||||
LEFT JOIN {db_name}.controller con ON inv.ControllerId = con.id
|
||||
LEFT JOIN user ON inv.CreatedBy = user.id
|
||||
LEFT JOIN {db_name}.device de ON inv.Pyrheliometer = de.id
|
||||
LEFT JOIN inv_status invs ON inv.InverterId = invs.InverterId
|
||||
WHERE inv.Deleted = 0 AND inv.ControllerId IN @Controllerid";
|
||||
inverterTable = (await conn.QueryAsync<InverterTable>(sql, new { Controllerid = controllerid }, commandTimeout: 600)).ToList();
|
||||
|
||||
@ -2001,6 +2039,39 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取單一逆變器
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="db_name"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<InverterTable> GetOneMasterInverter(int id, string db_name)
|
||||
{
|
||||
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
InverterTable inverter = new InverterTable();
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
string sql = $@"SELECT a.InverterId
|
||||
FROM solar_master.inv_status a join {db_name}.inverter b on a.inverterid = b.inverterid
|
||||
WHERE a.Deleted = 0 AND b.Id = {id}";
|
||||
inverter = (await conn.QueryFirstOrDefaultAsync<InverterTable>(sql, commandTimeout: 600));
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
return inverter;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 其餘電站列表
|
||||
/// </summary>
|
||||
@ -2558,41 +2629,75 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
|
||||
//public virtual async Task DeleteOneInverter(int id, string db_name, string table_name)
|
||||
//{
|
||||
// using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
// {
|
||||
// conn.Open();
|
||||
// using (var trans = conn.BeginTransaction())
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var sql = $"UPDATE {db_name}.{table_name} SET Deleted = 1 WHERE Id = @Id";
|
||||
public async Task<int> UpdateMasterInverter(InverterForMaster entity, List<string> properties)
|
||||
{
|
||||
int count;
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
conn.Open();
|
||||
using (var trans = conn.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = $@"UPDATE solar_master.inv_status a join {entity.DBName}.inverter b on a.inverterid = b.inverterid
|
||||
SET
|
||||
a.Enabled = {entity.Enabled},
|
||||
a.Status = {entity.Status}
|
||||
WHERE b.id = {entity.Id}";
|
||||
|
||||
// await conn.ExecuteAsync(sql, new { Id = id }, trans);
|
||||
count = await conn.ExecuteAsync(sql, entity, trans);
|
||||
|
||||
// string updateToInv_Status = @"DROP TABLE IF EXISTS solar_master.`inv_status`;
|
||||
// create table solar_master.inv_status
|
||||
// select * from solar_master.v_company_inv
|
||||
// where enabled = 1;
|
||||
// ALTER TABLE solar_master.`inv_status` ADD INDEX inv_status_index (`inverterid`);";
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
trans.Rollback();
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// await conn.ExecuteAsync(updateToInv_Status, new { Id = id }, trans);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
// trans.Commit();
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// trans.Rollback();
|
||||
// throw exception;
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// conn.Close();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// 透過table_name、inverterId,軟刪除指定資料表的單一筆inverter
|
||||
/// </summary>
|
||||
/// <param name="inverterId"></param>
|
||||
/// <param name="table_name"></param>
|
||||
/// <returns></returns>
|
||||
public async Task DeleteOneMasterInverter(string inverterId, string table_name)
|
||||
{
|
||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
{
|
||||
conn.Open();
|
||||
using (var trans = conn.BeginTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
var sql = $"UPDATE {table_name} SET Deleted = 1 WHERE InverterId = {inverterId}";
|
||||
|
||||
await conn.ExecuteAsync(sql, trans);
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
trans.Rollback();
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<DeviceInfo>> GetListPyrheliometerByPowerStationId(int powerStationId, string db_name)
|
||||
{
|
||||
@ -6447,36 +6552,21 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> CalcIrrDayHourHistoryPerHour(string dateTime, int powerStationId)
|
||||
public async Task<string> CalcIrrDayHistoryPerTwoHour(string dateTime, int powerStationId)
|
||||
{
|
||||
string result;
|
||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||
{
|
||||
try
|
||||
{
|
||||
//var sql = $@"update sensor_history_hour a join
|
||||
// (
|
||||
// select powerstationID, `TIMESTAMP`, irrday -
|
||||
// (select irrday from sensor_history_hour where powerstationID = {powerStationId} and LEFT(`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(dateTime).AddHours(-1).ToString("yyyy-MM-dd HH")}' limit 1) irrdayhour
|
||||
// from sensor_history_hour z
|
||||
// where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(dateTime).ToString("yyyy-MM-dd HH")}'
|
||||
// ) b on a.powerstationID = b.powerstationID and a.`TIMESTAMP` = b.`TIMESTAMP`
|
||||
// Set a.irrdayhour = b.irrdayhour where a.powerstationID = {powerStationId}";
|
||||
string d1 = dateTime + ":00:00";
|
||||
//string sql = $@"update sensor_history_hour a join
|
||||
// (
|
||||
// select powerstationID, `TIMESTAMP`, irrday -
|
||||
// (select irrday from sensor_history_hour where powerstationID = {powerStationId} and LEFT(`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(d1).AddHours(-1).ToString("yyyy-MM-dd HH")}' limit 1) irrdayhour
|
||||
// from sensor_history_hour z
|
||||
// where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{dateTime}'
|
||||
// ) b on a.powerstationID = b.powerstationID and a.`TIMESTAMP` = b.`TIMESTAMP`
|
||||
// Set a.irrdayhour = case when b.irrdayhour < 0 then 0 else b.irrdayhour end
|
||||
// where a.powerstationID = {powerStationId}";
|
||||
//result = await conn.QueryFirstOrDefaultAsync<PyrheliometerHistory>(sql, commandTimeout: 600);
|
||||
string sql = $@" select irrday -
|
||||
(select irrday from sensor_history_hour where powerstationID = {powerStationId} and LEFT(`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(d1).AddHours(-1).ToString("yyyy-MM-dd HH")}' limit 1) irrdayhour
|
||||
//string sql = $@" select irrday -
|
||||
// (select irrday from sensor_history_hour where powerstationID = {powerStationId} and LEFT(`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(d1).AddHours(-1).ToString("yyyy-MM-dd HH")}' limit 1) irrdayhour
|
||||
// from sensor_history_hour z
|
||||
// where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{dateTime}' ";
|
||||
string sql = $@" select IrrDay
|
||||
from sensor_history_hour z
|
||||
where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{dateTime}' ";
|
||||
where powerstationID = {powerStationId} and LEFT(z.`TIMESTAMP`, 13 ) = '{Convert.ToDateTime(d1).AddHours(-1).ToString("yyyy-MM-dd HH")}' ";
|
||||
result = await conn.QueryFirstOrDefaultAsync<string>(sql, commandTimeout: 600);
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
||||
@ -114,9 +114,9 @@ namespace SolarPower.Repository.Implement
|
||||
select * from temp_inv
|
||||
union
|
||||
SELECT '總計' report_date, {inv}
|
||||
round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, round(avg(irrDay),2) irrDay, round(avg(irrDayHour),2) irrDayHour,
|
||||
round( avg(temperature), 2) temperature, round(sum(hourmoney), 2) hourmoney, round(avg(totKWH), 2) totKWH, round(avg(totKWHKWP),2) totKWHKWP, round(avg(totmoney),2) totmoney, '電站名稱' stationName,
|
||||
round( avg(daymoney), 2) daymoney, round(avg(tothour), 2) tothour, round(avg(pr), 2) pr, avg(GeneratingCapacity) GeneratingCapacity
|
||||
round(sum(hourKWH), 2) hourKWH, round(sum(hourKWHp), 2) hourKWHp, round(sum(irrDay),2) irrDay, round(sum(irrDayHour),2) irrDayHour,
|
||||
round( avg(temperature), 2) temperature, round(sum(hourmoney), 2) hourmoney, round(sum(totKWH), 2) totKWH, round(sum(totKWHKWP),2) totKWHKWP, round(sum(totmoney),2) totmoney, '電站名稱' stationName,
|
||||
round( sum(daymoney), 2) daymoney, round(sum(tothour), 2) tothour, round(sum(pr), 2) pr, avg(GeneratingCapacity) GeneratingCapacity
|
||||
from temp_inv2 a; ";
|
||||
|
||||
break;
|
||||
@ -166,7 +166,7 @@ namespace SolarPower.Repository.Implement
|
||||
SELECT '總計' report_date, {inv}
|
||||
round(sum(dayKWH), 2) dayKWH, round(sum(dayKWHp), 2) dayKWHp, round(max(tothour), 2) tothour, round(avg(KWHKWP), 2) KWHKWP, round(avg(PR), 2) PR,
|
||||
GeneratingCapacity, round(sum(irradiance), 2) irradiance, round(avg(temperature), 2) temperature, round(sum(soldmoney), 2) soldmoney,
|
||||
round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay
|
||||
round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, round(avg(IrrDay), 2) IrrDay
|
||||
from temp_inv2 a; ";
|
||||
}
|
||||
else
|
||||
@ -264,7 +264,7 @@ namespace SolarPower.Repository.Implement
|
||||
SELECT '總計' report_date, {inv}
|
||||
round(sum(dayKWH), 2) dayKWH, round(sum(dayKWHp), 2) dayKWHp, round(max(tothour), 2) tothour, avg(KWHKWP) KWHKWP, round(avg(PR), 2) PR,
|
||||
GeneratingCapacity, round(sum(irradiance), 2) irradiance, round(avg(temperature), 2) temperature, round(sum(soldmoney), 2) soldmoney,
|
||||
round( monthKWH,2) monthKWH , monthmoney, stationName, monthmoneyone, SolarType, SiteDB, round(IrrDay , 2) IrrDay
|
||||
round( monthKWH,2) monthKWH , monthmoney, stationName, monthmoneyone, SolarType, SiteDB, round(avg(IrrDay), 2) IrrDay
|
||||
from temp_inv2 a; ";
|
||||
}
|
||||
|
||||
@ -315,12 +315,24 @@ namespace SolarPower.Repository.Implement
|
||||
// EXECUTE stmt;
|
||||
// DEALLOCATE PREPARE stmt;";
|
||||
#endregion
|
||||
DateTime firstDay = new DateTime(int.Parse(post.Time), 01, 01);
|
||||
DateTime lastDay;
|
||||
if (DateTime.Now.Year == int.Parse(post.Time))
|
||||
{
|
||||
lastDay = DateTime.Now.Date;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastDay = new DateTime(int.Parse(post.Time), 12, 31);
|
||||
}
|
||||
string days = (lastDay - firstDay).TotalDays.ToString();
|
||||
|
||||
sql = @$" DROP TABLE IF EXISTS temp_inv;
|
||||
create TEMPORARY TABLE temp_inv as
|
||||
SELECT DATE_FORMAT(a.report_date,'%Y/%m') report_date, {inv}
|
||||
b.todayKWH 'dayKWH', round((b.todayKWH / c.monthKWH)*100,2) 'dayKWHp', b.SOLARHOUR 'tothour', b.KWHKWP 'KWHKWP', b.PR,z.GeneratingCapacity,
|
||||
d.irradiance 'irradiance', d.Temperature 'temperature', b.money 'soldmoney',
|
||||
c.monthKWH 'monthKWH', c.money 'monthmoney', stationName, powerRate 'monthmoneyone',SolarType,SiteDB, d.IrrDay
|
||||
c.monthKWH 'monthKWH', c.money 'monthmoney', stationName, powerRate 'monthmoneyone',SolarType,SiteDB, d.IrrDay, {days} Days
|
||||
FROM report_invday a left join
|
||||
( # 每日加總 inv
|
||||
select powerStationid, DATE_FORMAT(TIMESTAMP,'%Y-%m') report_date, siteid, sitetype,
|
||||
@ -358,7 +370,7 @@ namespace SolarPower.Repository.Implement
|
||||
SELECT '總計' report_date, {inv}
|
||||
round(sum(dayKWH), 2) dayKWH, round(sum(dayKWHp), 2) dayKWHp, round(max(tothour), 2) tothour, avg(KWHKWP) KWHKWP, round(avg(PR), 2) PR,
|
||||
GeneratingCapacity, round(sum(irradiance), 2) irradiance, avg(temperature) temperature, round(sum(soldmoney), 2) soldmoney,
|
||||
round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, IrrDay
|
||||
round(monthKWH, 2) monthKWH, monthmoney, stationName, monthmoneyone, SolarType, SiteDB, round(avg(IrrDay), 2) IrrDay, 0
|
||||
from temp_inv2 a; ";
|
||||
break;
|
||||
|
||||
@ -805,5 +817,35 @@ namespace SolarPower.Repository.Implement
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> GetCompanyNameByPowerStationId(int powerStationId)
|
||||
{
|
||||
string result;
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
var sql = @$"SELECT c.Name
|
||||
FROM power_station ps
|
||||
LEFT JOIN company c ON ps.CompanyId = c.id
|
||||
WHERE ps.id = {powerStationId} AND ps.Deleted = 0";
|
||||
|
||||
result = await conn.QueryFirstOrDefaultAsync<string>(sql);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,6 +399,13 @@ namespace SolarPower.Repository.Interface
|
||||
/// <returns></returns>
|
||||
Task AddInverter(Inverter inverter, List<string> properties, string db_name);
|
||||
/// <summary>
|
||||
/// 新增Master逆變器
|
||||
/// </summary>
|
||||
/// <param name="inverter"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
Task AddMasterInverter(InverterForMaster inverter, List<string> properties);
|
||||
/// <summary>
|
||||
/// 取得控制器所有id
|
||||
/// </summary>
|
||||
Task<List<int>> GetAllDeviceControllerId(int stationId, string db_name);
|
||||
@ -539,6 +546,8 @@ namespace SolarPower.Repository.Interface
|
||||
Task<int> UpdatePyrheliometerHistoryMonthList(List<PyrheliometerHistory> entity);
|
||||
|
||||
Task<int> UpdateInverter(Inverter entity, List<string> properties, string db_name);
|
||||
Task<int> UpdateMasterInverter(InverterForMaster entity, List<string> properties);
|
||||
Task DeleteOneMasterInverter(string inverterId, string table_name);
|
||||
|
||||
Task<A> Getonediv<A>(string where, string db_name, string table_name);
|
||||
|
||||
@ -632,7 +641,8 @@ namespace SolarPower.Repository.Interface
|
||||
Task AlertColStationTableColumn(string dbname, string code);
|
||||
|
||||
Task<List<PowerStation>> GetAllNoStatusAsync();
|
||||
Task<string> CalcIrrDayHourHistoryPerHour(string dateTime, int powerStationId);
|
||||
Task<string> CalcIrrDayHistoryPerTwoHour(string dateTime, int powerStationId);
|
||||
Task<PowerStationHistory> GetPowerStationHistoryPerHourForPowerStation(string dateTime, string table_name);
|
||||
Task<InverterTable> GetOneMasterInverter(int id, string db_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,5 +14,6 @@ namespace SolarPower.Repository.Interface
|
||||
Task<List<MaxFormbody>> GetMaxtablebody(Select_table2 post);
|
||||
Task<dynamic> Findhaveinv(Select_table post);
|
||||
Task<int> CheckExcelAsync(Select_table post);
|
||||
Task<string> GetCompanyNameByPowerStationId(int powerStationId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,16 +4,8 @@
|
||||
ViewData["Title"] = "逆變器交叉分析";
|
||||
}
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -6,16 +6,8 @@
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -4,16 +4,8 @@
|
||||
ViewData["Title"] = "電站交叉分析";
|
||||
}
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -19,16 +19,8 @@
|
||||
</div>
|
||||
<!-- Your main content goes below here: -->
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@ -6,16 +6,8 @@
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -12,16 +12,8 @@
|
||||
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
|
||||
</ol>
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@ -25,20 +25,8 @@
|
||||
<!-- icheck bootstrap -->
|
||||
<link href="~/lib/icheck-bootstrap/icheck-bootstrap.min.css" rel="stylesheet" />
|
||||
<!-- Theme style -->
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="loadEffect" id="loading" style="top: 50%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
|
||||
<div class="blankpage-form-field">
|
||||
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4">
|
||||
@ -52,31 +40,31 @@
|
||||
{
|
||||
<p class="alert alert-danger">@ViewBag.ErrMsg</p>
|
||||
}
|
||||
<form id="login-form" asp-action="Index" method="post">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="username">帳號</label>
|
||||
<input asp-for="Account" type="text" id="account" class="form-control" placeholder="Account">
|
||||
<span asp-validation-for="Account" class="text-danger"></span>
|
||||
<span class="help-block">
|
||||
您的帳號
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="password">密碼</label>
|
||||
<input asp-for="Password" type="password" id="password" class="form-control" placeholder="Password" autocomplete="off">
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
<span class="help-block">
|
||||
您的密碼
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group text-left">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="rememberme">
|
||||
<label class="custom-control-label" for="rememberme"> 記住我</label>
|
||||
<form id="login-form" asp-action="Index" method="post">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="username">帳號</label>
|
||||
<input asp-for="Account" type="text" id="account" class="form-control" placeholder="Account">
|
||||
<span asp-validation-for="Account" class="text-danger"></span>
|
||||
<span class="help-block">
|
||||
您的帳號
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default float-right" id="login">登入</button>
|
||||
</form>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="password">密碼</label>
|
||||
<input asp-for="Password" type="password" id="password" class="form-control" placeholder="Password" autocomplete="off">
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
<span class="help-block">
|
||||
您的密碼
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group text-left">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="rememberme">
|
||||
<label class="custom-control-label" for="rememberme"> 記住我</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default float-right" id="login">登入</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="blankpage-footer text-center">
|
||||
<a asp-controller="Login" asp-action="ForgotPassword"><strong>忘記密碼</strong></a>
|
||||
@ -87,6 +75,10 @@
|
||||
<source src="~/media/video/cc.webm" type="video/webm">
|
||||
<source src="~/media/video/cc.mp4" type="video/mp4">
|
||||
</video>
|
||||
|
||||
<div class="d-flex justify-content-center text-secondary" style="transform: translateY(1150%);">
|
||||
<div class="spinner-border" role="status" id="loading" style="display: none"></div>
|
||||
</div>
|
||||
@*
|
||||
|
||||
<div class="login-box">
|
||||
|
||||
@ -11,16 +11,8 @@
|
||||
|
||||
<!-- Your main content goes below here: -->
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative; ">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
@*<div class="row mb-5">*@
|
||||
|
||||
@ -6,16 +6,8 @@
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -6,16 +6,8 @@
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<ol class="breadcrumb page-breadcrumb">
|
||||
|
||||
@ -17,16 +17,8 @@
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<!-- Your main content goes below here: -->
|
||||
|
||||
@ -6,16 +6,8 @@
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
@ -6,16 +6,8 @@
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<ol class="breadcrumb page-breadcrumb">
|
||||
|
||||
@ -16,16 +16,8 @@
|
||||
|
||||
<!-- Your main content goes below here: -->
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@ -19,16 +19,8 @@
|
||||
</div>
|
||||
<!-- Your main content goes below here: -->
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@ -12,16 +12,8 @@
|
||||
|
||||
<!-- Your main content goes below here: -->
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@ -13,16 +13,8 @@
|
||||
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
|
||||
</ol>*@
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -1331,6 +1323,45 @@
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region 刪除檔案
|
||||
$('#record_files_div').on("click", "a.del-operation-record-file-btn", function () {
|
||||
|
||||
var selectedFileId = $(this).attr("data-id");
|
||||
|
||||
var div = $(this).parents(".col-auto");
|
||||
|
||||
Swal.fire({
|
||||
title: "刪除",
|
||||
text: "你確定是否刪除此筆資料?",
|
||||
type: "warning",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "是",
|
||||
cancelButtonText: "否"
|
||||
}).then(function (result) {
|
||||
if (result.value) {
|
||||
|
||||
var url = "/Operation/DeleteOperationRecordFile";
|
||||
|
||||
var send_data = {
|
||||
ReocdeId: selected_id,
|
||||
SelectedId: selectedFileId
|
||||
}
|
||||
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
toast_error(rel.msg);
|
||||
return;
|
||||
}
|
||||
operationRecordTable.ajax.reload();
|
||||
toast_ok(rel.msg);
|
||||
div.remove();
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
});
|
||||
//#endregion
|
||||
|
||||
//#region 異常
|
||||
|
||||
//#region 改變日期(異常)
|
||||
@ -1646,7 +1677,7 @@
|
||||
status = 1;
|
||||
}
|
||||
$("input[name=status_modal_opRecord][value='" + status + "']").prop('checked', true); //狀態
|
||||
$('#work_person_select_modal').val(record.workPersonId).trigger("change");;
|
||||
$('#work_person_select_modal').val(record.workPersonIds).trigger("change");
|
||||
if (work_type != 2) {
|
||||
$(".fix-div").hide();
|
||||
} else {
|
||||
@ -2656,6 +2687,8 @@
|
||||
var times = 1;
|
||||
var ALLkwhkwp = 0;
|
||||
var kwhkwp = 0;
|
||||
var ALLDays = 0;
|
||||
var ALLavgdaykwh = 0;
|
||||
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
@ -2683,6 +2716,7 @@
|
||||
//暫時先執行到這--->取kwhkwp
|
||||
|
||||
var nowDisplayIrrDay = 0;
|
||||
var avgdaykwh = 0;
|
||||
|
||||
if (val.length != 0) {
|
||||
if (groupType != 6) {
|
||||
@ -2690,7 +2724,7 @@
|
||||
if (groupType == 0 && kwhkwp < val.kwhkwp.toFixed(2)) {
|
||||
kwhkwp = val.kwhkwp.toFixed(2);
|
||||
}
|
||||
if (groupType != 0) {
|
||||
if (groupType != 0 && groupType != 3) {
|
||||
ALLkwhkwp += val.kwhkwp;
|
||||
kwhkwp = (ALLkwhkwp / times).toFixed(2);
|
||||
times++;
|
||||
@ -2699,16 +2733,25 @@
|
||||
nowDisplayIrrDay = val.irrDayHour.toFixed(2);
|
||||
}
|
||||
else {
|
||||
nowDisplayIrrDay = val.irradiance.toFixed(2);
|
||||
nowDisplayIrrDay = val.irrDay.toFixed(2);
|
||||
}
|
||||
if (groupType == 3)
|
||||
{
|
||||
ALLDays += val.days;
|
||||
avgdaykwh = (val.kwh / val.generatingCapacity / val.days);
|
||||
ALLavgdaykwh += avgdaykwh;
|
||||
}
|
||||
else
|
||||
{
|
||||
avgdaykwh = val.kwhkwp;
|
||||
}
|
||||
// console.log(val);
|
||||
diffSOLARHOURALL = val.solarhour;
|
||||
$('#HistoryDetailTable').append('<tr>' +
|
||||
'<td>' + val.timestamp + '</td>' +
|
||||
'<td>' + (toThousands(val.kwh.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(val.kwhkwp.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(nowDisplayIrrDay)) + '</td>' + //irrDay
|
||||
//'<td>' + val.irradiance.toFixed(2) + '</td>' +
|
||||
'<td>' + (toThousands(avgdaykwh.toFixed(2))) + '</td>' +//val.kwhkwp
|
||||
'<td>' + (toThousands(nowDisplayIrrDay)) + '</td>' +
|
||||
'<td>' + (toThousands(val.pr.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(val.temp.toFixed(2))) + '</td>' +
|
||||
'</tr>');
|
||||
@ -2721,25 +2764,33 @@
|
||||
listtemperature.push(parseFloat(val.temp.toFixed(2)));
|
||||
listsolarhour.push(parseFloat(val.solarhour.toFixed(2)));
|
||||
listpr.push(parseFloat(val.pr.toFixed(2)));
|
||||
listkwhkwp.push(parseFloat(val.kwhkwp.toFixed(2)));
|
||||
listkwhkwp.push(parseFloat(avgdaykwh));//val.kwhkwp
|
||||
}
|
||||
else
|
||||
{
|
||||
if (groupType == 0 && kwhkwp < val.kwhkwp.toFixed(2)) {
|
||||
kwhkwp = val.kwhkwp.toFixed(2);
|
||||
}
|
||||
if (groupType != 0) {
|
||||
if (groupType != 0 && groupType != 3) {
|
||||
ALLkwhkwp += val.kwhkwp;
|
||||
kwhkwp = (ALLkwhkwp / times).toFixed(2);
|
||||
times++;
|
||||
}
|
||||
|
||||
if (groupType == 3) {
|
||||
ALLDays += val.days;
|
||||
avgdaykwh = (val.kwh / val.generatingCapacity / val.days);
|
||||
ALLavgdaykwh += avgdaykwh;
|
||||
}
|
||||
else {
|
||||
avgdaykwh = val.kwhkwp;
|
||||
}
|
||||
diffSOLARHOURALL += val.diffSOLARHOUR;
|
||||
$('#HistoryDetailTable').append('<tr>' +
|
||||
'<td>' + val.timestamp + '</td>' +
|
||||
'<td>' + (toThousands(val.kwh.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(val.kwhkwp.toFixed(2))) + '</td>' +
|
||||
|
||||
//'<td>' + val.irradiance.toFixed(2) + '</td>' +
|
||||
'<td>' + (toThousands(avgdaykwh.toFixed(2))) + '</td>' +//val.kwhkwp
|
||||
'<td>' + (toThousands(val.irrDay.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(val.pr.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(val.temp.toFixed(2))) + '</td>' +
|
||||
'</tr>');
|
||||
@ -2752,7 +2803,7 @@
|
||||
listtemperature.push(parseFloat(val.temp.toFixed(2)));
|
||||
listsolarhour.push(parseFloat(val.solarhour.toFixed(2)));
|
||||
listpr.push(parseFloat(val.pr.toFixed(2)));
|
||||
listkwhkwp.push(parseFloat(val.kwhkwp.toFixed(2)));
|
||||
listkwhkwp.push(parseFloat(avgdaykwh));//val.kwhkwp
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -2874,10 +2925,18 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
var avgK = 0;
|
||||
if (groupType == 3) {
|
||||
avgK = (ALLavgdaykwh / rel.data.length).toFixed(2);//(kwhALL / rel.data[0].generatingCapacity / ALLDays).toFixed(2);
|
||||
}
|
||||
else {
|
||||
avgK = kwhkwp;
|
||||
}
|
||||
|
||||
$('#HistoryTotalTable').append('<tr>' +
|
||||
'<td>' + TimestampALL + '</td>' +
|
||||
'<td>' + (toThousands(kwhALL.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(kwhkwp)) + '</td>' +
|
||||
'<td>' + (toThousands(avgK)) + '</td>' +
|
||||
//'<td>' + irradianceALL.toFixed(2) + '</td>' + // 改成累積日照 by jiahao 2022-04-30 00:444
|
||||
'<td>' + (toThousands(avgIrr_day.toFixed(2))) + '</td>' +
|
||||
'<td>' + (toThousands(avgPR.toFixed(2))) + '</td>' +
|
||||
|
||||
@ -219,7 +219,7 @@
|
||||
</div>
|
||||
<div class="mb-3 d-flex justify-content-start">
|
||||
<div class="pr-3">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-themed" onclick="ExportExcel()"><span class="fal fa-file-excel mr-1"></span> 匯出</button>
|
||||
<button type="button" class="btn btn-primary waves-effect waves-themed ml-1 btn-report" onclick="ExportExcel()" id="exportBtn"><span class="fal fa-file-excel mr-1"></span> 匯出</button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="pr-3" id="selectOneStation">
|
||||
@ -874,7 +874,7 @@
|
||||
str += "<th>掛錶日期</th>";
|
||||
/*str += "<th>裝置容量</th>";*/
|
||||
str += "<th>躉售費率</th>";
|
||||
str += "<th>每kw日均獲利</th>";
|
||||
str += "<th>日均獲利</th>";
|
||||
str += "<th>日均發電度數</th>";
|
||||
str += "<th>發電量</th>";
|
||||
str += "<th>PR</th>";
|
||||
@ -1024,25 +1024,27 @@
|
||||
sta += "<td>" + toThousands(Number(inverter[i]).toFixed(2)) + "</td>";
|
||||
}
|
||||
});
|
||||
sta += "<td>" + toThousands(Number(inverter.hourKWH)) + "</td>";
|
||||
sta += "<td>" + toThousands(Number(inverter.hourKWHp)) + "</td>";
|
||||
sta += "<td>" + toThousands(Number(inverter.irrDayHour)) + "</td>"; // body 小時平均日照度 irradiance
|
||||
sta += "<td>" + toThousands(Number(inverter.temperature)) + "</td>"; //body 小時平均模組溫度
|
||||
sta += "<td>" + ((inverter.hourKWH == null) ? 0 : toThousands(Number(inverter.hourKWH).toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.hourKWHp == null) ? 0 : toThousands(Number(inverter.hourKWHp).toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.irrDayHour == null) ? 0 : toThousands(Number(inverter.irrDayHour).toFixed(2))) + "</td>"; // body 小時平均日照度 irradiance
|
||||
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(Number(inverter.temperature).toFixed(2))) + "</td>";//body 小時平均模組溫度
|
||||
if (showmoney == 1) {
|
||||
sta += "<td>" + toThousands(Math.round(Number(inverter.hourmoney))) + "</td>";
|
||||
sta += "<td>" + ((inverter.hourmoney == null) ? 0 : toThousands(Number(inverter.hourmoney).toFixed(2))) + "</td>";
|
||||
}
|
||||
sta += "</tr>";
|
||||
thour = inverter.tothour ? inverter.tothour.toFixed(2) : 0;
|
||||
tpr = inverter.pr ? inverter.pr.toFixed(2) : 0;
|
||||
tkwh = inverter.totKWH ? inverter.totKWH.toFixed(2) : 0;
|
||||
kWhkwp = inverter.totKWHKWP ? inverter.totKWHKWP.toFixed(2) : 0; // 日報 有效發電小時
|
||||
ntd = inverter.totmoney ? Math.round(inverter.totmoney) : 0;
|
||||
ntdone = inverter.totmoney / inverter.totKWH ? Math.round(inverter.totmoney / inverter.totKWH * 10000) / 10000 : 0;
|
||||
GeneratingCapacity = inverter.GeneratingCapacity;
|
||||
averageDailyProfit = ntd / GeneratingCapacity ? Math.round(ntd / GeneratingCapacity * 10000) / 10000 : 0;
|
||||
if (index < rel.data.length - 1) {
|
||||
thour = inverter.tothour ? inverter.tothour.toFixed(2) : 0;
|
||||
tpr = inverter.pr ? inverter.pr.toFixed(2) : 0;
|
||||
tkwh = inverter.totKWH ? inverter.totKWH.toFixed(2) : 0;
|
||||
//kWhkwp = inverter.totKWHKWP ? inverter.totKWHKWP.toFixed(2) : 0; // 日報 有效發電小時
|
||||
kWhkwp = inverter.totKWHKWP ? (inverter.totKWH / inverter.GeneratingCapacity).toFixed(2) : 0; // 日報 有效發電小時
|
||||
ntd = inverter.totmoney ? inverter.totmoney.toFixed(2) : 0;
|
||||
ntdone = inverter.totmoney / inverter.totKWH ? (inverter.totmoney / inverter.totKWH).toFixed(2) : 0;
|
||||
GeneratingCapacity = inverter.GeneratingCapacity ? inverter.GeneratingCapacity.toFixed(2) : 0;
|
||||
averageDailyProfit = ntd / GeneratingCapacity ? (ntd / GeneratingCapacity).toFixed(2) : 0;
|
||||
}
|
||||
})
|
||||
var stc = "<tr>";
|
||||
/* stc += "<th>" + '日照小時' + "</th>";*/
|
||||
stc += "<th>" + '日均發電度數' + "</th>";
|
||||
stc += "<th>" + 'PR%' + "</th>";
|
||||
stc += "<th>" + '日發電量(kWh)' + "</th>";
|
||||
@ -1057,14 +1059,14 @@
|
||||
|
||||
var stb = "<tr>";
|
||||
/* stb += "<td>" + thour + "</td>";*/
|
||||
stb += "<td>" + toThousands(kWhkwp) + "</td>"; //header - 有效發電小時
|
||||
stb += "<td>" + toThousands(kWhkwp) + "</td>"; //header - 有效發電小時 kWhkwp
|
||||
stb += "<td>" + toThousands(tpr) + "</td>"; //
|
||||
stb += "<td>" + toThousands(tkwh) + "</td>";
|
||||
stb += "<td>" + toThousands(GeneratingCapacity) + "</td>";
|
||||
if (showmoney == 1) {
|
||||
stb += "<td>" + toThousands(Math.round(ntd)) + "</td>";
|
||||
stb += "<td>" + Math.round(ntdone * 10000) / 10000 + "</td>";
|
||||
stb += "<td>" + toThousands(Math.round(averageDailyProfit)) + "</td>";
|
||||
stb += "<td>" + toThousands(ntd) + "</td>";
|
||||
stb += "<td>" + toThousands(ntdone) + "</td>";
|
||||
stb += "<td>" + toThousands(averageDailyProfit) + "</td>";
|
||||
}
|
||||
stb += "</tr>";
|
||||
|
||||
@ -1095,32 +1097,34 @@
|
||||
if (inverter[i] == null) {
|
||||
sta += "<td>" + 0 + "</td>";
|
||||
} else {
|
||||
sta += "<td>" + toThousands(inverter[i]) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter[i].toFixed(2)) + "</td>";
|
||||
}
|
||||
});
|
||||
sta += "<td>" + toThousands(inverter.dayKWH) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp)) + "</td>";
|
||||
sta += "<td>" + inverter.tothour + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.KWHKWP) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWH == null) ? 0 : toThousands(inverter.dayKWH.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.tothour == null) ? 0 : toThousands(inverter.tothour.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.KWHKWP == null) ? 0 : toThousands(inverter.KWHKWP.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay)) + "</td>";
|
||||
sta += "<td>" + inverter.temperature + "</td>";
|
||||
sta += "<td>" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(inverter.temperature.toFixed(2))) + "</td>";
|
||||
if (showmoney == 1) {
|
||||
sta += "<td>" + toThousands(Math.round(inverter.soldmoney)) + "</td>";
|
||||
sta += "<td>" + ((inverter.soldmoney == null) ? 0 : toThousands(inverter.soldmoney.toFixed(2))) + "</td>";
|
||||
}
|
||||
sta += "</tr>";
|
||||
avghour += inverter.tothour ? inverter.tothour : 0;
|
||||
avgKWHKWP += inverter.KWHKWP ? inverter.KWHKWP : 0;
|
||||
avgdayKWH += inverter.dayKWH ? inverter.dayKWH : 0;
|
||||
monthKWH = inverter.monthKWH ? inverter.monthKWH : 0;
|
||||
monthmoney = inverter.monthmoney ? inverter.monthmoney : 0;
|
||||
if (index < rel.data.length - 1) {
|
||||
avghour += inverter.tothour ? inverter.tothour : 0;
|
||||
avgKWHKWP += inverter.KWHKWP ? inverter.KWHKWP : 0;
|
||||
avgdayKWH += inverter.dayKWH ? inverter.dayKWH : 0;
|
||||
monthKWH = inverter.monthKWH ? inverter.monthKWH : 0;
|
||||
monthmoney = inverter.monthmoney ? inverter.monthmoney : 0;
|
||||
}
|
||||
|
||||
if (inverter.SolarType == 1) {
|
||||
check_hire = true;
|
||||
sitedb = inverter.SiteDB
|
||||
}
|
||||
GeneratingCapacity = inverter.GeneratingCapacity;
|
||||
averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0;
|
||||
averageDailyProfit = monthmoney / GeneratingCapacity ? (monthmoney / GeneratingCapacity) : 0;
|
||||
})
|
||||
monthday = (rel.data.length - 1);//最後一筆是總計
|
||||
monthmoneyone = rel.data[0].monthmoneyone ? rel.data[0].monthmoneyone : 0;
|
||||
@ -1159,16 +1163,16 @@
|
||||
}
|
||||
else {
|
||||
/*stb += "<td>" + (avghour / monthday).toFixed(2) + "</td>";*/
|
||||
stb += "<td>" + toThousands((avgKWHKWP / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((avgdayKWH / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthKWH) + "</td>";
|
||||
stb += "<td>" + toThousands(GeneratingCapacity) + "</td>";
|
||||
stb += "<td>" + toThousands((monthKWH / GeneratingCapacity / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((monthKWH / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthKWH.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(GeneratingCapacity.toFixed(2)) + "</td>";
|
||||
|
||||
if (showmoney == 1) {
|
||||
stb += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + "</td>";
|
||||
stb += "<td>" + toThousands(Math.round(monthmoney)) + "</td>";
|
||||
stb += "<td>" + monthmoneyone + "</td>";
|
||||
stb += "<td>" + toThousands(Math.round(averageDailyProfit / monthday)) + "</td>";
|
||||
stb += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthmoney.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthmoneyone.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((averageDailyProfit / monthday).toFixed(2)) + "</td>";
|
||||
}
|
||||
stb += "<td>" + monthday + "</td>";
|
||||
stb += "</tr>";
|
||||
@ -1191,8 +1195,8 @@
|
||||
std += "<tr>";
|
||||
std += "<td>" + value.landowner + "</td>";
|
||||
std += "<td>" + value.leaseRate + "%" + "</td>";
|
||||
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100)) + "</td>";
|
||||
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100 * 1.05)) + "</td>";
|
||||
std += "<td>" + toThousands((monthmoney * value.leaseRate / 100).toFixed(2)) + "</td>";
|
||||
std += "<td>" + toThousands((monthmoney * value.leaseRate / 100 * 1.05).toFixed(2)) + "</td>";
|
||||
std += "</tr>";
|
||||
})
|
||||
$('#HireTableBody').append(std);
|
||||
@ -1217,6 +1221,8 @@
|
||||
var monthmoneyone = 0;
|
||||
var monthday = 0;
|
||||
var averageDailyProfit = 0;
|
||||
var generatingCapacity = 0;
|
||||
var days = 0;
|
||||
var sta = "";
|
||||
var check_hire = false;
|
||||
var sitedb = "";
|
||||
@ -1227,27 +1233,28 @@
|
||||
if (inverter[i] == null) {
|
||||
sta += "<td>" + 0 + "</td>";
|
||||
} else {
|
||||
sta += "<td>" + toThousands(inverter[i]) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter[i].toFixed(2)) + "</td>";
|
||||
}
|
||||
});
|
||||
sta += "<td>" + toThousands(inverter.dayKWH) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.dayKWHp) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.tothour) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.KWHKWP) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.PR.toFixed(2)) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.irradiance) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.temperature) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWH == null) ? 0 : toThousands(inverter.dayKWH.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.tothour == null) ? 0 : toThousands(inverter.tothour.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.KWHKWP == null) ? 0 : toThousands(inverter.KWHKWP.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.irradiance == null) ? 0 : toThousands(inverter.irradiance.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(inverter.temperature.toFixed(2))) + "</td>";
|
||||
if (showmoney == 1) {
|
||||
sta += "<td>" + toThousands(Math.round(inverter.soldmoney)) + "</td>";
|
||||
sta += "<td>" + ((inverter.soldmoney == null) ? 0 : toThousands(inverter.soldmoney.toFixed(2))) + "</td>";
|
||||
}
|
||||
sta += "</tr>";
|
||||
avghour += inverter.tothour ? inverter.tothour : 0;
|
||||
avgKWHKWP += inverter.KWHKWP ? inverter.KWHKWP : 0;
|
||||
avgdayKWH += inverter.dayKWH ? inverter.dayKWH : 0;
|
||||
monthKWH = inverter.monthKWH ? toThousands(inverter.monthKWH) : 0;
|
||||
monthKWH = inverter.monthKWH ? inverter.monthKWH : 0;
|
||||
monthmoney = inverter.monthmoney ? inverter.monthmoney : 0;
|
||||
|
||||
averageDailyProfit = monthmoney / inverter.GeneratingCapacity ? Math.round(monthmoney / inverter.GeneratingCapacity * 10000) / 10000 : 0;
|
||||
generatingCapacity = inverter.GeneratingCapacity ? inverter.GeneratingCapacity : 0;
|
||||
|
||||
averageDailyProfit = monthmoney / inverter.GeneratingCapacity ? (monthmoney / inverter.GeneratingCapacity) : 0;
|
||||
|
||||
if (inverter.SolarType == 1) {
|
||||
check_hire = true;
|
||||
@ -1255,13 +1262,16 @@
|
||||
}
|
||||
|
||||
})
|
||||
monthday = rel.data.length;
|
||||
monthday = (rel.data.length - 1);
|
||||
monthmoneyone = rel.data[0].monthmoneyone ? rel.data[0].monthmoneyone : 0;
|
||||
//ntdone = inverter.totmoney / inverter.totKWH ? (inverter.totmoney / inverter.totKWH).toFixed(2) : 0;
|
||||
days = rel.data[0].Days;
|
||||
|
||||
|
||||
var stc = "<tr>";
|
||||
stc += "<th>" + '日照平均(月)' + "</th>";
|
||||
stc += "<th>" + '日均發電度數(月)' + "</th>";
|
||||
stc += "<th>" + '裝置容量' + "</th>";
|
||||
stc += "<th>" + '發電量平均(kWh)(月)' + "</th>";
|
||||
stc += "<th>" + '發電量(kWh)(年)' + "</th>";
|
||||
if (showmoney == 1) {
|
||||
@ -1287,16 +1297,18 @@
|
||||
stb += "</tr>";
|
||||
}
|
||||
else {
|
||||
stb += "<td>" + (avghour / monthday).toFixed(2) + "</td>";
|
||||
stb += "<td>" + (avgKWHKWP / monthday).toFixed(2) + "</td>";
|
||||
stb += "<td>" + toThousands((avgdayKWH / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + monthKWH + "</td>";
|
||||
stb += "<td>" + toThousands((avghour / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((monthKWH / generatingCapacity).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(generatingCapacity.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((monthKWH / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthKWH.toFixed(2)) + "</td>";
|
||||
|
||||
if (showmoney == 1) {
|
||||
stb += "<td>" + toThousands(Math.round(monthmoney)) + "</td>";
|
||||
stb += "<td>" + monthmoneyone + "</td>";
|
||||
stb += "<td>" + toThousands(Math.round((averageDailyProfit / monthday / 30 * 10000) / 10000)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthmoney.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthmoneyone.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((averageDailyProfit / days).toFixed(2)) + "</td>";
|
||||
}
|
||||
stb += "<td>" + monthday + "</td>";
|
||||
stb += "<td>" + toThousands(monthday) + "</td>";
|
||||
stb += "</tr>";
|
||||
}
|
||||
var std = "";
|
||||
@ -1317,8 +1329,8 @@
|
||||
std += "<tr>";
|
||||
std += "<td>" + value.landowner + "</td>";
|
||||
std += "<td>" + toThousands(value.leaseRate) + "%" + "</td>";
|
||||
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100)) + "</td>";
|
||||
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100 * 1.05)) + "</td>";
|
||||
std += "<td>" + toThousands((monthmoney * value.leaseRate / 100).toFixed(2)) + "</td>";
|
||||
std += "<td>" + toThousands((monthmoney * value.leaseRate / 100 * 1.05).toFixed(2)) + "</td>";
|
||||
std += "</tr>";
|
||||
})
|
||||
$('#HireTableBody').append(std);
|
||||
@ -1355,18 +1367,18 @@
|
||||
if (inverter[i] == null) {
|
||||
sta += "<td>" + 0 + "</td>";
|
||||
} else {
|
||||
sta += "<td>" + toThousands(inverter[i]) + "</td>";
|
||||
sta += "<td>" + toThousands(inverter[i].toFixed(2)) + "</td>";
|
||||
}
|
||||
});
|
||||
sta += "<td>" + toThousands(inverter.dayKWH) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp)) + "</td>";
|
||||
sta += "<td>" + inverter.tothour + "</td>";
|
||||
sta += "<td>" + toThousands(inverter.KWHKWP) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWH == null) ? 0 : toThousands(inverter.dayKWH.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.dayKWHp == null) ? 0 : toThousands(inverter.dayKWHp.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.tothour == null) ? 0 : toThousands(inverter.tothour.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.KWHKWP == null) ? 0 : toThousands(inverter.KWHKWP.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.PR == null) ? 0 : toThousands(inverter.PR.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay)) + "</td>";
|
||||
sta += "<td>" + inverter.temperature + "</td>";
|
||||
sta += "<td>" + ((inverter.IrrDay == null) ? 0 : toThousands(inverter.IrrDay.toFixed(2))) + "</td>";
|
||||
sta += "<td>" + ((inverter.temperature == null) ? 0 : toThousands(inverter.temperature.toFixed(2))) + "</td>";
|
||||
if (showmoney == 1) {
|
||||
sta += "<td>" + toThousands(Math.round(inverter.soldmoney)) + "</td>";
|
||||
sta += "<td>" + ((inverter.soldmoney == null) ? 0 : toThousands(inverter.soldmoney.toFixed(2))) + "</td>";
|
||||
}
|
||||
sta += "</tr>";
|
||||
avghour += inverter.tothour ? inverter.tothour : 0;
|
||||
@ -1381,9 +1393,9 @@
|
||||
sitedb = inverter.SiteDB
|
||||
}
|
||||
GeneratingCapacity = inverter.GeneratingCapacity;
|
||||
averageDailyProfit = monthmoney / GeneratingCapacity ? Math.round(monthmoney / GeneratingCapacity * 10000) / 10000 : 0;
|
||||
averageDailyProfit = monthmoney / GeneratingCapacity ? (monthmoney / GeneratingCapacity) : 0;
|
||||
})
|
||||
monthday = rel.data.length;
|
||||
monthday = (rel.data.length - 1);
|
||||
|
||||
|
||||
var stc = "<tr>";
|
||||
@ -1419,18 +1431,19 @@
|
||||
}
|
||||
else {
|
||||
/*stb += "<td>" + (avghour / monthday).toFixed(2) + "</td>";*/
|
||||
stb += "<td>" + toThousands((avgKWHKWP / monthday).toFixed(2)) + "</td>";
|
||||
//stb += "<td>" + toThousands((avgKWHKWP / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((monthKWH / GeneratingCapacity).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((avgdayKWH / monthday).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthKWH) + "</td>";
|
||||
stb += "<td>" + toThousands(GeneratingCapacity) + "</td>";
|
||||
stb += "<td>" + toThousands(monthKWH.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(GeneratingCapacity.toFixed(2)) + "</td>";
|
||||
|
||||
if (showmoney == 1) {
|
||||
stb += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(3)) + "</td>";
|
||||
stb += "<td>" + toThousands(Math.round(monthmoney)) + "</td>";
|
||||
stb += "<td>" + Math.round(monthmoneyone / monthday * 10000) / 10000 + "</td>";
|
||||
stb += "<td>" + toThousands(Math.round(averageDailyProfit / monthday)) + "</td>";
|
||||
stb += "<td>" + toThousands((monthmoney / GeneratingCapacity).toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthmoney.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands(monthmoneyone / monthday.toFixed(2)) + "</td>";
|
||||
stb += "<td>" + toThousands((averageDailyProfit / monthday).toFixed(2)) + "</td>";
|
||||
}
|
||||
stb += "<td>" + monthday + "</td>";
|
||||
stb += "<td>" + toThousands(monthday) + "</td>";
|
||||
stb += "</tr>";
|
||||
}
|
||||
var std = "";
|
||||
@ -1451,8 +1464,8 @@
|
||||
std += "<tr>";
|
||||
std += "<td>" + value.landowner + "</td>";
|
||||
std += "<td>" + value.leaseRate + "%" + "</td>";
|
||||
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100)) + "</td>";
|
||||
std += "<td>" + toThousands(Math.round(monthmoney * value.leaseRate / 100 * 1.05)) + "</td>";
|
||||
std += "<td>" + toThousands((monthmoney * value.leaseRate / 100).toFixed(2)) + "</td>";
|
||||
std += "<td>" + toThousands((monthmoney * value.leaseRate / 100 * 1.05).toFixed(2)) + "</td>";
|
||||
std += "</tr>";
|
||||
})
|
||||
$('#HireTableBody').append(std);
|
||||
@ -1477,6 +1490,8 @@
|
||||
}
|
||||
|
||||
function ExportExcel() {
|
||||
$("#exportBtn").html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>').attr("disabled", true);
|
||||
|
||||
var send_data =
|
||||
{
|
||||
SearchType: searchType,
|
||||
@ -1491,10 +1506,12 @@
|
||||
$("#post").val(JSON.stringify(send_data));
|
||||
document.report.action = "StationReport/ExportExcel";
|
||||
document.report.submit();
|
||||
$("#exportBtn").html('<span class="fal fa-file-excel mr-1"></span> 匯出').attr("disabled", false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#exportBtn").html('<span class="fal fa-file-excel mr-1"></span> 匯出').attr("disabled", false);
|
||||
var text = "原因如下:<br\>";
|
||||
$.each(rel.data, function (index, val) {
|
||||
text += index + 1 + "." + val + "<br\>";
|
||||
@ -1517,6 +1534,7 @@
|
||||
{
|
||||
window.location = "/StationReport/ExportExcelmaxtable?post=" + JSON.stringify(send_data);
|
||||
}
|
||||
$("#exportBtn").html('<span class="fal fa-file-excel mr-1"></span> 匯出').attr("disabled", false);
|
||||
}
|
||||
}
|
||||
// 綜合比較
|
||||
@ -1625,17 +1643,17 @@
|
||||
/*StrInfoBody += "<td>" + data.generatingCapacity.toFixed(2) + "</td>";*/
|
||||
StrInfoBody += "<td>" + data.powerRate.toFixed(2) + "</td>";
|
||||
StrInfoBody += "<td>" + toThousands((data.todayMoney / data.generatingCapacity / data.days).toFixed(2)) + "</td>";//每kw日均獲利
|
||||
StrInfoBody += "<td>" + toThousands(data.avgKWHKWP.toFixed(2)) + "</td>"; // 日均發電度數
|
||||
StrInfoBody += "<td>" + toThousands((data.kwh / data.generatingCapacity).toFixed(2)) + "</td>"; // 日均發電度數
|
||||
StrInfoBody += "<td>" + toThousands(data.kwh.toFixed(2)) + "</td>"; // 發電量
|
||||
/*StrInfoBody += "<td>" + toThousands(data.irradiance.toFixed(2)) + "</td>"; // 累積日照*/
|
||||
StrInfoBody += "<td>" + toThousands(data.avgPR.toFixed(2)) + "</td>";
|
||||
if (showmoney == 1) {
|
||||
|
||||
StrInfoBody += "<td>" + toThousands(Math.round(data.todayMoney, 2)) + "</td>";
|
||||
StrInfoBody += "<td>" + toThousands(data.todayMoney.toFixed(2)) + "</td>";
|
||||
|
||||
StrInfoBody += "<td>" + Math.round(data.todayMoney * hirerate * 0.01, 2)+ "</td>";
|
||||
StrInfoBody += "<td>" + toThousands((data.todayMoney * hirerate * 0.01).toFixed(2)) + "</td>";
|
||||
|
||||
StrInfoBody += "<td>" + toThousands(Math.round(data.todayMoney, 2)) + "</td>";
|
||||
StrInfoBody += "<td>" + toThousands(data.todayMoney.toFixed(2)) + "</td>";
|
||||
}
|
||||
|
||||
|
||||
@ -1650,7 +1668,7 @@
|
||||
$.each(CityArray, function (index, data) {
|
||||
CityInfoBody += "<tr>";
|
||||
CityInfoBody += "<td>" + data.city + "</td>";
|
||||
CityInfoBody += "<td>" + data.generatingCapacity.toFixed(2) + "</td>";
|
||||
CityInfoBody += "<td>" + toThousands(data.generatingCapacity.toFixed(2)) + "</td>";
|
||||
CityInfoBody += "<td>" + toThousands(data.kwp.toFixed(2)) + "</td>";
|
||||
CityInfoBody += "<td>" + toThousands((data.kwp / data.generatingCapacity).toFixed(2)) + "</td>";
|
||||
CityInfoBody += "</tr>";
|
||||
|
||||
@ -11,16 +11,8 @@
|
||||
<li class="position-absolute pos-top pos-right d-none d-sm-block"><span class="js-get-date"></span></li>
|
||||
</ol>
|
||||
|
||||
<link rel="stylesheet" href="~/css/loading.css" />
|
||||
<div class="loadEffect" id="loading" style="top: 10%;">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<div class="d-flex justify-content-center text-secondary" style="top: 10%; transform: translateY(50%); z-index: 100; position: relative;">
|
||||
<div class="spinner-border" role="status" style="width: 3rem; height: 3rem; display:none;" id="loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
.loadEffect {
|
||||
z-index: 9999;
|
||||
left: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
margin: 0 auto;
|
||||
margin-top: 100px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.loadEffect span {
|
||||
display: inline-block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
border-radius: 50%;
|
||||
background: black;
|
||||
position: absolute;
|
||||
-webkit-animation: load 1.04s ease infinite;
|
||||
}
|
||||
|
||||
@-webkit-keyframes load {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(1) {
|
||||
left: 0;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
-webkit-animation-delay: 0.13s;
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(2) {
|
||||
left: 14px;
|
||||
top: 14px;
|
||||
-webkit-animation-delay: 0.26s;
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(3) {
|
||||
left: 50%;
|
||||
top: 0;
|
||||
margin-left: -8px;
|
||||
-webkit-animation-delay: 0.39s;
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(4) {
|
||||
top: 14px;
|
||||
right: 14px;
|
||||
-webkit-animation-delay: 0.52s;
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(5) {
|
||||
right: 0;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
-webkit-animation-delay: 0.65s;
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(6) {
|
||||
right: 14px;
|
||||
bottom: 14px;
|
||||
-webkit-animation-delay: 0.78s;
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(7) {
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
margin-left: -8px;
|
||||
-webkit-animation-delay: 0.91s;
|
||||
}
|
||||
|
||||
.loadEffect span:nth-child(8) {
|
||||
bottom: 14px;
|
||||
left: 14px;
|
||||
-webkit-animation-delay: 1.04s;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ namespace solarApp.Service
|
||||
public class getStationSvc
|
||||
{
|
||||
string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||
protected string tableName = "power_station";
|
||||
protected string tableName = "power_station_for_calc_test";//"power_station";
|
||||
/// <summary>
|
||||
/// 電站 Raw Data
|
||||
/// </summary>
|
||||
|
||||
@ -9,6 +9,7 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using solarApp.Service;
|
||||
using solarApp.Model;
|
||||
//using System.Text.RegularExpressions;
|
||||
|
||||
namespace solarApp
|
||||
{
|
||||
@ -699,5 +700,24 @@ namespace solarApp
|
||||
autoTask = false;
|
||||
lbMsgTitle.Text = System.DateTime.Now.ToString() + " invdayhour - 完成!";
|
||||
}
|
||||
|
||||
//test for email format
|
||||
//private void button3_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// if(IsValidEmail(textBox2.Text))
|
||||
// {
|
||||
// label3.Text = "OK";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// label3.Text = "X";
|
||||
// }
|
||||
//}
|
||||
|
||||
//bool IsValidEmail(string strIn)
|
||||
//{
|
||||
// // Return true if strIn is in valid e-mail format.
|
||||
// return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user