diff --git a/SolarPower/Controllers/StationReportController.cs b/SolarPower/Controllers/StationReportController.cs index 3085960..7819911 100644 --- a/SolarPower/Controllers/StationReportController.cs +++ b/SolarPower/Controllers/StationReportController.cs @@ -1212,5 +1212,298 @@ namespace SolarPower.Controllers return apiResult; } + public FileResult ExportExcelmaxtable(string post) + { + var postObject = JsonConvert.DeserializeObject(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 cityArrays = new List(); + 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 lasthead = new List() + { + "區域", + "電站名稱", + "發電量", + "發電小時", + "平均日照", + "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"); + } + + + + } } diff --git a/SolarPower/Models/ElectricitySoldRecord.cs b/SolarPower/Models/ElectricitySoldRecord.cs index 1dd8650..9ef01f4 100644 --- a/SolarPower/Models/ElectricitySoldRecord.cs +++ b/SolarPower/Models/ElectricitySoldRecord.cs @@ -14,6 +14,7 @@ namespace SolarPower.Models public string EndAt { get { return Convert.ToDateTime(endAt).ToString("yyyy-MM-dd"); } set { endAt = value; } } //結束時間 public int Kwh { get; set; }//購電度數 public float Money { get; set; }//售出金額 + public int Deleted { get; set; } } public class ElectricitySoldRecordTable : ElectricitySoldRecord diff --git a/SolarPower/Models/StationReport.cs b/SolarPower/Models/StationReport.cs index 89ed921..22a962c 100644 --- a/SolarPower/Models/StationReport.cs +++ b/SolarPower/Models/StationReport.cs @@ -85,13 +85,22 @@ namespace SolarPower.Models public string AreaName { get; set; } public string PowerstationName { get; set; } public int PowerstationId { get; set; } + public int PowerstationType { get; set; } public double Kwh { get; set; } public string PowerstationDB { get; set; } public double SolarHour { get; set; } public double AvgIrradiance { get; set; } public double AvgPR { 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; } } diff --git a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs index d6b6c7f..1fdec5a 100644 --- a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs +++ b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs @@ -34,7 +34,7 @@ namespace SolarPower.Repository.Implement post.Time = post.Time.Replace("-", "~"); post.Time = post.Time.Replace("/", "-"); 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 WHERE es.StartAt BETWEEN '{time[0]}' AND '{time[1]}' AND es.PowerstationId IN @ids AND es.Deleted = 0"; break; @@ -43,18 +43,17 @@ namespace SolarPower.Repository.Implement post.Time = post.Time.Replace("-", "~"); post.Time = post.Time.Replace("/", "-"); 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 WHERE es.StartAt BETWEEN '{time1[0]}' AND '{time1[1]}' AND es.PowerstationId IN @ids AND es.Deleted = 0"; - sql = ""; break; 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 WHERE DATE_FORMAT(es.StartAt , '%Y-%m') = '{post.Time}' AND es.PowerstationId IN @ids AND es.Deleted = 0"; break; 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 WHERE DATE_FORMAT(es.StartAt , '%Y') = '{post.Time}' AND es.PowerstationId IN @ids AND es.Deleted = 0"; break; diff --git a/SolarPower/Repository/Implement/StationReportRepository.cs b/SolarPower/Repository/Implement/StationReportRepository.cs index f9b407f..16d528d 100644 --- a/SolarPower/Repository/Implement/StationReportRepository.cs +++ b/SolarPower/Repository/Implement/StationReportRepository.cs @@ -265,13 +265,15 @@ namespace SolarPower.Repository.Implement a.Name AS 'AreaName', ps.Name AS 'PowerstationName', ps.SiteDB AS 'PowerstationDB', + ps.SolarType AS 'PowerstationType', + ps.Id as 'PowerStationId', n.* FROM power_station ps LEFT JOIN city c ON c.Id = ps.CityId LEFT JOIN area a ON a.Id = ps.AreaId 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 FROM power_station_history_hour ps @@ -280,7 +282,7 @@ namespace SolarPower.Repository.Implement ) a 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 WHERE ps.PowerStationId IN @ids {wheretime} diff --git a/SolarPower/Views/ElectricitySoldRecord/Index.cshtml b/SolarPower/Views/ElectricitySoldRecord/Index.cshtml index 32788f1..cb2ad94 100644 --- a/SolarPower/Views/ElectricitySoldRecord/Index.cshtml +++ b/SolarPower/Views/ElectricitySoldRecord/Index.cshtml @@ -594,7 +594,7 @@ } function Searchform() { - console.log(selecterd_powerstationId); +/* console.log(selecterd_powerstationId);*/ if (searchType == 0 || searchType == 1) { timerange = $('#DateGettext').val(); } diff --git a/SolarPower/Views/StationReport/Index.cshtml b/SolarPower/Views/StationReport/Index.cshtml index ed98377..d8d1c07 100644 --- a/SolarPower/Views/StationReport/Index.cshtml +++ b/SolarPower/Views/StationReport/Index.cshtml @@ -301,6 +301,7 @@ var nowpowerstation = null;//選擇電站 var haveinvertName = []; var nowform; + var xxx; $(function () { //#region 預設初始值 @@ -946,8 +947,16 @@ FormType: nowform, 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); + } 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 { toast_warning("請先選擇電站及報表類型"); } @@ -977,6 +986,12 @@ } //下方 $.each(rel.data, function (index, data) { + var hirerate = 0; + if (data.powerstationType == 1) + { + hirerate = hire(data.powerstationDB, data.powerstationId); + } + var cityinfo = { city: data.cityName, kwp: data.kwh, @@ -1010,6 +1025,16 @@ StrInfoBody += "" + data.solarHour.toFixed(2) + ""; StrInfoBody += "" + data.avgIrradiance.toFixed(2) + ""; StrInfoBody += "" + data.avgPR.toFixed(2) + ""; + if (showmoney == 1) { + StrInfoBody += "" + data.todayMoney.toFixed(2) + ""; + + StrInfoBody += "" + (data.todayMoney * hirerate * 0.01).toFixed(2)+ ""; + + StrInfoBody += "" + data.todayMoney.toFixed(2) + ""; + } + + + StrInfoBody += ""; kwp += data.kwh; kwhkwp += data.avgKWHKWP; @@ -1054,5 +1079,61 @@ 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); + // }) + //}); + } + } \ No newline at end of file diff --git a/solarApp/App.config b/solarApp/App.config index 83106d1..dfa6bbf 100644 --- a/solarApp/App.config +++ b/solarApp/App.config @@ -1,9 +1,8 @@  - - - + + \ No newline at end of file diff --git a/solarApp/Model/inv_hour.cs b/solarApp/Model/inv_hour.cs index d5163e1..457543a 100644 --- a/solarApp/Model/inv_hour.cs +++ b/solarApp/Model/inv_hour.cs @@ -87,6 +87,16 @@ namespace solarApp.Model public int count { get; set; } } + public class web_inv_15min + { + public string siteID { get; set; } + public string INVERTERID { get; set; } + public string reportdate { get; set; } + public double KWH { get; set; } + public double TODAYKWH { get; set; } + public double kWhKWP { get; set; } + } + public class web_inv_hour { public string INVERTERID { get; set; } diff --git a/solarApp/Model/sensor_model.cs b/solarApp/Model/sensor_model.cs new file mode 100644 index 0000000..0c002ae --- /dev/null +++ b/solarApp/Model/sensor_model.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace solarApp.Model +{ + public class sensor_model + { + public string id { get; set; } + public string SiteID { get; set; } + public string sensorName { get; set; } + public string type { get; set; } + public string DBName { get; set; } + public string TableName { get; set; } + public string colname { get; set; } + } + public class sensor_raw + { + public string SiteID { get; set; } + public string reportdate { get; set; } + public double sensorAvg01 { get; set; } + public double sensorAvg02 { get; set; } + public double sensorAvg03 { get; set; } + public double sensorAvg04 { get; set; } + public double sensorAvg05 { get; set; } + public double sensorAvg06 { get; set; } + } + + public class sensor_raw_V2 + { + public string SiteID { get; set; } + public string reportdate { get; set; } + public double irrAvg { get; set; } + public double modelTempAvg { get; set; } + public double envTempAvg { get; set; } + public double humidityAvg { get; set; } + public double windAvg { get; set; } + public double dustAvg { get; set; } + } + + public class sensor_hour + { + public string SiteID { get; set; } + public string reportdate { get; set; } + public double irrAvg { get; set; } + public double modelTempAvg { get; set; } + public double envTempAvg { get; set; } + public double humidityAvg { get; set; } + public double windAvg { get; set; } + public double dustAvg { get; set; } + public int count { get; set; } + } +} diff --git a/solarApp/Model/station_model.cs b/solarApp/Model/station_model.cs index ff0a4f5..3898318 100644 --- a/solarApp/Model/station_model.cs +++ b/solarApp/Model/station_model.cs @@ -40,10 +40,12 @@ namespace solarApp.Model public double PR { get; set; } public double SOLARHOUR { get; set; } public double kwhkwp { get; set; } - //public double MONEY { get; set; } - //public double TODAYMONEY { get; set; } - //public double CARBON { get; set; } - //public double TODAYCARBON { get; set; } + public double MONEY { get; set; } + public double todayMoney { get; set; } + public double totalMoney { get; set; } + public double CARBON { get; set; } + public double todayCarbon { get; set; } + public double totalCarbon { get; set; } } public class web_station_day diff --git a/solarApp/Program.cs b/solarApp/Program.cs index 21ecdcb..478ff41 100644 --- a/solarApp/Program.cs +++ b/solarApp/Program.cs @@ -17,7 +17,8 @@ namespace solarApp Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new fmMain()); + Application.Run(new fmArchive()); + //Application.Run(new fmMain()); } } } diff --git a/solarApp/Service/getInvSvc.cs b/solarApp/Service/getInvSvc.cs index 0b0aa0e..c129208 100644 --- a/solarApp/Service/getInvSvc.cs +++ b/solarApp/Service/getInvSvc.cs @@ -67,6 +67,21 @@ namespace solarApp.Service } } + + public List get_web_Inv_15min(string reportDate, string invID, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @"select `code` siteID, DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H:%i') reportdate, inverterid, a.KWH, a.TODAYKWH, round(a.kwhkwp, 3) kwhkwp + from inverter_history_15min a join power_station b on a.powerstationID = b.id + where left(`TIMESTAMP`, 10) = '" + reportDate + "' and inverterid = '" + invID + @"' and `code` = @siteID + order by cast(reportdate as datetime)"; + List ds = conn.Query(sql, new { siteID = siteID }).AsList(); + conn.Close(); + return ds; + } + } /// /// web 呈現值 每小時平均值 inverter - hour /// @@ -78,7 +93,7 @@ namespace solarApp.Service using (MySqlConnection conn = new MySqlConnection(Connection1)) { conn.Open(); - string sql = @"select `TIMESTAMP` reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR + string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H:%i') reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR from inverter_history_hour where left(`TIMESTAMP`, 10) = '" + reportDate + "' and inverterid = '" + invID + "' "; List ds = conn.Query(sql).AsList(); conn.Close(); @@ -86,26 +101,26 @@ namespace solarApp.Service } } - public List get_web_Inv_day(string reportDate, string invID) + public List get_web_Inv_day(string date1, string date2, string invID) { using (MySqlConnection conn = new MySqlConnection(Connection1)) { conn.Open(); - string sql = @"select `TIMESTAMP` reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR - from inverter_history_day where left(`TIMESTAMP`, 10) = '" + reportDate + "' and inverterid = '" + invID + "' "; + string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, round(PR, 2) PR + from inverter_history_day where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+ date2 +"' and inverterid = '" + invID + "' "; List ds = conn.Query(sql).AsList(); conn.Close(); return ds; } } - public List get_web_Inv_month(string reportDate, string invID) + public List get_web_Inv_month(string date1, string date2, string invID) { using (MySqlConnection conn = new MySqlConnection(Connection1)) { conn.Open(); - string sql = @"select `TIMESTAMP` reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR - from inverter_history_month where left(`TIMESTAMP`, 7) = '" + reportDate + "' and inverterid = '" + invID + "' "; + string sql = @"select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, inverterid, KWH, TODAYKWH, TOTALKWH, round(PR, 2) PR + from inverter_history_month where left(`TIMESTAMP`, 7) between '" + date1 + "' and '" + date2 + "' and inverterid = '" + invID + "' "; List ds = conn.Query(sql).AsList(); conn.Close(); return ds; diff --git a/solarApp/Service/getSensorSvc.cs b/solarApp/Service/getSensorSvc.cs new file mode 100644 index 0000000..87b6cda --- /dev/null +++ b/solarApp/Service/getSensorSvc.cs @@ -0,0 +1,220 @@ +using System; +using System.Collections.Generic; +using System.Text; +using MySql.Data.MySqlClient; +using Dapper; +using solarApp.Model; +using System.Configuration; + +namespace solarApp.Service +{ + public class getSensorSvc + { + string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString; + /// + /// 電站 Raw Data + /// + /// + /// + /// + /// + public List get_sensor_raw(string reportDate, string siteDB, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @"select siteid , FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(sensorAvg01, 3) sensorAvg01, round(sensorAvg02, 3) sensorAvg02, + round(sensorAvg03, 3) sensorAvg03, round(sensorAvg04, 3) sensorAvg04, round(sensorAvg05, 3) sensorAvg05, round(sensorAvg06, 3) sensorAvg06 + from " + siteDB + ".s" + siteID + @"_sensorAvg + where left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 10) = @reportDate"; + List ds = conn.Query(sql, new { reportDate = reportDate }).AsList(); + conn.Close(); + return ds; + } + } + + /// + /// Sensor 欄位需要平均時 欄位串接 (s1 + s2) / 2 + /// + /// + /// + string ConcatColumn(List lstData) + { + string ss = string.Empty; string result = string.Empty; + if (lstData.Count > 0) + { + foreach (var item in lstData) + { + ss += (ss == string.Empty) ? item.colname : "+" + item.colname; // 2 個以上欄位需要相加 + } + if (lstData.Count >= 2 && lstData[0].type == "PYR") result = "round( avg( " + ss + ") / " + lstData.Count.ToString() + " , 2) "; //日照計 2個以上 需要除以個數 (平均值) + else + result = "round( avg(" + ss + " ), 2) "; + } + else result = "0"; + return result; + } + + public List get_sensor_raw_hour(string reportDate, string siteDB, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + + // init 關閉 group full column + string ss = @"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));"; + conn.Execute(ss); + + + + #region 獲取 Sensor 類別 + string sql = @"select a.id, CONCAT( left(UID, 9) ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname + from " + siteDB + @".device a + where left(UID, 11) = @siteID"; + List ds_sensor = conn.Query(sql, new { siteID = siteID}).AsList(); + + //欄位處理 + // { "Type":[ + // { "Name":"日照計","EName":"PYR"}, + // { "Name":"模組溫度計","EName":"MTR"}, + // { "Name":"環境溫度計","EName":"ETR"}, + // { "Name":"環境濕度計","EName":"EMM"}, + // { "Name":"風速計","EName":"VAN"}, + // { "Name":" 電表","EName":"PWR"}]} + 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 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; + irrCol = ConcatColumn(irrlst);//日照計 + modelTempCol = ConcatColumn(modelTemplst); + evnTempCol = ConcatColumn(envTemplst); + humCol = ConcatColumn(humlst); + windCol = ConcatColumn(windlst); + dustCol = ConcatColumn(dustlst); + + string irrNot0 = string.Empty; // and 日照1 <> 0 and 日照2 <> 0 + # region 日照計需要過濾 0 + if (irrlst.Count > 0) + { + foreach (var item in irrlst) + irrNot0 += " and " + item.colname + " <> 0 "; // and S1 <> 0 and S2 <> 0 + } + #endregion + + //電表 + #endregion 獲取 Sensor 類別 + sql = @"select a.siteID, a.reportdate, a.modelTempAvg, ifnull(b.irrAvg, 0) irrAvg, a.envTempAvg, humidityAvg, windAvg, dustAvg from + ( + select @siteID siteID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, "+ modelTempCol+ @" modelTempAvg + ," + evnTempCol + @" envTempAvg, " + humCol + @" humidityAvg, " + windCol + @" windAvg, " + dustCol + @" dustAvg + from " + siteDB + ".s" + siteID + @"_sensorAvg + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') + ) a left join + ( + select FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate , " + irrCol + @" irrAvg + from " + siteDB + ".s" + siteID + @"_sensorAvg + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate "+ irrNot0 + @" #需要過濾 0 的數值 + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') + )b on a.reportdate = b.reportdate"; + List ds = conn.Query(sql, new { siteID = siteID, reportDate = reportDate }).AsList(); + conn.Close(); + return ds; + } + } + + /// + /// web 呈現值 station - hour + /// + /// + /// + public List get_web_sensor_hour(string reportDate, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, round(Irradiance, 2) irrAvg, round(Temperature, 2) modelTempAvg + from sensor_history_hour a join power_station b on a.PowerStationId = b.id + where left(`TIMESTAMP`, 10) = '" + reportDate + "' and b.`code` = @siteID"; + List ds = conn.Query(sql, new {siteID = siteID }).AsList(); + conn.Close(); + return ds; + } + } + + public List get_web_sensor_day(string date1, string date2, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, round(Irradiance, 2) irrAvg, round(Temperature, 2) modelTempAvg + from sensor_history_day a join power_station b on a.PowerStationId = b.id + where left(`TIMESTAMP`, 10) between '" + date1 + "' and '"+date2+"' and b.`code` = @siteID"; + List ds = conn.Query(sql, new { siteID = siteID }).AsList(); + conn.Close(); + return ds; + } + } + + public List get_web_sensor_month(string date1, string date2, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, round(Irradiance, 2) irrAvg, round(Temperature, 2) modelTempAvg + from sensor_history_month a join power_station b on a.PowerStationId = b.id + where left(`TIMESTAMP`, 7) between '" + date1 + "' and '" + date2 + "' and b.`code` = @siteID"; + List ds = conn.Query(sql, new { siteID = siteID}).AsList(); + conn.Close(); + return ds; + } + } + + + public List get_web_sensor50_hour(string reportDate, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, sensorAVG01, sensorAVG02, sensorAVG03, sensorAVG04, sensorAVG05, sensorAVG06 + from sensoravg_history_hour a join power_station b on a.PowerStationId = b.id + where left(`TIMESTAMP`, 10) = '" + reportDate + "' and b.`code` = @siteID"; + List ds = conn.Query(sql, new { siteID = siteID }).AsList(); + conn.Close(); + return ds; + } + } + + public List get_web_sensor50_day(string date1, string date2, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, sensorAVG01, sensorAVG02, sensorAVG03, sensorAVG04, sensorAVG05, sensorAVG06 + from sensoravg_history_day a join power_station b on a.PowerStationId = b.id + where left(`TIMESTAMP`, 10) between @date1 and @date2 and b.`code` = @siteID"; + List ds = conn.Query(sql, new { siteID = siteID, date1 = date1, date2 = date2 }).AsList(); + conn.Close(); + return ds; + } + } + + public List get_web_sensor50_month(string date1, string date2, string siteID) + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, b.`code` siteid, sensorAVG01, sensorAVG02, sensorAVG03, sensorAVG04, sensorAVG05, sensorAVG06 + from sensoravg_history_month a join power_station b on a.PowerStationId = b.id + where left(`TIMESTAMP`, 7) between @date1 and @date2 and b.`code` = @siteID"; + List ds = conn.Query(sql, new { siteID = siteID, date1 = date1, date2 = date2 }).AsList(); + conn.Close(); + return ds; + } + } + } +} diff --git a/solarApp/Service/getStationSvc.cs b/solarApp/Service/getStationSvc.cs index e16d2f9..a09c034 100644 --- a/solarApp/Service/getStationSvc.cs +++ b/solarApp/Service/getStationSvc.cs @@ -29,7 +29,7 @@ namespace solarApp.Service string sql = @"select id , FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, siteid, round(KWH, 3) KWH, round(TODAYKWH, 3) TODAYKWH, round(TOTALKWH, 3)TOTALKWH, round(PR, 3) PR, round(TODAYKWH, 3)SOLARHOUR , round(kwhkwp, 3) kwhkwp from " + siteDB + ".s" + siteID + @"_station - where left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 10) = @reportDate"; + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @reportDate"; List ds = conn.Query(sql, new { reportDate = reportDate }).AsList(); conn.Close(); return ds; @@ -69,11 +69,11 @@ namespace solarApp.Service // from v_station_temp // where left(reportdate, 10) between @date1 and @date2 // group by siteid, left(reportdate, 10)"; - string sql = @" select siteid, left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 10) reportdate, round((sum(KWH)), 2) KWH, round((max(TODAYKWH)), 2) TODAYKWH, round((max(TOTALKWH)), 2) TOTALKWH, + string sql = @" select siteid, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') reportdate, round((sum(KWH)), 2) KWH, round((max(TODAYKWH)), 2) TODAYKWH, round((max(TOTALKWH)), 2) TOTALKWH, round((max(PR)), 2) PR, round((max(SOLARHOUR)), 2) SOLARHOUR, round((max(KWHKWP)), 2) KWHKWP, count(*) count from " + siteDB+ ".s"+ siteID + @"_station - where left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 10) between @date1 and @date2 - group by siteid, left(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i'), 10)"; + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2 + group by siteid, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d')"; List ds = conn.Query(sql, new { date1 = date1, date2 = date2 }).AsList(); conn.Close(); return ds; @@ -87,15 +87,17 @@ namespace solarApp.Service /// /// /// - public List get_web_station_hour(string reportDate) + public List get_web_station_hour(string reportDate, string siteID) { using (MySqlConnection conn = new MySqlConnection(Connection1)) { conn.Open(); string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H') reportdate, siteid, round(KWH, 2) KWH, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, - round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money - from power_station_history_hour where left(`TIMESTAMP`, 10) = '" + reportDate + "' "; - List ds = conn.Query(sql).AsList(); + round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, round(money, 3) money, round(todaymoney, 3) todaymoney, round(totalmoney, 3) totalmoney, + round(carbon, 3) carbon, round(todayCarbon, 3) todayCarbon, round(totalCarbon, 3) totalCarbon + from power_station_history_hour + where siteID = @siteID and left(`TIMESTAMP`, 10) = '" + reportDate + "' "; + List ds = conn.Query(sql, new { siteID = siteID.Substring(0, 9) }).AsList(); conn.Close(); return ds; } @@ -107,28 +109,28 @@ namespace solarApp.Service /// /// /// - public List get_web_station_day(string date1, string date2) + public List get_web_station_day(string date1, string date2, string siteID) { using (MySqlConnection conn = new MySqlConnection(Connection1)) { conn.Open(); string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, - round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money - from power_station_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 "; - List ds = conn.Query(sql, new { date1 = date1, date2 = date2 }).AsList(); + round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money + from power_station_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and siteid = @siteID"; + List ds = conn.Query(sql, new { date1 = date1, date2 = date2 , siteID = siteID}).AsList(); conn.Close(); return ds; } } - public List get_web_station_month(string date1, string date2) + public List get_web_station_month(string date1, string date2, string siteID) { using (MySqlConnection conn = new MySqlConnection(Connection1)) { conn.Open(); string sql = @" select DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, siteid, round(TOTALKWH, 2) TOTALKWH, round(PR, 3) PR, round(KWHKWP, 3) KWHKWP, money - from power_station_history_month where left(`TIMESTAMP`, 7) between @date1 and @date2 "; - List ds = conn.Query(sql, new { date1 = date1, date2 = date2 }).AsList(); + from power_station_history_month where left(`TIMESTAMP`, 7) between @date1 and @date2 and siteid = @siteID"; + List ds = conn.Query(sql, new { date1 = date1, date2 = date2, siteID = siteID }).AsList(); conn.Close(); return ds; } diff --git a/solarApp/Service/procInvSvc.cs b/solarApp/Service/procInvSvc.cs index 215ff4e..54efdd0 100644 --- a/solarApp/Service/procInvSvc.cs +++ b/solarApp/Service/procInvSvc.cs @@ -12,211 +12,240 @@ namespace solarApp.Service public class procInvSvc { string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString; - /// - /// 每小時平均值 inverter 原始資料 - hour - /// - /// - /// - /// - public List proc_Inv_hour(string reportDate) - { - using (MySqlConnection conn = new MySqlConnection(Connection1)) - { - conn.Open(); - //string sql = @" select a.reportdate, a.inverterid, a.KWH, b.TODAYKWH, b.TOTALKWH, b.PR, a.count from - // ( - // select left(reportdate, 13)reportdate, inverterid - // ,round((sum(WH)/1000), 2) KWH, count(*) count - // from v_inv_temp - // where left(reportdate, 10) = '" + reportDate + "' and inverterid = '" + invID + @"' - // group by left(reportdate, 13), inverterid - // )a join ( - // select reportdate, round(TODAYKWH, 2) TODAYKWH, round(TOTALKWH, 2) TOTALKWH, inverterid, round(PR, 2) PR - // from v_inv_temp - // where left(reportdate, 10) = '" + reportDate + @"' and right(reportdate, 2) = '55' and inverterid = '" + invID + @"' - // )b on a.reportdate = left(b.reportdate, 13) and a.inverterid = b.inverterid "; - string sql = @" -INSERT INTO `solar_master`.`inverter_history_hour`(`PowerStationId`, `INVERTERID`, `TIMESTAMP`, Irradiance, `AC1V`, `AC1A`, `AC1W`, `AC1F`, `AC1WH`, `AC2V`, `AC2A`, `AC2W`, `AC2F`, `AC2WH`, -`AC3V`, `AC3A`, `AC3W`, `AC3F`, `AC3WH`, `DC1V`, `DC1A`, `DC1W`, `DC1WH`, `DC2V`, `DC2A`, `DC2W`, `DC2WH`, `DC3V`, `DC3A`, `DC3W`, -`DC3WH`, `DC4V`, `DC4A`, `DC4W`, `DC4WH`, `DC5V`, `DC5A`, `DC5W`, `DC5WH`, `PR`, `RA1`, `RA2`, `RA3`, `RA4`, `RA5`, `ACKW`, `KWH`, `TODAYKWH`, `TOTALKWH`, `KWHKWP`) -SELECT 1 powerStationID, a.INVERTERID, concat(a.reportDate,':00:00') reportDate, IFNULL(Irradiance, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH, - a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, - a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, inv_pr.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, a.KWH, a.TODAYKWH, a.TOTALKWH, - i.Capacity, (a.KWH / i.Capacity) AS KWHKWP -from -( -- 取得該時間區間的KWH - SELECT FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d %H') AS reportDate, a.INVERTERID, - AVG(a.AC1V) AS AC1V, AVG(a.AC1A) AS AC1A, SUM(a.AC1W) AS AC1W, - AVG(a.AC1F) AS AC1F, SUM(a.AC1WH) AS AC1WH, AVG(a.AC2V) AS AC2V, - AVG(a.AC2A) AS AC2A, SUM(a.AC2W) AS AC2W, AVG(a.AC2F) AS AC2F, - SUM(a.AC2WH) AS AC2WH,AVG(a.AC3V) AS AC3V, AVG(a.AC3A) AS AC3A, - SUM(a.AC3W) AS AC3W, AVG(a.AC3F) AS AC3F, SUM(a.AC3WH) AS AC3WH, - AVG(a.DC1V) AS DC1V, AVG(a.DC1A) AS DC1A, SUM(a.DC1W) AS DC1W, - SUM(a.DC1WH) AS DC1WH, AVG(a.DC2V) AS DC2V, AVG(a.DC2A) AS DC2A, - SUM(a.DC2W) AS DC2W, SUM(a.DC2WH) AS DC2WH, AVG(a.DC3V) AS DC3V, - AVG(a.DC3A) AS DC3A, AVG(a.DC3W) AS DC3W, AVG(a.DC3WH) AS DC3WH, - AVG(a.DC4V) AS DC4V, AVG(a.DC4A) AS DC4A, SUM(a.DC4W) AS DC4W, - SUM(a.DC4WH) AS DC4WH,AVG(a.DC5V) AS DC5V, AVG(a.DC5A) AS DC5A, - SUM(a.DC5W) AS DC5W, SUM(a.DC5WH) AS DC5WH, #inv_pr.PR AS PR, - AVG(a.RA1) AS RA1, AVG(a.RA2) AS RA2, AVG(a.RA3) AS RA3, - AVG(a.RA4) AS RA4, AVG(a.RA5) AS RA5, # a.KWH, - MAX(a.TODAYKWH) AS TODAYKWH, MAX(a.TOTALKWH) AS TOTALKWH, (SUM(a.WH)/1000) AS KWH - FROM s02202000101_inv a - WHERE left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = '2021-08-04' - GROUP BY left(FROM_UNIXTIME(a.TIMESTAMP/ 1000, '%Y-%m-%d %H'), 13), a.INVERTERID -) a -LEFT JOIN( -- 取得整點值PR - SELECT FROM_UNIXTIME(inv.TIMESTAMP / 1000, '%Y-%m-%d %H') AS reportDate, inv.INVERTERID, inv.PR - FROM s02202000101_inv inv - WHERE left(DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP / 1000), '%Y-%m-%d %H:%i'), 10) = '2021-08-04' - and right(DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP / 1000), '%Y-%m-%d %H:%i'), 2) = '55' - GROUP BY FROM_UNIXTIME(inv.TIMESTAMP/ 1000, '%Y-%m-%d %H'), inv.INVERTERID -) inv_pr -ON a.reportDate = inv_pr.reportDate AND a.INVERTERID = inv_pr.INVERTERID --- 取得逆變器容量 -LEFT JOIN solar_com0002.inverter i ON a.INVERTERID = i.InverterId --- 取日照度 ----------------------臨時做法 -left join ( - select FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d %H') AS reportDate, round(avg(SENSORAVG01),3) Irradiance - from s02202000101_sensoravg a - where left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = '2021-08-04' and SENSORAVG01 <> 0 - group by FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d %H') -)irr on a.reportDate = irr.reportDate ;"; - List ds = conn.Query(sql).AsList(); - conn.Close(); - return ds; + public string _siteID { get; set; } + public string _siteDB { get; set; } + public string _siteID01 { get; set; } + public string _date1 { get; set; } + public string _date2 { get; set; } + public string _powerStationID { get; set; } + + + public bool clearData() + { + bool result = false; + try + { + #region 取得 PowerStationID + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; + var ds = conn.Query(sql, new { siteID = _siteID }).AsList(); + _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; + conn.Close(); + } + #endregion + + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" + delete from inverter_history_15min where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1; + delete from inverter_history_hour where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1; + delete from inverter_history_day where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1; + delete from inverter_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ;"; + var ds = conn.Execute(sql, new { date1 = _date1, PowerStationID = _powerStationID }); + conn.Close(); + } + result = true; } + catch (Exception ex) + { + throw ex; + } + return result; } - public List proc_Inv_day(string reportDate) + public bool archiveData() { - using (MySqlConnection conn = new MySqlConnection(Connection1)) + + bool result = false; + try { - conn.Open(); - string sql = @" -INSERT INTO `solar_master`.`inverter_history_day`(`PowerStationId`, `INVERTERID`, `TIMESTAMP`, Irradiance, `AC1V`, `AC1A`, `AC1W`, `AC1F`, `AC1WH`, `AC2V`, `AC2A`, `AC2W`, `AC2F`, `AC2WH`, -`AC3V`, `AC3A`, `AC3W`, `AC3F`, `AC3WH`, `DC1V`, `DC1A`, `DC1W`, `DC1WH`, `DC2V`, `DC2A`, `DC2W`, `DC2WH`, `DC3V`, `DC3A`, `DC3W`, -`DC3WH`, `DC4V`, `DC4A`, `DC4W`, `DC4WH`, `DC5V`, `DC5A`, `DC5W`, `DC5WH`, `PR`, `RA1`, `RA2`, `RA3`, `RA4`, `RA5`, `ACKW`, `KWH`, `TODAYKWH`, `TOTALKWH`, `KWHKWP`) - -SELECT 1 powerStationID, a.INVERTERID, concat(a.reportDate,':00:00') reportDate, IFNULL(Irradiance, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH, - a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, - a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, a.KWH, a.TODAYKWH, a.TOTALKWH, - i.Capacity, (a.KWH / i.Capacity) AS KWHKWP -from -( -- 取得該時間區間的KWH - SELECT FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d') AS reportDate, a.INVERTERID, - AVG(a.AC1V) AS AC1V, AVG(a.AC1A) AS AC1A, SUM(a.AC1W) AS AC1W, - AVG(a.AC1F) AS AC1F, SUM(a.AC1WH) AS AC1WH, AVG(a.AC2V) AS AC2V, - AVG(a.AC2A) AS AC2A, SUM(a.AC2W) AS AC2W, AVG(a.AC2F) AS AC2F, - SUM(a.AC2WH) AS AC2WH,AVG(a.AC3V) AS AC3V, AVG(a.AC3A) AS AC3A, - SUM(a.AC3W) AS AC3W, AVG(a.AC3F) AS AC3F, SUM(a.AC3WH) AS AC3WH, - AVG(a.DC1V) AS DC1V, AVG(a.DC1A) AS DC1A, SUM(a.DC1W) AS DC1W, - SUM(a.DC1WH) AS DC1WH, AVG(a.DC2V) AS DC2V, AVG(a.DC2A) AS DC2A, - SUM(a.DC2W) AS DC2W, SUM(a.DC2WH) AS DC2WH, AVG(a.DC3V) AS DC3V, - AVG(a.DC3A) AS DC3A, AVG(a.DC3W) AS DC3W, AVG(a.DC3WH) AS DC3WH, - AVG(a.DC4V) AS DC4V, AVG(a.DC4A) AS DC4A, SUM(a.DC4W) AS DC4W, - SUM(a.DC4WH) AS DC4WH,AVG(a.DC5V) AS DC5V, AVG(a.DC5A) AS DC5A, - SUM(a.DC5W) AS DC5W, SUM(a.DC5WH) AS DC5WH, #inv_pr.PR AS PR, - AVG(a.RA1) AS RA1, AVG(a.RA2) AS RA2, AVG(a.RA3) AS RA3, - AVG(a.RA4) AS RA4, AVG(a.RA5) AS RA5, # a.KWH, - AVG(a.PR) as PR, - MAX(a.TODAYKWH) AS TODAYKWH, MAX(a.TOTALKWH) AS TOTALKWH, (SUM(a.WH)/1000) AS KWH - FROM solar_com0002.s02202000101_inv a - WHERE left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = '2021-08-04' - GROUP BY left(FROM_UNIXTIME(a.TIMESTAMP/ 1000, '%Y-%m-%d'), 10), a.INVERTERID -) a --- LEFT JOIN( -- 取得整點值PR --- SELECT FROM_UNIXTIME(inv.TIMESTAMP / 1000, '%Y-%m-%d') AS reportDate, inv.INVERTERID, inv.PR --- FROM s02202000101_inv inv --- WHERE left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = '2021-08-04' --- and right(DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP / 1000), '%Y-%m-%d %H:%i'), 2) = '55' --- GROUP BY FROM_UNIXTIME(inv.TIMESTAMP/ 1000, '%Y-%m-%d %H'), inv.INVERTERID --- ) inv_pr --- ON a.reportDate = inv_pr.reportDate AND a.INVERTERID = inv_pr.INVERTERID --- 取得逆變器容量 -LEFT JOIN solar_com0002.inverter i ON a.INVERTERID = i.InverterId --- 取日照度 ----------------------臨時做法 -left join ( - select FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d') AS reportDate, round(avg(SENSORAVG01),3) Irradiance - from s02202000101_sensoravg a - where left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = '2021-08-04' and SENSORAVG01 <> 0 - group by FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d') -)irr on a.reportDate = irr.reportDate ;"; - List ds = conn.Query(sql).AsList(); - conn.Close(); - return ds; + clearData(); + insert_inv(); + result = true; } - } + catch (Exception ex) + { + throw ex; + } + return result; + } - public List proc_station_hour(string reportDate) + bool insert_inv() { - using (MySqlConnection conn = new MySqlConnection(Connection1)) + bool result = false; + try { - conn.Open(); - string sql = @" -INSERT INTO `solar_master`.`power_station_history_hour`(`PowerStationId`, `TIMESTAMP`, `SITEID`, `SITETYPE`, `KWH`, `TODAYKWH`, `TOTALKWH`, `KWHKWP`, `PR`, `MP`, `SOLARHOUR`, `MONEY`, `TODAYMONEY`, `TOTALMONEY`, `CARBON`, `TODAYCARBON`, `TOTALCARBON`) + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string ss = @"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));"; + conn.Execute(ss); -select 1 PowerStationId, concat(FROM_UNIXTIME(`TIMESTAMP`/1000, '%Y-%m-%d %H'), ':00:00') reportdate, siteid, 0 SITETYPE, round((sum(KWH)), 2) KWH, round((max(TODAYKWH)), 2) TODAYKWH, round((max(TOTALKWH)), 2) TOTALKWH, round((max(KWHKWP)), 2) KWHKWP, round((max(PR)), 2) PR, 0 as MP, round((max(SOLARHOUR)), 2) SOLARHOUR, - 0, 0 , 0, 0, 0 , 0 -from solar_com0002.s02202000101_station -where FROM_UNIXTIME(`TIMESTAMP`/1000, '%Y-%m-%d') = '2021-08-04' -group by siteid, FROM_UNIXTIME(`TIMESTAMP`/1000, '%Y-%m-%d %H')"; - List ds = conn.Query(sql).AsList(); - conn.Close(); - return ds; + #region 15 min + string sql = @" + INSERT INTO solar_master.inverter_history_15min( PowerStationId, TIMESTAMP, INVERTERID, KWH, TODAYKWH, KWHKWP) + select PowerStationId, reportdate, a.inverterid, KWH, TODAYKWH, round((kwh/capacity), 3) kwpkwp from + ( + select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00:00')reportdate, inverterid, + round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH + from " + _siteDB + ".s" + _siteID01 + @"_inv + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '00' and '10' + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid + union + select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':15:00')reportdate, inverterid, + round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH + from " + _siteDB + ".s" + _siteID01 + @"_inv + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '15' and '25' + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid + union + select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':30:00')reportdate, inverterid, + round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH + from " + _siteDB + ".s" + _siteID01 + @"_inv + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '30' and '40' + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid + union + select @PowerStationId PowerStationId, CONCAT(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':45:00')reportdate, inverterid, + round((sum(WH)/1000), 3) KWH, round(max(TODAYKWH), 3) TODAYKWH + from " + _siteDB + ".s" + _siteID01 + @"_inv + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and right(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') , 2) between '45' and '55' + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') , inverterid + ) a join " + _siteDB + @".inverter b on a.inverterid = b.inverterid"; + var ds = conn.Execute(sql, new { date1 = _date1, PowerStationID = _powerStationID }); + #endregion + + #region hour + sql = @" + insert into solar_master.inverter_history_hour (PowerStationId, INVERTERID, TIMESTAMP, Irradiance, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH, + AC3V, AC3A, AC3W, AC3F, AC3WH, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W, DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, + PR, RA1, RA2, RA3, RA4, RA5, DCKW, ACKW, KWH, TODAYKWH, TOTALKWH, KWHKWP) + + SELECT @powerstationID powerStationID, a.INVERTERID, a.reportDate, IFNULL(Irradiance, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH, + a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, + a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, + inv_pr.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, ((DC1W + DC2W + DC3W + DC4W+ DC5W) / 1000) DCKW, + ((AC1W + AC2W + AC3W) / 1000) ACKW, a.KWH, a.TODAYKWH, a.TOTALKWH, (a.KWH / i.Capacity) AS KWHKWP + from + ( -- 取得該時間區間的KWH + SELECT concat(FROM_UNIXTIME(a.TIMESTAMP/1000,'%Y-%m-%d %H'), ':00:00') reportDate, a.INVERTERID, + AVG(a.AC1V) AS AC1V, AVG(a.AC1A) AS AC1A, SUM(a.AC1W) AS AC1W, AVG(a.AC1F) AS AC1F, SUM(a.AC1WH) AS AC1WH, AVG(a.AC2V) AS AC2V, + AVG(a.AC2A) AS AC2A, SUM(a.AC2W) AS AC2W, AVG(a.AC2F) AS AC2F, SUM(a.AC2WH) AS AC2WH,AVG(a.AC3V) AS AC3V, AVG(a.AC3A) AS AC3A, + SUM(a.AC3W) AS AC3W, AVG(a.AC3F) AS AC3F, SUM(a.AC3WH) AS AC3WH, AVG(a.DC1V) AS DC1V, AVG(a.DC1A) AS DC1A, SUM(a.DC1W) AS DC1W, + SUM(a.DC1WH) AS DC1WH, AVG(a.DC2V) AS DC2V, AVG(a.DC2A) AS DC2A, SUM(a.DC2W) AS DC2W, SUM(a.DC2WH) AS DC2WH, AVG(a.DC3V) AS DC3V, + AVG(a.DC3A) AS DC3A, AVG(a.DC3W) AS DC3W, AVG(a.DC3WH) AS DC3WH, AVG(a.DC4V) AS DC4V, AVG(a.DC4A) AS DC4A, SUM(a.DC4W) AS DC4W, + SUM(a.DC4WH) AS DC4WH,AVG(a.DC5V) AS DC5V, AVG(a.DC5A) AS DC5A, SUM(a.DC5W) AS DC5W, SUM(a.DC5WH) AS DC5WH, + AVG(a.RA1) AS RA1, AVG(a.RA2) AS RA2, AVG(a.RA3) AS RA3, + AVG(a.RA4) AS RA4, AVG(a.RA5) AS RA5, MAX(a.TODAYKWH) AS TODAYKWH, MAX(a.TOTALKWH) AS TOTALKWH, (SUM(a.WH)/1000) AS KWH + FROM " + _siteDB + ".s" + _siteID01 + @"_inv a + WHERE left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = @date1 + GROUP BY left(FROM_UNIXTIME(a.TIMESTAMP/ 1000, '%Y-%m-%d %H'), 13), a.INVERTERID + ) a + LEFT JOIN( -- 取得整點值PR + SELECT concat(FROM_UNIXTIME(inv.TIMESTAMP/1000,'%Y-%m-%d %H'), ':00:00') AS reportDate, inv.INVERTERID, inv.PR + FROM " + _siteDB + ".s" + _siteID01 + @"_inv inv + WHERE left(DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP / 1000), '%Y-%m-%d %H:%i'), 10) = @date1 + and right(DATE_FORMAT(FROM_UNIXTIME(inv.TIMESTAMP / 1000), '%Y-%m-%d %H:%i'), 2) = '55' + GROUP BY FROM_UNIXTIME(inv.TIMESTAMP/ 1000, '%Y-%m-%d %H'), inv.INVERTERID + ) inv_pr + ON a.reportDate = inv_pr.reportDate AND a.INVERTERID = inv_pr.INVERTERID + -- 取得逆變器容量 + LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId + -- 取日照度 --------------------- + left join ( + select concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d %H'), ':00:00') AS reportDate, Irradiance + from sensor_history_hour a + where powerstationID = @powerstationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1 + )irr on a.reportDate = irr.reportDate + order by a.INVERTERID, a.reportDate;"; + int ct = conn.Execute(sql, new { date1 = _date1, PowerStationID = _powerStationID }); + + #endregion hour + + #region day + sql = @" + INSERT INTO solar_master.inverter_history_day(PowerStationId, INVERTERID, TIMESTAMP, Irradiance, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH, + AC3V, AC3A, AC3W, AC3F, AC3WH, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W, + DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, PR, RA1, RA2, RA3, RA4, RA5, `DCKW`, `ACKW`, KWH, TODAYKWH, TOTALKWH, KWHKWP) + + SELECT @powerStationID powerStationID, a.INVERTERID, concat(a.reportDate,' 00:00:00') reportDate, IFNULL(Irradiance, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH, + a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, + a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, + DCKW, ACKW, a.KWH, a.TODAYKWH, a.TOTALKWH, (a.KWH / i.Capacity) AS KWHKWP + from + ( -- 取得該時間區間的KWH + SELECT DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') AS reportDate, a.INVERTERID, + AVG(a.AC1V) AS AC1V, AVG(a.AC1A) AS AC1A, SUM(a.AC1W) AS AC1W, AVG(a.AC1F) AS AC1F, SUM(a.AC1WH) AS AC1WH, AVG(a.AC2V) AS AC2V, + AVG(a.AC2A) AS AC2A, SUM(a.AC2W) AS AC2W, AVG(a.AC2F) AS AC2F, SUM(a.AC2WH) AS AC2WH,AVG(a.AC3V) AS AC3V, AVG(a.AC3A) AS AC3A, + SUM(a.AC3W) AS AC3W, AVG(a.AC3F) AS AC3F, SUM(a.AC3WH) AS AC3WH, AVG(a.DC1V) AS DC1V, AVG(a.DC1A) AS DC1A, SUM(a.DC1W) AS DC1W, + SUM(a.DC1WH) AS DC1WH, AVG(a.DC2V) AS DC2V, AVG(a.DC2A) AS DC2A, SUM(a.DC2W) AS DC2W, SUM(a.DC2WH) AS DC2WH, AVG(a.DC3V) AS DC3V, + AVG(a.DC3A) AS DC3A, AVG(a.DC3W) AS DC3W, AVG(a.DC3WH) AS DC3WH, AVG(a.DC4V) AS DC4V, AVG(a.DC4A) AS DC4A, SUM(a.DC4W) AS DC4W, + SUM(a.DC4WH) AS DC4WH,AVG(a.DC5V) AS DC5V, AVG(a.DC5A) AS DC5A, SUM(a.DC5W) AS DC5W, SUM(a.DC5WH) AS DC5WH, max(PR) AS PR, + AVG(a.RA1) AS RA1, AVG(a.RA2) AS RA2, AVG(a.RA3) AS RA3, AVG(a.RA4) AS RA4, AVG(a.RA5) AS RA5, avg(DCKW) as DCKW, avg(ACKW) as ACKW, + MAX(a.TODAYKWH) AS TODAYKWH, MAX(a.TOTALKWH) AS TOTALKWH, SUM(a.KWH) AS KWH + FROM solar_master.inverter_history_hour a + WHERE powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') = @date1 + GROUP BY DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d'), a.INVERTERID + ) a + LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId + -- 取日照度 ---------------------- + left join ( + select DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') AS reportDate, Irradiance + from sensor_history_day a + where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m-%d') = @date1 and Irradiance <> 0 limit 1 + )irr on a.reportDate = irr.reportDate ;"; + conn.Execute(sql, new { date1 = _date1, PowerStationID = _powerStationID }); + #endregion day + + #region month + sql = @" + delete from inverter_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ; + + INSERT INTO solar_master.inverter_history_month (PowerStationId, INVERTERID, TIMESTAMP, Irradiance, AC1V, AC1A, AC1W, AC1F, AC1WH, AC2V, AC2A, AC2W, AC2F, AC2WH, + AC3V, AC3A, AC3W, AC3F, AC3WH, DC1V, DC1A, DC1W, DC1WH, DC2V, DC2A, DC2W, DC2WH, DC3V, DC3A, DC3W, + DC3WH, DC4V, DC4A, DC4W, DC4WH, DC5V, DC5A, DC5W, DC5WH, PR, RA1, RA2, RA3, RA4, RA5, `DCKW`, `ACKW`, KWH, TODAYKWH, TOTALKWH, KWHKWP) + + SELECT @powerStationID powerStationID, a.INVERTERID, concat(a.reportDate,'-01 00:00:00') reportDate, IFNULL(Irradiance, 0), a.AC1V, a.AC1A, a.AC1W, a.AC1F, a.AC1WH, a.AC2V, a.AC2A, a.AC2W, a.AC2F, a.AC2WH, + a.AC3V, a.AC3A, a.AC3W, a.AC3F, a.AC3WH, a.DC1V, a.DC1A, a.DC1W, a.DC1WH, a.DC2V, a.DC2A, a.DC2W, a.DC2WH, a.DC3V, a.DC3A, a.DC3W, + a.DC3WH, a.DC4V, a.DC4A, a.DC4W, a.DC4WH, a.DC5V, a.DC5A, a.DC5W, a.DC5WH, a.PR, a.RA1, a.RA2, a.RA3, a.RA4, a.RA5, DCKW, ACKW, a.KWH, a.TODAYKWH, a.TOTALKWH, + (a.KWH / i.Capacity) AS KWHKWP + from + ( -- 取得該時間區間的KWH + SELECT DATE_FORMAT(a.TIMESTAMP, '%Y-%m') AS reportDate, a.INVERTERID, + AVG(a.AC1V) AS AC1V, AVG(a.AC1A) AS AC1A, SUM(a.AC1W) AS AC1W, AVG(a.AC1F) AS AC1F, SUM(a.AC1WH) AS AC1WH, AVG(a.AC2V) AS AC2V, + AVG(a.AC2A) AS AC2A, SUM(a.AC2W) AS AC2W, AVG(a.AC2F) AS AC2F, SUM(a.AC2WH) AS AC2WH,AVG(a.AC3V) AS AC3V, AVG(a.AC3A) AS AC3A, + SUM(a.AC3W) AS AC3W, AVG(a.AC3F) AS AC3F, SUM(a.AC3WH) AS AC3WH, AVG(a.DC1V) AS DC1V, AVG(a.DC1A) AS DC1A, SUM(a.DC1W) AS DC1W, + SUM(a.DC1WH) AS DC1WH, AVG(a.DC2V) AS DC2V, AVG(a.DC2A) AS DC2A, SUM(a.DC2W) AS DC2W, SUM(a.DC2WH) AS DC2WH, AVG(a.DC3V) AS DC3V, + AVG(a.DC3A) AS DC3A, AVG(a.DC3W) AS DC3W, AVG(a.DC3WH) AS DC3WH, AVG(a.DC4V) AS DC4V, AVG(a.DC4A) AS DC4A, SUM(a.DC4W) AS DC4W, + SUM(a.DC4WH) AS DC4WH,AVG(a.DC5V) AS DC5V, AVG(a.DC5A) AS DC5A, SUM(a.DC5W) AS DC5W, SUM(a.DC5WH) AS DC5WH, max(PR) AS PR, + AVG(a.RA1) AS RA1, AVG(a.RA2) AS RA2, AVG(a.RA3) AS RA3, AVG(a.RA4) AS RA4, AVG(a.RA5) AS RA5, avg(DCKW) as DCKW, avg(ACKW) as ACKW, + MAX(a.TODAYKWH) AS TODAYKWH, MAX(a.TOTALKWH) AS TOTALKWH, SUM(a.KWH) AS KWH + FROM solar_master.inverter_history_day a + WHERE powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m') = @date1 + GROUP BY DATE_FORMAT(a.TIMESTAMP, '%Y-%m'), a.INVERTERID + ) a + LEFT JOIN " + _siteDB + @".inverter i ON a.INVERTERID = i.InverterId + -- 取日照度 ---------------------- + left join ( + select DATE_FORMAT(a.TIMESTAMP, '%Y-%m') AS reportDate, Irradiance + from sensor_history_month a + where powerstationID = @powerstationID and DATE_FORMAT(a.TIMESTAMP, '%Y-%m') = @date1 and Irradiance <> 0 + )irr on a.reportDate = irr.reportDate ;"; + conn.Execute(sql, new { date1 = _date1.Substring(0, 7), PowerStationID = _powerStationID }); + #endregion month + + conn.Close(); + } + result = true; } - } - - public List proc_station_day(string reportDate) - { - using (MySqlConnection conn = new MySqlConnection(Connection1)) - { - conn.Open(); - string sql = @" -insert into solar_master.power_station_history_day(`PowerStationId`, `TIMESTAMP`, `SITEID`, `SITETYPE`, `TODAYKWH`, `TOTALKWH`, `KWHKWP`, `PR`, `MP`, `SOLARHOUR`, `MONEY`, `TOTALMONEY`, `CARBON`, `TOTALCARBON`) - -SELECT 1 as PowerStationId, FROM_UNIXTIME(s.TIMESTAMP/1000, '%Y-%m-%d %H') AS reportDate, s.SITEID, s.SITETYPE, - s.TodayKWh, s.TotalKWH, s.KWHKWP, s.PR, s.MP, s.SolarHour, 0, 0, 0, 0 - FROM solar_com0002.s02202000101_station s - WHERE DATE_FORMAT(FROM_UNIXTIME(s.TIMESTAMP/1000), '%Y-%m-%d') = '2021-08-04' - ORDER BY TIMESTAMP DESC - LIMIT 1 "; - List ds = conn.Query(sql).AsList(); - conn.Close(); - return ds; + catch (Exception ex) + { + throw ex; } - } - - public List proc_sensor_hour(string reportDate) - { - using (MySqlConnection conn = new MySqlConnection(Connection1)) - { - conn.Open(); - string sql = @" - -INSERT INTO `solar_master`.`sensor_history_hour`(`PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`) - -select a.PowerStationId, a.reportDate, ifnull(b.Irradiance, 0) Irradiance, a.temperature -from -(#溫度 - select 1 as PowerStationId, concat(FROM_UNIXTIME(`TIMESTAMP`/1000, '%Y-%m-%d %H'), ':00:00') AS reportDate, - 0 Irradiance, round(avg(SENSORAVG02),3) temperature - from s02202000101_sensoravg a - where left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = '2021-08-04' - group by FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d %H') -)a left join ( - #日照 - select 1 as PowerStationId, concat(FROM_UNIXTIME(`TIMESTAMP`/1000, '%Y-%m-%d %H'), ':00:00') AS reportDate, - round(avg(SENSORAVG01),3) Irradiance, round(avg(SENSORAVG02),3) temperature - from s02202000101_sensoravg a - where left(FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d'), 10) = '2021-08-04' and SENSORAVG01 <> 0 - group by FROM_UNIXTIME(a.TIMESTAMP / 1000, '%Y-%m-%d %H') -)b on a.reportDate = b.reportDate ;"; - List ds = conn.Query(sql).AsList(); - conn.Close(); - return ds; - } - } + return result; + } + } } diff --git a/solarApp/Service/procSensorSvc.cs b/solarApp/Service/procSensorSvc.cs new file mode 100644 index 0000000..b5e8bde --- /dev/null +++ b/solarApp/Service/procSensorSvc.cs @@ -0,0 +1,362 @@ +using System; +using System.Collections.Generic; +using System.Text; +using MySql.Data.MySqlClient; +using Dapper; +using solarApp.Model; +using System.Configuration; +using System.Threading.Tasks; + +namespace solarApp.Service +{ + public class procSensorSvc + { + string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString; + + public string _siteID { get; set; } + public string _siteDB { get; set; } + public string _siteID01 { get; set; } + public string _date1 { get; set; } + public string _date2 { get; set; } + public string _powerStationID { get; set; } + + //public procSensorSvc(string siteDB, string siteID, string date1, string date2) + //{ + // if (!string.IsNullOrEmpty(siteDB)) _siteDB = siteDB; + // if (!string.IsNullOrEmpty(siteID)) _siteID = siteID.Substring(0, 9); + // if (!string.IsNullOrEmpty(siteID)) _siteID01 = siteID; + // if (!string.IsNullOrEmpty(_date1)) _date1 = date1; + // if (!string.IsNullOrEmpty(_date2)) _date2 = date2; + // #region 取得 PowerStationID + // using (MySqlConnection conn = new MySqlConnection(Connection1)) + // { + // conn.Open(); + // string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; + // var ds = conn.Query(sql, new { siteID = _siteID }).AsList(); + // _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; + // conn.Close(); + // } + // #endregion + + // archiveData(); + //} + + public bool archiveData() { + + bool result = false; + try + { + clearData(); + insert_sensor(); + result = true; + } + catch (Exception ex) + { + throw ex; + } + return result; + } + + /// + /// 清除指定期間、指定電站的 Sensor hour、day、month 資料 + /// + /// + private bool clearData() + { + bool result = false; + try + { + #region 取得 PowerStationID + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; + var ds = conn.Query(sql, new { siteID = _siteID }).AsList(); + _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; + conn.Close(); + } + #endregion + + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @"delete from sensor_history_hour where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID; + delete from sensor_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID; + delete from sensor_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID; + delete from sensoravg_history_hour where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID; + delete from sensoravg_history_day where left(`TIMESTAMP`, 10) between @date1 and @date2 and PowerStationID = @powerStationID; + delete from sensoravg_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID;"; + var ds = conn.Execute(sql, new { date1 = _date1, date2 = _date2, PowerStationID = _powerStationID }); + conn.Close(); + } + result = true; + } + catch (Exception ex) + { + throw ex; + } + return result; + } + + /// + /// Sensor 欄位需要平均時 欄位串接 (s1 + s2) / 2 + /// + /// + /// + string ConcatColumn(List lstData) + { + string ss = string.Empty; string result = string.Empty; + if (lstData.Count > 0) + { + foreach (var item in lstData) + { + ss += (ss == string.Empty) ? item.colname : "+" + item.colname; // 2 個以上欄位需要相加 + } + if (lstData.Count >= 2) result = "(" + ss + ") / " + lstData.Count.ToString(); // 2個以上 需要除以個數 (平均值) + else + result = ss; + } + else result = "0"; + return result; + } + bool insert_sensor() + { + bool result = false; + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + #region 取得 PowerStationID + string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; + var ds = conn.Query(sql, new { siteID = _siteID }).AsList(); + _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; + + #endregion + // init 關閉 group full column + string ss = @"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));"; + conn.Execute(ss); + + #region 獲取 Sensor 類別 + //沒有被刪除、啟用中、狀態正常的 才可列入計算 + sql = @"select a.id, CONCAT( left(UID, 9) ,'01') SiteID, a.`name` sensorName, type, DBName, TableName, colname + from " + _siteDB + @".device a + where left(UID, 11) = @siteID and deleted = 0 and enabled = 1 and `status` = 1 "; + List ds_sensor = conn.Query(sql, new { siteID = _siteID01 }).AsList(); + + //欄位處理 + // { "Type":[ + // { "Name":"日照計","EName":"PYR"}, + // { "Name":"模組溫度計","EName":"MTR"}, + // { "Name":"環境溫度計","EName":"ETR"}, + // { "Name":"環境濕度計","EName":"EMM"}, + // { "Name":"風速計","EName":"VAN"}, + // { "Name":" 電表","EName":"PWR"}]} + 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 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; + irrCol = ConcatColumn(irrlst);//日照計 + modelTempCol = ConcatColumn(modelTemplst); + evnTempCol = ConcatColumn(envTemplst); + humCol = ConcatColumn(humlst); + windCol = ConcatColumn(windlst); + dustCol = ConcatColumn(dustlst); + + string irrNot0 = string.Empty; // and 日照1 <> 0 and 日照2 <> 0 + # region 日照計需要過濾 0 + if (irrlst.Count > 0) + { + foreach (var item in irrlst) + irrNot0 += " and " + item.colname + " <> 0 "; // and S1 <> 0 and S2 <> 0 + } + #endregion + + //電表 + + #endregion 獲取 Sensor 類別 + + try + { + + #region hour + sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`) + select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.modelTempAvg from + ( + select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, round(avg(" + modelTempCol + @"), 2) modelTempAvg, + round(avg(" + evnTempCol + @"), 2) envTempAvg, round(avg(" + humCol + @"), 2) humidityAvg, round(avg(" + windCol + @"), 2) windAvg, + round(avg(" + dustCol + @"), 2) dustAvg + from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2 + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') + ) a left join + ( + select concat(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate, round(avg(" + irrCol + @"), 2) irrAvg + from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2 " + irrNot0 + @" #需要過濾 0 的數值 + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') + )b on a.reportdate = b.reportdate"; + //MySqlCommand cmd = new MySqlCommand(sql, conn); + //cmd.Parameters() + //cmd.ExecuteNonQuery(); + conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 }); + #endregion hour + + #region day + sql = @"insert into sensor_history_day( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`) + select a.powerstationID, a.reportdate, ifnull(b.Irradiance, 0) irrAvg, a.modelTempAvg from + ( + select powerStationID , concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00') reportdate, round(avg(Temperature), 2) modelTempAvg + from solar_master.sensor_history_hour + where powerstationID = @powerstationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') + ) a left join + ( + select concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00') reportdate, round(avg(Irradiance), 2) Irradiance + from solar_master.sensor_history_hour + where powerstationID = @powerstationID + and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2 and Irradiance <> 0 #需要過濾 0 的數值 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') + )b on a.reportdate = b.reportdate"; + conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 }); + #endregion day + + #region month 如果跨月 會有2筆資料 + + sql = @" + delete from sensor_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID; + + insert into sensor_history_month( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`) + select a.powerstationID, a.reportdate, ifnull(b.Irradiance, 0) irrAvg, a.modelTempAvg from + ( + select powerStationID , concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, round(avg(Temperature), 2) modelTempAvg + from solar_master.sensor_history_day + where powerstationID = @powerstationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m') + ) a left join + ( + select concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, round(avg(Irradiance), 2) Irradiance + from solar_master.sensor_history_day + where powerstationID = @powerstationID + and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2 and Irradiance <> 0 #需要過濾 0 的數值 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m') + )b on a.reportdate = b.reportdate"; + conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0,7), date2 = _date2.Substring(0, 7) }); + #endregion month + + #region Sensor 1~50 hour + sql = @" + INSERT INTO solar_master.sensoravg_history_hour(PowerStationId, `TIMESTAMP`, SENSORAVG01, SENSORAVG02, SENSORAVG03, SENSORAVG04, SENSORAVG05, SENSORAVG06, SENSORAVG07, SENSORAVG08, SENSORAVG09, SENSORAVG10, SENSORAVG11, SENSORAVG12, SENSORAVG13, SENSORAVG14, SENSORAVG15, SENSORAVG16, SENSORAVG17, SENSORAVG18, SENSORAVG19, SENSORAVG20, SENSORAVG21, SENSORAVG22, SENSORAVG23, SENSORAVG24, SENSORAVG25, SENSORAVG26, SENSORAVG27, SENSORAVG28, SENSORAVG29, SENSORAVG30, SENSORAVG31, SENSORAVG32, SENSORAVG33, SENSORAVG34, SENSORAVG35, SENSORAVG36, SENSORAVG37, SENSORAVG38, SENSORAVG39, SENSORAVG40, SENSORAVG41, SENSORAVG42, SENSORAVG43, SENSORAVG44, SENSORAVG45, SENSORAVG46, SENSORAVG47, SENSORAVG48, SENSORAVG49, SENSORAVG50) + select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, avg(sensorAvg01), avg(sensorAvg02), + avg(sensorAvg03), avg(sensorAvg04), avg(sensorAvg05), avg(sensorAvg06), avg(sensorAvg07), avg(sensorAvg08), avg(sensorAvg09), + avg(sensorAvg10), avg(sensorAvg11), avg(sensorAvg12), avg(sensorAvg13), avg(sensorAvg14), avg(sensorAvg15), avg(sensorAvg16), + avg(sensorAvg17), avg(sensorAvg18), avg(sensorAvg19), avg(sensorAvg20), avg(sensorAvg21), avg(sensorAvg22), avg(sensorAvg23), + avg(sensorAvg24), avg(sensorAvg25), avg(sensorAvg26), avg(sensorAvg27), avg(sensorAvg28), avg(sensorAvg29), avg(sensorAvg30), + avg(sensorAvg31), avg(sensorAvg32), avg(sensorAvg33), avg(sensorAvg34), avg(sensorAvg35), avg(sensorAvg36), avg(sensorAvg37), + avg(sensorAvg38), avg(sensorAvg39), avg(sensorAvg40), avg(sensorAvg41), avg(sensorAvg42), avg(sensorAvg43), avg(sensorAvg44), + avg(sensorAvg45), avg(sensorAvg46), avg(sensorAvg47), avg(sensorAvg48), avg(sensorAvg49), avg(sensorAvg50) + from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2 + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H');"; + conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 }); + + //日照計 update + sql = string.Empty; + foreach (var item in irrlst) + { + sql += @" update sensoravg_history_hour a join + ( + select @powerstationID powerstationID, concat(FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H'), ':00') reportdate, round(avg(" + item.colname + @"), 2) irrAvg + from " + _siteDB + ".s" + _siteID01 + @"_sensorAvg + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') between @date1 and @date2 and " + item.colname + @" <> 0 #需要過濾 0 的數值 + group by FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H') + )b on a.powerStationID = b.powerStationID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d %H:%i') = b.reportdate + set a." + item.colname + " = b.irrAvg;"; + } + if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 }); + + #endregion + + #region Sensor 1~50 day + sql = @" + INSERT INTO solar_master.sensoravg_history_day(PowerStationId, `TIMESTAMP`, SENSORAVG01, SENSORAVG02, SENSORAVG03, SENSORAVG04, SENSORAVG05, SENSORAVG06, SENSORAVG07, SENSORAVG08, SENSORAVG09, SENSORAVG10, SENSORAVG11, SENSORAVG12, SENSORAVG13, SENSORAVG14, SENSORAVG15, SENSORAVG16, SENSORAVG17, SENSORAVG18, SENSORAVG19, SENSORAVG20, SENSORAVG21, SENSORAVG22, SENSORAVG23, SENSORAVG24, SENSORAVG25, SENSORAVG26, SENSORAVG27, SENSORAVG28, SENSORAVG29, SENSORAVG30, SENSORAVG31, SENSORAVG32, SENSORAVG33, SENSORAVG34, SENSORAVG35, SENSORAVG36, SENSORAVG37, SENSORAVG38, SENSORAVG39, SENSORAVG40, SENSORAVG41, SENSORAVG42, SENSORAVG43, SENSORAVG44, SENSORAVG45, SENSORAVG46, SENSORAVG47, SENSORAVG48, SENSORAVG49, SENSORAVG50) + select @powerStationID powerstationID, DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') reportdate, avg(sensorAvg01), avg(sensorAvg02), + avg(sensorAvg03), avg(sensorAvg04), avg(sensorAvg05), avg(sensorAvg06), avg(sensorAvg07), avg(sensorAvg08), avg(sensorAvg09), + avg(sensorAvg10), avg(sensorAvg11), avg(sensorAvg12), avg(sensorAvg13), avg(sensorAvg14), avg(sensorAvg15), avg(sensorAvg16), + avg(sensorAvg17), avg(sensorAvg18), avg(sensorAvg19), avg(sensorAvg20), avg(sensorAvg21), avg(sensorAvg22), avg(sensorAvg23), + avg(sensorAvg24), avg(sensorAvg25), avg(sensorAvg26), avg(sensorAvg27), avg(sensorAvg28), avg(sensorAvg29), avg(sensorAvg30), + avg(sensorAvg31), avg(sensorAvg32), avg(sensorAvg33), avg(sensorAvg34), avg(sensorAvg35), avg(sensorAvg36), avg(sensorAvg37), + avg(sensorAvg38), avg(sensorAvg39), avg(sensorAvg40), avg(sensorAvg41), avg(sensorAvg42), avg(sensorAvg43), avg(sensorAvg44), + avg(sensorAvg45), avg(sensorAvg46), avg(sensorAvg47), avg(sensorAvg48), avg(sensorAvg49), avg(sensorAvg50) + from solar_master.sensoravg_history_hour + where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d');"; + conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 }); + + //日照計 update + sql = string.Empty; + foreach (var item in irrlst) + { + sql += @" update solar_master.sensoravg_history_day a join + ( + select @powerstationID powerstationID, concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00') reportdate, round(avg(" + item.colname + @"), 2) irrAvg + from solar_master.sensoravg_history_hour + where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') between @date1 and @date2 and " + item.colname + @" <> 0 #需要過濾 0 的數值 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') + )b on a.powerStationID = b.powerStationID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = b.reportdate + set a." + item.colname + " = b.irrAvg;"; + } + if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1, date2 = _date2 }); + + #endregion + + #region Sensor 1~50 month + sql = @" + delete from sensoravg_history_month where left(`TIMESTAMP`, 7) between left(@date1, 7) and left(@date2, 7) and PowerStationID = @powerStationID; + + INSERT INTO solar_master.sensoravg_history_month (PowerStationId, `TIMESTAMP`, SENSORAVG01, SENSORAVG02, SENSORAVG03, SENSORAVG04, SENSORAVG05, SENSORAVG06, SENSORAVG07, SENSORAVG08, SENSORAVG09, SENSORAVG10, SENSORAVG11, SENSORAVG12, SENSORAVG13, SENSORAVG14, SENSORAVG15, SENSORAVG16, SENSORAVG17, SENSORAVG18, SENSORAVG19, SENSORAVG20, SENSORAVG21, SENSORAVG22, SENSORAVG23, SENSORAVG24, SENSORAVG25, SENSORAVG26, SENSORAVG27, SENSORAVG28, SENSORAVG29, SENSORAVG30, SENSORAVG31, SENSORAVG32, SENSORAVG33, SENSORAVG34, SENSORAVG35, SENSORAVG36, SENSORAVG37, SENSORAVG38, SENSORAVG39, SENSORAVG40, SENSORAVG41, SENSORAVG42, SENSORAVG43, SENSORAVG44, SENSORAVG45, SENSORAVG46, SENSORAVG47, SENSORAVG48, SENSORAVG49, SENSORAVG50) + select @powerStationID powerstationID, concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, avg(sensorAvg01), avg(sensorAvg02), + avg(sensorAvg03), avg(sensorAvg04), avg(sensorAvg05), avg(sensorAvg06), avg(sensorAvg07), avg(sensorAvg08), avg(sensorAvg09), + avg(sensorAvg10), avg(sensorAvg11), avg(sensorAvg12), avg(sensorAvg13), avg(sensorAvg14), avg(sensorAvg15), avg(sensorAvg16), + avg(sensorAvg17), avg(sensorAvg18), avg(sensorAvg19), avg(sensorAvg20), avg(sensorAvg21), avg(sensorAvg22), avg(sensorAvg23), + avg(sensorAvg24), avg(sensorAvg25), avg(sensorAvg26), avg(sensorAvg27), avg(sensorAvg28), avg(sensorAvg29), avg(sensorAvg30), + avg(sensorAvg31), avg(sensorAvg32), avg(sensorAvg33), avg(sensorAvg34), avg(sensorAvg35), avg(sensorAvg36), avg(sensorAvg37), + avg(sensorAvg38), avg(sensorAvg39), avg(sensorAvg40), avg(sensorAvg41), avg(sensorAvg42), avg(sensorAvg43), avg(sensorAvg44), + avg(sensorAvg45), avg(sensorAvg46), avg(sensorAvg47), avg(sensorAvg48), avg(sensorAvg49), avg(sensorAvg50) + from solar_master.sensoravg_history_day + where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m');"; + conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0, 7), date2 = _date2.Substring(0, 7) }); + + //日照計 update + sql = string.Empty; + foreach (var item in irrlst) + { + sql += @" update solar_master.sensoravg_history_month a join + ( + select @powerstationID powerstationID, concat( DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00') reportdate, round(avg(" + item.colname + @"), 2) irrAvg + from solar_master.sensoravg_history_day + where powerStationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m') between @date1 and @date2 and " + item.colname + @" <> 0 #需要過濾 0 的數值 + group by DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') + )b on a.powerStationID = b.powerStationID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m') = b.reportdate + set a." + item.colname + " = b.irrAvg;"; + } + if (!string.IsNullOrEmpty(sql)) conn.Execute(sql, new { powerStationID = _powerStationID, date1 = _date1.Substring(0, 7), date2 = _date2.Substring(0, 7) }); + + #endregion + + conn.Close(); + result = true; + } + catch (Exception ex) + { + throw ex; + } + } + return result; + } + + } +} diff --git a/solarApp/Service/procStationSvc.cs b/solarApp/Service/procStationSvc.cs new file mode 100644 index 0000000..5b60bd6 --- /dev/null +++ b/solarApp/Service/procStationSvc.cs @@ -0,0 +1,190 @@ +using System; +using System.Collections.Generic; +using System.Text; +using MySql.Data.MySqlClient; +using Dapper; +using solarApp.Model; +using System.Configuration; + +namespace solarApp.Service +{ + public class procStationSvc + { + string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString; + + public string _siteID { get; set; } + public string _siteDB { get; set; } + public string _siteID01 { get; set; } + public string _date1 { get; set; } + public string _date2 { get; set; } + public string _powerStationID { get; set; } + + + public bool clearData() + { + bool result = false; + try + { + #region 取得 PowerStationID + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; + var ds = conn.Query(sql, new { siteID = _siteID }).AsList(); + _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; + conn.Close(); + } + #endregion + + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string sql = @" + delete from power_station_history_hour where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1; + delete from power_station_history_day where powerstationID = @powerStationID and DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') = @date1; + delete from power_station_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ;"; + var ds = conn.Execute(sql, new { date1 = _date1, powerStationID = _powerStationID }); + conn.Close(); + } + result = true; + } + catch (Exception ex) + { + throw ex; + } + return result; + } + + public bool archiveData() + { + bool result = false; + try + { + clearData(); + insert_station(); + result = true; + } + catch (Exception ex) + { + throw ex; + } + return result; + } + + bool insert_station() + { + bool result = false; + try + { + using (MySqlConnection conn = new MySqlConnection(Connection1)) + { + conn.Open(); + string ss = @"SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));"; + conn.Execute(ss); + + string sql = @" select id as PowerStationID from solar_master.power_station where `code` = @siteID"; + var ds = conn.Query(sql, new { siteID = _siteID }).AsList(); + _powerStationID = (ds.Count > 0) ? ds[0][0].ToString() : "0"; + + #region hour -- solar_type 計費類別:0 自建、1 租建、2自建 ------------ 1 租建計算方式 後再再補上 + + //select b.id PowerStationId, a.reportdate, b.siteID, a.siteType, a.KWH, a.TODAYKWH, a.TOTALKWH, a.KWHKWP, a.PR, a.MP, a.SOLARHOUR, + // (KWH * PowerRate) MONEY, (a.TODAYKWH * PowerRate) TODAYMONEY, (a.TOTALKWH * PowerRate) TOTALMONEY, + // (KWH * CarbonRate) CARBON, (a.TODAYKWH * CarbonRate) TODAYCARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON + // from + // ( + // select siteid, siteType, concat(FROM_UNIXTIME(`TIMESTAMP`/ 1000, '%Y-%m-%d %H'), ':00:00') reportdate, + // round((sum(KWH)), 4) KWH, round((max(TODAYKWH)), 4) TODAYKWH, round((max(TOTALKWH)), 4) TOTALKWH, round((max(KWHKWP)), 4) KWHKWP, + // round((max(PR)), 4) PR, 0 as MP, round((max(SOLARHOUR)), 4) SOLARHOUR + + // from " + _siteDB + ".s" + _siteID01 + @"_station + + // where FROM_UNIXTIME(`TIMESTAMP`/ 1000, '%Y-%m-%d') = @date1 + + // group by siteid, FROM_UNIXTIME(`TIMESTAMP`/ 1000, '%Y-%m-%d %H') + // )a join + // ( + // select id, `code` siteID, PowerRate, (select `value` from solar_master.`variable` where `name` = 'CarbonRate') as CarbonRate, SolarType + // from solar_master.power_station + // where `code` = @siteID + // ) b on a.siteID = b.siteID + + sql = @"insert into solar_master.power_station_history_hour(PowerStationId, `TIMESTAMP`, SITEID, SITETYPE, KWH, TODAYKWH, TOTALKWH, KWHKWP, PR, MP, SOLARHOUR, MONEY, TODAYMONEY, TOTALMONEY, CARBON, TODAYCARBON, TOTALCARBON) + + select b.id PowerStationId, concat(FROM_UNIXTIME(`TIMESTAMP`/1000, '%Y-%m-%d %H'), ':00:00') reportdate, a.siteid, a.siteType, + a.KWH, TODAYKWH, TOTALKWH, KWHKWP , PR, MP, a.SOLARHOUR , + (a.KWH * PowerRate) MONEY, (a.TODAYKWH * PowerRate) TODAYMONEY, (a.TOTALKWH * PowerRate) TOTALMONEY, + (a.KWH * CarbonRate) CARBON, (a.TODAYKWH * CarbonRate) TODAYCARBON, round((a.TOTALKWH * CarbonRate), 3) TOTALCARBON + from " + _siteDB + ".s" + _siteID01 + @"_station a join + (select id, `code` siteID, PowerRate, (select `value` from solar_master.`variable` where `name` = 'CarbonRate') as CarbonRate, SolarType + from solar_master.power_station where `code` = @siteID + ) b on a.siteID = b.siteID + where FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d') = @date1 and a.SITEID = @siteID "; + int ct = conn.Execute(sql, new { date1 = _date1, siteID = _siteID }); + + #endregion hour + + #region day + sql = @" INSERT INTO solar_master.power_station_history_day( PowerStationId, `TIMESTAMP`, SITEID, SITETYPE, TODAYKWH, TOTALKWH, KWHKWP, + PR, MP, SOLARHOUR, MONEY, TOTALMONEY, CARBON, TOTALCARBON) + + select b.id PowerStationId, a.reportdate, b.siteID, a.siteType, a.TODAYKWH, a.TOTALKWH, a.KWHKWP, a.PR, a.MP, a.SOLARHOUR, + (KWH * PowerRate) MONEY, (a.TOTALKWH * PowerRate) TOTALMONEY, + (KWH * CarbonRate) CARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON + from + ( + select concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d'), ' 00:00:00') reportdate, siteid, siteType, round((sum(KWH)), 4) KWH, + round((max(TODAYKWH)), 4) TODAYKWH, round((max(TOTALKWH)), 4) TOTALKWH, round((max(KWHKWP)), 4) KWHKWP, + round((max(PR)), 4) PR, round((max(MP)), 4) as MP, round((max(SOLARHOUR)), 4) SOLARHOUR + from solar_master.power_station_history_hour a + where SITEID = @siteID and DATE_FORMAT(a.`TIMESTAMP`,'%Y-%m-%d') = @date1 + group by a.siteid, DATE_FORMAT(`TIMESTAMP`,'%Y-%m-%d') + )a join + ( + select id, `code` siteID, PowerRate, (select `value` from solar_master.`variable` where `name` = 'CarbonRate') as CarbonRate, SolarType + from solar_master.power_station + where `code` = @siteID + ) b on a.siteID = b.siteID "; + conn.Execute(sql, new { date1 = _date1, siteID = _siteID }); + #endregion day + + #region month + sql = @" + delete from power_station_history_month where powerstationID = @powerStationID and left(`TIMESTAMP`, 7) = left(@date1, 7) ; + + INSERT INTO solar_master.power_station_history_month(PowerStationId, `TIMESTAMP`, SITEID, SITETYPE, TOTALKWH, KWHKWP, + PR, MP, SOLARHOUR, MONEY, TOTALMONEY, CARBON, TOTALCARBON) + + select b.id PowerStationId, a.reportdate, b.siteID, a.siteType, a.TOTALKWH, a.KWHKWP, a.PR, a.MP, a.SOLARHOUR, + (KWH * PowerRate) MONEY, (a.TOTALKWH * PowerRate) TOTALMONEY, + (KWH * CarbonRate) CARBON, round((a.TOTALKWH * CarbonRate), 4) TOTALCARBON + from + ( + select concat(DATE_FORMAT(`TIMESTAMP`,'%Y-%m'), '-01 00:00:00') reportdate, siteid, siteType, round((sum(KWH)), 4) KWH, + round((max(TODAYKWH)), 4) TODAYKWH, round((max(TOTALKWH)), 4) TOTALKWH, round((max(KWHKWP)), 4) KWHKWP, + round((max(PR)), 4) PR, round((max(MP)), 4) as MP, round((max(SOLARHOUR)), 4) SOLARHOUR + from solar_master.power_station_history_hour a + where SITEID = @siteID and DATE_FORMAT(a.`TIMESTAMP`, '%Y-%m') = @date1 + group by a.siteid, DATE_FORMAT(`TIMESTAMP`, '%Y-%m') + )a join + ( + select id, `code` siteID, PowerRate, (select `value` from solar_master.`variable` where `name` = 'CarbonRate') as CarbonRate, SolarType + from solar_master.power_station + where `code` = @siteID + ) b on a.siteID = b.siteID "; + conn.Execute(sql, new { date1 = _date1.Substring(0, 7), siteID = _siteID, powerStationID = _powerStationID }); + + #endregion month + + conn.Close(); + } + result = true; + } + catch (Exception ex) + { + throw ex; + } + return result; + } + } +} diff --git a/solarApp/fmArchive.Designer.cs b/solarApp/fmArchive.Designer.cs index 2f5b495..c914109 100644 --- a/solarApp/fmArchive.Designer.cs +++ b/solarApp/fmArchive.Designer.cs @@ -29,668 +29,232 @@ namespace solarApp /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - this.tb2 = new System.Windows.Forms.TabPage(); - this.sp_main_station = new System.Windows.Forms.SplitContainer(); - this.label12 = new System.Windows.Forms.Label(); - this.dtselect_station2 = new System.Windows.Forms.DateTimePicker(); - this.lbMsg_station = new System.Windows.Forms.Label(); - this.bt_find_station = new System.Windows.Forms.Button(); - this.dtselect_station1 = new System.Windows.Forms.DateTimePicker(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.label13 = new System.Windows.Forms.Label(); - this.sp_child_station = new System.Windows.Forms.SplitContainer(); - this.gv_web_station_day = new System.Windows.Forms.DataGridView(); - this.panel7 = new System.Windows.Forms.Panel(); - this.label10 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.gv_web_station_hour = new System.Windows.Forms.DataGridView(); - this.panel4 = new System.Windows.Forms.Panel(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.gv_fic_station_day = new System.Windows.Forms.DataGridView(); - this.panel5 = new System.Windows.Forms.Panel(); - this.label7 = new System.Windows.Forms.Label(); - this.gv_fic_station_raw = new System.Windows.Forms.DataGridView(); - this.panel6 = new System.Windows.Forms.Panel(); - this.label8 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.tb_inv = new System.Windows.Forms.TabPage(); - this.sp_main_inv = new System.Windows.Forms.SplitContainer(); - this.bt_inv_proc = new System.Windows.Forms.Button(); - this.lbMsg_inv = new System.Windows.Forms.Label(); - this.lbInverterID = new System.Windows.Forms.Label(); - this.fp_inv = new System.Windows.Forms.FlowLayoutPanel(); - this.bt_select1 = new System.Windows.Forms.Button(); - this.sp_child_inv = new System.Windows.Forms.SplitContainer(); - this.gv_web_inv_hour = new System.Windows.Forms.DataGridView(); - this.panel1 = new System.Windows.Forms.Panel(); - this.label3 = new System.Windows.Forms.Label(); - this.lb_inv_hour = new System.Windows.Forms.Label(); - this.gv_fic_inv_hour = new System.Windows.Forms.DataGridView(); - this.panel3 = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.gv_fic_inv_raw = new System.Windows.Forms.DataGridView(); - this.panel2 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.lb_raw_inv_hour = new System.Windows.Forms.Label(); this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tb2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.sp_main_station)).BeginInit(); - this.sp_main_station.Panel1.SuspendLayout(); - this.sp_main_station.Panel2.SuspendLayout(); - this.sp_main_station.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.sp_child_station)).BeginInit(); - this.sp_child_station.Panel1.SuspendLayout(); - this.sp_child_station.Panel2.SuspendLayout(); - this.sp_child_station.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_web_station_day)).BeginInit(); - this.panel7.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_web_station_hour)).BeginInit(); - this.panel4.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_station_day)).BeginInit(); - this.panel5.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_station_raw)).BeginInit(); - this.panel6.SuspendLayout(); - this.tb_inv.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.sp_main_inv)).BeginInit(); - this.sp_main_inv.Panel1.SuspendLayout(); - this.sp_main_inv.Panel2.SuspendLayout(); - this.sp_main_inv.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.sp_child_inv)).BeginInit(); - this.sp_child_inv.Panel1.SuspendLayout(); - this.sp_child_inv.Panel2.SuspendLayout(); - this.sp_child_inv.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_web_inv_hour)).BeginInit(); - this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_inv_hour)).BeginInit(); - this.panel3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_inv_raw)).BeginInit(); - this.panel2.SuspendLayout(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.bt_clear_station = new System.Windows.Forms.Button(); + this.bt_clear_inv = new System.Windows.Forms.Button(); + this.fp_site = new System.Windows.Forms.FlowLayoutPanel(); + this.dtSelect = new System.Windows.Forms.DateTimePicker(); + 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.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.panel1 = new System.Windows.Forms.Panel(); + this.btVerifyData = new System.Windows.Forms.Button(); + this.lbSiteDB_sensor = new System.Windows.Forms.Label(); + this.lbSiteID_sensor = new System.Windows.Forms.Label(); + this.lbSiteName_sensor = new System.Windows.Forms.Label(); + this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // - // tb2 - // - this.tb2.Controls.Add(this.sp_main_station); - this.tb2.Location = new System.Drawing.Point(4, 28); - this.tb2.Name = "tb2"; - this.tb2.Padding = new System.Windows.Forms.Padding(3); - this.tb2.Size = new System.Drawing.Size(1774, 921); - this.tb2.TabIndex = 1; - this.tb2.Text = " site "; - this.tb2.UseVisualStyleBackColor = true; - // - // sp_main_station - // - this.sp_main_station.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.sp_main_station.Dock = System.Windows.Forms.DockStyle.Fill; - this.sp_main_station.Location = new System.Drawing.Point(3, 3); - this.sp_main_station.Name = "sp_main_station"; - // - // sp_main_station.Panel1 - // - this.sp_main_station.Panel1.Controls.Add(this.label12); - this.sp_main_station.Panel1.Controls.Add(this.dtselect_station2); - this.sp_main_station.Panel1.Controls.Add(this.lbMsg_station); - this.sp_main_station.Panel1.Controls.Add(this.bt_find_station); - this.sp_main_station.Panel1.Controls.Add(this.dtselect_station1); - this.sp_main_station.Panel1.Controls.Add(this.flowLayoutPanel1); - // - // sp_main_station.Panel2 - // - this.sp_main_station.Panel2.BackColor = System.Drawing.Color.OldLace; - this.sp_main_station.Panel2.Controls.Add(this.sp_child_station); - this.sp_main_station.Size = new System.Drawing.Size(1768, 915); - this.sp_main_station.SplitterDistance = 262; - this.sp_main_station.TabIndex = 0; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label12.Location = new System.Drawing.Point(13, 44); - this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(24, 24); - this.label12.TabIndex = 12; - this.label12.Text = "~"; - // - // dtselect_station2 - // - this.dtselect_station2.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.dtselect_station2.Location = new System.Drawing.Point(12, 76); - this.dtselect_station2.Name = "dtselect_station2"; - this.dtselect_station2.Size = new System.Drawing.Size(234, 31); - this.dtselect_station2.TabIndex = 10; - // - // lbMsg_station - // - this.lbMsg_station.AutoSize = true; - this.lbMsg_station.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.lbMsg_station.Location = new System.Drawing.Point(26, 162); - this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lbMsg_station.Name = "lbMsg_station"; - this.lbMsg_station.Size = new System.Drawing.Size(22, 24); - this.lbMsg_station.TabIndex = 9; - this.lbMsg_station.Text = "..."; - // - // bt_find_station - // - this.bt_find_station.Location = new System.Drawing.Point(12, 124); - this.bt_find_station.Name = "bt_find_station"; - this.bt_find_station.Size = new System.Drawing.Size(94, 29); - this.bt_find_station.TabIndex = 7; - this.bt_find_station.Text = "查詢"; - this.bt_find_station.UseVisualStyleBackColor = true; - // - // dtselect_station1 - // - this.dtselect_station1.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.dtselect_station1.Location = new System.Drawing.Point(14, 8); - this.dtselect_station1.Name = "dtselect_station1"; - this.dtselect_station1.Size = new System.Drawing.Size(234, 31); - this.dtselect_station1.TabIndex = 6; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.BackColor = System.Drawing.Color.Azure; - this.flowLayoutPanel1.Controls.Add(this.label13); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 270); - this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(262, 645); - this.flowLayoutPanel1.TabIndex = 8; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label13.Location = new System.Drawing.Point(4, 0); - this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(110, 24); - this.label13.TabIndex = 4; - this.label13.Text = "請選擇 電站"; - // - // sp_child_station - // - this.sp_child_station.Dock = System.Windows.Forms.DockStyle.Fill; - this.sp_child_station.Location = new System.Drawing.Point(0, 0); - this.sp_child_station.Margin = new System.Windows.Forms.Padding(4); - this.sp_child_station.Name = "sp_child_station"; - // - // sp_child_station.Panel1 - // - this.sp_child_station.Panel1.Controls.Add(this.gv_web_station_day); - this.sp_child_station.Panel1.Controls.Add(this.panel7); - this.sp_child_station.Panel1.Controls.Add(this.gv_web_station_hour); - this.sp_child_station.Panel1.Controls.Add(this.panel4); - // - // sp_child_station.Panel2 - // - this.sp_child_station.Panel2.Controls.Add(this.gv_fic_station_day); - this.sp_child_station.Panel2.Controls.Add(this.panel5); - this.sp_child_station.Panel2.Controls.Add(this.gv_fic_station_raw); - this.sp_child_station.Panel2.Controls.Add(this.panel6); - this.sp_child_station.Size = new System.Drawing.Size(1502, 915); - this.sp_child_station.SplitterDistance = 727; - this.sp_child_station.SplitterWidth = 13; - this.sp_child_station.TabIndex = 1; - // - // gv_web_station_day - // - this.gv_web_station_day.AllowUserToAddRows = false; - this.gv_web_station_day.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.Azure; - this.gv_web_station_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; - this.gv_web_station_day.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gv_web_station_day.Dock = System.Windows.Forms.DockStyle.Fill; - this.gv_web_station_day.Location = new System.Drawing.Point(0, 583); - this.gv_web_station_day.Margin = new System.Windows.Forms.Padding(4); - this.gv_web_station_day.Name = "gv_web_station_day"; - this.gv_web_station_day.ReadOnly = true; - this.gv_web_station_day.RowHeadersWidth = 51; - this.gv_web_station_day.RowTemplate.Height = 25; - this.gv_web_station_day.Size = new System.Drawing.Size(727, 332); - this.gv_web_station_day.TabIndex = 3; - // - // panel7 - // - this.panel7.Controls.Add(this.label10); - this.panel7.Controls.Add(this.label11); - this.panel7.Dock = System.Windows.Forms.DockStyle.Top; - this.panel7.Location = new System.Drawing.Point(0, 545); - this.panel7.Margin = new System.Windows.Forms.Padding(4); - this.panel7.Name = "panel7"; - this.panel7.Size = new System.Drawing.Size(727, 38); - this.panel7.TabIndex = 2; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label10.Location = new System.Drawing.Point(230, 8); - this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(368, 24); - this.label10.TabIndex = 1; - this.label10.Text = "solar_master.power_station_history_day"; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label11.Location = new System.Drawing.Point(35, 8); - this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(162, 24); - this.label11.TabIndex = 0; - this.label11.Text = "web: station 每天"; - // - // gv_web_station_hour - // - this.gv_web_station_hour.AllowUserToAddRows = false; - this.gv_web_station_hour.AllowUserToDeleteRows = false; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.Azure; - this.gv_web_station_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2; - this.gv_web_station_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gv_web_station_hour.Dock = System.Windows.Forms.DockStyle.Top; - this.gv_web_station_hour.Location = new System.Drawing.Point(0, 38); - this.gv_web_station_hour.Margin = new System.Windows.Forms.Padding(4); - this.gv_web_station_hour.Name = "gv_web_station_hour"; - this.gv_web_station_hour.ReadOnly = true; - this.gv_web_station_hour.RowHeadersWidth = 51; - this.gv_web_station_hour.RowTemplate.Height = 25; - this.gv_web_station_hour.Size = new System.Drawing.Size(727, 507); - this.gv_web_station_hour.TabIndex = 1; - // - // panel4 - // - this.panel4.Controls.Add(this.label5); - this.panel4.Controls.Add(this.label6); - this.panel4.Dock = System.Windows.Forms.DockStyle.Top; - this.panel4.Location = new System.Drawing.Point(0, 0); - this.panel4.Margin = new System.Windows.Forms.Padding(4); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(727, 38); - this.panel4.TabIndex = 0; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label5.Location = new System.Drawing.Point(230, 8); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(379, 24); - this.label5.TabIndex = 1; - this.label5.Text = "solar_master.power_station_history_hour"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label6.Location = new System.Drawing.Point(35, 8); - this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(156, 24); - this.label6.TabIndex = 0; - this.label6.Text = "web: site 每小時 "; - // - // gv_fic_station_day - // - this.gv_fic_station_day.AllowUserToAddRows = false; - this.gv_fic_station_day.AllowUserToDeleteRows = false; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_station_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; - this.gv_fic_station_day.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gv_fic_station_day.Dock = System.Windows.Forms.DockStyle.Fill; - this.gv_fic_station_day.Location = new System.Drawing.Point(0, 583); - this.gv_fic_station_day.Margin = new System.Windows.Forms.Padding(4); - this.gv_fic_station_day.Name = "gv_fic_station_day"; - this.gv_fic_station_day.ReadOnly = true; - this.gv_fic_station_day.RowHeadersWidth = 51; - this.gv_fic_station_day.RowTemplate.Height = 25; - this.gv_fic_station_day.Size = new System.Drawing.Size(762, 332); - this.gv_fic_station_day.TabIndex = 4; - // - // panel5 - // - this.panel5.Controls.Add(this.label7); - this.panel5.Dock = System.Windows.Forms.DockStyle.Top; - this.panel5.Location = new System.Drawing.Point(0, 545); - this.panel5.Margin = new System.Windows.Forms.Padding(4); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(762, 38); - this.panel5.TabIndex = 3; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label7.Location = new System.Drawing.Point(15, 8); - this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(152, 24); - this.label7.TabIndex = 2; - this.label7.Text = "FIC: station 每天"; - // - // gv_fic_station_raw - // - this.gv_fic_station_raw.AllowUserToAddRows = false; - this.gv_fic_station_raw.AllowUserToDeleteRows = false; - dataGridViewCellStyle4.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_station_raw.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4; - this.gv_fic_station_raw.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gv_fic_station_raw.Dock = System.Windows.Forms.DockStyle.Top; - this.gv_fic_station_raw.Location = new System.Drawing.Point(0, 38); - this.gv_fic_station_raw.Margin = new System.Windows.Forms.Padding(4); - this.gv_fic_station_raw.Name = "gv_fic_station_raw"; - this.gv_fic_station_raw.ReadOnly = true; - this.gv_fic_station_raw.RowHeadersWidth = 51; - this.gv_fic_station_raw.RowTemplate.Height = 25; - this.gv_fic_station_raw.Size = new System.Drawing.Size(762, 507); - this.gv_fic_station_raw.TabIndex = 2; - // - // panel6 - // - this.panel6.Controls.Add(this.label8); - this.panel6.Controls.Add(this.label9); - this.panel6.Dock = System.Windows.Forms.DockStyle.Top; - this.panel6.Location = new System.Drawing.Point(0, 0); - this.panel6.Margin = new System.Windows.Forms.Padding(4); - this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(762, 38); - this.panel6.TabIndex = 1; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label8.Location = new System.Drawing.Point(255, 8); - this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(350, 24); - this.label8.TabIndex = 3; - this.label8.Text = "solar_com0002.s02202000101_station"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label9.Location = new System.Drawing.Point(15, 8); - this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(245, 24); - this.label9.TabIndex = 2; - this.label9.Text = "FIC: station 原始資料(hour)"; - // - // tb_inv - // - this.tb_inv.BackColor = System.Drawing.Color.LightSkyBlue; - this.tb_inv.Controls.Add(this.sp_main_inv); - this.tb_inv.Location = new System.Drawing.Point(4, 28); - this.tb_inv.Name = "tb_inv"; - this.tb_inv.Padding = new System.Windows.Forms.Padding(3); - this.tb_inv.Size = new System.Drawing.Size(1774, 921); - this.tb_inv.TabIndex = 0; - this.tb_inv.Text = " Inverter "; - // - // sp_main_inv - // - this.sp_main_inv.BackColor = System.Drawing.Color.LightSkyBlue; - this.sp_main_inv.Dock = System.Windows.Forms.DockStyle.Fill; - this.sp_main_inv.Location = new System.Drawing.Point(3, 3); - this.sp_main_inv.Name = "sp_main_inv"; - // - // sp_main_inv.Panel1 - // - this.sp_main_inv.Panel1.BackColor = System.Drawing.Color.LightSkyBlue; - this.sp_main_inv.Panel1.Controls.Add(this.bt_inv_proc); - this.sp_main_inv.Panel1.Controls.Add(this.lbMsg_inv); - this.sp_main_inv.Panel1.Controls.Add(this.lbInverterID); - this.sp_main_inv.Panel1.Controls.Add(this.fp_inv); - this.sp_main_inv.Panel1.Controls.Add(this.bt_select1); - // - // sp_main_inv.Panel2 - // - this.sp_main_inv.Panel2.Controls.Add(this.sp_child_inv); - this.sp_main_inv.Size = new System.Drawing.Size(1768, 915); - this.sp_main_inv.SplitterDistance = 357; - this.sp_main_inv.TabIndex = 0; - // - // bt_inv_proc - // - this.bt_inv_proc.Location = new System.Drawing.Point(22, 83); - this.bt_inv_proc.Name = "bt_inv_proc"; - this.bt_inv_proc.Size = new System.Drawing.Size(94, 29); - this.bt_inv_proc.TabIndex = 6; - this.bt_inv_proc.Text = "查詢"; - this.bt_inv_proc.UseVisualStyleBackColor = true; - this.bt_inv_proc.Click += new System.EventHandler(this.bt_inv_proc_Click); - // - // lbMsg_inv - // - this.lbMsg_inv.AutoSize = true; - this.lbMsg_inv.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.lbMsg_inv.Location = new System.Drawing.Point(136, 28); - this.lbMsg_inv.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lbMsg_inv.Name = "lbMsg_inv"; - this.lbMsg_inv.Size = new System.Drawing.Size(22, 24); - this.lbMsg_inv.TabIndex = 5; - this.lbMsg_inv.Text = "..."; - // - // lbInverterID - // - this.lbInverterID.AutoSize = true; - this.lbInverterID.Dock = System.Windows.Forms.DockStyle.Bottom; - this.lbInverterID.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.lbInverterID.Location = new System.Drawing.Point(0, 246); - this.lbInverterID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lbInverterID.Name = "lbInverterID"; - this.lbInverterID.Size = new System.Drawing.Size(105, 24); - this.lbInverterID.TabIndex = 3; - this.lbInverterID.Text = "待處理設備"; - // - // fp_inv - // - this.fp_inv.BackColor = System.Drawing.Color.GhostWhite; - this.fp_inv.Dock = System.Windows.Forms.DockStyle.Bottom; - this.fp_inv.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.fp_inv.Location = new System.Drawing.Point(0, 270); - this.fp_inv.Margin = new System.Windows.Forms.Padding(4); - this.fp_inv.Name = "fp_inv"; - this.fp_inv.Size = new System.Drawing.Size(357, 645); - this.fp_inv.TabIndex = 2; - // - // bt_select1 - // - this.bt_select1.Location = new System.Drawing.Point(22, 23); - this.bt_select1.Name = "bt_select1"; - this.bt_select1.Size = new System.Drawing.Size(94, 29); - this.bt_select1.TabIndex = 1; - this.bt_select1.Text = "查詢"; - this.bt_select1.UseVisualStyleBackColor = true; - // - // sp_child_inv - // - this.sp_child_inv.Dock = System.Windows.Forms.DockStyle.Fill; - this.sp_child_inv.Location = new System.Drawing.Point(0, 0); - this.sp_child_inv.Margin = new System.Windows.Forms.Padding(4); - this.sp_child_inv.Name = "sp_child_inv"; - // - // sp_child_inv.Panel1 - // - this.sp_child_inv.Panel1.Controls.Add(this.gv_web_inv_hour); - this.sp_child_inv.Panel1.Controls.Add(this.panel1); - // - // sp_child_inv.Panel2 - // - this.sp_child_inv.Panel2.Controls.Add(this.gv_fic_inv_hour); - this.sp_child_inv.Panel2.Controls.Add(this.panel3); - this.sp_child_inv.Panel2.Controls.Add(this.gv_fic_inv_raw); - this.sp_child_inv.Panel2.Controls.Add(this.panel2); - this.sp_child_inv.Size = new System.Drawing.Size(1407, 915); - this.sp_child_inv.SplitterDistance = 678; - this.sp_child_inv.SplitterWidth = 13; - this.sp_child_inv.TabIndex = 0; - // - // gv_web_inv_hour - // - this.gv_web_inv_hour.AllowUserToAddRows = false; - this.gv_web_inv_hour.AllowUserToDeleteRows = false; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.Azure; - this.gv_web_inv_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; - this.gv_web_inv_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gv_web_inv_hour.Dock = System.Windows.Forms.DockStyle.Fill; - this.gv_web_inv_hour.Location = new System.Drawing.Point(0, 38); - this.gv_web_inv_hour.Margin = new System.Windows.Forms.Padding(4); - this.gv_web_inv_hour.Name = "gv_web_inv_hour"; - this.gv_web_inv_hour.ReadOnly = true; - this.gv_web_inv_hour.RowHeadersWidth = 51; - this.gv_web_inv_hour.RowTemplate.Height = 25; - this.gv_web_inv_hour.Size = new System.Drawing.Size(678, 877); - this.gv_web_inv_hour.TabIndex = 1; - // - // panel1 - // - this.panel1.Controls.Add(this.label3); - this.panel1.Controls.Add(this.lb_inv_hour); - 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(678, 38); - this.panel1.TabIndex = 0; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label3.Location = new System.Drawing.Point(230, 8); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(321, 24); - this.label3.TabIndex = 1; - this.label3.Text = "solar_master.inverter_history_hour"; - // - // lb_inv_hour - // - this.lb_inv_hour.AutoSize = true; - this.lb_inv_hour.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.lb_inv_hour.Location = new System.Drawing.Point(35, 8); - this.lb_inv_hour.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lb_inv_hour.Name = "lb_inv_hour"; - this.lb_inv_hour.Size = new System.Drawing.Size(151, 24); - this.lb_inv_hour.TabIndex = 0; - this.lb_inv_hour.Text = "web: inv 每小時 "; - // - // gv_fic_inv_hour - // - this.gv_fic_inv_hour.AllowUserToAddRows = false; - this.gv_fic_inv_hour.AllowUserToDeleteRows = false; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_inv_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; - this.gv_fic_inv_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gv_fic_inv_hour.Dock = System.Windows.Forms.DockStyle.Fill; - this.gv_fic_inv_hour.Location = new System.Drawing.Point(0, 583); - this.gv_fic_inv_hour.Margin = new System.Windows.Forms.Padding(4); - this.gv_fic_inv_hour.Name = "gv_fic_inv_hour"; - this.gv_fic_inv_hour.ReadOnly = true; - this.gv_fic_inv_hour.RowHeadersWidth = 51; - this.gv_fic_inv_hour.RowTemplate.Height = 25; - this.gv_fic_inv_hour.Size = new System.Drawing.Size(716, 332); - this.gv_fic_inv_hour.TabIndex = 4; - // - // panel3 - // - this.panel3.Controls.Add(this.label1); - this.panel3.Dock = System.Windows.Forms.DockStyle.Top; - this.panel3.Location = new System.Drawing.Point(0, 545); - this.panel3.Margin = new System.Windows.Forms.Padding(4); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(716, 38); - this.panel3.TabIndex = 3; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label1.Location = new System.Drawing.Point(15, 8); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(141, 24); - this.label1.TabIndex = 2; - this.label1.Text = "FIC: inv 每小時 "; - // - // gv_fic_inv_raw - // - this.gv_fic_inv_raw.AllowUserToAddRows = false; - this.gv_fic_inv_raw.AllowUserToDeleteRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_inv_raw.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; - this.gv_fic_inv_raw.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.gv_fic_inv_raw.Dock = System.Windows.Forms.DockStyle.Top; - this.gv_fic_inv_raw.Location = new System.Drawing.Point(0, 38); - this.gv_fic_inv_raw.Margin = new System.Windows.Forms.Padding(4); - this.gv_fic_inv_raw.Name = "gv_fic_inv_raw"; - this.gv_fic_inv_raw.ReadOnly = true; - this.gv_fic_inv_raw.RowHeadersWidth = 51; - this.gv_fic_inv_raw.RowTemplate.Height = 25; - this.gv_fic_inv_raw.Size = new System.Drawing.Size(716, 507); - this.gv_fic_inv_raw.TabIndex = 2; - // - // panel2 - // - this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.lb_raw_inv_hour); - this.panel2.Dock = System.Windows.Forms.DockStyle.Top; - this.panel2.Location = new System.Drawing.Point(0, 0); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(716, 38); - this.panel2.TabIndex = 1; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label2.Location = new System.Drawing.Point(255, 8); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(315, 24); - this.label2.TabIndex = 3; - this.label2.Text = "solar_com0002.s02202000101_inv"; - // - // lb_raw_inv_hour - // - this.lb_raw_inv_hour.AutoSize = true; - this.lb_raw_inv_hour.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.lb_raw_inv_hour.Location = new System.Drawing.Point(15, 8); - this.lb_raw_inv_hour.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lb_raw_inv_hour.Name = "lb_raw_inv_hour"; - this.lb_raw_inv_hour.Size = new System.Drawing.Size(155, 24); - this.lb_raw_inv_hour.TabIndex = 2; - this.lb_raw_inv_hour.Text = "FIC: inv 原始資料"; - // // tabControl1 // - this.tabControl1.Controls.Add(this.tb_inv); - this.tabControl1.Controls.Add(this.tb2); + this.tabControl1.Appearance = System.Windows.Forms.TabAppearance.Buttons; + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(1782, 953); - this.tabControl1.TabIndex = 1; + this.tabControl1.TabIndex = 0; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.splitContainer1); + this.tabPage1.Location = new System.Drawing.Point(4, 31); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(1774, 918); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "tabPage1"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(3, 3); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.splitContainer1.Panel1.Controls.Add(this.bt_clear_station); + this.splitContainer1.Panel1.Controls.Add(this.bt_clear_inv); + this.splitContainer1.Panel1.Controls.Add(this.fp_site); + this.splitContainer1.Panel1.Controls.Add(this.dtSelect); + this.splitContainer1.Panel1.Controls.Add(this.bt_site); + this.splitContainer1.Panel1.Controls.Add(this.bt_Inv); + this.splitContainer1.Panel1.Controls.Add(this.bt_Sensor); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.dataGridView1); + this.splitContainer1.Panel2.Controls.Add(this.panel1); + this.splitContainer1.Size = new System.Drawing.Size(1768, 912); + this.splitContainer1.SplitterDistance = 300; + this.splitContainer1.SplitterWidth = 10; + this.splitContainer1.TabIndex = 0; + // + // bt_clear_station + // + this.bt_clear_station.Enabled = false; + this.bt_clear_station.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.bt_clear_station.Location = new System.Drawing.Point(3, 418); + this.bt_clear_station.Name = "bt_clear_station"; + this.bt_clear_station.Size = new System.Drawing.Size(135, 44); + this.bt_clear_station.TabIndex = 6; + this.bt_clear_station.Text = "clear data"; + this.bt_clear_station.UseVisualStyleBackColor = true; + this.bt_clear_station.Click += new System.EventHandler(this.bt_clear_station_Click); + // + // bt_clear_inv + // + this.bt_clear_inv.Enabled = false; + this.bt_clear_inv.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.bt_clear_inv.Location = new System.Drawing.Point(5, 335); + this.bt_clear_inv.Name = "bt_clear_inv"; + this.bt_clear_inv.Size = new System.Drawing.Size(135, 44); + this.bt_clear_inv.TabIndex = 5; + this.bt_clear_inv.Text = "clear data"; + this.bt_clear_inv.UseVisualStyleBackColor = true; + this.bt_clear_inv.Click += new System.EventHandler(this.bt_clear_inv_Click); + // + // fp_site + // + this.fp_site.Dock = System.Windows.Forms.DockStyle.Top; + this.fp_site.Location = new System.Drawing.Point(0, 0); + this.fp_site.Name = "fp_site"; + this.fp_site.Size = new System.Drawing.Size(300, 150); + this.fp_site.TabIndex = 4; + // + // dtSelect + // + this.dtSelect.Location = new System.Drawing.Point(37, 156); + this.dtSelect.Name = "dtSelect"; + this.dtSelect.Size = new System.Drawing.Size(204, 27); + this.dtSelect.TabIndex = 3; + this.dtSelect.ValueChanged += new System.EventHandler(this.dtSelect_ValueChanged); + // + // bt_site + // + this.bt_site.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.bt_site.Location = new System.Drawing.Point(152, 418); + this.bt_site.Name = "bt_site"; + this.bt_site.Size = new System.Drawing.Size(135, 44); + this.bt_site.TabIndex = 2; + this.bt_site.Text = "Site 歸檔"; + this.bt_site.UseVisualStyleBackColor = true; + this.bt_site.Click += new System.EventHandler(this.bt_site_Click); + // + // bt_Inv + // + this.bt_Inv.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.bt_Inv.Location = new System.Drawing.Point(152, 335); + this.bt_Inv.Name = "bt_Inv"; + this.bt_Inv.Size = new System.Drawing.Size(135, 44); + this.bt_Inv.TabIndex = 1; + this.bt_Inv.Text = "Inv 歸檔"; + this.bt_Inv.UseVisualStyleBackColor = true; + this.bt_Inv.Click += new System.EventHandler(this.bt_Inv_Click); + // + // bt_Sensor + // + this.bt_Sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.bt_Sensor.Location = new System.Drawing.Point(152, 256); + this.bt_Sensor.Name = "bt_Sensor"; + this.bt_Sensor.Size = new System.Drawing.Size(135, 44); + this.bt_Sensor.TabIndex = 0; + this.bt_Sensor.Text = "Sensor 歸檔"; + this.bt_Sensor.UseVisualStyleBackColor = true; + this.bt_Sensor.Click += new System.EventHandler(this.bt_Sensor_Click); + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridView1.Location = new System.Drawing.Point(0, 125); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowHeadersWidth = 51; + this.dataGridView1.RowTemplate.Height = 29; + this.dataGridView1.Size = new System.Drawing.Size(1458, 787); + this.dataGridView1.TabIndex = 1; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.SystemColors.GradientActiveCaption; + this.panel1.Controls.Add(this.btVerifyData); + this.panel1.Controls.Add(this.lbSiteDB_sensor); + this.panel1.Controls.Add(this.lbSiteID_sensor); + this.panel1.Controls.Add(this.lbSiteName_sensor); + 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(1458, 125); + this.panel1.TabIndex = 0; + // + // 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, 7); + this.btVerifyData.Name = "btVerifyData"; + this.btVerifyData.Size = new System.Drawing.Size(158, 44); + this.btVerifyData.TabIndex = 12; + this.btVerifyData.Text = "檢核結果"; + this.btVerifyData.UseVisualStyleBackColor = true; + this.btVerifyData.Click += new System.EventHandler(this.btVerifyData_Click); + // + // lbSiteDB_sensor + // + 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(41, 19); + 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); + this.lbSiteDB_sensor.TabIndex = 11; + this.lbSiteDB_sensor.Text = "Site_DB"; + // + // lbSiteID_sensor + // + 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(200, 19); + 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); + this.lbSiteID_sensor.TabIndex = 10; + this.lbSiteID_sensor.Text = "Site_ID"; + // + // lbSiteName_sensor + // + 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.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); + this.lbSiteName_sensor.TabIndex = 9; + this.lbSiteName_sensor.Text = "Site_Name"; + // + // tabPage2 + // + this.tabPage2.Location = new System.Drawing.Point(4, 31); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(1774, 918); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "tabPage2"; + this.tabPage2.UseVisualStyleBackColor = true; // // fmArchive // @@ -700,100 +264,39 @@ namespace solarApp this.Controls.Add(this.tabControl1); this.Name = "fmArchive"; this.Text = "fmArchive"; - this.tb2.ResumeLayout(false); - this.sp_main_station.Panel1.ResumeLayout(false); - this.sp_main_station.Panel1.PerformLayout(); - this.sp_main_station.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.sp_main_station)).EndInit(); - this.sp_main_station.ResumeLayout(false); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); - this.sp_child_station.Panel1.ResumeLayout(false); - this.sp_child_station.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.sp_child_station)).EndInit(); - this.sp_child_station.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.gv_web_station_day)).EndInit(); - this.panel7.ResumeLayout(false); - this.panel7.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_web_station_hour)).EndInit(); - this.panel4.ResumeLayout(false); - this.panel4.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_station_day)).EndInit(); - this.panel5.ResumeLayout(false); - this.panel5.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_station_raw)).EndInit(); - this.panel6.ResumeLayout(false); - this.panel6.PerformLayout(); - this.tb_inv.ResumeLayout(false); - this.sp_main_inv.Panel1.ResumeLayout(false); - this.sp_main_inv.Panel1.PerformLayout(); - this.sp_main_inv.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.sp_main_inv)).EndInit(); - this.sp_main_inv.ResumeLayout(false); - this.sp_child_inv.Panel1.ResumeLayout(false); - this.sp_child_inv.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.sp_child_inv)).EndInit(); - this.sp_child_inv.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.gv_web_inv_hour)).EndInit(); + this.Load += new System.EventHandler(this.fmArchive_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_inv_hour)).EndInit(); - this.panel3.ResumeLayout(false); - this.panel3.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.gv_fic_inv_raw)).EndInit(); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.tabControl1.ResumeLayout(false); this.ResumeLayout(false); } #endregion - private System.Windows.Forms.TabPage tb2; - private System.Windows.Forms.SplitContainer sp_main_station; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.DateTimePicker dtselect_station2; - private System.Windows.Forms.Label lbMsg_station; - private System.Windows.Forms.Button bt_find_station; - private System.Windows.Forms.DateTimePicker dtselect_station1; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.SplitContainer sp_child_station; - private System.Windows.Forms.DataGridView gv_web_station_day; - private System.Windows.Forms.Panel panel7; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.DataGridView gv_web_station_hour; - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.DataGridView gv_fic_station_day; - private System.Windows.Forms.Panel panel5; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.DataGridView gv_fic_station_raw; - private System.Windows.Forms.Panel panel6; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.TabPage tb_inv; - private System.Windows.Forms.SplitContainer sp_main_inv; - private System.Windows.Forms.Button bt_inv_proc; - private System.Windows.Forms.Label lbMsg_inv; - private System.Windows.Forms.Label lbInverterID; - private System.Windows.Forms.FlowLayoutPanel fp_inv; - private System.Windows.Forms.Button bt_select1; - private System.Windows.Forms.SplitContainer sp_child_inv; - private System.Windows.Forms.DataGridView gv_web_inv_hour; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label lb_inv_hour; - private System.Windows.Forms.DataGridView gv_fic_inv_hour; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.DataGridView gv_fic_inv_raw; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label lb_raw_inv_hour; private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.DateTimePicker dtSelect; + private System.Windows.Forms.Button bt_site; + private System.Windows.Forms.Button bt_Inv; + private System.Windows.Forms.Button bt_Sensor; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Label lbSiteDB_sensor; + private System.Windows.Forms.Label lbSiteID_sensor; + private System.Windows.Forms.Label lbSiteName_sensor; + private System.Windows.Forms.FlowLayoutPanel fp_site; + private System.Windows.Forms.Button btVerifyData; + private System.Windows.Forms.Button bt_clear_inv; + private System.Windows.Forms.Button bt_clear_station; } } \ No newline at end of file diff --git a/solarApp/fmArchive.cs b/solarApp/fmArchive.cs index 7c2ab47..2c5ee0d 100644 --- a/solarApp/fmArchive.cs +++ b/solarApp/fmArchive.cs @@ -5,11 +5,13 @@ using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; +using solarApp.Service; namespace solarApp { public partial class fmArchive : Form { + getStationSvc stationSvc = new getStationSvc(); public fmArchive() { InitializeComponent(); @@ -19,5 +21,133 @@ namespace solarApp { } + + private void bt_Sensor_Click(object sender, EventArgs e) + { + string date1 = dtSelect.Value.ToString("yyyy-MM-dd"); + //procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1); + procSensorSvc sensorSvc = new procSensorSvc(); + 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(); + //sensorSvc.archiveData(); + MessageBox.Show("OK"); + } + + private void fmArchive_Load(object sender, EventArgs e) + { + #region 電站清單 + int i = 0; + var site_list = stationSvc.get_station_list(); + foreach (var item in site_list) + { + RadioButton rb = new RadioButton(); + rb.Name = item.SiteID; + rb.Text = item.SiteName; + rb.Tag = item.SiteDB; + rb.Font = new Font(Font.FontFamily, 22); + rb.AutoSize = true; + rb.CheckedChanged += new EventHandler(rb_site_CheckedChanged); + fp_site.Controls.Add(rb); + if (i == 0) rb.Checked = true; + i++; + } + #endregion + } + + private void rb_site_CheckedChanged(object sender, EventArgs e) + { + RadioButton rb = sender as RadioButton; + if (rb.Checked) + { + lbSiteName_sensor.Text = rb.Text; + lbSiteDB_sensor.Text = rb.Tag.ToString(); + lbSiteID_sensor.Text = rb.Name; + + //顯示 table name on label + //lbSiteRaw.Text = lbSiteName_inv.Text + " " + lbSiteDB_inv.Text + ".s" + lbSiteID_inv.Text + "_Station"; + //lbInvRaw.Text = lbSiteName_inv.Text + " " + lbSiteDB_inv.Text + ".s" + lbSiteID_inv.Text + "_Inv"; + //lbSensorRaw.Text = lbSiteName_inv.Text + " " + lbSiteDB_inv.Text + ".s" + lbSiteID_inv.Text + "_SensorAVG"; + + //add_inv_list(lbSiteDB_inv.Text, lbSiteID_inv.Text.Substring(0, 9)); + } + } + + private void btVerifyData_Click(object sender, EventArgs e) + { + fmMain fm = new fmMain(); + fm.Show(); + } + + private void bt_Inv_Click(object sender, EventArgs e) + { + string date1 = dtSelect.Value.ToString("yyyy-MM-dd"); + //procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1); + procInvSvc invSvc = new procInvSvc(); + invSvc._siteDB = lbSiteDB_sensor.Text; + invSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9); + invSvc._siteID01 = lbSiteID_sensor.Text; + invSvc._date1 = date1; + invSvc._date2 = date1; + invSvc.archiveData(); + //sensorSvc.archiveData(); + MessageBox.Show("OK"); + } + + private void dtSelect_ValueChanged(object sender, EventArgs e) + { + bt_clear_inv.Enabled = true; + bt_clear_station.Enabled = true; + bt_clear_inv.Text = "clear " + dtSelect.Value.ToString("MM-dd"); + bt_clear_station.Text = "clear " + dtSelect.Value.ToString("MM-dd"); + } + + private void bt_clear_inv_Click(object sender, EventArgs e) + { + string date1 = dtSelect.Value.ToString("yyyy-MM-dd"); + //procSensorSvc sensorSvc = new procSensorSvc(lbSiteDB_sensor.Text, lbSiteID_sensor.Text, date1, date1); + procInvSvc invSvc = new procInvSvc(); + invSvc._siteDB = lbSiteDB_sensor.Text; + invSvc._siteID = lbSiteID_sensor.Text.Substring(0, 9); + invSvc._siteID01 = lbSiteID_sensor.Text; + invSvc._date1 = date1; + invSvc._date2 = date1; + invSvc.clearData(); + //sensorSvc.archiveData(); + MessageBox.Show("OK"); + } + + private void bt_clear_station_Click(object sender, EventArgs e) + { + string date1 = dtSelect.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; + siteSvc.clearData(); + //sensorSvc.archiveData(); + MessageBox.Show("OK"); + } + + private void bt_site_Click(object sender, EventArgs e) + { + string date1 = dtSelect.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; + siteSvc.archiveData(); + //sensorSvc.archiveData(); + MessageBox.Show("OK"); + } } } diff --git a/solarApp/fmMain.Designer.cs b/solarApp/fmMain.Designer.cs index 136b60e..8569d89 100644 --- a/solarApp/fmMain.Designer.cs +++ b/solarApp/fmMain.Designer.cs @@ -39,6 +39,41 @@ namespace solarApp System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tb_inv = new System.Windows.Forms.TabPage(); this.sp_main_inv = new System.Windows.Forms.SplitContainer(); @@ -62,6 +97,7 @@ namespace solarApp this.label15 = new System.Windows.Forms.Label(); this.gv_web_inv_hour = new System.Windows.Forms.DataGridView(); this.panel1 = new System.Windows.Forms.Panel(); + this.btInv_15min = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.lb_inv_hour = new System.Windows.Forms.Label(); this.gv_fic_inv_hour = new System.Windows.Forms.DataGridView(); @@ -74,8 +110,6 @@ namespace solarApp this.tb2 = new System.Windows.Forms.TabPage(); this.sp_main_station = new System.Windows.Forms.SplitContainer(); this.label13 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this.dtselect_station2 = new System.Windows.Forms.DateTimePicker(); this.lbMsg_station = new System.Windows.Forms.Label(); this.bt_find_station = new System.Windows.Forms.Button(); this.dtselect_station1 = new System.Windows.Forms.DateTimePicker(); @@ -100,6 +134,38 @@ namespace solarApp this.panel6 = new System.Windows.Forms.Panel(); this.lbSiteRaw = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); + this.tbSensor = new System.Windows.Forms.TabPage(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.lbSiteDB_sensor = new System.Windows.Forms.Label(); + this.lbSiteID_sensor = new System.Windows.Forms.Label(); + this.lbSiteName_sensor = new System.Windows.Forms.Label(); + this.lbMsg_sensor = new System.Windows.Forms.Label(); + this.label24 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.label25 = new System.Windows.Forms.Label(); + this.btSearch_sensor = new System.Windows.Forms.Button(); + this.dtSelect_sensor1 = new System.Windows.Forms.DateTimePicker(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.gv_web_sensor_month = new System.Windows.Forms.DataGridView(); + this.panel11 = new System.Windows.Forms.Panel(); + this.label26 = new System.Windows.Forms.Label(); + this.label27 = new System.Windows.Forms.Label(); + this.gv_web_sensor_day = new System.Windows.Forms.DataGridView(); + this.panel12 = new System.Windows.Forms.Panel(); + this.label28 = new System.Windows.Forms.Label(); + this.label29 = new System.Windows.Forms.Label(); + this.gv_web_sensor_hour = new System.Windows.Forms.DataGridView(); + this.panel13 = new System.Windows.Forms.Panel(); + this.btSensor_switch = new System.Windows.Forms.Button(); + this.label30 = new System.Windows.Forms.Label(); + this.label31 = new System.Windows.Forms.Label(); + this.gv_fic_sensor_hour = new System.Windows.Forms.DataGridView(); + this.panel14 = new System.Windows.Forms.Panel(); + this.label32 = new System.Windows.Forms.Label(); + this.gv_fic_sensor_raw = new System.Windows.Forms.DataGridView(); + this.panel15 = new System.Windows.Forms.Panel(); + this.lbSensorRaw = new System.Windows.Forms.Label(); + this.label34 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tb_inv.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.sp_main_inv)).BeginInit(); @@ -140,12 +206,33 @@ namespace solarApp this.panel5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gv_fic_station_raw)).BeginInit(); this.panel6.SuspendLayout(); + this.tbSensor.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_web_sensor_month)).BeginInit(); + this.panel11.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_web_sensor_day)).BeginInit(); + this.panel12.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_web_sensor_hour)).BeginInit(); + this.panel13.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_fic_sensor_hour)).BeginInit(); + this.panel14.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_fic_sensor_raw)).BeginInit(); + this.panel15.SuspendLayout(); this.SuspendLayout(); // // tabControl1 // this.tabControl1.Controls.Add(this.tb_inv); this.tabControl1.Controls.Add(this.tb2); + this.tabControl1.Controls.Add(this.tbSensor); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; @@ -281,7 +368,7 @@ namespace solarApp // dtselect_inv // this.dtselect_inv.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.dtselect_inv.Location = new System.Drawing.Point(36, 162); + this.dtselect_inv.Location = new System.Drawing.Point(36, 160); this.dtselect_inv.Name = "dtselect_inv"; this.dtselect_inv.Size = new System.Drawing.Size(250, 31); this.dtselect_inv.TabIndex = 0; @@ -320,15 +407,31 @@ namespace solarApp this.gv_web_inv_month.AllowUserToDeleteRows = false; dataGridViewCellStyle1.BackColor = System.Drawing.Color.Azure; this.gv_web_inv_month.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_inv_month.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.gv_web_inv_month.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_inv_month.DefaultCellStyle = dataGridViewCellStyle3; this.gv_web_inv_month.Dock = System.Windows.Forms.DockStyle.Fill; - this.gv_web_inv_month.Location = new System.Drawing.Point(0, 853); + this.gv_web_inv_month.Location = new System.Drawing.Point(0, 891); this.gv_web_inv_month.Margin = new System.Windows.Forms.Padding(4); this.gv_web_inv_month.Name = "gv_web_inv_month"; this.gv_web_inv_month.ReadOnly = true; this.gv_web_inv_month.RowHeadersWidth = 51; this.gv_web_inv_month.RowTemplate.Height = 25; - this.gv_web_inv_month.Size = new System.Drawing.Size(666, 183); + this.gv_web_inv_month.Size = new System.Drawing.Size(666, 145); this.gv_web_inv_month.TabIndex = 7; // // panel9 @@ -336,7 +439,7 @@ namespace solarApp this.panel9.Controls.Add(this.label16); this.panel9.Controls.Add(this.label17); this.panel9.Dock = System.Windows.Forms.DockStyle.Top; - this.panel9.Location = new System.Drawing.Point(0, 815); + this.panel9.Location = new System.Drawing.Point(0, 853); this.panel9.Margin = new System.Windows.Forms.Padding(4); this.panel9.Name = "panel9"; this.panel9.Size = new System.Drawing.Size(666, 38); @@ -368,9 +471,25 @@ namespace solarApp // this.gv_web_inv_day.AllowUserToAddRows = false; this.gv_web_inv_day.AllowUserToDeleteRows = false; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.Azure; - this.gv_web_inv_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle4.BackColor = System.Drawing.Color.Azure; + this.gv_web_inv_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_inv_day.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; this.gv_web_inv_day.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_inv_day.DefaultCellStyle = dataGridViewCellStyle6; this.gv_web_inv_day.Dock = System.Windows.Forms.DockStyle.Top; this.gv_web_inv_day.Location = new System.Drawing.Point(0, 583); this.gv_web_inv_day.Margin = new System.Windows.Forms.Padding(4); @@ -378,7 +497,7 @@ namespace solarApp this.gv_web_inv_day.ReadOnly = true; this.gv_web_inv_day.RowHeadersWidth = 51; this.gv_web_inv_day.RowTemplate.Height = 25; - this.gv_web_inv_day.Size = new System.Drawing.Size(666, 232); + this.gv_web_inv_day.Size = new System.Drawing.Size(666, 270); this.gv_web_inv_day.TabIndex = 4; // // panel8 @@ -418,9 +537,25 @@ namespace solarApp // this.gv_web_inv_hour.AllowUserToAddRows = false; this.gv_web_inv_hour.AllowUserToDeleteRows = false; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.Azure; - this.gv_web_inv_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle7.BackColor = System.Drawing.Color.Azure; + this.gv_web_inv_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_inv_hour.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; this.gv_web_inv_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_inv_hour.DefaultCellStyle = dataGridViewCellStyle9; this.gv_web_inv_hour.Dock = System.Windows.Forms.DockStyle.Top; this.gv_web_inv_hour.Location = new System.Drawing.Point(0, 38); this.gv_web_inv_hour.Margin = new System.Windows.Forms.Padding(4); @@ -433,6 +568,7 @@ namespace solarApp // // panel1 // + this.panel1.Controls.Add(this.btInv_15min); this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.lb_inv_hour); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; @@ -442,6 +578,16 @@ namespace solarApp this.panel1.Size = new System.Drawing.Size(666, 38); this.panel1.TabIndex = 0; // + // btInv_15min + // + this.btInv_15min.Location = new System.Drawing.Point(559, 4); + this.btInv_15min.Name = "btInv_15min"; + this.btInv_15min.Size = new System.Drawing.Size(94, 29); + this.btInv_15min.TabIndex = 2; + this.btInv_15min.Text = " 15 min"; + this.btInv_15min.UseVisualStyleBackColor = true; + this.btInv_15min.Click += new System.EventHandler(this.btInv_15min_Click); + // // label3 // this.label3.AutoSize = true; @@ -468,9 +614,25 @@ namespace solarApp // this.gv_fic_inv_hour.AllowUserToAddRows = false; this.gv_fic_inv_hour.AllowUserToDeleteRows = false; - dataGridViewCellStyle4.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_inv_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle10.BackColor = System.Drawing.Color.LightCyan; + this.gv_fic_inv_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_fic_inv_hour.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.gv_fic_inv_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_fic_inv_hour.DefaultCellStyle = dataGridViewCellStyle12; this.gv_fic_inv_hour.Dock = System.Windows.Forms.DockStyle.Fill; this.gv_fic_inv_hour.Location = new System.Drawing.Point(0, 583); this.gv_fic_inv_hour.Margin = new System.Windows.Forms.Padding(4); @@ -507,9 +669,25 @@ namespace solarApp // this.gv_fic_inv_raw.AllowUserToAddRows = false; this.gv_fic_inv_raw.AllowUserToDeleteRows = false; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_inv_raw.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.LightCyan; + this.gv_fic_inv_raw.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_fic_inv_raw.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.gv_fic_inv_raw.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle15.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_fic_inv_raw.DefaultCellStyle = dataGridViewCellStyle15; this.gv_fic_inv_raw.Dock = System.Windows.Forms.DockStyle.Top; this.gv_fic_inv_raw.Location = new System.Drawing.Point(0, 38); this.gv_fic_inv_raw.Margin = new System.Windows.Forms.Padding(4); @@ -574,8 +752,6 @@ namespace solarApp // sp_main_station.Panel1 // this.sp_main_station.Panel1.Controls.Add(this.label13); - this.sp_main_station.Panel1.Controls.Add(this.label12); - this.sp_main_station.Panel1.Controls.Add(this.dtselect_station2); this.sp_main_station.Panel1.Controls.Add(this.lbMsg_station); this.sp_main_station.Panel1.Controls.Add(this.bt_find_station); this.sp_main_station.Panel1.Controls.Add(this.dtselect_station1); @@ -592,38 +768,20 @@ namespace solarApp // label13 // this.label13.AutoSize = true; + this.label13.Dock = System.Windows.Forms.DockStyle.Bottom; this.label13.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label13.Location = new System.Drawing.Point(6, 363); + this.label13.Location = new System.Drawing.Point(0, 367); this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(110, 24); this.label13.TabIndex = 13; this.label13.Text = "請選擇 電站"; // - // label12 - // - this.label12.AutoSize = true; - this.label12.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label12.Location = new System.Drawing.Point(13, 44); - this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(24, 24); - this.label12.TabIndex = 12; - this.label12.Text = "~"; - // - // dtselect_station2 - // - this.dtselect_station2.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.dtselect_station2.Location = new System.Drawing.Point(12, 76); - this.dtselect_station2.Name = "dtselect_station2"; - this.dtselect_station2.Size = new System.Drawing.Size(234, 31); - this.dtselect_station2.TabIndex = 10; - // // lbMsg_station // this.lbMsg_station.AutoSize = true; this.lbMsg_station.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.lbMsg_station.Location = new System.Drawing.Point(26, 162); + this.lbMsg_station.Location = new System.Drawing.Point(30, 111); this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lbMsg_station.Name = "lbMsg_station"; this.lbMsg_station.Size = new System.Drawing.Size(22, 24); @@ -632,7 +790,7 @@ namespace solarApp // // bt_find_station // - this.bt_find_station.Location = new System.Drawing.Point(12, 124); + this.bt_find_station.Location = new System.Drawing.Point(16, 73); this.bt_find_station.Name = "bt_find_station"; this.bt_find_station.Size = new System.Drawing.Size(94, 29); this.bt_find_station.TabIndex = 7; @@ -690,9 +848,25 @@ namespace solarApp // this.gv_web_station_month.AllowUserToAddRows = false; this.gv_web_station_month.AllowUserToDeleteRows = false; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.Azure; - this.gv_web_station_month.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle16.BackColor = System.Drawing.Color.Azure; + this.gv_web_station_month.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16; + dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_station_month.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17; this.gv_web_station_month.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle18.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle18.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle18.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle18.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle18.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_station_month.DefaultCellStyle = dataGridViewCellStyle18; this.gv_web_station_month.Dock = System.Windows.Forms.DockStyle.Fill; this.gv_web_station_month.Location = new System.Drawing.Point(0, 913); this.gv_web_station_month.Margin = new System.Windows.Forms.Padding(4); @@ -740,9 +914,25 @@ namespace solarApp // this.gv_web_station_day.AllowUserToAddRows = false; this.gv_web_station_day.AllowUserToDeleteRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.Azure; - this.gv_web_station_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle19.BackColor = System.Drawing.Color.Azure; + this.gv_web_station_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle19; + dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle20.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle20.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle20.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle20.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle20.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_station_day.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle20; this.gv_web_station_day.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle21.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle21.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle21.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_station_day.DefaultCellStyle = dataGridViewCellStyle21; this.gv_web_station_day.Dock = System.Windows.Forms.DockStyle.Top; this.gv_web_station_day.Location = new System.Drawing.Point(0, 583); this.gv_web_station_day.Margin = new System.Windows.Forms.Padding(4); @@ -790,9 +980,25 @@ namespace solarApp // this.gv_web_station_hour.AllowUserToAddRows = false; this.gv_web_station_hour.AllowUserToDeleteRows = false; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.Azure; - this.gv_web_station_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle22.BackColor = System.Drawing.Color.Azure; + this.gv_web_station_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22; + dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle23.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_station_hour.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23; this.gv_web_station_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle24.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_station_hour.DefaultCellStyle = dataGridViewCellStyle24; this.gv_web_station_hour.Dock = System.Windows.Forms.DockStyle.Top; this.gv_web_station_hour.Location = new System.Drawing.Point(0, 38); this.gv_web_station_hour.Margin = new System.Windows.Forms.Padding(4); @@ -840,9 +1046,25 @@ namespace solarApp // this.gv_fic_station_day.AllowUserToAddRows = false; this.gv_fic_station_day.AllowUserToDeleteRows = false; - dataGridViewCellStyle9.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_station_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle25.BackColor = System.Drawing.Color.LightCyan; + this.gv_fic_station_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle25; + dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle26.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle26.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle26.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle26.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_fic_station_day.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle26; this.gv_fic_station_day.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle27.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle27.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle27.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle27.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle27.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_fic_station_day.DefaultCellStyle = dataGridViewCellStyle27; this.gv_fic_station_day.Dock = System.Windows.Forms.DockStyle.Fill; this.gv_fic_station_day.Location = new System.Drawing.Point(0, 583); this.gv_fic_station_day.Margin = new System.Windows.Forms.Padding(4); @@ -878,9 +1100,25 @@ namespace solarApp // this.gv_fic_station_raw.AllowUserToAddRows = false; this.gv_fic_station_raw.AllowUserToDeleteRows = false; - dataGridViewCellStyle10.BackColor = System.Drawing.Color.LightCyan; - this.gv_fic_station_raw.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle28.BackColor = System.Drawing.Color.LightCyan; + this.gv_fic_station_raw.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle28; + dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle29.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle29.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle29.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle29.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle29.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle29.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_fic_station_raw.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle29; this.gv_fic_station_raw.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle30.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle30.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle30.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle30.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle30.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle30.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_fic_station_raw.DefaultCellStyle = dataGridViewCellStyle30; this.gv_fic_station_raw.Dock = System.Windows.Forms.DockStyle.Top; this.gv_fic_station_raw.Location = new System.Drawing.Point(0, 38); this.gv_fic_station_raw.Margin = new System.Windows.Forms.Padding(4); @@ -924,6 +1162,495 @@ namespace solarApp this.label9.TabIndex = 2; this.label9.Text = "FIC: station 原始資料(hour)"; // + // tbSensor + // + this.tbSensor.Controls.Add(this.splitContainer1); + this.tbSensor.Location = new System.Drawing.Point(4, 28); + this.tbSensor.Name = "tbSensor"; + this.tbSensor.Padding = new System.Windows.Forms.Padding(3); + this.tbSensor.Size = new System.Drawing.Size(1735, 1042); + this.tbSensor.TabIndex = 2; + this.tbSensor.Text = "Sensor"; + this.tbSensor.UseVisualStyleBackColor = true; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(3, 3); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Khaki; + this.splitContainer1.Panel1.Controls.Add(this.lbSiteDB_sensor); + this.splitContainer1.Panel1.Controls.Add(this.lbSiteID_sensor); + this.splitContainer1.Panel1.Controls.Add(this.lbSiteName_sensor); + this.splitContainer1.Panel1.Controls.Add(this.lbMsg_sensor); + this.splitContainer1.Panel1.Controls.Add(this.label24); + this.splitContainer1.Panel1.Controls.Add(this.flowLayoutPanel1); + this.splitContainer1.Panel1.Controls.Add(this.btSearch_sensor); + this.splitContainer1.Panel1.Controls.Add(this.dtSelect_sensor1); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Size = new System.Drawing.Size(1729, 1036); + this.splitContainer1.SplitterDistance = 351; + this.splitContainer1.TabIndex = 1; + // + // lbSiteDB_sensor + // + 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(36, 100); + 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); + this.lbSiteDB_sensor.TabIndex = 8; + this.lbSiteDB_sensor.Text = "Site_DB"; + // + // lbSiteID_sensor + // + 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(36, 58); + 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); + this.lbSiteID_sensor.TabIndex = 7; + this.lbSiteID_sensor.Text = "Site_ID"; + // + // lbSiteName_sensor + // + 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(36, 14); + 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); + this.lbSiteName_sensor.TabIndex = 6; + this.lbSiteName_sensor.Text = "Site_Name"; + // + // lbMsg_sensor + // + this.lbMsg_sensor.AutoSize = true; + this.lbMsg_sensor.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.lbMsg_sensor.Location = new System.Drawing.Point(155, 218); + this.lbMsg_sensor.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbMsg_sensor.Name = "lbMsg_sensor"; + this.lbMsg_sensor.Size = new System.Drawing.Size(22, 24); + this.lbMsg_sensor.TabIndex = 5; + this.lbMsg_sensor.Text = "..."; + // + // label24 + // + this.label24.AutoSize = true; + this.label24.Dock = System.Windows.Forms.DockStyle.Bottom; + this.label24.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label24.Location = new System.Drawing.Point(0, 367); + this.label24.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(132, 24); + this.label24.TabIndex = 3; + this.label24.Text = "請選擇 sensor"; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.BackColor = System.Drawing.Color.LemonChiffon; + this.flowLayoutPanel1.Controls.Add(this.label25); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 391); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(351, 645); + this.flowLayoutPanel1.TabIndex = 2; + // + // label25 + // + this.label25.AutoSize = true; + this.label25.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label25.Location = new System.Drawing.Point(4, 0); + this.label25.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(134, 24); + this.label25.TabIndex = 4; + this.label25.Text = "請選擇 Sensor"; + // + // btSearch_sensor + // + this.btSearch_sensor.Location = new System.Drawing.Point(36, 215); + this.btSearch_sensor.Name = "btSearch_sensor"; + this.btSearch_sensor.Size = new System.Drawing.Size(94, 29); + this.btSearch_sensor.TabIndex = 1; + this.btSearch_sensor.Text = "查詢"; + this.btSearch_sensor.UseVisualStyleBackColor = true; + this.btSearch_sensor.Click += new System.EventHandler(this.btSearch_sensor_Click); + // + // dtSelect_sensor1 + // + this.dtSelect_sensor1.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.dtSelect_sensor1.Location = new System.Drawing.Point(36, 148); + this.dtSelect_sensor1.Name = "dtSelect_sensor1"; + this.dtSelect_sensor1.Size = new System.Drawing.Size(250, 31); + this.dtSelect_sensor1.TabIndex = 0; + // + // splitContainer2 + // + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Margin = new System.Windows.Forms.Padding(4); + this.splitContainer2.Name = "splitContainer2"; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.gv_web_sensor_month); + this.splitContainer2.Panel1.Controls.Add(this.panel11); + this.splitContainer2.Panel1.Controls.Add(this.gv_web_sensor_day); + this.splitContainer2.Panel1.Controls.Add(this.panel12); + this.splitContainer2.Panel1.Controls.Add(this.gv_web_sensor_hour); + this.splitContainer2.Panel1.Controls.Add(this.panel13); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.gv_fic_sensor_hour); + this.splitContainer2.Panel2.Controls.Add(this.panel14); + this.splitContainer2.Panel2.Controls.Add(this.gv_fic_sensor_raw); + this.splitContainer2.Panel2.Controls.Add(this.panel15); + this.splitContainer2.Size = new System.Drawing.Size(1374, 1036); + this.splitContainer2.SplitterDistance = 666; + this.splitContainer2.SplitterWidth = 13; + this.splitContainer2.TabIndex = 0; + // + // gv_web_sensor_month + // + this.gv_web_sensor_month.AllowUserToAddRows = false; + this.gv_web_sensor_month.AllowUserToDeleteRows = false; + dataGridViewCellStyle31.BackColor = System.Drawing.Color.Azure; + this.gv_web_sensor_month.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle31; + dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle32.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_sensor_month.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle32; + this.gv_web_sensor_month.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle33.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle33.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle33.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle33.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle33.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle33.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_sensor_month.DefaultCellStyle = dataGridViewCellStyle33; + this.gv_web_sensor_month.Dock = System.Windows.Forms.DockStyle.Fill; + this.gv_web_sensor_month.Location = new System.Drawing.Point(0, 874); + this.gv_web_sensor_month.Margin = new System.Windows.Forms.Padding(4); + this.gv_web_sensor_month.Name = "gv_web_sensor_month"; + this.gv_web_sensor_month.ReadOnly = true; + this.gv_web_sensor_month.RowHeadersWidth = 51; + this.gv_web_sensor_month.RowTemplate.Height = 25; + this.gv_web_sensor_month.Size = new System.Drawing.Size(666, 162); + this.gv_web_sensor_month.TabIndex = 7; + // + // panel11 + // + this.panel11.Controls.Add(this.label26); + this.panel11.Controls.Add(this.label27); + this.panel11.Dock = System.Windows.Forms.DockStyle.Top; + this.panel11.Location = new System.Drawing.Point(0, 836); + this.panel11.Margin = new System.Windows.Forms.Padding(4); + this.panel11.Name = "panel11"; + this.panel11.Size = new System.Drawing.Size(666, 38); + this.panel11.TabIndex = 6; + // + // label26 + // + this.label26.AutoSize = true; + this.label26.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label26.Location = new System.Drawing.Point(230, 8); + this.label26.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label26.Name = "label26"; + this.label26.Size = new System.Drawing.Size(331, 24); + this.label26.TabIndex = 1; + this.label26.Text = "solar_master.Sensor_history_month"; + // + // label27 + // + this.label27.AutoSize = true; + this.label27.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label27.Location = new System.Drawing.Point(35, 8); + this.label27.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label27.Name = "label27"; + this.label27.Size = new System.Drawing.Size(160, 24); + this.label27.TabIndex = 0; + this.label27.Text = "web: sensor 每月"; + // + // gv_web_sensor_day + // + this.gv_web_sensor_day.AllowUserToAddRows = false; + this.gv_web_sensor_day.AllowUserToDeleteRows = false; + dataGridViewCellStyle34.BackColor = System.Drawing.Color.Azure; + this.gv_web_sensor_day.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle34; + dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle35.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle35.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_sensor_day.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle35; + this.gv_web_sensor_day.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle36.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle36.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle36.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_sensor_day.DefaultCellStyle = dataGridViewCellStyle36; + this.gv_web_sensor_day.Dock = System.Windows.Forms.DockStyle.Top; + this.gv_web_sensor_day.Location = new System.Drawing.Point(0, 583); + this.gv_web_sensor_day.Margin = new System.Windows.Forms.Padding(4); + this.gv_web_sensor_day.Name = "gv_web_sensor_day"; + this.gv_web_sensor_day.ReadOnly = true; + this.gv_web_sensor_day.RowHeadersWidth = 51; + this.gv_web_sensor_day.RowTemplate.Height = 25; + this.gv_web_sensor_day.Size = new System.Drawing.Size(666, 253); + this.gv_web_sensor_day.TabIndex = 4; + // + // panel12 + // + this.panel12.Controls.Add(this.label28); + this.panel12.Controls.Add(this.label29); + this.panel12.Dock = System.Windows.Forms.DockStyle.Top; + this.panel12.Location = new System.Drawing.Point(0, 545); + this.panel12.Margin = new System.Windows.Forms.Padding(4); + this.panel12.Name = "panel12"; + this.panel12.Size = new System.Drawing.Size(666, 38); + this.panel12.TabIndex = 3; + // + // label28 + // + this.label28.AutoSize = true; + this.label28.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label28.Location = new System.Drawing.Point(230, 8); + this.label28.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label28.Name = "label28"; + this.label28.Size = new System.Drawing.Size(302, 24); + this.label28.TabIndex = 1; + this.label28.Text = "solar_master.Sensor_history_day"; + // + // label29 + // + this.label29.AutoSize = true; + this.label29.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label29.Location = new System.Drawing.Point(35, 8); + this.label29.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label29.Name = "label29"; + this.label29.Size = new System.Drawing.Size(160, 24); + this.label29.TabIndex = 0; + this.label29.Text = "web: sensor 每天"; + // + // gv_web_sensor_hour + // + this.gv_web_sensor_hour.AllowUserToAddRows = false; + this.gv_web_sensor_hour.AllowUserToDeleteRows = false; + dataGridViewCellStyle37.BackColor = System.Drawing.Color.Azure; + this.gv_web_sensor_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle37; + dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle38.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle38.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle38.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle38.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle38.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle38.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_web_sensor_hour.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle38; + this.gv_web_sensor_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle39.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle39.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle39.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle39.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle39.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle39.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_web_sensor_hour.DefaultCellStyle = dataGridViewCellStyle39; + this.gv_web_sensor_hour.Dock = System.Windows.Forms.DockStyle.Top; + this.gv_web_sensor_hour.Location = new System.Drawing.Point(0, 38); + this.gv_web_sensor_hour.Margin = new System.Windows.Forms.Padding(4); + this.gv_web_sensor_hour.Name = "gv_web_sensor_hour"; + this.gv_web_sensor_hour.ReadOnly = true; + this.gv_web_sensor_hour.RowHeadersWidth = 51; + this.gv_web_sensor_hour.RowTemplate.Height = 25; + this.gv_web_sensor_hour.Size = new System.Drawing.Size(666, 507); + this.gv_web_sensor_hour.TabIndex = 1; + // + // panel13 + // + this.panel13.Controls.Add(this.btSensor_switch); + this.panel13.Controls.Add(this.label30); + this.panel13.Controls.Add(this.label31); + this.panel13.Dock = System.Windows.Forms.DockStyle.Top; + this.panel13.Location = new System.Drawing.Point(0, 0); + this.panel13.Margin = new System.Windows.Forms.Padding(4); + this.panel13.Name = "panel13"; + this.panel13.Size = new System.Drawing.Size(666, 38); + this.panel13.TabIndex = 0; + // + // btSensor_switch + // + this.btSensor_switch.Location = new System.Drawing.Point(563, 6); + this.btSensor_switch.Name = "btSensor_switch"; + this.btSensor_switch.Size = new System.Drawing.Size(94, 29); + this.btSensor_switch.TabIndex = 10; + this.btSensor_switch.Text = "sensor50"; + this.btSensor_switch.UseVisualStyleBackColor = true; + this.btSensor_switch.Click += new System.EventHandler(this.btSensor_switch_Click); + // + // label30 + // + this.label30.AutoSize = true; + this.label30.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label30.Location = new System.Drawing.Point(230, 8); + this.label30.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label30.Name = "label30"; + this.label30.Size = new System.Drawing.Size(313, 24); + this.label30.TabIndex = 1; + this.label30.Text = "solar_master.Sensor_history_hour"; + // + // label31 + // + this.label31.AutoSize = true; + this.label31.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label31.Location = new System.Drawing.Point(35, 8); + this.label31.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label31.Name = "label31"; + this.label31.Size = new System.Drawing.Size(186, 24); + this.label31.TabIndex = 0; + this.label31.Text = "web: Sensor 每小時 "; + // + // gv_fic_sensor_hour + // + this.gv_fic_sensor_hour.AllowUserToAddRows = false; + this.gv_fic_sensor_hour.AllowUserToDeleteRows = false; + dataGridViewCellStyle40.BackColor = System.Drawing.Color.LightCyan; + this.gv_fic_sensor_hour.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle40; + dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle41.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_fic_sensor_hour.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle41; + this.gv_fic_sensor_hour.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle42.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle42.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle42.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle42.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle42.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle42.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_fic_sensor_hour.DefaultCellStyle = dataGridViewCellStyle42; + this.gv_fic_sensor_hour.Dock = System.Windows.Forms.DockStyle.Fill; + this.gv_fic_sensor_hour.Location = new System.Drawing.Point(0, 583); + this.gv_fic_sensor_hour.Margin = new System.Windows.Forms.Padding(4); + this.gv_fic_sensor_hour.Name = "gv_fic_sensor_hour"; + this.gv_fic_sensor_hour.ReadOnly = true; + this.gv_fic_sensor_hour.RowHeadersWidth = 51; + this.gv_fic_sensor_hour.RowTemplate.Height = 25; + this.gv_fic_sensor_hour.Size = new System.Drawing.Size(695, 453); + this.gv_fic_sensor_hour.TabIndex = 4; + // + // panel14 + // + this.panel14.Controls.Add(this.label32); + this.panel14.Dock = System.Windows.Forms.DockStyle.Top; + this.panel14.Location = new System.Drawing.Point(0, 545); + this.panel14.Margin = new System.Windows.Forms.Padding(4); + this.panel14.Name = "panel14"; + this.panel14.Size = new System.Drawing.Size(695, 38); + this.panel14.TabIndex = 3; + // + // label32 + // + this.label32.AutoSize = true; + this.label32.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label32.Location = new System.Drawing.Point(15, 8); + this.label32.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label32.Name = "label32"; + this.label32.Size = new System.Drawing.Size(176, 24); + this.label32.TabIndex = 2; + this.label32.Text = "FIC: Sensor 每小時 "; + // + // gv_fic_sensor_raw + // + this.gv_fic_sensor_raw.AllowUserToAddRows = false; + this.gv_fic_sensor_raw.AllowUserToDeleteRows = false; + dataGridViewCellStyle43.BackColor = System.Drawing.Color.LightCyan; + this.gv_fic_sensor_raw.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle43; + dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle44.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gv_fic_sensor_raw.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle44; + this.gv_fic_sensor_raw.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridViewCellStyle45.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle45.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle45.Font = new System.Drawing.Font("Microsoft JhengHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + dataGridViewCellStyle45.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle45.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle45.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle45.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.gv_fic_sensor_raw.DefaultCellStyle = dataGridViewCellStyle45; + this.gv_fic_sensor_raw.Dock = System.Windows.Forms.DockStyle.Top; + this.gv_fic_sensor_raw.Location = new System.Drawing.Point(0, 38); + this.gv_fic_sensor_raw.Margin = new System.Windows.Forms.Padding(4); + this.gv_fic_sensor_raw.Name = "gv_fic_sensor_raw"; + this.gv_fic_sensor_raw.ReadOnly = true; + this.gv_fic_sensor_raw.RowHeadersWidth = 51; + this.gv_fic_sensor_raw.RowTemplate.Height = 25; + this.gv_fic_sensor_raw.Size = new System.Drawing.Size(695, 507); + this.gv_fic_sensor_raw.TabIndex = 2; + // + // panel15 + // + this.panel15.Controls.Add(this.lbSensorRaw); + this.panel15.Controls.Add(this.label34); + this.panel15.Dock = System.Windows.Forms.DockStyle.Top; + this.panel15.Location = new System.Drawing.Point(0, 0); + this.panel15.Margin = new System.Windows.Forms.Padding(4); + this.panel15.Name = "panel15"; + this.panel15.Size = new System.Drawing.Size(695, 38); + this.panel15.TabIndex = 1; + // + // lbSensorRaw + // + this.lbSensorRaw.AutoSize = true; + this.lbSensorRaw.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.lbSensorRaw.Location = new System.Drawing.Point(255, 8); + this.lbSensorRaw.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbSensorRaw.Name = "lbSensorRaw"; + this.lbSensorRaw.Size = new System.Drawing.Size(350, 24); + this.lbSensorRaw.TabIndex = 3; + this.lbSensorRaw.Text = "solar_com0002.s02202000101_Sensor"; + // + // label34 + // + this.label34.AutoSize = true; + this.label34.Font = new System.Drawing.Font("Microsoft JhengHei UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label34.Location = new System.Drawing.Point(15, 8); + this.label34.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label34.Name = "label34"; + this.label34.Size = new System.Drawing.Size(190, 24); + this.label34.TabIndex = 2; + this.label34.Text = "FIC: Sensor 原始資料"; + // // fmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F); @@ -987,6 +1714,33 @@ namespace solarApp ((System.ComponentModel.ISupportInitialize)(this.gv_fic_station_raw)).EndInit(); this.panel6.ResumeLayout(false); this.panel6.PerformLayout(); + this.tbSensor.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); + this.splitContainer2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.gv_web_sensor_month)).EndInit(); + this.panel11.ResumeLayout(false); + this.panel11.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_web_sensor_day)).EndInit(); + this.panel12.ResumeLayout(false); + this.panel12.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_web_sensor_hour)).EndInit(); + this.panel13.ResumeLayout(false); + this.panel13.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_fic_sensor_hour)).EndInit(); + this.panel14.ResumeLayout(false); + this.panel14.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gv_fic_sensor_raw)).EndInit(); + this.panel15.ResumeLayout(false); + this.panel15.PerformLayout(); this.ResumeLayout(false); } @@ -1038,9 +1792,7 @@ namespace solarApp private System.Windows.Forms.FlowLayoutPanel fp_site; private System.Windows.Forms.Label lbMsg_inv; private System.Windows.Forms.DateTimePicker dateTimePicker1; - private System.Windows.Forms.Label label12; private System.Windows.Forms.DateTimePicker dtselect_station1; - private System.Windows.Forms.DateTimePicker dtselect_station2; private System.Windows.Forms.DataGridView gv_web_inv_day; private System.Windows.Forms.Panel panel8; private System.Windows.Forms.Label label14; @@ -1059,5 +1811,41 @@ namespace solarApp private System.Windows.Forms.Label lbSiteDB_inv; private System.Windows.Forms.Label lbSiteRaw; private System.Windows.Forms.Label lbInvRaw; + private System.Windows.Forms.TabPage tbSensor; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Label lbSiteID_sensor; + private System.Windows.Forms.Label lbSiteName_sensor; + private System.Windows.Forms.Label lbMsg_sensor; + private System.Windows.Forms.Label label24; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Label label25; + private System.Windows.Forms.Button bt; + private System.Windows.Forms.DateTimePicker dtSelect_sensor1; + private System.Windows.Forms.SplitContainer splitContainer2; + private System.Windows.Forms.DataGridView gv_web_sensor_month; + private System.Windows.Forms.Panel panel11; + private System.Windows.Forms.Label label26; + private System.Windows.Forms.Label label27; + private System.Windows.Forms.DataGridView gv_web_sensor_day; + private System.Windows.Forms.Panel panel12; + private System.Windows.Forms.Label label28; + private System.Windows.Forms.Label label29; + private System.Windows.Forms.DataGridView dataGridView3; + private System.Windows.Forms.Panel panel13; + private System.Windows.Forms.Label label30; + private System.Windows.Forms.Label label31; + private System.Windows.Forms.DataGridView gv_fic_sensor_hour; + private System.Windows.Forms.Panel panel14; + private System.Windows.Forms.Label label32; + private System.Windows.Forms.DataGridView gv_fic_sensor_raw; + private System.Windows.Forms.Panel panel15; + private System.Windows.Forms.Label lbSensorRaw; + private System.Windows.Forms.Label label34; + private System.Windows.Forms.DataGridView gv_web_sensor_hour; + private System.Windows.Forms.Label lbSiteDB_sensor; + private System.Windows.Forms.Button btSearch_sensor; + private System.Windows.Forms.Button btSensor_switch; + private System.Windows.Forms.Button btInv_15min; } } \ No newline at end of file diff --git a/solarApp/fmMain.cs b/solarApp/fmMain.cs index 5336da0..45884e9 100644 --- a/solarApp/fmMain.cs +++ b/solarApp/fmMain.cs @@ -14,6 +14,7 @@ namespace solarApp { get_inv_svc inv_svc = new get_inv_svc(); getStationSvc stationSvc = new getStationSvc(); + getSensorSvc sensorSvc = new getSensorSvc(); public fmMain() { InitializeComponent(); @@ -23,29 +24,45 @@ namespace solarApp private async void button1_Click(object sender, EventArgs e) { lbMsg_inv.Text = "loading ... "; - string date1 = dtselect_inv.Value.ToString("yyyy-MM-dd"); - gv_fic_inv_raw.DataSource = inv_svc.Get_rawInv(date1, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text); + string date2 = dtselect_inv.Value.ToString("yyyy-MM-dd"); + //string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd"); + string date1 = dtselect_inv.Value.AddDays(-7).ToString("yyyy-MM-dd"); - gv_fic_inv_hour.DataSource = inv_svc.get_Inv_rawAvg(date1, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text); - gv_web_inv_hour.DataSource = inv_svc.get_web_Inv_hour(date1, lbInverterID.Text); + gv_fic_inv_raw.DataSource = inv_svc.Get_rawInv(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text); - gv_web_inv_day.DataSource = inv_svc.get_web_Inv_day(date1, lbInverterID.Text); + gv_fic_inv_hour.DataSource = inv_svc.get_Inv_rawAvg(date2, lbInverterID.Text, lbSiteDB_inv.Text, lbSiteID_inv.Text); - gv_web_inv_month.DataSource = inv_svc.get_web_Inv_month( date1.Substring(0, 7), lbInverterID.Text); + gv_web_inv_hour.DataSource = inv_svc.get_web_Inv_hour(date2, lbInverterID.Text); + + gv_web_inv_day.DataSource = inv_svc.get_web_Inv_day(date1, date2, lbInverterID.Text); + + gv_web_inv_month.DataSource = inv_svc.get_web_Inv_month( date1.Substring(0, 7), date2.Substring(0, 7), lbInverterID.Text); lbMsg_inv.Text = " done " + System.DateTime.Now.ToShortTimeString(); } - + + private void btInv_15min_Click(object sender, EventArgs e) + { + lbMsg_inv.Text = "loading ... "; + string date2 = dtselect_inv.Value.ToString("yyyy-MM-dd"); + //string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd"); + string date1 = dtselect_inv.Value.AddDays(-7).ToString("yyyy-MM-dd"); + + gv_web_inv_hour.DataSource = inv_svc.get_web_Inv_15min(date2, lbInverterID.Text , lbSiteID_inv.Text.Substring(0, 9)); + } private void fmMain_Load(object sender, EventArgs e) { - dtselect_station1.Value = DateTime.Today.AddDays(-7); - dtselect_station2.Value = DateTime.Today.AddDays(-1); + + + dtselect_station1.Value = DateTime.Today.AddDays(-1); + dtselect_inv.Value = DateTime.Today.AddDays(-1); - // Cursor.Current = Cursors.Default; - + dtSelect_sensor1.Value = DateTime.Today.AddDays(-1); + + tabControl1.SelectedTab = tabControl1.TabPages[1]; @@ -81,9 +98,16 @@ namespace solarApp lbSiteDB_inv.Text = rb.Tag.ToString(); lbSiteName_inv.Text = rb.Text; lbSiteID_inv.Text = rb.Name; + + lbSiteName_sensor.Text = lbSiteName_inv.Text; + lbSiteDB_sensor.Text = lbSiteDB_inv.Text; + lbSiteID_sensor.Text = lbSiteID_inv.Text; + //顯示 table name on label lbSiteRaw.Text = lbSiteName_inv.Text + " "+ lbSiteDB_inv.Text + ".s" + lbSiteID_inv.Text + "_Station"; lbInvRaw.Text = lbSiteName_inv.Text + " " + lbSiteDB_inv.Text + ".s" + lbSiteID_inv.Text + "_Inv"; + lbSensorRaw.Text = lbSiteName_inv.Text + " " + lbSiteDB_inv.Text + ".s" + lbSiteID_inv.Text + "_SensorAVG"; + add_inv_list(lbSiteDB_inv.Text, lbSiteID_inv.Text.Substring(0, 9)); } } @@ -153,21 +177,51 @@ namespace solarApp { lbMsg_station.Text = "loading ... "; - string date1 = dtselect_station1.Value.ToString("yyyy-MM-dd"); - string date2 = dtselect_station2.Value.ToString("yyyy-MM-dd"); + string date2 = dtselect_station1.Value.ToString("yyyy-MM-dd"); + //string date2 = dtselect_station2.Value.ToString("yyyy-MM-dd"); + string date1 = dtselect_station1.Value.AddDays(-7).ToString("yyyy-MM-dd"); - gv_fic_station_raw.DataSource = stationSvc.get_station_raw(date1, lbSiteDB_inv.Text, lbSiteID_inv.Text); + gv_fic_station_raw.DataSource = stationSvc.get_station_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text); gv_fic_station_day.DataSource = stationSvc.get_station_rawAvg(date1, date2, lbSiteDB_inv.Text, lbSiteID_inv.Text); - gv_web_station_hour.DataSource = stationSvc.get_web_station_hour( date1 ); + gv_web_station_hour.DataSource = stationSvc.get_web_station_hour(date2, lbSiteID_inv.Text); - gv_web_station_day.DataSource = stationSvc.get_web_station_day(date1, date2); + gv_web_station_day.DataSource = stationSvc.get_web_station_day(date1, date2, lbSiteID_inv.Text.Substring(0, 9)); - gv_web_station_month.DataSource = stationSvc.get_web_station_month(date1.Substring(0, 7), date2.Substring(0, 7)); - + gv_web_station_month.DataSource = stationSvc.get_web_station_month(date1.Substring(0, 7), date2.Substring(0, 7), lbSiteID_inv.Text.Substring(0, 9)); lbMsg_station.Text = " done " + System.DateTime.Now.ToShortTimeString(); - } + } + + private void btSearch_sensor_Click(object sender, EventArgs e) + { + string date2 = dtSelect_sensor1.Value.ToString("yyyy-MM-dd"); + //string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd"); + string date1 = dtSelect_sensor1.Value.AddDays(-7).ToString("yyyy-MM-dd"); + + gv_fic_sensor_raw.DataSource = sensorSvc.get_sensor_raw(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text); + + gv_fic_sensor_hour.DataSource = sensorSvc.get_sensor_raw_hour(date2, lbSiteDB_inv.Text, lbSiteID_inv.Text.Substring(0, 11)); + + gv_web_sensor_hour.DataSource = sensorSvc.get_web_sensor_hour(date2, lbSiteID_inv.Text.Substring(0, 09)); + + gv_web_sensor_day.DataSource = sensorSvc.get_web_sensor_day(date1, date2, lbSiteID_inv.Text.Substring(0, 09)); + + gv_web_sensor_month.DataSource = sensorSvc.get_web_sensor_month(date1.Substring(0, 7), date2.Substring(0, 7), lbSiteID_inv.Text.Substring(0, 09)); + } + + private void btSensor_switch_Click(object sender, EventArgs e) + { + string date2 = dtSelect_sensor1.Value.ToString("yyyy-MM-dd"); + //string date2 = dtSelect_sensor2.Value.ToString("yyyy-MM-dd"); + string date1 = dtSelect_sensor1.Value.AddDays(-7).ToString("yyyy-MM-dd"); + + gv_web_sensor_hour.DataSource = sensorSvc.get_web_sensor50_hour(date2, lbSiteID_inv.Text.Substring(0, 09)); + + gv_web_sensor_day.DataSource = sensorSvc.get_web_sensor50_day(date1, date2, lbSiteID_inv.Text.Substring(0, 09)); + + gv_web_sensor_month.DataSource = sensorSvc.get_web_sensor50_month(date1.Substring(0, 7), date2.Substring(0, 7), lbSiteID_inv.Text.Substring(0, 09)); + } } }