前端:stationOverview - 運維畫面預設值為:2 維修

This commit is contained in:
jiahao 2023-08-01 17:37:05 +08:00
parent 1c2097b3cb
commit 26da763cbb
6 changed files with 48 additions and 41 deletions

View File

@ -219,7 +219,7 @@ namespace SolarPower.Repository.Implement
try
{
string where = "";
if (filter.Status == 2)
if (filter.Status == 2) //狀態 0:未完成 1:完成 2:未完成-過期 3:完成-過期
{
where = $"opr.Deleted = 1 ";
}
@ -247,7 +247,7 @@ namespace SolarPower.Repository.Implement
sql += " AND opr.EndTime >= @StartDate";
}
if (filter.WorkType > 0)
if (filter.WorkType > 0)//工作項目, 0:清洗 1:巡檢 2:維修
{
filter.WorkType -= 1;
sql += @" AND opr.WorkType = @WorkType";

View File

@ -162,7 +162,7 @@
<script>
var localurl = this.location.href;
var powerids = new Array(0);//當前選擇電站
var Type = 0; // 項目
var Type = 2; // //工作項目, 0:清洗 1:巡檢 2:維修
var stationId;
var errortoID;
var powerStationData;

View File

@ -41,10 +41,11 @@ namespace solarApp.Service
bool result = false;
// string yyyymm = System.DateTime.Now.AddMonths(-2).ToString("yyyy-MM");
_siteID = siteID;
//搬移的月份
move_month = System.DateTime.Now.AddMonths(-1).ToString("yyyy-MM");
//_date1 = date1;
get_siteInfo();
//搬移的月份
move_month = System.DateTime.Now.AddMonths(-1).ToString("yyyy-MM");
//move_month = System.DateTime.Now.ToString("yyyy-MM"); //這個月
//_date1 = date1;
get_siteInfo();
checkTable();
moveData_station();

View File

@ -5,6 +5,8 @@ using MySql.Data.MySqlClient;
using Dapper;
using solarApp.Model;
using System.Configuration;
using Google.Protobuf.WellKnownTypes;
using MySqlX.XDevAPI.Relational;
namespace solarApp.Service
{
@ -86,10 +88,13 @@ namespace solarApp.Service
}
}
#endregion
string sql = "";
int rowCT = 0;
TimeSpan duration;
if (ds.Count > 0)
{
#region err_main
string sql = "";
string sql_header = "INSERT INTO `err_main`(`id`, `timestamp`, `datestamp`, `uuidHash`, `uuid`, `isOpen`, `sourceState`, `ackState`, `ackRequired`, `alarmClass`, `priority`, `normalTime`, `ackTime`, `userAccount`, `alarmTransition`, `lastUpdate`) ";
foreach (var item in ds)
{ // //{item.uuidHash}, '{Convert.ToBase64String(item.uuid)}'
@ -97,8 +102,8 @@ namespace solarApp.Service
, {item.isOpen}, {item.sourceState}, {item.ackState}, {item.ackRequired}, {item.alarmClass}, {item.priority}, {item.normalTime}, {item.ackTime}
, '{item.userAccount}', {item.alarmTransition}, {item.lastUpdate}); ";
}
int rowCT = conn.Execute(sql, commandTimeout: 600);
TimeSpan duration = DateTime.Now - dt_start;
rowCT = conn.Execute(sql, commandTimeout: 600);
duration = DateTime.Now - dt_start;
arclog.insert_log("0", "syncError s1", duration.TotalSeconds, "orionAlarmRecord", "err_main", "0", "", rowCT.ToString(), conn, null);
#endregion
@ -142,51 +147,52 @@ namespace solarApp.Service
// rowCT = conn.Execute(sql, commandTimeout: 600);
// duration = DateTime.Now - dt_start;
// arclog.insert_log("0", "syncError s4 site_id", duration.TotalSeconds, "v_company_inv", "err_main", "0", "", rowCT.ToString(), conn, null);
// #endregion
// #endregion
#region update
sql = $@" update err_main a join alarmorion_orionalarmfacetvalue b on a.id = b.alarm
sql = $@" update err_main a join alarmorion_orionalarmfacetvalue b on a.id = b.alarm
set a.errMsg = unicode_decode(b.value)
where facetName = 1 and alarm in ({sb.ToString()});";
rowCT = conn.Execute(sql, commandTimeout: 600);
duration = DateTime.Now - dt_start;
arclog.insert_log("0", "syncError s4 errMsg", duration.TotalSeconds, "facetvalue", "err_main", "0", "", rowCT.ToString(), conn, null);
rowCT = conn.Execute(sql, commandTimeout: 600);
duration = DateTime.Now - dt_start;
arclog.insert_log("0", "syncError s4 errMsg", duration.TotalSeconds, "facetvalue", "err_main", "0", "", rowCT.ToString(), conn, null);
#endregion
}
#region
dt_start = DateTime.Now;
sql = $@"DROP TABLE IF EXISTS `temp_healthStatus`;
#region
dt_start = DateTime.Now;
sql = $@"DROP TABLE IF EXISTS `temp_healthStatus`;
create table temp_healthStatus
select v.siteName, z.* from (
select ROW_NUMBER() OVER (PARTITION BY site_id ORDER BY HealthStatus desc) row_num,
site_id, alarmID, datestamp, HealthStatus
from (
select site_id, datestamp, sourceState, id alarmID,
case when alarmClass = 1 then 3 # Network -
when alarmClass != 1 then 2 end HealthStatus # inv, sensor
case when alarmClass = 2 then 3 # Network -
when alarmClass != 2 then 2 end HealthStatus # inv, sensor
from err_main
where sourceState = 1 and left(site_id , 1) = '0'
and datestamp > '{ System.DateTime.Now.AddDays(-60).ToString("yyyy-MM-dd")}'
and datestamp > '{System.DateTime.Now.AddDays(-60).ToString("yyyy-MM-dd")}'
order by HealthStatus desc
limit 100
) x
)z join v_station v on z.site_id = v.siteid
where row_num = 1;";
conn.Execute(sql, commandTimeout: 600);
conn.Execute(sql, commandTimeout: 600);
sql = $@"update power_station set healthstatus = 1;
sql = $@"update power_station set healthstatus = 1;
update power_station a join temp_healthstatus b on a.code = b.site_id
set a.healthstatus = b.healthstatus;";
rowCT = conn.Execute(sql, commandTimeout: 600);
duration = DateTime.Now - dt_start;
arclog.insert_log("0", "syncError s5 site health", duration.TotalSeconds, "temp_healthstatus", "err_main", "0", "", rowCT.ToString(), conn, null);
rowCT = conn.Execute(sql, commandTimeout: 600);
duration = DateTime.Now - dt_start;
arclog.insert_log("0", "syncError s5 site health", duration.TotalSeconds, "temp_healthstatus", "err_main", "0", "", rowCT.ToString(), conn, null);
#endregion
#endregion
#region Inverter
dt_start = DateTime.Now;
sql = $@"update inv_status set status = 1;
#region Inverter
dt_start = DateTime.Now;
sql = $@"update inv_status set status = 1;
update inv_status a join
(
select errDevice, 2 errStatus
@ -195,12 +201,11 @@ namespace solarApp.Service
group by errDevice
)b on a.inverterid = b.errDevice
set status = errStatus;";
rowCT = conn.Execute(sql, commandTimeout: 600);
duration = DateTime.Now - dt_start;
arclog.insert_log("0", "syncError s6 inv health", duration.TotalSeconds, "", "err_main", "0", "", rowCT.ToString(), conn, null);
rowCT = conn.Execute(sql, commandTimeout: 600);
duration = DateTime.Now - dt_start;
arclog.insert_log("0", "syncError s6 inv health", duration.TotalSeconds, "", "err_main", "0", "", rowCT.ToString(), conn, null);
#endregion
}
#endregion
conn.Close();
}
result = true;

View File

@ -760,7 +760,7 @@ namespace solarApp
this.ClientSize = new System.Drawing.Size(1782, 953);
this.Controls.Add(this.tabControl1);
this.Name = "fmArchive";
this.Text = "fmArchive 06-28 拯救 Kevin";
this.Text = "fmArchive 07-01 拯救 Kevin";
this.Load += new System.EventHandler(this.fmArchive_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);

View File

@ -192,7 +192,7 @@ namespace solarApp
//水位管理 每月 20 日 晚上8點
if (System.DateTime.Now.Day == 20 && System.DateTime.Now.Hour == 20 && DateTime.Now.Minute == 00
&& (DateTime.Now.Second >= 0 && DateTime.Now.Second <= 10)
&& (DateTime.Now.Second >= 0 && DateTime.Now.Second <= 20)
&& autoTask == false)
{
autoTask = true;
@ -679,15 +679,16 @@ namespace solarApp
if (CanDoSend)
{
SMTPConfig smtp = new SMTPConfig(); ;
smtp.Host = "msr.hinet.net";
//smtp.Host = "msr.hinet.net";
//smtp.UserName = "ficgreen01@gmail.com";
//smtp.Password = "qwe2015qwe";
//smtp.UserName = "ficgreen02@gmail.com";
//smtp.Password = "qwe20150504qwe";
//smtp.UserName = "shanghohui@gmail.com";
//smtp.Password = "wswgnluvoodfexrb";
//smtp.EnableSsl = true;
//smtp.Port = 587;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
smtp.Port = 587;
smtp.UserName = tbUserName.Text;
smtp.Password = tbPassword.Text;
if (rbSSL.Checked)