This commit is contained in:
Kai 2022-03-17 09:40:51 +08:00
commit e1ba4d6a04
6 changed files with 51 additions and 31 deletions

1
.gitignore vendored
View File

@ -346,3 +346,4 @@ healthchecksdb
/SolarPower/wwwroot/upload/report/20210819 /SolarPower/wwwroot/upload/report/20210819
/SolarPower/SolarPower.zip /SolarPower/SolarPower.zip
/SolarPower.zip /SolarPower.zip
/SolarPower/wwwroot/upload/report/20220227

View File

@ -1046,6 +1046,10 @@ namespace SolarPower.Controllers
} }
var sheet = workbook.CreateSheet(powerstationid.Name); var sheet = workbook.CreateSheet(powerstationid.Name);
var Formbody = GetForm(select_Table);//取body var Formbody = GetForm(select_Table);//取body
if(Formbody.Result.Data.Count == 0)
{
continue;
}
var Formhead = GetTableHead(select_Table);//取head var Formhead = GetTableHead(select_Table);//取head
int RowPosition = 0; int RowPosition = 0;
@ -1099,6 +1103,7 @@ namespace SolarPower.Controllers
var thour = ""; var tpr = ""; var tkwh = ""; var kWhkwp = ""; var ntd = ""; var ntdone = ""; var GeneratingCapacity = ""; var thour = ""; var tpr = ""; var tkwh = ""; var kWhkwp = ""; var ntd = ""; var ntdone = ""; var GeneratingCapacity = "";
foreach (dynamic body in Formbody.Result.Data) foreach (dynamic body in Formbody.Result.Data)
{ {
index = 0; index = 0;
var dbody = body as IDictionary<string, object>; var dbody = body as IDictionary<string, object>;
thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString()); thour = Checknull(Math.Round(Convert.ToDouble(dbody["tothour"]), 2).ToString());

View File

@ -2,6 +2,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using Quartz; using Quartz;
using SolarPower.Models; using SolarPower.Models;
using SolarPower.Models.User;
using SolarPower.Repository.Interface; using SolarPower.Repository.Interface;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -198,10 +199,25 @@ namespace SolarPower.Quartz.Jobs
#region #region
var users = userRepository.GetAllAsync(); var users = userRepository.GetAllAsync();
var ttt = new List<string>() {
"s506488@gmail.com", //var usertest = new List<User>();
"cesarliuc@gmail.com" //var oneuser = new User()
}; //{
// Account = "cesarliuc@gmail.com",
// Password = "np/F0eliIy3lPJe1tU18oiG7dzKRrpVw16/XZpHOph8=",
// Id = 13,
// Email = "cesarliuc@gmail.com",
// Status = 1,
// Name = "TEST"
//};
//usertest.Add(oneuser);
//var ttt = new List<string>() {
// "s506488@gmail.com",
// "cesarliuc@gmail.com"
//};
foreach (var user in users.Result) foreach (var user in users.Result)
{ {
@ -244,15 +260,15 @@ namespace SolarPower.Quartz.Jobs
Type = 1 Type = 1
}; };
List<string> properties = new List<string>() List<string> properties = new List<string>()
{ {
"UserId", "UserId",
"EmailType", "EmailType",
"RecipientEmail", "RecipientEmail",
"Subject", "Subject",
"Attachment", "Attachment",
"RecipientName", "RecipientName",
"Type" "Type"
}; };
await noticeScheduleRepository.AddOneAsync(DaySchedule, properties); await noticeScheduleRepository.AddOneAsync(DaySchedule, properties);
} }
} }
@ -279,24 +295,24 @@ namespace SolarPower.Quartz.Jobs
Type = 1 Type = 1
}; };
List<string> properties = new List<string>() List<string> properties = new List<string>()
{ {
"UserId", "UserId",
"EmailType", "EmailType",
"RecipientEmail", "RecipientEmail",
"Subject", "Subject",
"Attachment", "Attachment",
"RecipientName", "RecipientName",
"Type" "Type"
}; };
await noticeScheduleRepository.AddOneAsync(MaxSchedule, properties); await noticeScheduleRepository.AddOneAsync(MaxSchedule, properties);
if (DateTime.Now.ToString("dd") == "01") if (DateTime.Now.ToString("dd") == "01")
{ {
Select_table2 maxmonthexcel = new Select_table2() Select_table2 maxmonthexcel = new Select_table2()
{ {
FormType = 0, FormType = 1,
PowerStation = sentMaxpowerstations, PowerStation = sentMaxpowerstations,
SearchType = 0, SearchType = 1,
Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM"), Time = DateTime.Now.AddDays(-1).ToString("yyyy-MM"),
Userid = user.Id Userid = user.Id
}; };

View File

@ -393,7 +393,7 @@ namespace SolarPower.Repository.Implement
GROUP BY a.Id,a.time GROUP BY a.Id,a.time
) n ON n.Id = ps.Id ) n ON n.Id = ps.Id
WHERE ps.Id IN @ids ORDER BY ps.CityId"; WHERE ps.Id IN @ids ORDER BY ps.CityId";
result = (await conn.QueryAsync<MaxFormbody>(sql,new { ids = ids})).ToList(); result = (await conn.QueryAsync<MaxFormbody>(sql,new { ids = ids}, commandTimeout: 300)).ToList();
} }
catch (Exception exception) catch (Exception exception)
{ {
@ -597,7 +597,7 @@ namespace SolarPower.Repository.Implement
break; break;
} }
a = await conn.QueryAsync<dynamic>(sql); a = await conn.QueryAsync<dynamic>(sql,commandTimeout: 300);
} }
catch (Exception exception) catch (Exception exception)
{ {

View File

@ -228,7 +228,7 @@ namespace solarApp.Service
WHEN b.SolarType = 1 THEN a.TOTALKWH * PowerRate * c.LeaseRate WHEN b.SolarType = 1 THEN a.TOTALKWH * PowerRate * c.LeaseRate
ELSE a.TOTALKWH * PowerRate ELSE a.TOTALKWH * PowerRate
END TOTALMONEY,*/ END TOTALMONEY,*/
(KWH * PowerRate) MONEY, (a.TODAYKWH * PowerRate) MONEY,
(a.TOTALKWH * PowerRate) TOTALMONEY, (a.TOTALKWH * PowerRate) TOTALMONEY,
(KWH * CarbonRate) CARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON (KWH * CarbonRate) CARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON
from from
@ -269,9 +269,7 @@ namespace solarApp.Service
#endregion day #endregion day
#region month #region month
sql = @" sql = @"
delete from power_station_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = @date1 ;
INSERT INTO solar_master.power_station_history_month(PowerStationId, `TIMESTAMP`, SITEID, SITETYPE, monthKwh , TOTALKWH, KWHKWP, INSERT INTO solar_master.power_station_history_month(PowerStationId, `TIMESTAMP`, SITEID, SITETYPE, monthKwh , TOTALKWH, KWHKWP,
PR, MP, SOLARHOUR, MONEY, TOTALMONEY, CARBON, TOTALCARBON) PR, MP, SOLARHOUR, MONEY, TOTALMONEY, CARBON, TOTALCARBON)

View File

@ -319,7 +319,7 @@ namespace solarApp
private void gv_inv_detail_CellDoubleClick(object sender, DataGridViewCellEventArgs e) private void gv_inv_detail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{ {
if (gv_inv_detail.Columns.Count == 5) return; if (gv_inv_detail.Columns.Count == 5 || e.RowIndex == -1) return;
string inverterID = gv_inv_detail.Rows[e.RowIndex].Cells[1].Value.ToString(); string inverterID = gv_inv_detail.Rows[e.RowIndex].Cells[1].Value.ToString();
//MessageBox.Show(inverterID); //MessageBox.Show(inverterID);