手動檢查 總體歸檔機制
This commit is contained in:
parent
38e8623799
commit
a182fdce77
@ -124,4 +124,34 @@ namespace solarApp.Model
|
||||
public string date { get; set; }
|
||||
public string count { get; set; }
|
||||
}
|
||||
|
||||
public class ck_inv_day
|
||||
{
|
||||
public int PowerStationId { get; set; }
|
||||
public string station_code { get; set; }
|
||||
public string station_name { get; set; }
|
||||
public int dataRows_A { get; set; }
|
||||
public int invCT_B { get; set; }
|
||||
public double AdivB_C { get; set; }
|
||||
public int periodDay_B { get; set; }
|
||||
public double CsubstrctionB { get; set; }
|
||||
}
|
||||
|
||||
public class ck_inv_day_detail1
|
||||
{
|
||||
public int PowerStationId { get; set; }
|
||||
public string inverterid { get; set; }
|
||||
public double todaykWh { get; set; }
|
||||
public int RowCT { get; set; }
|
||||
}
|
||||
|
||||
public class ck_inv_day_detail2
|
||||
{
|
||||
public int PowerStationId { get; set; }
|
||||
public string crdDate { get; set; }
|
||||
public string inverterid { get; set; }
|
||||
public double kwh { get; set; }
|
||||
public double todaykWh { get; set; }
|
||||
public double pr { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,5 +166,69 @@ where crdDate between '" + date1 + "' and '" + date2 + "' and a.inverterid = '"
|
||||
return ds;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 總計每天應有數據, inv hour --> day
|
||||
/// </summary>
|
||||
/// <param name="siteDB"></param>
|
||||
/// <param name="siteID"></param>
|
||||
/// <returns></returns>
|
||||
public List<ck_inv_day> get_ck_invDay_list(string date1, string date2)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||
{
|
||||
conn.Open();
|
||||
string sql = @$"select PowerStationId, station_code, station_name, dataRows as dataRows_A, invCT as invCT_B, periodCT AdivB_C, periodDay periodDay_B, (periodCT - periodDay) CsubstrctionB from
|
||||
(
|
||||
select a.PowerStationId, station_code, station_name, b.ct dataRows, a.ct invCT, ifnull(round((b.ct / a.ct), 2), 0) periodCT, (DATEDIFF('{date2}' , '{date1}') + 1) periodDay
|
||||
from
|
||||
( -- 每個電站的 inv 數量
|
||||
select b.id PowerStationId, b.`name` station_name, left(inverterid, 11) station_code, count(*) ct
|
||||
from v_company_inv a join power_station b on left(a.inverterid, 9) = b.`code`
|
||||
where b.Deleted = 0 and a.`enabled` = 1 and b.`status` = 1 # 啟用
|
||||
group by left(inverterid, 11)
|
||||
) a left outer join
|
||||
(
|
||||
select PowerStationId , left(crddate, 7) crddate , a.inverterid, round(a.TODAYKWH, 2) todaykWh, count(*) ct
|
||||
from inverter_history_day a
|
||||
where a.crddate between '{date1}' and '{date2}'
|
||||
group by a.PowerStationId , left(crddate, 7)
|
||||
)b on a.PowerStationId = b.PowerStationId
|
||||
)x ";
|
||||
List<ck_inv_day> ds = conn.Query<ck_inv_day>(sql).AsList<ck_inv_day>();
|
||||
conn.Close();
|
||||
return ds;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ck_inv_day_detail1> get_ck_invDay_detail1(string powerstationID, string date1, string date2)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||
{
|
||||
conn.Open();
|
||||
string sql = @$"select PowerStationId , a.inverterid, round(avg(a.TODAYKWH), 2) todaykWh, count(*) RowCT
|
||||
from inverter_history_day a
|
||||
where PowerStationId = '{powerstationID}' and a.crddate between '{date1}' and '{date2}'
|
||||
group by a.PowerStationId , inverterid ";
|
||||
List<ck_inv_day_detail1> ds = conn.Query<ck_inv_day_detail1>(sql).AsList<ck_inv_day_detail1>();
|
||||
conn.Close();
|
||||
return ds;
|
||||
}
|
||||
}
|
||||
|
||||
public List<ck_inv_day_detail2> get_ck_invDay_detail2(string inverterid, string date1, string date2)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||
{
|
||||
conn.Open();
|
||||
string sql = @$"select a.PowerStationId, left(crddate, 10) crdDate , a.inverterid, round(a.kwh, 2) kwh, round(a.TODAYKWH, 2) todaykWh, round(a.pr, 2) pr
|
||||
from inverter_history_day a
|
||||
where inverterid = '{inverterid}' and a.crddate between '{date1}' and '{date2}'
|
||||
";
|
||||
List<ck_inv_day_detail2> ds = conn.Query<ck_inv_day_detail2>(sql).AsList<ck_inv_day_detail2>();
|
||||
conn.Close();
|
||||
return ds;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,20 +81,24 @@ namespace solarApp.Service
|
||||
// { "Name":"環境濕度計","EName":"EMM"},
|
||||
// { "Name":"風速計","EName":"VAN"},
|
||||
// { "Name":" 電表","EName":"PWR"}]}
|
||||
// { "Name":" 累計日照量","EName":"TPY"}]}
|
||||
|
||||
var irrlst = ds_sensor.FindAll(x => x.type.Contains("PYR"));
|
||||
var modelTemplst = ds_sensor.FindAll(x => x.type.Contains("MTR"));
|
||||
var envTemplst = ds_sensor.FindAll(x => x.type.Contains("ETR"));
|
||||
var humlst = ds_sensor.FindAll(x => x.type.Contains("EMM"));
|
||||
var windlst = ds_sensor.FindAll(x => x.type.Contains("VAN"));
|
||||
var dustlst = ds_sensor.FindAll(x => x.type.Contains("DST")); //需要新增於DB
|
||||
var totIrrlst = ds_sensor.FindAll(x => x.type.Contains("TPY")); //累計日照量
|
||||
//var meterlst = ds_sensor.FindAll(x => x.type.Contains("PWR")); 電錶暫不處理
|
||||
string irrCol = string.Empty; string modelTempCol = string.Empty; string evnTempCol = string.Empty; string humCol = string.Empty; string windCol = string.Empty; string meterCol = string.Empty; string dustCol = string.Empty;
|
||||
string irrCol = string.Empty; string modelTempCol = string.Empty; string evnTempCol = string.Empty; string humCol = string.Empty; string windCol = string.Empty; string meterCol = string.Empty; string dustCol = string.Empty; string totIrrCol = string.Empty;
|
||||
irrCol = ConcatColumn(irrlst);//日照計
|
||||
modelTempCol = ConcatColumn(modelTemplst);
|
||||
evnTempCol = ConcatColumn(envTemplst);
|
||||
humCol = ConcatColumn(humlst);
|
||||
windCol = ConcatColumn(windlst);
|
||||
dustCol = ConcatColumn(dustlst);
|
||||
totIrrCol = ConcatColumn(totIrrlst);
|
||||
|
||||
string irrNot0 = string.Empty; // and 日照1 <> 0 and 日照2 <> 0
|
||||
# region 日照計需要過濾 0
|
||||
|
||||
@ -98,8 +98,9 @@ namespace solarApp.Service
|
||||
get_siteInfo();
|
||||
clearData();
|
||||
insert_inv();
|
||||
|
||||
//日報表
|
||||
//insert_report_invDay();
|
||||
//insert_report_invDay(); get_ck_invDay_list
|
||||
result = true;
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
@ -356,9 +357,12 @@ namespace solarApp.Service
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_logger != null)
|
||||
{
|
||||
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器hour補償", _siteID, _date1);
|
||||
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器hour補償 - [Exception]:{2}", _siteID, _date1, ex.ToString());
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
@ -411,9 +415,12 @@ namespace solarApp.Service
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_logger != null)
|
||||
{
|
||||
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器day補償", _siteID, _date1);
|
||||
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器day補償 - [Exception]:{2}", _siteID, _date1, ex.ToString());
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
#endregion day
|
||||
@ -467,9 +474,12 @@ namespace solarApp.Service
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_logger != null)
|
||||
{
|
||||
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器month補償", _siteID, _date1);
|
||||
_logger.LogError("【ProcInvSvc】執行失敗[{0}]在{1}逆變器month補償 - [Exception]:{2}", _siteID, _date1, ex.ToString());
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
|
||||
85
solarApp/fmArchive.Designer.cs
generated
85
solarApp/fmArchive.Designer.cs
generated
@ -29,6 +29,8 @@ namespace solarApp
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
@ -45,8 +47,10 @@ namespace solarApp
|
||||
this.bt_site = new System.Windows.Forms.Button();
|
||||
this.bt_Inv = new System.Windows.Forms.Button();
|
||||
this.bt_Sensor = new System.Windows.Forms.Button();
|
||||
this.br_rpt_invDay = new System.Windows.Forms.DataGridView();
|
||||
this.gv_inv_detail = new System.Windows.Forms.DataGridView();
|
||||
this.gv_rpt_invDay = new System.Windows.Forms.DataGridView();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.bt_invDay = new System.Windows.Forms.Button();
|
||||
this.btVerifyData = new System.Windows.Forms.Button();
|
||||
this.lbSiteDB_sensor = new System.Windows.Forms.Label();
|
||||
this.lbSiteID_sensor = new System.Windows.Forms.Label();
|
||||
@ -71,7 +75,8 @@ namespace solarApp
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.br_rpt_invDay)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gv_inv_detail)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gv_rpt_invDay)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
||||
@ -130,7 +135,8 @@ namespace solarApp
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.br_rpt_invDay);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.gv_inv_detail);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.gv_rpt_invDay);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.panel1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1768, 912);
|
||||
this.splitContainer1.SplitterDistance = 400;
|
||||
@ -271,20 +277,45 @@ namespace solarApp
|
||||
this.bt_Sensor.UseVisualStyleBackColor = true;
|
||||
this.bt_Sensor.Click += new System.EventHandler(this.bt_Sensor_Click);
|
||||
//
|
||||
// br_rpt_invDay
|
||||
// gv_inv_detail
|
||||
//
|
||||
this.br_rpt_invDay.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.br_rpt_invDay.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.br_rpt_invDay.Location = new System.Drawing.Point(0, 125);
|
||||
this.br_rpt_invDay.Name = "br_rpt_invDay";
|
||||
this.br_rpt_invDay.RowHeadersWidth = 51;
|
||||
this.br_rpt_invDay.RowTemplate.Height = 29;
|
||||
this.br_rpt_invDay.Size = new System.Drawing.Size(1358, 787);
|
||||
this.br_rpt_invDay.TabIndex = 1;
|
||||
this.gv_inv_detail.AllowUserToAddRows = false;
|
||||
this.gv_inv_detail.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.gv_inv_detail.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.gv_inv_detail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.gv_inv_detail.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gv_inv_detail.Location = new System.Drawing.Point(768, 75);
|
||||
this.gv_inv_detail.Name = "gv_inv_detail";
|
||||
this.gv_inv_detail.ReadOnly = true;
|
||||
this.gv_inv_detail.RowHeadersWidth = 51;
|
||||
this.gv_inv_detail.RowTemplate.Height = 29;
|
||||
this.gv_inv_detail.Size = new System.Drawing.Size(590, 837);
|
||||
this.gv_inv_detail.TabIndex = 2;
|
||||
this.gv_inv_detail.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gv_inv_detail_CellDoubleClick);
|
||||
//
|
||||
// gv_rpt_invDay
|
||||
//
|
||||
this.gv_rpt_invDay.AllowUserToAddRows = false;
|
||||
this.gv_rpt_invDay.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.gv_rpt_invDay.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.gv_rpt_invDay.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.gv_rpt_invDay.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.gv_rpt_invDay.Location = new System.Drawing.Point(0, 75);
|
||||
this.gv_rpt_invDay.Name = "gv_rpt_invDay";
|
||||
this.gv_rpt_invDay.ReadOnly = true;
|
||||
this.gv_rpt_invDay.RowHeadersWidth = 51;
|
||||
this.gv_rpt_invDay.RowTemplate.Height = 29;
|
||||
this.gv_rpt_invDay.Size = new System.Drawing.Size(768, 837);
|
||||
this.gv_rpt_invDay.TabIndex = 1;
|
||||
this.gv_rpt_invDay.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_rpt_invDay_CellFormatting);
|
||||
this.gv_rpt_invDay.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.gv_rpt_invDay_CellMouseDoubleClick);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
|
||||
this.panel1.Controls.Add(this.bt_invDay);
|
||||
this.panel1.Controls.Add(this.btVerifyData);
|
||||
this.panel1.Controls.Add(this.lbSiteDB_sensor);
|
||||
this.panel1.Controls.Add(this.lbSiteID_sensor);
|
||||
@ -292,17 +323,28 @@ namespace solarApp
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(1358, 125);
|
||||
this.panel1.Size = new System.Drawing.Size(1358, 75);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// bt_invDay
|
||||
//
|
||||
this.bt_invDay.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.bt_invDay.Location = new System.Drawing.Point(21, 8);
|
||||
this.bt_invDay.Name = "bt_invDay";
|
||||
this.bt_invDay.Size = new System.Drawing.Size(159, 44);
|
||||
this.bt_invDay.TabIndex = 14;
|
||||
this.bt_invDay.Text = "Inv 檢核";
|
||||
this.bt_invDay.UseVisualStyleBackColor = true;
|
||||
this.bt_invDay.Click += new System.EventHandler(this.bt_invDay_Click);
|
||||
//
|
||||
// btVerifyData
|
||||
//
|
||||
this.btVerifyData.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.btVerifyData.Location = new System.Drawing.Point(635, 8);
|
||||
this.btVerifyData.Location = new System.Drawing.Point(746, 8);
|
||||
this.btVerifyData.Name = "btVerifyData";
|
||||
this.btVerifyData.Size = new System.Drawing.Size(158, 44);
|
||||
this.btVerifyData.TabIndex = 12;
|
||||
this.btVerifyData.Text = "檢核結果";
|
||||
this.btVerifyData.Text = "各資料表明細";
|
||||
this.btVerifyData.UseVisualStyleBackColor = true;
|
||||
this.btVerifyData.Click += new System.EventHandler(this.btVerifyData_Click);
|
||||
//
|
||||
@ -310,7 +352,7 @@ namespace solarApp
|
||||
//
|
||||
this.lbSiteDB_sensor.AutoSize = true;
|
||||
this.lbSiteDB_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.lbSiteDB_sensor.Location = new System.Drawing.Point(49, 19);
|
||||
this.lbSiteDB_sensor.Location = new System.Drawing.Point(209, 20);
|
||||
this.lbSiteDB_sensor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbSiteDB_sensor.Name = "lbSiteDB_sensor";
|
||||
this.lbSiteDB_sensor.Size = new System.Drawing.Size(79, 24);
|
||||
@ -322,7 +364,7 @@ namespace solarApp
|
||||
//
|
||||
this.lbSiteID_sensor.AutoSize = true;
|
||||
this.lbSiteID_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.lbSiteID_sensor.Location = new System.Drawing.Point(201, 19);
|
||||
this.lbSiteID_sensor.Location = new System.Drawing.Point(361, 20);
|
||||
this.lbSiteID_sensor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbSiteID_sensor.Name = "lbSiteID_sensor";
|
||||
this.lbSiteID_sensor.Size = new System.Drawing.Size(72, 24);
|
||||
@ -333,7 +375,7 @@ namespace solarApp
|
||||
//
|
||||
this.lbSiteName_sensor.AutoSize = true;
|
||||
this.lbSiteName_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.lbSiteName_sensor.Location = new System.Drawing.Point(360, 19);
|
||||
this.lbSiteName_sensor.Location = new System.Drawing.Point(520, 20);
|
||||
this.lbSiteName_sensor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbSiteName_sensor.Name = "lbSiteName_sensor";
|
||||
this.lbSiteName_sensor.Size = new System.Drawing.Size(107, 24);
|
||||
@ -510,7 +552,8 @@ namespace solarApp
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.br_rpt_invDay)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gv_inv_detail)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gv_rpt_invDay)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
@ -531,7 +574,7 @@ namespace solarApp
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.DataGridView br_rpt_invDay;
|
||||
private System.Windows.Forms.DataGridView gv_rpt_invDay;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.DateTimePicker dtSelect1;
|
||||
@ -565,5 +608,7 @@ namespace solarApp
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Button bt_invDay;
|
||||
private System.Windows.Forms.DataGridView gv_inv_detail;
|
||||
}
|
||||
}
|
||||
@ -26,13 +26,25 @@ namespace solarApp
|
||||
{
|
||||
string date1 = dtSelect1.Value.ToString("yyyy-MM-dd");
|
||||
//procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1);
|
||||
string date2 = dtSelect2.Value.ToString("yyyy-MM-dd");
|
||||
//procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1);
|
||||
procSensorSvc sensorSvc = new procSensorSvc();
|
||||
//invSvc._siteDB = lbSiteDB_sensor.Text;
|
||||
//invSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
|
||||
//invSvc._siteID01 = lbSiteID_sensor.Text;
|
||||
//invSvc._date1 = date1;
|
||||
//invSvc._date2 = date1;
|
||||
foreach (DateTime day in EachDay(DateTime.Parse(date1), DateTime.Parse(date2)))
|
||||
{
|
||||
//string d1 = day.ToString("yyyy-MM-dd");
|
||||
sensorSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), date1);
|
||||
}
|
||||
//sensorSvc._siteDB = lbSiteDB_sensor.Text;
|
||||
//sensorSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
|
||||
//sensorSvc._siteID01 = lbSiteID_sensor.Text;
|
||||
//sensorSvc._date1 = date1;
|
||||
//sensorSvc._date2 = date1;
|
||||
sensorSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), date1);
|
||||
|
||||
//sensorSvc.archiveData();
|
||||
MessageBox.Show("OK");
|
||||
}
|
||||
@ -56,6 +68,9 @@ namespace solarApp
|
||||
i++;
|
||||
}
|
||||
#endregion
|
||||
// dtselect_station1.Value = DateTime.Today.AddDays(-1);
|
||||
dtSelect1.Value = System.DateTime.Today.AddDays(-1);
|
||||
dtSelect2.Value = System.DateTime.Today.AddDays(-1);
|
||||
}
|
||||
|
||||
private void rb_site_CheckedChanged(object sender, EventArgs e)
|
||||
@ -152,14 +167,19 @@ namespace solarApp
|
||||
private void bt_site_Click(object sender, EventArgs e)
|
||||
{
|
||||
string date1 = dtSelect1.Value.ToString("yyyy-MM-dd");
|
||||
string date2 = dtSelect2.Value.ToString("yyyy-MM-dd");
|
||||
//procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1);
|
||||
procStationSvc siteSvc = new procStationSvc();
|
||||
//siteSvc._siteDB = lbSiteDB_sensor.Text;
|
||||
//siteSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
|
||||
//siteSvc._siteID01 = lbSiteID_sensor.Text;
|
||||
//siteSvc._date1 = date1;
|
||||
//siteSvc._date2 = date1;
|
||||
//invSvc._siteDB = lbSiteDB_sensor.Text;
|
||||
//invSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9);
|
||||
//invSvc._siteID01 = lbSiteID_sensor.Text;
|
||||
//invSvc._date1 = date1;
|
||||
//invSvc._date2 = date1;
|
||||
foreach (DateTime day in EachDay(DateTime.Parse(date1), DateTime.Parse(date2)))
|
||||
{
|
||||
//string d1 = day.ToString("yyyy-MM-dd");
|
||||
siteSvc.archiveData(lbSiteID_sensor.Text.Substring(0, 9), date1);
|
||||
}
|
||||
//sensorSvc.archiveData();
|
||||
MessageBox.Show("OK");
|
||||
}
|
||||
@ -215,5 +235,79 @@ namespace solarApp
|
||||
//sensorSvc.archiveData();
|
||||
MessageBox.Show("OK");
|
||||
}
|
||||
|
||||
private void bt_invDay_Click(object sender, EventArgs e)
|
||||
{
|
||||
string date1 = dtSelect1.Value.ToString("yyyy-MM-dd");
|
||||
string date2 = dtSelect2.Value.ToString("yyyy-MM-dd");
|
||||
get_inv_svc invSvc = new get_inv_svc();
|
||||
var ds = invSvc.get_ck_invDay_list(date1, date2);
|
||||
gv_rpt_invDay.DataSource = ds;
|
||||
gv_rpt_invDay.Columns[0].Width = 60;
|
||||
gv_rpt_invDay.Columns[1].Width = 70;
|
||||
gv_rpt_invDay.Columns[2].Width = 80;
|
||||
gv_rpt_invDay.Columns[3].Width = 90;
|
||||
gv_rpt_invDay.Columns[4].Width = 90;
|
||||
gv_rpt_invDay.Columns[5].Width = 90;
|
||||
gv_rpt_invDay.Columns[6].Width = 90;
|
||||
gv_rpt_invDay.Columns[7].Width = 90;
|
||||
|
||||
}
|
||||
|
||||
private void gv_rpt_invDay_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
if (gv_rpt_invDay.Rows[e.RowIndex].Cells["CsubstrctionB"].Value != null && !string.IsNullOrWhiteSpace(gv_rpt_invDay.Rows[e.RowIndex].Cells["CsubstrctionB"].Value.ToString()))
|
||||
{
|
||||
if (gv_rpt_invDay.Rows[e.RowIndex].Cells["CsubstrctionB"].Value.ToString() != "0")
|
||||
{
|
||||
gv_rpt_invDay.Rows[e.RowIndex].Cells["CsubstrctionB"].Style = new DataGridViewCellStyle { ForeColor = Color.Red, BackColor = Color.White };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void gv_rpt_invDay_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
|
||||
{
|
||||
string powerStationID = gv_rpt_invDay.Rows[e.RowIndex].Cells[0].Value.ToString();
|
||||
// MessageBox.Show(powerStationID);
|
||||
|
||||
string date1 = dtSelect1.Value.ToString("yyyy-MM-dd");
|
||||
string date2 = dtSelect2.Value.ToString("yyyy-MM-dd");
|
||||
get_inv_svc invSvc = new get_inv_svc();
|
||||
var ds = invSvc.get_ck_invDay_detail1( powerStationID, date1, date2);
|
||||
gv_inv_detail.DataSource = ds;
|
||||
gv_inv_detail.Columns[0].Width = 60;
|
||||
gv_inv_detail.Columns[1].Width = 160; //invID
|
||||
gv_inv_detail.Columns[2].Width = 80;
|
||||
gv_inv_detail.Columns[3].Width = 90;
|
||||
|
||||
//switch (e.ColumnIndex)
|
||||
//{
|
||||
// case 0:
|
||||
// MessageBox.Show("这是第零列得");
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
private void gv_inv_detail_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (gv_inv_detail.Columns.Count == 5) return;
|
||||
|
||||
string inverterID = gv_inv_detail.Rows[e.RowIndex].Cells[1].Value.ToString();
|
||||
//MessageBox.Show(inverterID);
|
||||
|
||||
string date1 = dtSelect1.Value.ToString("yyyy-MM-dd");
|
||||
string date2 = dtSelect2.Value.ToString("yyyy-MM-dd");
|
||||
get_inv_svc invSvc = new get_inv_svc();
|
||||
var ds = invSvc.get_ck_invDay_detail2(inverterID, date1, date2);
|
||||
gv_inv_detail.DataSource = ds;
|
||||
gv_inv_detail.Columns[0].Width = 60;
|
||||
gv_inv_detail.Columns[1].Width = 150;
|
||||
gv_inv_detail.Columns[2].Width = 80;
|
||||
gv_inv_detail.Columns[3].Width = 100;
|
||||
gv_inv_detail.Columns[4].Width = 80;
|
||||
gv_inv_detail.Columns[5].Width = 80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user