衝突合併

This commit is contained in:
Kai 2021-07-30 20:12:40 +08:00
commit 8c51ec5e04
12 changed files with 309 additions and 77 deletions

View File

@ -385,6 +385,10 @@ 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")
{
a.NormalTime = "";
}
} }
apiResult.Code = "0000"; apiResult.Code = "0000";
@ -430,6 +434,10 @@ 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")
{
a.NormalTime = "";
}
} }
apiResult.Code = "0000"; apiResult.Code = "0000";

View File

@ -75,10 +75,10 @@ namespace SolarPower.Controllers
return apiResult; return apiResult;
} }
public async Task<ApiResult<List<string>>> GetTableHead(Select_table post) public async Task<ApiResult<InvAndMoney>> GetTableHead(Select_table post)
{ {
ApiResult<List<string>> apiResult = new ApiResult<List<string>>(); ApiResult<InvAndMoney> apiResult = new ApiResult<InvAndMoney>();
List<string> inverter = new List<string>(); InvAndMoney inverter = new InvAndMoney();
try try
{ {
var powerStation = await powerStationRepository.GetOneAsync(post.PowerStation); var powerStation = await powerStationRepository.GetOneAsync(post.PowerStation);
@ -88,10 +88,17 @@ namespace SolarPower.Controllers
apiResult.Msg = "需加入查詢電站"; apiResult.Msg = "需加入查詢電站";
return apiResult; return apiResult;
} }
inverter = await stationReportRepository.GetInverterId(powerStation.SiteDB,post); inverter.Inv = await stationReportRepository.GetInverterId(powerStation.SiteDB,post);
for (int i = 0;i<inverter.Count;i++) for (int i = 0;i<inverter.Inv.Count;i++)
{ {
inverter[i] = "inv_" + inverter[i].Substring(inverter[i].Length - 4, 4); inverter.Inv[i] = "inv_" + inverter.Inv[i].Substring(inverter.Inv[i].Length - 4, 4);
}
if (myUser.Role.Auths.Contains("ShowMoney"))
{
inverter.ShowMoney = 1;
}else
{
inverter.ShowMoney = 0;
} }
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Data = inverter; apiResult.Data = inverter;
@ -194,7 +201,7 @@ namespace SolarPower.Controllers
sheet.SetColumnWidth(index, 4 * 160 * 8); sheet.SetColumnWidth(index, 4 * 160 * 8);
index++; index++;
foreach (var head in Formhead.Result.Data) foreach (var head in Formhead.Result.Data.Inv)
{ {
cell = row.CreateCell(index); cell = row.CreateCell(index);
cell.SetCellValue(head); cell.SetCellValue(head);
@ -203,14 +210,19 @@ namespace SolarPower.Controllers
index++; index++;
} }
string[] lasthead = List<string> lasthead = new List<string>()
{ {
"小時發電量(kWh)", "小時發電量(kWh)",
"小時發電量百分比(%)", "小時發電量百分比(%)",
"小時平均日照度(W/㎡)", "小時平均日照度(W/㎡)",
"小時平均模組溫度(°C)", "小時平均模組溫度(°C)"
"小時售電金額(NTD)",
}; };
if(Formhead.Result.Data.ShowMoney == 1)
{
lasthead.Add("小時售電金額(NTD)");
}
foreach (var head in lasthead) foreach (var head in lasthead)
{ {
@ -248,20 +260,23 @@ namespace SolarPower.Controllers
cell.SetCellValue(b); cell.SetCellValue(b);
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
index++; index++;
foreach (var head in Formhead.Result.Data) foreach (var head in Formhead.Result.Data.Inv)
{ {
cell = row.CreateCell(index); cell = row.CreateCell(index);
cell.SetCellValue(dbody[head] == null ? "0" : dbody[head].ToString()); cell.SetCellValue(dbody[head] == null ? "0" : dbody[head].ToString());
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
index++; index++;
} }
string[] bodynames = { List<string> bodynames = new List<string>(){
"hourKWH", "hourKWH",
"hourKWHp", "hourKWHp",
"irradiance", "irradiance",
"temperature", "temperature"
"hourmoney",
}; };
if (Formhead.Result.Data.ShowMoney == 1)
{
bodynames.Add("hourmoney");
}
foreach (var bodyname in bodynames) foreach (var bodyname in bodynames)
{ {
cell = row.CreateCell(index); cell = row.CreateCell(index);
@ -313,6 +328,7 @@ namespace SolarPower.Controllers
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
RowPosition++; RowPosition++;
index = 0; index = 0;
row = sheet.CreateRow(RowPosition); row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index); cell = row.CreateCell(index);
@ -323,24 +339,30 @@ namespace SolarPower.Controllers
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
RowPosition++; RowPosition++;
index = 0;
row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index);
cell.SetCellValue("日售電金額(NTD):");
cell.CellStyle = styleLine12;
cell = row.CreateCell(1);
cell.SetCellValue(ntd);
cell.CellStyle = styleLine12;
RowPosition++;
index = 0; if (Formhead.Result.Data.ShowMoney == 1)
row = sheet.CreateRow(RowPosition); {
cell = row.CreateCell(index); index = 0;
cell.SetCellValue("日售電單價(NTD):"); row = sheet.CreateRow(RowPosition);
cell.CellStyle = styleLine12; cell = row.CreateCell(index);
cell = row.CreateCell(1); cell.SetCellValue("日售電金額(NTD):");
cell.SetCellValue(ntdone); cell.CellStyle = styleLine12;
cell.CellStyle = styleLine12; cell = row.CreateCell(1);
cell.SetCellValue(ntd);
cell.CellStyle = styleLine12;
RowPosition++;
index = 0;
row = sheet.CreateRow(RowPosition);
cell = row.CreateCell(index);
cell.SetCellValue("日售電單價(NTD):");
cell.CellStyle = styleLine12;
cell = row.CreateCell(1);
cell.SetCellValue(ntdone);
cell.CellStyle = styleLine12;
}
#endregion #endregion
break; break;
@ -354,7 +376,7 @@ namespace SolarPower.Controllers
sheet.SetColumnWidth(index2, 4 * 160 * 8); sheet.SetColumnWidth(index2, 4 * 160 * 8);
index2++; index2++;
foreach (var head in Formhead.Result.Data) foreach (var head in Formhead.Result.Data.Inv)
{ {
cell2 = row2.CreateCell(index2); cell2 = row2.CreateCell(index2);
cell2.SetCellValue(head); cell2.SetCellValue(head);
@ -363,7 +385,7 @@ namespace SolarPower.Controllers
index2++; index2++;
} }
string[] lasthead2 = List<string> lasthead2 = new List<string>()
{ {
"日發電量(kWh)", "日發電量(kWh)",
"日發電量百分比(%)", "日發電量百分比(%)",
@ -371,10 +393,13 @@ namespace SolarPower.Controllers
"kWH/kWP", "kWH/kWP",
"PR%", "PR%",
"日平均日照度(W/㎡)", "日平均日照度(W/㎡)",
"日平均模組溫度(°C)", "日平均模組溫度(°C)"
"日售電金額(NTD)"
}; };
if (Formhead.Result.Data.ShowMoney == 1)
{
lasthead2.Add("日售電金額(NTD)");
}
foreach (var head in lasthead2) foreach (var head in lasthead2)
{ {
cell2 = row2.CreateCell(index2); cell2 = row2.CreateCell(index2);
@ -401,7 +426,7 @@ namespace SolarPower.Controllers
monthKWH = dbody["monthKWH"] == null ? "0": dbody["monthKWH"].ToString(); monthKWH = dbody["monthKWH"] == null ? "0": dbody["monthKWH"].ToString();
monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString(); monthmoney = dbody["monthmoney"] == null ? "0" : dbody["monthmoney"].ToString();
monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString(); monthmoneyone = (Convert.ToDouble(dbody["monthmoneyone"].ToString()) + Convert.ToDouble(monthmoneyone)).ToString();
if (dbody["SolarType"].ToString() == "1")//檢驗是否為租用 if (dbody["SolarType"].ToString() == "1" && Formhead.Result.Data.ShowMoney == 1)//檢驗是否為租用
{ {
check_hire = true; check_hire = true;
sitedb = dbody["SiteDB"].ToString(); sitedb = dbody["SiteDB"].ToString();
@ -413,23 +438,26 @@ namespace SolarPower.Controllers
cell2.SetCellValue(b); cell2.SetCellValue(b);
cell2.CellStyle = styleLine12; cell2.CellStyle = styleLine12;
index2++; index2++;
foreach (var head in Formhead.Result.Data) foreach (var head in Formhead.Result.Data.Inv)
{ {
cell2 = row2.CreateCell(index2); cell2 = row2.CreateCell(index2);
cell2.SetCellValue(dbody[head] == null ? "0": dbody[head].ToString()); cell2.SetCellValue(dbody[head] == null ? "0": dbody[head].ToString());
cell2.CellStyle = styleLine12; cell2.CellStyle = styleLine12;
index2++; index2++;
} }
string[] bodynames = { List<string> bodynames = new List<string>(){
"dayKWH", "dayKWH",
"dayKWHp", "dayKWHp",
"tothour", "tothour",
"KWHKWP", "KWHKWP",
"PR", "PR",
"irradiance", "irradiance",
"temperature", "temperature"
"soldmoney"
}; };
if (Formhead.Result.Data.ShowMoney == 1)
{
bodynames.Add("soldmoney");
}
foreach (var bodyname in bodynames) foreach (var bodyname in bodynames)
{ {
cell2 = row2.CreateCell(index2); cell2 = row2.CreateCell(index2);
@ -471,14 +499,17 @@ namespace SolarPower.Controllers
cell.SetCellValue("月發電量(kWh)"); cell.SetCellValue("月發電量(kWh)");
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
index++; index++;
cell = row.CreateCell(index); if (Formhead.Result.Data.ShowMoney == 1)
cell.SetCellValue("月售電金額(NTD)"); {
cell.CellStyle = styleLine12; cell = row.CreateCell(index);
index++; cell.SetCellValue("月售電金額(NTD)");
cell = row.CreateCell(index); cell.CellStyle = styleLine12;
cell.SetCellValue("月售電單價(NTD)"); index++;
cell.CellStyle = styleLine12; cell = row.CreateCell(index);
index++; cell.SetCellValue("月售電單價(NTD)");
cell.CellStyle = styleLine12;
index++;
}
cell = row.CreateCell(index); cell = row.CreateCell(index);
cell.SetCellValue("月售電天數"); cell.SetCellValue("月售電天數");
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
@ -505,14 +536,17 @@ namespace SolarPower.Controllers
cell.SetCellValue(monthKWH); cell.SetCellValue(monthKWH);
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
index++; index++;
cell = row.CreateCell(index); if (Formhead.Result.Data.ShowMoney == 1)
cell.SetCellValue(monthmoney); {
cell.CellStyle = styleLine12; cell = row.CreateCell(index);
index++; cell.SetCellValue(monthmoney);
cell = row.CreateCell(index); cell.CellStyle = styleLine12;
cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday,2)); index++;
cell.CellStyle = styleLine12; cell = row.CreateCell(index);
index++; cell.SetCellValue(Math.Round(Convert.ToDouble(monthmoneyone) / Useday, 2));
cell.CellStyle = styleLine12;
index++;
}
cell = row.CreateCell(index); cell = row.CreateCell(index);
cell.SetCellValue(Useday); cell.SetCellValue(Useday);
cell.CellStyle = styleLine12; cell.CellStyle = styleLine12;
@ -581,8 +615,15 @@ namespace SolarPower.Controllers
} }
} }
var name = "";
if(postObject.FormType == 0)
{
name = "日";
}
else
{
name = "月";
}
var ms = new NpoiMemoryStream var ms = new NpoiMemoryStream
@ -592,7 +633,7 @@ namespace SolarPower.Controllers
workbook.Write(ms); workbook.Write(ms);
ms.Flush(); ms.Flush();
ms.Seek(0, SeekOrigin.Begin); ms.Seek(0, SeekOrigin.Begin);
return File(ms, "application/vnd.ms-excel", "text.xlsx"); return File(ms, "application/vnd.ms-excel", name+"報表.xlsx");
} }
public string Checknull(string a) public string Checknull(string a)

View File

@ -597,5 +597,29 @@ namespace SolarPower.Controllers
return apiResult; return apiResult;
} }
[HttpPost]
public async Task<ApiResult<string>> DeleteOneGetEmail(IdAndTypeByEmail post)
{
ApiResult<string> apiResult = new ApiResult<string>();
try
{
await userRepository.DeleteOneGetEmail(post);
apiResult.Code = "0000";
apiResult.Msg = "更改成功";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = errorCode.GetString(apiResult.Code);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
} }
} }

View File

@ -2082,6 +2082,14 @@ ENGINE=InnoDB
-- 新增帳號是否接收通知權限 20210730
ALTER TABLE `power_station_operation_personnel`
ADD COLUMN `EmailDayReport` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '接收Email日報 0:不接收 1:接收' AFTER `UserId`,
ADD COLUMN `EmailMonthReport` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '接收Email月報 0:不接收 1:接收' AFTER `EmailDayReport`,
ADD COLUMN `EmailComplexReport` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '接收Email綜合報告 0:不接收 1:接收' AFTER `EmailMonthReport`,
ADD COLUMN `EmailException` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '接收Email異常通知 0:不接收 1:接收' AFTER `EmailComplexReport`;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;

View File

@ -18,6 +18,12 @@ namespace SolarPower.Models
public string PowerStationName { get; set; } public string PowerStationName { get; set; }
} }
public class InvAndMoney
{
public List<string> Inv { get; set; }
public int ShowMoney { get; set; }
}
public class Select_table public class Select_table
{ {
public int SearchType { get; set; } public int SearchType { get; set; }

View File

@ -142,6 +142,10 @@ namespace SolarPower.Models.User
public string PowerStationName { get; set; } public string PowerStationName { get; set; }
public string Code { get; set; } public string Code { get; set; }
public string EscrowName { get; set; } public string EscrowName { get; set; }
public byte EmailDayReport { get; set; }
public byte EmailMonthReport { get; set; }
public byte EmailComplexReport { get; set; }
public byte EmailException { get; set; }
} }
public class PostUserPowerStation public class PostUserPowerStation
@ -149,4 +153,10 @@ namespace SolarPower.Models.User
public int PowerStationId { get; set; } public int PowerStationId { get; set; }
public int UserId { get; set; } public int UserId { get; set; }
} }
public class IdAndTypeByEmail
{
public int Id { get; set; }
public int Type { get; set; }
public int Check { get; set; }
}
} }

View File

@ -65,7 +65,7 @@ namespace SolarPower.Quartz.Jobs
#region () #region ()
logger.LogInformation("【CalcPowerStationJob】【開始取得氣象觀測】"); logger.LogInformation("【CalcPowerStationJob】【開始取得氣象觀測】");
var client = new HttpClient(); var client = new HttpClient();
var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80"; var UVUri = "https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization=CWB-EA24220B-DDCC-4188-84E5-AD37A0E03F80&elementName=TIME,TEMP";
HttpResponseMessage response = client.GetAsync(UVUri).Result; HttpResponseMessage response = client.GetAsync(UVUri).Result;
String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString(); String jsonUVs = response.Content.ReadAsStringAsync().Result.ToString();
Root2 observation = JsonConvert.DeserializeObject<Root2>(jsonUVs); Root2 observation = JsonConvert.DeserializeObject<Root2>(jsonUVs);

View File

@ -330,12 +330,17 @@ namespace SolarPower.Repository.Implement
op.Id, op.Id,
ps.Code, ps.Code,
ps.Name AS PowerStationName, ps.Name AS PowerStationName,
op.EmailDayReport,
op.EmailMonthReport,
op.EmailComplexReport,
op.EmailException,
CASE ps.IsEscrow WHEN 1 THEN CONCAT(ps.EscrowName, '()') CASE ps.IsEscrow WHEN 1 THEN CONCAT(ps.EscrowName, '()')
WHEN 0 THEN c.Name WHEN 0 THEN c.Name
END AS EscrowName END AS EscrowName
FROM power_station_operation_personnel op FROM power_station_operation_personnel op
LEFT JOIN power_station ps ON op.PowerStationId = ps.Id LEFT JOIN power_station ps ON op.PowerStationId = ps.Id
LEFT JOIN company c ON ps.CompanyId = c.Id LEFT JOIN company c ON ps.CompanyId = c.Id
LEFT JOIN user us ON us.Id = @UserId
WHERE op.Deleted = 0 AND op.UserId = @UserId"; WHERE op.Deleted = 0 AND op.UserId = @UserId";
result = (await conn.QueryAsync<UserPowerStation>(sql, new { UserId = userId })).ToList(); result = (await conn.QueryAsync<UserPowerStation>(sql, new { UserId = userId })).ToList();
@ -442,5 +447,49 @@ namespace SolarPower.Repository.Implement
return result; return result;
} }
} }
public async Task DeleteOneGetEmail(IdAndTypeByEmail post)
{
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
var changetype = "";
switch (post.Type)
{
case 0:
changetype = "EmailDayReport";
break;
case 1:
changetype = "EmailMonthReport";
break;
case 2:
changetype = "EmailComplexReport";
break;
case 3:
changetype = "EmailException";
break;
}
var sql = @$"UPDATE power_station_operation_personnel SET {changetype} = {post.Check} WHERE Id = @Id";
await conn.ExecuteAsync(sql, new { Id = post.Id }, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
}
}
} }
} }

View File

@ -102,5 +102,7 @@ namespace SolarPower.Repository.Interface
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
Task<List<UserPowerStation>> GetCompanyPowerStationAsync(int companyId, int userId); Task<List<UserPowerStation>> GetCompanyPowerStationAsync(int companyId, int userId);
Task DeleteOneGetEmail(IdAndTypeByEmail post);
} }
} }

View File

@ -642,7 +642,7 @@
$('#TableHead').empty(); $('#TableHead').empty();
var str = "<tr>"; var str = "<tr>";
str += "<th>Date</th>"; str += "<th>Date</th>";
$.each(rel.data, function (index, inverter) { $.each(rel.data.inv, function (index, inverter) {
haveinvertName.push(inverter); haveinvertName.push(inverter);
str += "<th>" + inverter + "</th>"; str += "<th>" + inverter + "</th>";
}) })
@ -653,7 +653,9 @@
str += "<th>小時<br />發電量<br />百分比<br />(%)</th>"; str += "<th>小時<br />發電量<br />百分比<br />(%)</th>";
str += "<th>小時<br />平均<br />日照度<br />(W/㎡)</th>"; str += "<th>小時<br />平均<br />日照度<br />(W/㎡)</th>";
str += "<th>小時<br />平均<br />模組<br />溫度<br />(°C)</th>"; str += "<th>小時<br />平均<br />模組<br />溫度<br />(°C)</th>";
str += "<th>小時<br />售電<br />金額<br />(NTD)</th>"; if (rel.data.showMoney == 1) {
str += "<th>小時<br />售電<br />金額<br />(NTD)</th>";
}
break; break;
case 1: case 1:
str += "<th>日<br />發電量<br />(kWh)</th>"; str += "<th>日<br />發電量<br />(kWh)</th>";
@ -663,13 +665,15 @@
str += "<th>PR%</th>"; str += "<th>PR%</th>";
str += "<th>日<br />平均<br />日照度<br />(W/㎡)</th>"; str += "<th>日<br />平均<br />日照度<br />(W/㎡)</th>";
str += "<th>日<br />平均<br />模組溫度<br />(°C)</th>"; str += "<th>日<br />平均<br />模組溫度<br />(°C)</th>";
str += "<th>日<br />售電金額<br />(NTD)</th>"; if (rel.data.showMoney == 1) {
str += "<th>日<br />售電金額<br />(NTD)</th>";
}
break; break;
} }
str += "</tr>"; str += "</tr>";
$('#TableHead').append(str); $('#TableHead').append(str);
tablebody(form); tablebody(form, rel.data.showMoney);
}, 'json'); }, 'json');
@ -680,7 +684,7 @@
tablehand(form); tablehand(form);
} }
function tablebody(form) function tablebody(form,showmoney)
{ {
var send_data = var send_data =
{ {
@ -722,7 +726,9 @@
sta += "<td>" + Number(inverter.hourKWHp) + "</td>"; sta += "<td>" + Number(inverter.hourKWHp) + "</td>";
sta += "<td>" + Number(inverter.irradiance) + "</td>"; sta += "<td>" + Number(inverter.irradiance) + "</td>";
sta += "<td>" + Number(inverter.temperature) + "</td>"; sta += "<td>" + Number(inverter.temperature) + "</td>";
sta += "<td>" + Number(inverter.hourmoney) + "</td>"; if (showmoney == 1) {
sta += "<td>" + Number(inverter.hourmoney) + "</td>";
}
sta += "</tr>"; sta += "</tr>";
thour = inverter.tothour ? inverter.tothour.toFixed(2) : 0; thour = inverter.tothour ? inverter.tothour.toFixed(2) : 0;
tpr = inverter.pr ? inverter.pr.toFixed(2) : 0; tpr = inverter.pr ? inverter.pr.toFixed(2) : 0;
@ -736,8 +742,10 @@
stc += "<th>" + 'kWH/kWP' + "</th>"; stc += "<th>" + 'kWH/kWP' + "</th>";
stc += "<th>" + 'PR%' + "</th>"; stc += "<th>" + 'PR%' + "</th>";
stc += "<th>" + '日發電量(kWh)' + "</th>"; stc += "<th>" + '日發電量(kWh)' + "</th>";
stc += "<th>" + '日售電金額(NTD)' + "</th>"; if (showmoney == 1) {
stc += "<th>" + '日售電單價(NTD)' + "</th>"; stc += "<th>" + '日售電金額(NTD)' + "</th>";
stc += "<th>" + '日售電單價(NTD)' + "</th>";
}
stc += "</tr>"; stc += "</tr>";
@ -746,8 +754,10 @@
stb += "<td>" + kWhkwp + "</td>"; stb += "<td>" + kWhkwp + "</td>";
stb += "<td>" + tpr + "</td>"; stb += "<td>" + tpr + "</td>";
stb += "<td>" + tkwh + "</td>"; stb += "<td>" + tkwh + "</td>";
stb += "<td>" + ntd + "</td>"; if (showmoney == 1) {
stb += "<td>" + ntdone + "</td>"; stb += "<td>" + ntd + "</td>";
stb += "<td>" + ntdone + "</td>";
}
stb += "</tr>"; stb += "</tr>";
@ -784,7 +794,9 @@
sta += "<td>" + inverter.PR + "</td>"; sta += "<td>" + inverter.PR + "</td>";
sta += "<td>" + inverter.irradiance + "</td>"; sta += "<td>" + inverter.irradiance + "</td>";
sta += "<td>" + inverter.temperature + "</td>"; sta += "<td>" + inverter.temperature + "</td>";
sta += "<td>" + inverter.soldmoney + "</td>"; if (showmoney == 1) {
sta += "<td>" + inverter.soldmoney + "</td>";
}
sta += "</tr>"; sta += "</tr>";
avghour += inverter.tothour ? inverter.tothour : 0; avghour += inverter.tothour ? inverter.tothour : 0;
avgKWHKWP += inverter.KWHKWP ? inverter.KWHKWP : 0; avgKWHKWP += inverter.KWHKWP ? inverter.KWHKWP : 0;
@ -808,8 +820,10 @@
stc += "<th>" + '日kWH/kWP平均' + "</th>"; stc += "<th>" + '日kWH/kWP平均' + "</th>";
stc += "<th>" + '日發電量平均(kWh)' + "</th>"; stc += "<th>" + '日發電量平均(kWh)' + "</th>";
stc += "<th>" + '月發電量(kWh)' + "</th>"; stc += "<th>" + '月發電量(kWh)' + "</th>";
stc += "<th>" + '月售電金額(NTD)' + "</th>"; if (showmoney == 1) {
stc += "<th>" + '月售電單價(NTD)' + "</th>"; stc += "<th>" + '月售電金額(NTD)' + "</th>";
stc += "<th>" + '月售電單價(NTD)' + "</th>";
}
stc += "<th>" + '月售電天數' + "</th>"; stc += "<th>" + '月售電天數' + "</th>";
stc += "</tr>"; stc += "</tr>";
@ -830,13 +844,15 @@
stb += "<td>" + (avgKWHKWP / monthday).toFixed(2) + "</td>"; stb += "<td>" + (avgKWHKWP / monthday).toFixed(2) + "</td>";
stb += "<td>" + (avgdayKWH / monthday).toFixed(2) + "</td>"; stb += "<td>" + (avgdayKWH / monthday).toFixed(2) + "</td>";
stb += "<td>" + monthKWH + "</td>"; stb += "<td>" + monthKWH + "</td>";
stb += "<td>" + monthmoney + "</td>"; if (showmoney == 1) {
stb += "<td>" + (monthmoneyone / monthday).toFixed(2) + "</td>"; stb += "<td>" + monthmoney + "</td>";
stb += "<td>" + (monthmoneyone / monthday).toFixed(2) + "</td>";
}
stb += "<td>" + monthday + "</td>"; stb += "<td>" + monthday + "</td>";
stb += "</tr>"; stb += "</tr>";
} }
var std = ""; var std = "";
if (check_hire == true) if (check_hire == true && showmoney == 1)
{ {
var dataTosent = var dataTosent =
{ {

View File

@ -764,6 +764,44 @@
//#endregion //#endregion
$("#user-power-station-table").on("click", "input.custom-control-input", function () {
selected_id = $(this).attr('data-id');
var clicktype = $(this).attr('id');
var usetypename = clicktype.split("-");
var usetype = 0;
var check = 0;
switch (usetypename[1])
{
case "emailDayReport": usetype = 0; break;
case "emailMonthReport": usetype = 1; break;
case "emailComplexReport": usetype = 2; break;
case "emailException": usetype = 3; break;
}
if (this.checked) {
check = 1;
}
else {
check = 0;
}
var url = "/User/DeleteOneGetEmail/";
var send_data = {
Id: selected_id,
Type: usetype,
Check: check
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
}, 'json');
})
//#region 新增使用者管理電站 //#region 新增使用者管理電站
function AddUserPowerStation(e) { function AddUserPowerStation(e) {
@ -849,6 +887,32 @@
str += "<td>" + value.code + "</td>"; str += "<td>" + value.code + "</td>";
str += "<td>" + value.powerStationName + "</td>"; str += "<td>" + value.powerStationName + "</td>";
str += "<td>" + value.escrowName + "</td>"; str += "<td>" + value.escrowName + "</td>";
if (value.emailDayReport == 0) {
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input' data-id='" + value.id + "' id = 'select-emailDayReport-" + value.code + "' ><label class='custom-control-label' for='select-emailDayReport-" + value.code +"'>接收</label></div>"+ "</td>";
}
else
{
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input' data-id='" + value.id + "' id = 'select-emailDayReport-" + value.code + "' checked><label class='custom-control-label' for='select-emailDayReport-" + value.code + "'>接收</label></div>" + "</td>";
}
if (value.emailMonthReport == 0) {
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input' data-id='" + value.id + "' id = 'select-emailMonthReport-" + value.code + "' ><label class='custom-control-label' for='select-emailMonthReport-" + value.code + "'>接收</label></div>" + "</td>";
}
else {
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input' data-id='" + value.id + "' id = 'select-emailMonthReport-" + value.code + "' checked><label class='custom-control-label' for='select-emailMonthReport-" + value.code + "'>接收</label></div>" + "</td>";
}
if (value.emailComplexReport == 0) {
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input' data-id='" + value.id + "' id = 'select-emailComplexReport-" + value.code + "' ><label class='custom-control-label' for='select-emailComplexReport-" + value.code + "'>接收</label></div>" + "</td>";
}
else {
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input' data-id='" + value.id + "' id = 'select-emailComplexReport-" + value.code + "' checked><label class='custom-control-label' for='select-emailComplexReport-" + value.code + "'>接收</label></div>" + "</td>";
}
if (value.emailException == 0) {
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input'data-id='" + value.id + "' id = 'select-emailException-" + value.code + "' ><label class='custom-control-label' for='select-emailException-" + value.code + "'>接收</label></div>" + "</td>";
}
else {
str += "<td>" + "<div class='custom-control custom-checkbox'><input type ='checkbox' class='custom-control-input' data-id='" + value.id + "' id = 'select-emailException-" + value.code + "' checked><label class='custom-control-label' for='select-emailException-" + value.code + "'>接收</label></div>" + "</td>";
}
str += "<td>" + '<button type="button" class="btn btn-danger btn-pills waves-effect waves-themed del-user-power-station" data-id="' + value.id + '">刪除</button>' + "</td>"; str += "<td>" + '<button type="button" class="btn btn-danger btn-pills waves-effect waves-themed del-user-power-station" data-id="' + value.id + '">刪除</button>' + "</td>";
str += "</tr>"; str += "</tr>";

View File

@ -137,6 +137,10 @@
<th>電站代碼</th> <th>電站代碼</th>
<th>電站名稱</th> <th>電站名稱</th>
<th>公司</th> <th>公司</th>
<th>收email日報</th>
<th>收email月報</th>
<th>收email綜合報告</th>
<th>收email異常通知</th>
<th>功能</th> <th>功能</th>
</tr> </tr>
</thead> </thead>