金額顯示
This commit is contained in:
parent
2e36250db2
commit
a31611b625
@ -1211,5 +1211,298 @@ namespace SolarPower.Controllers
|
|||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FileResult ExportExcelmaxtable(string post)
|
||||||
|
{
|
||||||
|
var postObject = JsonConvert.DeserializeObject<Select_table2>(post);
|
||||||
|
var workbook = new XSSFWorkbook();
|
||||||
|
#region excel設定
|
||||||
|
IFont font12 = workbook.CreateFont();
|
||||||
|
font12.FontName = "新細明體";
|
||||||
|
font12.FontHeightInPoints = 12;
|
||||||
|
ICellStyle style12 = workbook.CreateCellStyle();
|
||||||
|
style12.SetFont(font12);
|
||||||
|
style12.Alignment = HorizontalAlignment.Center;
|
||||||
|
style12.VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
IFont font12Times = workbook.CreateFont();
|
||||||
|
font12Times.FontName = "Times New Roman";
|
||||||
|
font12Times.FontHeightInPoints = 12;
|
||||||
|
IFont font18 = workbook.CreateFont();
|
||||||
|
font18.FontName = "新細明體";
|
||||||
|
font18.FontHeightInPoints = 18;
|
||||||
|
font18.IsBold = true;
|
||||||
|
ICellStyle styleTitle18 = workbook.CreateCellStyle();
|
||||||
|
styleTitle18.SetFont(font18);
|
||||||
|
styleTitle18.Alignment = HorizontalAlignment.Center;
|
||||||
|
styleTitle18.VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
ICellStyle styleLeft12 = workbook.CreateCellStyle();
|
||||||
|
styleLeft12.SetFont(font12);
|
||||||
|
styleLeft12.Alignment = HorizontalAlignment.Left;
|
||||||
|
styleLeft12.VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
ICellStyle styleLine12 = workbook.CreateCellStyle();
|
||||||
|
styleLine12.SetFont(font12);
|
||||||
|
styleLine12.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
|
||||||
|
styleLine12.VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
styleLine12.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
styleLine12.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
styleLine12.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
styleLine12.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
ICellStyle stylein12 = workbook.CreateCellStyle();
|
||||||
|
stylein12.SetFont(font12Times);
|
||||||
|
stylein12.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
|
||||||
|
stylein12.VerticalAlignment = VerticalAlignment.Center;
|
||||||
|
stylein12.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
stylein12.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
stylein12.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
stylein12.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
|
||||||
|
stylein12.WrapText = true;
|
||||||
|
#endregion
|
||||||
|
var Formbody = GetMaxForm(postObject);
|
||||||
|
var sheet = workbook.CreateSheet("綜合報表");
|
||||||
|
int RowPosition = 0;
|
||||||
|
int index = 0;
|
||||||
|
var citycount = Formbody.Result.Data.GroupBy(a => a.CityName).Count();
|
||||||
|
RowPosition = citycount + 6;
|
||||||
|
IRow row;
|
||||||
|
ICell cell;
|
||||||
|
double kwhkwp = 0;
|
||||||
|
double kwp = 0;
|
||||||
|
CellRangeAddress region;
|
||||||
|
List<CityArray> cityArrays = new List<CityArray>();
|
||||||
|
foreach (var form in Formbody.Result.Data)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
row = sheet.CreateRow(RowPosition);
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(form.CityName+form.AreaName);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(form.PowerstationName);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(form.Kwh,2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(form.SolarHour,2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(form.AvgIrradiance,2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(form.AvgPR,2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
kwp += form.Kwh;
|
||||||
|
kwhkwp += form.AvgKWHKWP;
|
||||||
|
RowPosition++;
|
||||||
|
CityArray cityinfo = new CityArray
|
||||||
|
{
|
||||||
|
City = form.CityName,
|
||||||
|
Count = 1,
|
||||||
|
Kwh = form.Kwh,
|
||||||
|
SolarHour = form.SolarHour
|
||||||
|
};
|
||||||
|
if( cityArrays.Where(a=>a.City == form.CityName).Count() > 0)
|
||||||
|
{
|
||||||
|
var city = cityArrays.Where(a => a.City == form.CityName).FirstOrDefault();
|
||||||
|
city.Count += cityinfo.Count;
|
||||||
|
city.Kwh += cityinfo.Kwh;
|
||||||
|
city.SolarHour += cityinfo.SolarHour;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cityArrays.Add(cityinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
RowPosition = citycount + 6;
|
||||||
|
RowPosition--;
|
||||||
|
row = sheet.CreateRow(RowPosition);
|
||||||
|
index = 0;
|
||||||
|
List<string> lasthead = new List<string>()
|
||||||
|
{
|
||||||
|
"區域",
|
||||||
|
"電站名稱",
|
||||||
|
"發電量",
|
||||||
|
"發電小時",
|
||||||
|
"平均日照",
|
||||||
|
"PR"
|
||||||
|
};
|
||||||
|
foreach (var head in lasthead)
|
||||||
|
{
|
||||||
|
sheet.SetColumnWidth(index, 4 * 160 * 8);
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(head);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
RowPosition--;
|
||||||
|
RowPosition -= citycount;
|
||||||
|
var cityRowPosition = RowPosition;
|
||||||
|
index = 0;
|
||||||
|
foreach(var cityArray in cityArrays)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
row = sheet.CreateRow(cityRowPosition);
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(cityArray.City);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round((cityArray.Kwh / cityArray.Count), 2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round((cityArray.SolarHour / cityArray.Count), 2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(cityRowPosition, cityRowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
cityRowPosition++;
|
||||||
|
}
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
RowPosition--;
|
||||||
|
row = sheet.CreateRow(RowPosition);
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue("縣市");
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue("平均發電量(kWp)");
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue("發電時間(小時)");
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
RowPosition = 0;
|
||||||
|
index = 0;
|
||||||
|
row = sheet.CreateRow(RowPosition);
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue("時間");
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index ++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue("發電量");
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue("有效日照時數");
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RowPosition++;
|
||||||
|
row = sheet.CreateRow(RowPosition);
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(postObject.Time);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(kwp,2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
index ++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.SetCellValue(Math.Round(kwhkwp, 2));
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
region = new CellRangeAddress(RowPosition, RowPosition, index, index + 1);
|
||||||
|
sheet.AddMergedRegion(region);
|
||||||
|
index++;
|
||||||
|
cell = row.CreateCell(index);
|
||||||
|
cell.CellStyle = styleLine12;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var ms = new NpoiMemoryStream
|
||||||
|
{
|
||||||
|
AllowClose = false
|
||||||
|
};
|
||||||
|
workbook.Write(ms);
|
||||||
|
ms.Flush();
|
||||||
|
ms.Seek(0, SeekOrigin.Begin);
|
||||||
|
var Datename = postObject.Time.Replace("-", "");
|
||||||
|
return File(ms, "application/vnd.ms-excel", "FIC太陽能監控平台" + "_" + "綜合報表" + "_" + postObject.Userid + Datename + ".xlsx");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ namespace SolarPower.Models
|
|||||||
public string EndAt { get { return Convert.ToDateTime(endAt).ToString("yyyy-MM-dd"); } set { endAt = value; } } //結束時間
|
public string EndAt { get { return Convert.ToDateTime(endAt).ToString("yyyy-MM-dd"); } set { endAt = value; } } //結束時間
|
||||||
public int Kwh { get; set; }//購電度數
|
public int Kwh { get; set; }//購電度數
|
||||||
public float Money { get; set; }//售出金額
|
public float Money { get; set; }//售出金額
|
||||||
|
public int Deleted { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ElectricitySoldRecordTable : ElectricitySoldRecord
|
public class ElectricitySoldRecordTable : ElectricitySoldRecord
|
||||||
|
|||||||
@ -85,13 +85,22 @@ namespace SolarPower.Models
|
|||||||
public string AreaName { get; set; }
|
public string AreaName { get; set; }
|
||||||
public string PowerstationName { get; set; }
|
public string PowerstationName { get; set; }
|
||||||
public int PowerstationId { get; set; }
|
public int PowerstationId { get; set; }
|
||||||
|
public int PowerstationType { get; set; }
|
||||||
public double Kwh { get; set; }
|
public double Kwh { get; set; }
|
||||||
public string PowerstationDB { get; set; }
|
public string PowerstationDB { get; set; }
|
||||||
public double SolarHour { get; set; }
|
public double SolarHour { get; set; }
|
||||||
public double AvgIrradiance { get; set; }
|
public double AvgIrradiance { get; set; }
|
||||||
public double AvgPR { get; set; }
|
public double AvgPR { get; set; }
|
||||||
public double AvgKWHKWP { get; set; }
|
public double AvgKWHKWP { get; set; }
|
||||||
|
public double TodayMoney { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CityArray
|
||||||
|
{
|
||||||
|
public string City { get; set; }
|
||||||
|
public double Kwh { get; set; }
|
||||||
|
public double SolarHour { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
post.Time = post.Time.Replace("-", "~");
|
post.Time = post.Time.Replace("-", "~");
|
||||||
post.Time = post.Time.Replace("/", "-");
|
post.Time = post.Time.Replace("/", "-");
|
||||||
var time = post.Time.Split("~");
|
var time = post.Time.Split("~");
|
||||||
sql = @$"SELECT es.`*`,ps.Name AS PowerStationName FROM electricity_sold_record es
|
sql = @$"SELECT es.*,ps.Name AS PowerStationName FROM electricity_sold_record es
|
||||||
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
||||||
WHERE es.StartAt BETWEEN '{time[0]}' AND '{time[1]}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
WHERE es.StartAt BETWEEN '{time[0]}' AND '{time[1]}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
||||||
break;
|
break;
|
||||||
@ -43,18 +43,17 @@ namespace SolarPower.Repository.Implement
|
|||||||
post.Time = post.Time.Replace("-", "~");
|
post.Time = post.Time.Replace("-", "~");
|
||||||
post.Time = post.Time.Replace("/", "-");
|
post.Time = post.Time.Replace("/", "-");
|
||||||
var time1 = post.Time.Split("~");
|
var time1 = post.Time.Split("~");
|
||||||
sql = @$"SELECT es.`*`,ps.Name AS PowerStationName FROM electricity_sold_record es
|
sql = @$"SELECT es.*,ps.Name AS PowerStationName FROM electricity_sold_record es
|
||||||
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
||||||
WHERE es.StartAt BETWEEN '{time1[0]}' AND '{time1[1]}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
WHERE es.StartAt BETWEEN '{time1[0]}' AND '{time1[1]}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
||||||
sql = "";
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sql = @$"SELECT es.`*`,ps.Name AS PowerStationName FROM electricity_sold_record es
|
sql = @$"SELECT es.*,ps.Name AS PowerStationName FROM electricity_sold_record es
|
||||||
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
||||||
WHERE DATE_FORMAT(es.StartAt , '%Y-%m') = '{post.Time}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
WHERE DATE_FORMAT(es.StartAt , '%Y-%m') = '{post.Time}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sql = @$"SELECT es.`*`,ps.Name AS PowerStationName FROM electricity_sold_record es
|
sql = @$"SELECT es.*,ps.Name AS PowerStationName FROM electricity_sold_record es
|
||||||
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
LEFT JOIN power_station ps ON es.PowerstationId = ps.Id
|
||||||
WHERE DATE_FORMAT(es.StartAt , '%Y') = '{post.Time}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
WHERE DATE_FORMAT(es.StartAt , '%Y') = '{post.Time}' AND es.PowerstationId IN @ids AND es.Deleted = 0";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -265,13 +265,15 @@ namespace SolarPower.Repository.Implement
|
|||||||
a.Name AS 'AreaName',
|
a.Name AS 'AreaName',
|
||||||
ps.Name AS 'PowerstationName',
|
ps.Name AS 'PowerstationName',
|
||||||
ps.SiteDB AS 'PowerstationDB',
|
ps.SiteDB AS 'PowerstationDB',
|
||||||
|
ps.SolarType AS 'PowerstationType',
|
||||||
|
ps.Id as 'PowerStationId',
|
||||||
n.*
|
n.*
|
||||||
FROM power_station ps
|
FROM power_station ps
|
||||||
LEFT JOIN city c ON c.Id = ps.CityId
|
LEFT JOIN city c ON c.Id = ps.CityId
|
||||||
LEFT JOIN area a ON a.Id = ps.AreaId
|
LEFT JOIN area a ON a.Id = ps.AreaId
|
||||||
left JOIN
|
left JOIN
|
||||||
(
|
(
|
||||||
SELECT SUM(a.SolarHour) SolarHour,SUM(a.Kwh) Kwh,AVG(b.PR) AvgPR,AVG(b.KWHKWP) AvgKWHKWP,AVG(c.Irradiance) AvgIrradiance,a.PowerStationId FROM
|
SELECT SUM(a.SolarHour) SolarHour,SUM(a.Kwh) Kwh,AVG(b.PR) AvgPR,AVG(b.KWHKWP) AvgKWHKWP,AVG(c.Irradiance) AvgIrradiance,SUM(b.TodayMoney) as 'TodayMoney',a.PowerStationId FROM
|
||||||
(
|
(
|
||||||
SELECT Max(ps.SOLARHOUR) AS 'SolarHour',MAX(ps.TODAYKWH) 'Kwh' ,DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d ') AS 'time', ps.PowerStationId
|
SELECT Max(ps.SOLARHOUR) AS 'SolarHour',MAX(ps.TODAYKWH) 'Kwh' ,DATE_FORMAT(ps.TIMESTAMP,'%Y-%m-%d ') AS 'time', ps.PowerStationId
|
||||||
FROM power_station_history_hour ps
|
FROM power_station_history_hour ps
|
||||||
@ -280,7 +282,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
) a
|
) a
|
||||||
left JOIN
|
left JOIN
|
||||||
(
|
(
|
||||||
SELECT B.PR ,B.KWHKWP, DATE_FORMAT(A.bb,'%Y-%m-%d') time FROM
|
SELECT B.PR ,B.KWHKWP,B.TODAYMONEY AS 'TodayMoney', DATE_FORMAT(A.bb,'%Y-%m-%d') time FROM
|
||||||
(
|
(
|
||||||
SELECT Max(ps.TIMESTAMP) AS bb FROM power_station_history_hour ps
|
SELECT Max(ps.TIMESTAMP) AS bb FROM power_station_history_hour ps
|
||||||
WHERE ps.PowerStationId IN @ids {wheretime}
|
WHERE ps.PowerStationId IN @ids {wheretime}
|
||||||
|
|||||||
@ -594,7 +594,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Searchform() {
|
function Searchform() {
|
||||||
console.log(selecterd_powerstationId);
|
/* console.log(selecterd_powerstationId);*/
|
||||||
if (searchType == 0 || searchType == 1) {
|
if (searchType == 0 || searchType == 1) {
|
||||||
timerange = $('#DateGettext').val();
|
timerange = $('#DateGettext').val();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -298,6 +298,7 @@
|
|||||||
var nowpowerstation = null;//選擇電站
|
var nowpowerstation = null;//選擇電站
|
||||||
var haveinvertName = [];
|
var haveinvertName = [];
|
||||||
var nowform;
|
var nowform;
|
||||||
|
var xxx;
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
//#region 預設初始值
|
//#region 預設初始值
|
||||||
@ -943,8 +944,16 @@
|
|||||||
FormType: nowform,
|
FormType: nowform,
|
||||||
PowerStation: selecterd_invert
|
PowerStation: selecterd_invert
|
||||||
}
|
}
|
||||||
if (send_data.FormType != null && send_data.PowerStation.length != 0) {
|
if (send_data.FormType != null && send_data.PowerStation.length != 0 && send_data.FormType != 2) {
|
||||||
window.location = "/StationReport/ExportExcel?post=" + JSON.stringify(send_data);
|
window.location = "/StationReport/ExportExcel?post=" + JSON.stringify(send_data);
|
||||||
|
} else {
|
||||||
|
if (send_data.FormType != 2) {
|
||||||
|
toast_warning("請先選擇電站及報表類型");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (send_data.PowerStation.length != 0 && send_data.FormType == 2) {
|
||||||
|
window.location = "/StationReport/ExportExcelmaxtable?post=" + JSON.stringify(send_data);
|
||||||
} else {
|
} else {
|
||||||
toast_warning("請先選擇電站及報表類型");
|
toast_warning("請先選擇電站及報表類型");
|
||||||
}
|
}
|
||||||
@ -974,6 +983,12 @@
|
|||||||
}
|
}
|
||||||
//下方
|
//下方
|
||||||
$.each(rel.data, function (index, data) {
|
$.each(rel.data, function (index, data) {
|
||||||
|
var hirerate = 0;
|
||||||
|
if (data.powerstationType == 1)
|
||||||
|
{
|
||||||
|
hirerate = hire(data.powerstationDB, data.powerstationId);
|
||||||
|
}
|
||||||
|
|
||||||
var cityinfo = {
|
var cityinfo = {
|
||||||
city: data.cityName,
|
city: data.cityName,
|
||||||
kwp: data.kwh,
|
kwp: data.kwh,
|
||||||
@ -1007,6 +1022,16 @@
|
|||||||
StrInfoBody += "<td>" + data.solarHour.toFixed(2) + "</td>";
|
StrInfoBody += "<td>" + data.solarHour.toFixed(2) + "</td>";
|
||||||
StrInfoBody += "<td>" + data.avgIrradiance.toFixed(2) + "</td>";
|
StrInfoBody += "<td>" + data.avgIrradiance.toFixed(2) + "</td>";
|
||||||
StrInfoBody += "<td>" + data.avgPR.toFixed(2) + "</td>";
|
StrInfoBody += "<td>" + data.avgPR.toFixed(2) + "</td>";
|
||||||
|
if (showmoney == 1) {
|
||||||
|
StrInfoBody += "<td>" + data.todayMoney.toFixed(2) + "</td>";
|
||||||
|
|
||||||
|
StrInfoBody += "<td>" + (data.todayMoney * hirerate * 0.01).toFixed(2)+ "</td>";
|
||||||
|
|
||||||
|
StrInfoBody += "<td>" + data.todayMoney.toFixed(2) + "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
StrInfoBody += "</tr>";
|
StrInfoBody += "</tr>";
|
||||||
kwp += data.kwh;
|
kwp += data.kwh;
|
||||||
kwhkwp += data.avgKWHKWP;
|
kwhkwp += data.avgKWHKWP;
|
||||||
@ -1051,5 +1076,61 @@
|
|||||||
nowform = 2;
|
nowform = 2;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function hire(db, id)
|
||||||
|
{
|
||||||
|
var hirerate = 0;
|
||||||
|
var dataTosent =
|
||||||
|
{
|
||||||
|
Sitedb: db,
|
||||||
|
PowerstationId: id
|
||||||
|
}
|
||||||
|
var posturl = "/StationReport/GetHireInfo";
|
||||||
|
$.ajax({
|
||||||
|
url: posturl,
|
||||||
|
type: "POST",//'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
data: dataTosent, // 輸入的資料
|
||||||
|
cache: false,
|
||||||
|
async: false,
|
||||||
|
success: function (response) {
|
||||||
|
$.each(response.data, function (index, value) {
|
||||||
|
hirerate += Number(value.leaseRate);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//await $.post(posturl, dataTosent, function (rel) {
|
||||||
|
|
||||||
|
// if (rel.code != "0000") {
|
||||||
|
// out_reject();
|
||||||
|
// toast_error(rel.data.msg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}).promise();
|
||||||
|
|
||||||
|
return hirerate;
|
||||||
|
//return new Promise(function (out_resolve, out_reject) {
|
||||||
|
// $.post(posturl, dataTosent, function (rel) {
|
||||||
|
|
||||||
|
// if (rel.code != "0000") {
|
||||||
|
// out_reject();
|
||||||
|
// toast_error(rel.data.msg);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// $.each(rel.data, function (index, value) {
|
||||||
|
// hirerate += Number(value.leaseRate);
|
||||||
|
// })
|
||||||
|
// out_resolve(hirerate);
|
||||||
|
// })
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
@ -7,26 +7,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"LoginExpireMinute": 60, //登入到期時間,單位(分)
|
"LoginExpireMinute": 60, //登入到期時間,單位(分)
|
||||||
//"DBConfig": {
|
|
||||||
// "Server": "MVgHWzR3rGDgD57TUoFunA==",
|
|
||||||
// "port": "r4AoXMUDodcQjIzofGNCcg==",
|
|
||||||
// "Database": "z8TVtiXZ6MwgWbUEAOXA/fiHzd7c0iUhFqn1mHzxhKo=",
|
|
||||||
// "Root": "mWlR2HshQNhRRE34jg4kdg==",
|
|
||||||
// "Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
|
||||||
//},
|
|
||||||
"DBConfig": {
|
"DBConfig": {
|
||||||
"Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
|
"Server": "MVgHWzR3rGDgD57TUoFunA==",
|
||||||
"port": "CrEmevYrUsSo7Mkb7Gxn8A==",
|
"port": "r4AoXMUDodcQjIzofGNCcg==",
|
||||||
"Database": "CEyYZnO8B5+yTXQcFSsiBA==",
|
"Database": "z8TVtiXZ6MwgWbUEAOXA/fiHzd7c0iUhFqn1mHzxhKo=",
|
||||||
"Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
|
"Root": "mWlR2HshQNhRRE34jg4kdg==",
|
||||||
"Password": "8WMHBEWuT0XoAB4kzduQHA=="
|
"Password": "y4uPqlH9ncTgR/I07qpwaA=="
|
||||||
},
|
},
|
||||||
|
//"DBConfig": {
|
||||||
|
// "Server": "AVXfxd+IRlLtJ0MCi9HU1g==",
|
||||||
|
// "port": "CrEmevYrUsSo7Mkb7Gxn8A==",
|
||||||
|
// "Database": "CEyYZnO8B5+yTXQcFSsiBA==",
|
||||||
|
// "Root": "Aph7AzoiwAmmBHCfS1rqeQ==",
|
||||||
|
// "Password": "8WMHBEWuT0XoAB4kzduQHA=="
|
||||||
|
//},
|
||||||
"BackgroundServiceCron": {
|
"BackgroundServiceCron": {
|
||||||
"CalcPowerStationJob": "0 5 * * * ?",
|
"CalcPowerStationJob": "0 5 * * * ?",
|
||||||
"CalcAvgPowerStationJob": "0 0 2 * * ?",
|
"CalcAvgPowerStationJob": "0 0 2 * * ?",
|
||||||
"OperationScheduleJob": "0 0 2 * * ?",
|
"OperationScheduleJob": "0 0 2 * * ?",
|
||||||
"CalcInverter15minJob": "0 2/15 * * * ?",
|
"CalcInverter15minJob": "0 2/15 * * * ?",
|
||||||
"SendEmailJob": "0/10 * * * * ?"
|
"SendEmailJob": "0 0 3 * * ?"
|
||||||
},
|
},
|
||||||
"SMTPConfig": {
|
"SMTPConfig": {
|
||||||
"Host": "smtp.gmail.com",
|
"Host": "smtp.gmail.com",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user