Merge branch 'master' of https://github.com/shanghohui-Company/SolarPower
This commit is contained in:
commit
993f670a1b
@ -38,7 +38,7 @@ namespace SolarPower.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
powerStations = await powerStationRepository.GetPowerStationsByCompanyId(myUser.CompanyId);
|
powerStations = await powerStationRepository.GetPowerStationsByCompanyId(myUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
var siteDBNamePowerStationId = new Dictionary<string, List<int>>();
|
var siteDBNamePowerStationId = new Dictionary<string, List<int>>();
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace SolarPower.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
powerStations = await powerStationRepository.GetPowerStationsByCompanyId(myUser.CompanyId);
|
powerStations = await powerStationRepository.GetPowerStationsByCompanyId(myUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
var siteDBNamePowerStationId = new Dictionary<string, List<int>>();
|
var siteDBNamePowerStationId = new Dictionary<string, List<int>>();
|
||||||
@ -51,7 +51,7 @@ namespace SolarPower.Controllers
|
|||||||
|
|
||||||
var powerStationDevices = await powerStationRepository.GetPowerStationDevice(siteDBNamePowerStationId, filter);
|
var powerStationDevices = await powerStationRepository.GetPowerStationDevice(siteDBNamePowerStationId, filter);
|
||||||
|
|
||||||
powerStationDevices = powerStationDevices.Where(x => x.DeviceId != null).ToList();
|
//powerStationDevices = powerStationDevices.Where(x => x.DeviceId != null).ToList();
|
||||||
|
|
||||||
var powerStationDevice_cityName_Group = powerStationDevices.GroupBy(x => x.CityName).ToList();
|
var powerStationDevice_cityName_Group = powerStationDevices.GroupBy(x => x.CityName).ToList();
|
||||||
|
|
||||||
@ -78,9 +78,12 @@ namespace SolarPower.Controllers
|
|||||||
var temp = new List<PowerStationDevice>();
|
var temp = new List<PowerStationDevice>();
|
||||||
temp.Add(powerStation);
|
temp.Add(powerStation);
|
||||||
foreach (var device in psName_Group)
|
foreach (var device in psName_Group)
|
||||||
|
{
|
||||||
|
if(!string.IsNullOrEmpty(device.DeviceId))
|
||||||
{
|
{
|
||||||
temp.Add(device);
|
temp.Add(device);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
deviceDic.Add(psName_Group.Key, temp);
|
deviceDic.Add(psName_Group.Key, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2032,8 +2032,24 @@ namespace SolarPower.Controllers
|
|||||||
solaramount = await powerStationRepository.GetSolarByCity(myUser, cityid);
|
solaramount = await powerStationRepository.GetSolarByCity(myUser, cityid);
|
||||||
|
|
||||||
foreach (var solar in solaramount)
|
foreach (var solar in solaramount)
|
||||||
|
{
|
||||||
|
//判斷該檔案是否存在
|
||||||
|
if (!string.IsNullOrEmpty(solar.MainDisplay))
|
||||||
|
{
|
||||||
|
var fullFilePath = Directory.GetCurrentDirectory() + "/wwwroot" + Path.Combine(stationImageFilePath, solar.Id.ToString()) + "/" + solar.MainDisplay;
|
||||||
|
if (System.IO.File.Exists(fullFilePath))
|
||||||
{
|
{
|
||||||
solar.MainDisplay = Path.Combine(stationImageFilePath, solar.Id.ToString()) + "/" + solar.MainDisplay;
|
solar.MainDisplay = Path.Combine(stationImageFilePath, solar.Id.ToString()) + "/" + solar.MainDisplay;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
solar.MainDisplay = Path.Combine("img", "blank.gif");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
solar.MainDisplay = Path.Combine("img", "blank.gif");
|
||||||
|
}
|
||||||
List<int> deviceControllerid = await powerStationRepository.GetAllDeviceControllerId(solar.Id, solar.SiteDB);
|
List<int> deviceControllerid = await powerStationRepository.GetAllDeviceControllerId(solar.Id, solar.SiteDB);
|
||||||
var InverterTable = await powerStationRepository.InverterTable(deviceControllerid, solar.SiteDB);
|
var InverterTable = await powerStationRepository.InverterTable(deviceControllerid, solar.SiteDB);
|
||||||
solar.InverterAmount = InverterTable.Count;
|
solar.InverterAmount = InverterTable.Count;
|
||||||
|
|||||||
@ -6,11 +6,11 @@ using SolarPower.Models.PowerStation;
|
|||||||
using SolarPower.Repository.Interface;
|
using SolarPower.Repository.Interface;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace SolarPower.Controllers
|
namespace SolarPower.Controllers
|
||||||
{
|
{
|
||||||
@ -51,9 +51,25 @@ namespace SolarPower.Controllers
|
|||||||
solaramount = await overviewRepository.GetSolarByCity(myUser, post);
|
solaramount = await overviewRepository.GetSolarByCity(myUser, post);
|
||||||
|
|
||||||
foreach (var solar in solaramount)
|
foreach (var solar in solaramount)
|
||||||
|
{
|
||||||
|
//判斷該檔案是否存在
|
||||||
|
if (!string.IsNullOrEmpty(solar.MainDisplay))
|
||||||
|
{
|
||||||
|
var fullFilePath = Directory.GetCurrentDirectory() + "/wwwroot" + Path.Combine(stationImageFilePath, solar.Id.ToString()) + "/" + solar.MainDisplay;
|
||||||
|
if (System.IO.File.Exists(fullFilePath))
|
||||||
{
|
{
|
||||||
solar.MainDisplay = Path.Combine(stationImageFilePath, solar.Id.ToString()) + "/" + solar.MainDisplay;
|
solar.MainDisplay = Path.Combine(stationImageFilePath, solar.Id.ToString()) + "/" + solar.MainDisplay;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
solar.MainDisplay = Path.Combine("img", "blank.gif");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
solar.MainDisplay = Path.Combine("img", "blank.gif");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
apiResult.Data = solaramount;
|
apiResult.Data = solaramount;
|
||||||
}
|
}
|
||||||
@ -438,7 +454,7 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
a.Function = @$"<a href='javascript:;' class='waves-effect waves-themed mb-3 mr-2 edit-btn'>{a.FormId}</a>";
|
a.Function = @$"<a href='javascript:;' class='waves-effect waves-themed mb-3 mr-2 edit-btn'>{a.FormId}</a>";
|
||||||
}
|
}
|
||||||
if(a.NormalTime == "1970-01-01 08:00:00")
|
if (a.NormalTime == "1970-01-01 08:00:00")
|
||||||
{
|
{
|
||||||
a.NormalTime = "";
|
a.NormalTime = "";
|
||||||
}
|
}
|
||||||
@ -491,12 +507,12 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
|
|
||||||
List<double> values = new List<double>();
|
List<double> values = new List<double>();
|
||||||
foreach(var lable in inverterkwhBar.Labels)
|
foreach (var lable in inverterkwhBar.Labels)
|
||||||
{
|
{
|
||||||
var find = false;
|
var find = false;
|
||||||
foreach (var value in inverterHistory)
|
foreach (var value in inverterHistory)
|
||||||
{
|
{
|
||||||
if(value.TIMESTAMP == lable)
|
if (value.TIMESTAMP == lable)
|
||||||
{
|
{
|
||||||
values.Add(value.KWH);
|
values.Add(value.KWH);
|
||||||
find = true;
|
find = true;
|
||||||
|
|||||||
@ -1212,5 +1212,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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
|
|
||||||
if (this.environment.IsDevelopment())
|
if (this.environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
dateTime = DateTimeNow.AddHours(-1).ToString("yyyy-MM-dd HH");
|
dateTime = "2021-08-06 10";
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation("【CalcPowerStationJob】【任務開始】");
|
logger.LogInformation("【CalcPowerStationJob】【任務開始】");
|
||||||
@ -170,10 +170,22 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
history.CARBON = history.KWH * carbonRate;
|
history.CARBON = history.KWH * carbonRate;
|
||||||
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
//總減碳量(總發電量 * (0.554/1000)[抓資料庫值]
|
||||||
calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate;
|
calcPowerStation.Total_Carbon = history.TotalKWH * carbonRate;
|
||||||
|
|
||||||
|
if(lastmoneyhistorybyhour != null)
|
||||||
|
{
|
||||||
history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate;
|
history.TODAYCARBON = lastmoneyhistorybyhour.TODAYCARBON + history.KWH * carbonRate;
|
||||||
history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate;
|
history.TOTALCARBON = lastmoneyhistorybyhour.TOTALCARBON + history.KWH * carbonRate;
|
||||||
history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
history.TODAYMONEY = lastmoneyhistorybyhour.TODAYMONEY + history.KWH * powerStation.PowerRate;
|
||||||
history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
history.TOTALMONEY = lastmoneyhistorybyhour.TOTALMONEY + history.KWH * powerStation.PowerRate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
history.TODAYCARBON = history.KWH * carbonRate;
|
||||||
|
history.TOTALCARBON = history.KWH * carbonRate;
|
||||||
|
history.TODAYMONEY = history.KWH * powerStation.PowerRate;
|
||||||
|
history.TOTALMONEY = history.KWH * powerStation.PowerRate;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 發電時間
|
#region 發電時間
|
||||||
@ -347,6 +359,8 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
if (!this.environment.IsDevelopment())
|
||||||
|
{
|
||||||
#region step3. 將historiers INSERT 到 power_station_history_hour 資料表
|
#region step3. 將historiers INSERT 到 power_station_history_hour 資料表
|
||||||
List<string> history_properties = new List<string>()
|
List<string> history_properties = new List<string>()
|
||||||
{
|
{
|
||||||
@ -480,7 +494,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
await powerStationRepository.AddInverterHistory(inverterHistories, inverter_history_properties);
|
await powerStationRepository.AddInverterHistory(inverterHistories, inverter_history_properties);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region step6. 將 sensoravg INSERT 到 sensoravg_history_hour 資料表
|
#region step7. 將 sensoravg INSERT 到 sensoravg_history_hour 資料表
|
||||||
List<string> sensoravg_history_properties = new List<string>()
|
List<string> sensoravg_history_properties = new List<string>()
|
||||||
{
|
{
|
||||||
"PowerStationId",
|
"PowerStationId",
|
||||||
@ -540,6 +554,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
await powerStationRepository.AddSensorAvgHistory(sensorAvgHistoryHour, sensoravg_history_properties);
|
await powerStationRepository.AddSensorAvgHistory(sensorAvgHistoryHour, sensoravg_history_properties);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region step8. 新增天氣資訊
|
||||||
List<string> weather_observation_properties = new List<string>()
|
List<string> weather_observation_properties = new List<string>()
|
||||||
{
|
{
|
||||||
"PowerStationId",
|
"PowerStationId",
|
||||||
@ -547,6 +562,10 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
"Temp"
|
"Temp"
|
||||||
};
|
};
|
||||||
await powerStationRepository.AddWeatherObservation(weatherObservations, weather_observation_properties);
|
await powerStationRepository.AddWeatherObservation(weatherObservations, weather_observation_properties);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger.LogInformation("【CalcPowerStationJob】【任務完成】");
|
logger.LogInformation("【CalcPowerStationJob】【任務完成】");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -3710,16 +3710,26 @@ namespace SolarPower.Repository.Implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<PowerStation>> GetPowerStationsByCompanyId(int companyId)
|
public async Task<List<PowerStation>> GetPowerStationsByCompanyId(MyUser myUser)
|
||||||
{
|
{
|
||||||
List<PowerStation> result;
|
List<PowerStation> result;
|
||||||
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
using (IDbConnection conn = this._databaseHelper.GetConnection())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0 AND CompanyId = @CompanyId";
|
var sql = $"SELECT * FROM {tableName} ps";
|
||||||
|
|
||||||
result = (await conn.QueryAsync<PowerStation>(sql, new { CompanyId = companyId })).ToList();
|
if (myUser.Role.Layer == 2)
|
||||||
|
{
|
||||||
|
sql += " WHERE ps.Deleted = 0 AND ps.CompanyId = @CompanyId ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql += @" LEFT JOIN power_station_operation_personnel op ON ps.Id = op.PowerStationId
|
||||||
|
WHERE ps.Deleted = 0 AND op.Deleted = 0 AND op.UserId = @UserId ";
|
||||||
|
}
|
||||||
|
|
||||||
|
result = (await conn.QueryAsync<PowerStation>(sql, new { CompanyId = myUser.CompanyId, UserId = myUser.Id })).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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}
|
||||||
|
|||||||
@ -546,7 +546,7 @@ namespace SolarPower.Repository.Interface
|
|||||||
Task<SensorAvgHistory> CalcSensorAvgHistoryMonthDataByPowerStationId(string month, int powerStationId);
|
Task<SensorAvgHistory> CalcSensorAvgHistoryMonthDataByPowerStationId(string month, int powerStationId);
|
||||||
Task<int> AddSensorAvgHistoryMonthList(List<SensorAvgHistory> entity, List<string> properties);
|
Task<int> AddSensorAvgHistoryMonthList(List<SensorAvgHistory> entity, List<string> properties);
|
||||||
Task<int> UpdateSensorAvgHistoryMonthList(List<SensorAvgHistory> entity);
|
Task<int> UpdateSensorAvgHistoryMonthList(List<SensorAvgHistory> entity);
|
||||||
Task<List<PowerStation>> GetPowerStationsByCompanyId(int companyId);
|
Task<List<PowerStation>> GetPowerStationsByCompanyId(MyUser myUser);
|
||||||
Task<List<PowerStationInverter>> GetPowerStationInverter(Dictionary<string, List<int>> dic, string filter);
|
Task<List<PowerStationInverter>> GetPowerStationInverter(Dictionary<string, List<int>> dic, string filter);
|
||||||
Task<List<PowerStationDevice>> GetPowerStationDevice(Dictionary<string, List<int>> dic, string filter);
|
Task<List<PowerStationDevice>> GetPowerStationDevice(Dictionary<string, List<int>> dic, string filter);
|
||||||
Task<List<InverterHistory>> GetInverterHistoryRowData(string nowDay, List<StationCodeWithInverterIds> entities);
|
Task<List<InverterHistory>> GetInverterHistoryRowData(string nowDay, List<StationCodeWithInverterIds> entities);
|
||||||
|
|||||||
@ -21,7 +21,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto px-0">
|
<div class="col-auto px-0">
|
||||||
<a href="javascript:;" id="collapse" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;"><i onclick="myfunc(this)" class="fal fa-angle-right fa-lg py-3"></i></a>
|
<a href="javascript:;" id="collapse" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;" aria-expanded="true">
|
||||||
|
<span class="collapsed-reveal"><i class="fal fa-angle-left fa-lg py-3"></i></span>
|
||||||
|
<span class="collapsed-hidden"><i class="fal fa-angle-right fa-lg py-3"></i></span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main class="col px-5 pl-md-2 main">
|
<main class="col px-5 pl-md-2 main">
|
||||||
@ -217,7 +220,7 @@
|
|||||||
PushSpecifyCurrentCompareCol(Single_day_compare_col);
|
PushSpecifyCurrentCompareCol(Single_day_compare_col);
|
||||||
})
|
})
|
||||||
|
|
||||||
function myfunc(div) {
|
@*function myfunc(div) {
|
||||||
var className = div.getAttribute("class");
|
var className = div.getAttribute("class");
|
||||||
if (className == "fal fa-angle-left fa-lg py-3") {
|
if (className == "fal fa-angle-left fa-lg py-3") {
|
||||||
div.className = "fal fa-angle-right fa-lg py-3";
|
div.className = "fal fa-angle-right fa-lg py-3";
|
||||||
@ -225,7 +228,7 @@
|
|||||||
else {
|
else {
|
||||||
div.className = "fal fa-angle-left fa-lg py-3";
|
div.className = "fal fa-angle-left fa-lg py-3";
|
||||||
}
|
}
|
||||||
}
|
}*@
|
||||||
|
|
||||||
//#region 更換搜尋條件(日,日區間,月,年)
|
//#region 更換搜尋條件(日,日區間,月,年)
|
||||||
function changeType(type, e) {
|
function changeType(type, e) {
|
||||||
|
|||||||
@ -25,7 +25,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto px-0">
|
<div class="col-auto px-0">
|
||||||
<a href="javascript:;" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;"><i onclick="myfunc(this)" class="fal fa-angle-right fa-lg py-3" id="collapse"></i></a>
|
<a href="javascript:;" id="collapse" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;" aria-expanded="true">
|
||||||
|
<span class="collapsed-reveal"><i class="fal fa-angle-left fa-lg py-3"></i></span>
|
||||||
|
<span class="collapsed-hidden"><i class="fal fa-angle-right fa-lg py-3"></i></span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main class="col px-5 pl-md-2 main">
|
<main class="col px-5 pl-md-2 main">
|
||||||
@ -591,7 +594,7 @@
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 左邊的搜索欄位
|
//#region 左邊的搜索欄位
|
||||||
function myfunc(div) {
|
@*function myfunc(div) {
|
||||||
var className = div.getAttribute("class");
|
var className = div.getAttribute("class");
|
||||||
if (className == "fal fa-angle-left fa-lg py-3") {
|
if (className == "fal fa-angle-left fa-lg py-3") {
|
||||||
div.className = "fal fa-angle-right fa-lg py-3";
|
div.className = "fal fa-angle-right fa-lg py-3";
|
||||||
@ -599,7 +602,7 @@
|
|||||||
else {
|
else {
|
||||||
div.className = "fal fa-angle-left fa-lg py-3";
|
div.className = "fal fa-angle-left fa-lg py-3";
|
||||||
}
|
}
|
||||||
}
|
}*@
|
||||||
|
|
||||||
$("#js_list_accordion_filter").change(function (e) {
|
$("#js_list_accordion_filter").change(function (e) {
|
||||||
GetPowerStationCollapse($(this).val());
|
GetPowerStationCollapse($(this).val());
|
||||||
|
|||||||
@ -21,7 +21,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto px-0">
|
<div class="col-auto px-0">
|
||||||
<a href="javascript:;" id="collapse" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;"><i onclick="myfunc(this)" class="fal fa-angle-right fa-lg py-3"></i></a>
|
<a href="javascript:;" id="collapse" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;" aria-expanded="true">
|
||||||
|
<span class="collapsed-reveal"><i class="fal fa-angle-left fa-lg py-3"></i></span>
|
||||||
|
<span class="collapsed-hidden"><i class="fal fa-angle-right fa-lg py-3"></i></span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main class="col px-5 pl-md-2 main">
|
<main class="col px-5 pl-md-2 main">
|
||||||
@ -166,7 +169,7 @@
|
|||||||
//#endregion
|
//#endregion
|
||||||
})
|
})
|
||||||
|
|
||||||
function myfunc(div) {
|
@*function myfunc(div) {
|
||||||
var className = div.getAttribute("class");
|
var className = div.getAttribute("class");
|
||||||
if (className == "fal fa-angle-left fa-lg py-3") {
|
if (className == "fal fa-angle-left fa-lg py-3") {
|
||||||
div.className = "fal fa-angle-right fa-lg py-3";
|
div.className = "fal fa-angle-right fa-lg py-3";
|
||||||
@ -174,7 +177,7 @@
|
|||||||
else {
|
else {
|
||||||
div.className = "fal fa-angle-left fa-lg py-3";
|
div.className = "fal fa-angle-left fa-lg py-3";
|
||||||
}
|
}
|
||||||
}
|
}*@
|
||||||
|
|
||||||
//#region 更換搜尋條件(日,日區間,月,年)
|
//#region 更換搜尋條件(日,日區間,月,年)
|
||||||
function changeType(type, e) {
|
function changeType(type, e) {
|
||||||
@ -444,7 +447,7 @@
|
|||||||
|
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
toast_error(rel.data.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -187,7 +187,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row align-items-end">
|
||||||
@*
|
@*
|
||||||
<div class="col-xl-6">
|
<div class="col-xl-6">
|
||||||
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">逆變器</h5>
|
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">逆變器</h5>
|
||||||
@ -216,31 +216,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
*@
|
*@
|
||||||
<div class="col-xl-6">
|
<div class="col-xl-8">
|
||||||
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
|
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
|
||||||
<div class="row d-flex justify-content-between px-5">
|
<div class="row d-flex justify-content-between px-5">
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_brand_label" for="photovoltaic_panel_brand">廠牌</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_brand_label" for="photovoltaic_panel_brand">廠牌</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_brand_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_brand_text" class="color-info-600"></label>
|
||||||
<input type="text" id="photovoltaic_panel_brand" name="photovoltaic_panel_brand" class="form-control">
|
<input type="text" id="photovoltaic_panel_brand" name="photovoltaic_panel_brand" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_specification_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_specification_text" class="color-info-600"></label>
|
||||||
<input type="text" id="photovoltaic_panel_specification" name="photovoltaic_panel_specification" class="form-control">
|
<input type="text" id="photovoltaic_panel_specification" name="photovoltaic_panel_specification" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_amount_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_amount_text" class="color-info-600"></label>
|
||||||
<input type="number" step="1" id="photovoltaic_panel_amount" name="photovoltaic_panel_amount" class="form-control">
|
<input type="number" step="1" id="photovoltaic_panel_amount" name="photovoltaic_panel_amount" class="form-control">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_product_model_label" for="photovoltaic_panel_product_model">型號</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_product_model_label" for="photovoltaic_panel_product_model">型號</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_product_model_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_product_model_text" class="color-info-600"></label>
|
||||||
|
|||||||
@ -2403,33 +2403,7 @@
|
|||||||
pointHoverRadius: 5,
|
pointHoverRadius: 5,
|
||||||
fill: false,
|
fill: false,
|
||||||
data: listtemperature
|
data: listtemperature
|
||||||
},{
|
}, {
|
||||||
type: 'line',
|
|
||||||
label: 'PR(%)',
|
|
||||||
yAxisID: 'D',
|
|
||||||
borderColor: 'rgba(68, 114, 196)',
|
|
||||||
pointBackgroundColor: 'rgb(68, 114, 196)',
|
|
||||||
pointBorderColor: 'rgb(68, 114, 196)',
|
|
||||||
pointBorderWidth: 1,
|
|
||||||
borderWidth: 2,
|
|
||||||
pointRadius: 4,
|
|
||||||
pointHoverRadius: 5,
|
|
||||||
fill: false,
|
|
||||||
data: listpr
|
|
||||||
},{
|
|
||||||
type: 'line',
|
|
||||||
label: '發電小時',
|
|
||||||
yAxisID: 'C',
|
|
||||||
borderColor: 'rgba(165, 165, 165)',
|
|
||||||
pointBackgroundColor: 'rgb(165, 165, 165)',
|
|
||||||
pointBorderColor: 'rgb(165, 165, 165)',
|
|
||||||
pointBorderWidth: 1,
|
|
||||||
borderWidth: 2,
|
|
||||||
pointRadius: 4,
|
|
||||||
pointHoverRadius: 5,
|
|
||||||
fill: false,
|
|
||||||
data: listsolarhour
|
|
||||||
},{
|
|
||||||
type: 'line',
|
type: 'line',
|
||||||
label: '日照度(kWh/㎡)',
|
label: '日照度(kWh/㎡)',
|
||||||
yAxisID: 'B',
|
yAxisID: 'B',
|
||||||
@ -2442,7 +2416,21 @@
|
|||||||
pointHoverRadius: 5,
|
pointHoverRadius: 5,
|
||||||
fill: false,
|
fill: false,
|
||||||
data: listirradiance
|
data: listirradiance
|
||||||
}, {
|
},{
|
||||||
|
type: 'bar',
|
||||||
|
label: 'PR(%)',
|
||||||
|
yAxisID: 'D',
|
||||||
|
backgroundColor: 'rgba(68, 114, 196)',
|
||||||
|
borderWidth: 1,
|
||||||
|
data: listpr
|
||||||
|
},{
|
||||||
|
type: 'bar',
|
||||||
|
label: '發電小時',
|
||||||
|
yAxisID: 'C',
|
||||||
|
backgroundColor: 'rgba(165, 165, 165)',
|
||||||
|
borderWidth: 1,
|
||||||
|
data: listsolarhour
|
||||||
|
},{
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
backgroundColor: 'rgba(103, 180, 172, 1)',
|
backgroundColor: 'rgba(103, 180, 172, 1)',
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
|
|||||||
@ -157,29 +157,29 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row align-items-end">
|
||||||
<div class="col-xl-6">
|
<div class="col-xl-8">
|
||||||
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
|
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
|
||||||
<div class="row d-flex justify-content-between px-5">
|
<div class="row d-flex justify-content-between px-5">
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_brand_label" for="photovoltaic_panel_brand">廠牌</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_brand_label" for="photovoltaic_panel_brand">廠牌</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_brand_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_brand_text" class="color-info-600"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_specification_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_specification_text" class="color-info-600"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_amount_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_amount_text" class="color-info-600"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 mb-3 row">
|
<div class="col-xl-3 mb-3 row">
|
||||||
<label class="col-xl-4 form-label" id="photovoltaic_panel_product_model_label" for="photovoltaic_panel_product_model">型號</label>
|
<label class="col-xl-4 form-label" id="photovoltaic_panel_product_model_label" for="photovoltaic_panel_product_model">型號</label>
|
||||||
<div class="col-xl-8">
|
<div class="col-xl-8">
|
||||||
<label id="photovoltaic_panel_product_model_text" class="color-info-600"></label>
|
<label id="photovoltaic_panel_product_model_text" class="color-info-600"></label>
|
||||||
|
|||||||
@ -166,7 +166,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto px-0">
|
<div class="col-auto px-0">
|
||||||
<a href="javascript:;" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;"><i onclick="myfunc(this)" class="fal fa-angle-right fa-lg py-3" id="collapse"></i></a>
|
<a href="javascript:;" id="collapse" data-target=".sidebar" data-toggle="collapse" class="btn btn-default btn-xs btn-icon waves-effect waves-themed" style="border-radius: 0;" aria-expanded="true">
|
||||||
|
<span class="collapsed-reveal"><i class="fal fa-angle-left fa-lg py-3"></i></span>
|
||||||
|
<span class="collapsed-hidden"><i class="fal fa-angle-right fa-lg py-3"></i></span>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main class="col px-5 pl-md-2 main">
|
<main class="col px-5 pl-md-2 main">
|
||||||
@ -298,6 +301,7 @@
|
|||||||
var nowpowerstation = null;//選擇電站
|
var nowpowerstation = null;//選擇電站
|
||||||
var haveinvertName = [];
|
var haveinvertName = [];
|
||||||
var nowform;
|
var nowform;
|
||||||
|
var xxx;
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
//#region 預設初始值
|
//#region 預設初始值
|
||||||
@ -513,7 +517,7 @@
|
|||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region 左邊的搜索欄位
|
//#region 左邊的搜索欄位
|
||||||
function myfunc(div) {
|
@*function myfunc(div) {
|
||||||
var className = div.getAttribute("class");
|
var className = div.getAttribute("class");
|
||||||
if (className == "fal fa-angle-left fa-lg py-3") {
|
if (className == "fal fa-angle-left fa-lg py-3") {
|
||||||
div.className = "fal fa-angle-right fa-lg py-3";
|
div.className = "fal fa-angle-right fa-lg py-3";
|
||||||
@ -521,7 +525,7 @@
|
|||||||
else {
|
else {
|
||||||
div.className = "fal fa-angle-left fa-lg py-3";
|
div.className = "fal fa-angle-left fa-lg py-3";
|
||||||
}
|
}
|
||||||
}
|
}*@
|
||||||
|
|
||||||
$("#js_list_accordion_filter").change(function (e) {
|
$("#js_list_accordion_filter").change(function (e) {
|
||||||
GetPowerStationCollapse($(this).val());
|
GetPowerStationCollapse($(this).val());
|
||||||
@ -943,8 +947,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 +986,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 +1025,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 +1079,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>
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user