資料匯入 v0.1
This commit is contained in:
parent
8f76245a13
commit
9312693d78
1
.gitignore
vendored
1
.gitignore
vendored
@ -343,3 +343,4 @@ healthchecksdb
|
|||||||
|
|
||||||
|
|
||||||
/SolarPower/wwwroot/upload/operation_recode/1
|
/SolarPower/wwwroot/upload/operation_recode/1
|
||||||
|
/SolarPower/wwwroot/upload/report/20210819
|
||||||
|
|||||||
48
solarApp/Form1.Designer.cs
generated
48
solarApp/Form1.Designer.cs
generated
@ -1,48 +0,0 @@
|
|||||||
|
|
||||||
namespace solarApp
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// Form1
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(1269, 751);
|
|
||||||
this.Name = "Form1";
|
|
||||||
this.Text = "Form1";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace solarApp
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -17,7 +17,8 @@ namespace solarApp
|
|||||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new fmArchive());
|
Application.Run(new fmExcel());
|
||||||
|
//Application.Run(new fmArchive());
|
||||||
//Application.Run(new fmMain());
|
//Application.Run(new fmMain());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
203
solarApp/Service/csvHelper.cs
Normal file
203
solarApp/Service/csvHelper.cs
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace solarApp.Service
|
||||||
|
{
|
||||||
|
//static class myHelper
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
public static class csvHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void SaveCSV(DataTable dt, string fullPath)//table資料寫入csv
|
||||||
|
{
|
||||||
|
System.IO.FileInfo fi = new System.IO.FileInfo(fullPath);
|
||||||
|
if (!fi.Directory.Exists)
|
||||||
|
{
|
||||||
|
fi.Directory.Create();
|
||||||
|
}
|
||||||
|
System.IO.FileStream fs = new System.IO.FileStream(fullPath, System.IO.FileMode.Create, System.IO.FileAccess.Write);
|
||||||
|
System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, System.Text.Encoding.UTF8);
|
||||||
|
string data = "";
|
||||||
|
|
||||||
|
for (int i = 0; i < dt.Columns.Count; i++)//寫入列名
|
||||||
|
{
|
||||||
|
data += dt.Columns[i].ColumnName.ToString();
|
||||||
|
if (i < dt.Columns.Count - 1)
|
||||||
|
{
|
||||||
|
data += ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sw.WriteLine(data);
|
||||||
|
|
||||||
|
for (int i = 0; i < dt.Rows.Count; i++) //寫入各行資料
|
||||||
|
{
|
||||||
|
data = "";
|
||||||
|
for (int j = 0; j < dt.Columns.Count; j++)
|
||||||
|
{
|
||||||
|
string str = dt.Rows[i][j].ToString();
|
||||||
|
str = str.Replace("\"", "\"\"");//替換英文冒號 英文冒號需要換成兩個冒號
|
||||||
|
if (str.Contains(',') || str.Contains('"')
|
||||||
|
|| str.Contains('\r') || str.Contains('\n')) //含逗號 冒號 換行符的需要放到引號中
|
||||||
|
{
|
||||||
|
str = string.Format("\"{0}\"", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
data += str;
|
||||||
|
if (j < dt.Columns.Count - 1)
|
||||||
|
{
|
||||||
|
data += ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sw.WriteLine(data);
|
||||||
|
}
|
||||||
|
sw.Close();
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DataTable OpenCSV(string filePath)//從csv讀取資料返回table
|
||||||
|
{
|
||||||
|
System.Text.Encoding encoding = GetType(filePath); //Encoding.ASCII;//
|
||||||
|
DataTable dt = new DataTable();
|
||||||
|
System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
||||||
|
|
||||||
|
System.IO.StreamReader sr = new System.IO.StreamReader(fs, encoding);
|
||||||
|
|
||||||
|
//記錄每次讀取的一行記錄
|
||||||
|
string strLine = "";
|
||||||
|
//記錄每行記錄中的各欄位內容
|
||||||
|
string[] aryLine = null;
|
||||||
|
string[] tableHead = null;
|
||||||
|
//標示列數
|
||||||
|
int columnCount = 0;
|
||||||
|
//標示是否是讀取的第一行
|
||||||
|
bool IsFirst = true;
|
||||||
|
//逐行讀取CSV中的資料
|
||||||
|
while ((strLine = sr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
if (IsFirst == true)
|
||||||
|
{
|
||||||
|
tableHead = strLine.Split(',');
|
||||||
|
IsFirst = false;
|
||||||
|
columnCount = tableHead.Length;
|
||||||
|
//建立列
|
||||||
|
for (int i = 0; i < columnCount; i++)
|
||||||
|
{
|
||||||
|
DataColumn dc = new DataColumn(tableHead[i]);
|
||||||
|
dt.Columns.Add(dc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aryLine = strLine.Split(',');
|
||||||
|
DataRow dr = dt.NewRow();
|
||||||
|
for (int j = 0; j < columnCount; j++)
|
||||||
|
{
|
||||||
|
dr[j] = aryLine[j];
|
||||||
|
}
|
||||||
|
dt.Rows.Add(dr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (aryLine != null && aryLine.Length > 0)
|
||||||
|
{
|
||||||
|
dt.DefaultView.Sort = tableHead[0] + " " + "asc";
|
||||||
|
}
|
||||||
|
|
||||||
|
sr.Close();
|
||||||
|
fs.Close();
|
||||||
|
return dt;
|
||||||
|
}
|
||||||
|
/// 給定檔案的路徑,讀取檔案的二進位制資料,判斷檔案的編碼型別
|
||||||
|
/// <param name="FILE_NAME">檔案路徑</param>
|
||||||
|
/// <returns>檔案的編碼型別</returns>
|
||||||
|
public static System.Text.Encoding GetType(string FILE_NAME)
|
||||||
|
{
|
||||||
|
//System.IO.FileStream fs = new System.IO.FileStream(FILE_NAME, System.IO.FileAccess.Read);
|
||||||
|
using (FileStream fs = File.Create(FILE_NAME))
|
||||||
|
{
|
||||||
|
System.Text.Encoding r = GetType(fs);
|
||||||
|
fs.Close();
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 通過給定的檔案流,判斷檔案的編碼型別
|
||||||
|
/// <param name="fs">檔案流</param>
|
||||||
|
/// <returns>檔案的編碼型別</returns>
|
||||||
|
public static System.Text.Encoding GetType(System.IO.FileStream fs)
|
||||||
|
{
|
||||||
|
byte[] Unicode = new byte[] { 0xFF, 0xFE, 0x41 };
|
||||||
|
byte[] UnicodeBIG = new byte[] { 0xFE, 0xFF, 0x00 };
|
||||||
|
byte[] UTF8 = new byte[] { 0xEF, 0xBB, 0xBF }; //帶BOM
|
||||||
|
System.Text.Encoding reVal = System.Text.Encoding.Default;
|
||||||
|
|
||||||
|
System.IO.BinaryReader r = new System.IO.BinaryReader(fs, System.Text.Encoding.Default);
|
||||||
|
int i;
|
||||||
|
int.TryParse(fs.Length.ToString(), out i);
|
||||||
|
byte[] ss = r.ReadBytes(i);
|
||||||
|
if (IsUTF8Bytes(ss) || (ss[0] == 0xEF && ss[1] == 0xBB && ss[2] == 0xBF))
|
||||||
|
{
|
||||||
|
reVal = System.Text.Encoding.UTF8;
|
||||||
|
}
|
||||||
|
else if (ss[0] == 0xFE && ss[1] == 0xFF && ss[2] == 0x00)
|
||||||
|
{
|
||||||
|
reVal = System.Text.Encoding.BigEndianUnicode;
|
||||||
|
}
|
||||||
|
else if (ss[0] == 0xFF && ss[1] == 0xFE && ss[2] == 0x41)
|
||||||
|
{
|
||||||
|
reVal = System.Text.Encoding.Unicode;
|
||||||
|
}
|
||||||
|
r.Close();
|
||||||
|
return reVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 判斷是否是不帶 BOM 的 UTF8 格式
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static bool IsUTF8Bytes(byte[] data)
|
||||||
|
{
|
||||||
|
int charByteCounter = 1; //計算當前正分析的字元應還有的位元組數
|
||||||
|
byte curByte; //當前分析的位元組.
|
||||||
|
for (int i = 0; i < data.Length; i++)
|
||||||
|
{
|
||||||
|
curByte = data[i];
|
||||||
|
if (charByteCounter == 1)
|
||||||
|
{
|
||||||
|
if (curByte >= 0x80)
|
||||||
|
{
|
||||||
|
//判斷當前
|
||||||
|
while (((curByte <<= 1) & 0x80) != 0)
|
||||||
|
{
|
||||||
|
charByteCounter++;
|
||||||
|
}
|
||||||
|
//標記位首位若為非0 則至少以2個1開始 如:110XXXXX...........1111110X
|
||||||
|
if (charByteCounter == 1 || charByteCounter > 6)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//若是UTF-8 此時第一位必須為1
|
||||||
|
if ((curByte & 0xC0) != 0x80)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
charByteCounter--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (charByteCounter > 1)
|
||||||
|
{
|
||||||
|
throw new Exception("非預期的byte格式");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace solarApp.Service
|
|
||||||
{
|
|
||||||
//static class myHelper
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
|
||||||
public static class ListHelper
|
|
||||||
{
|
|
||||||
public static string ToSiteTable(this IList<String> list)
|
|
||||||
{
|
|
||||||
|
|
||||||
return string.Join(", ", list.ToArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
382
solarApp/Service/operateCSV.cs
Normal file
382
solarApp/Service/operateCSV.cs
Normal file
@ -0,0 +1,382 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
using System.Configuration;
|
||||||
|
using Dapper;
|
||||||
|
|
||||||
|
namespace solarApp.Service
|
||||||
|
{
|
||||||
|
public class operateCSV
|
||||||
|
{
|
||||||
|
string Connection1 = ConfigurationManager.ConnectionStrings["mySql"].ConnectionString;
|
||||||
|
/// <summary>
|
||||||
|
/// 讀取CSV檔案通過文字格式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="strpath"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DataTable readCsvTxt(string strpath)
|
||||||
|
{
|
||||||
|
int intColCount = 0;
|
||||||
|
bool blnFlag = true;
|
||||||
|
DataTable mydt = new DataTable("myTableName");
|
||||||
|
|
||||||
|
DataColumn mydc;
|
||||||
|
DataRow mydr;
|
||||||
|
|
||||||
|
string strline;
|
||||||
|
string[] aryline;
|
||||||
|
|
||||||
|
System.IO.StreamReader mysr = new System.IO.StreamReader(strpath);
|
||||||
|
|
||||||
|
while ((strline = mysr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
aryline = strline.Split(',');
|
||||||
|
|
||||||
|
if (blnFlag)
|
||||||
|
{
|
||||||
|
blnFlag = false;
|
||||||
|
intColCount = aryline.Length;
|
||||||
|
for (int i = 0; i < aryline.Length; i++)
|
||||||
|
{
|
||||||
|
mydc = new DataColumn(aryline[i]);
|
||||||
|
mydt.Columns.Add(mydc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mydr = mydt.NewRow();
|
||||||
|
for (int i = 0; i < intColCount; i++)
|
||||||
|
{
|
||||||
|
mydr[i] = aryline[i];
|
||||||
|
}
|
||||||
|
mydt.Rows.Add(mydr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mydt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 利用SQL查詢CSV
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
//public DataTable readCsvSql(string path, string filename, string deviceName)
|
||||||
|
//{
|
||||||
|
// string strconn = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Text;", path);
|
||||||
|
// string sql = string.Format("SELECT * FROM [{0}]", filename);
|
||||||
|
// using (OleDbConnection conn = new OleDbConnection(strconn))
|
||||||
|
// {
|
||||||
|
// DataTable dtTable = new DataTable();
|
||||||
|
// OleDbDataAdapter adapter = new OleDbDataAdapter(sql, conn);
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// adapter.Fill(dtTable);
|
||||||
|
// logHelper.WriteLog(string.Format("[裝置]:{0}-->讀取檔案-->結果:成功", deviceName));
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// dtTable = new DataTable();
|
||||||
|
// logHelper.WriteLog(string.Format("[裝置]:{0}-->讀取檔案-->結果:{1}", deviceName, ex.Message));
|
||||||
|
// throw ex;
|
||||||
|
// }
|
||||||
|
// return dtTable;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 讀取CSV檔案
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mycsvdt"></param>
|
||||||
|
/// <param name="filepath"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void createColumnHour(ref DataTable mycsvdt, string filepath)
|
||||||
|
{
|
||||||
|
string strpath = filepath; //csv檔案的路徑
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int intColCount = 0;
|
||||||
|
bool blnFlag = true;
|
||||||
|
|
||||||
|
DataColumn mydc;
|
||||||
|
|
||||||
|
string strline;
|
||||||
|
string[] aryline;
|
||||||
|
StreamReader mysr = new StreamReader(strpath, System.Text.Encoding.Default);
|
||||||
|
|
||||||
|
int rowIndex = 0;
|
||||||
|
while ((strline = mysr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
rowIndex += 1;
|
||||||
|
if (rowIndex < 4) continue;
|
||||||
|
aryline = strline.Split(new char[] { ',' });
|
||||||
|
|
||||||
|
//給datatable加上列名
|
||||||
|
if (blnFlag)
|
||||||
|
{
|
||||||
|
blnFlag = false;
|
||||||
|
intColCount = aryline.Length;
|
||||||
|
int col = 0;
|
||||||
|
for (int i = 0; i < aryline.Length; i++)
|
||||||
|
{
|
||||||
|
col = i + 1;
|
||||||
|
mydc = new DataColumn(col.ToString());
|
||||||
|
mycsvdt.Columns.Add(mydc);
|
||||||
|
}
|
||||||
|
//最後一欄 放 Inv編號
|
||||||
|
mydc = new DataColumn("inv");
|
||||||
|
mycsvdt.Columns.Add(mydc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
//throw (Stack.GetErrorStack(strpath + "讀取CSV檔案中的資料出錯." + e.Message, "OpenCSVFile("));
|
||||||
|
//return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createColumnDay(ref DataTable mycsvdt, string filepath)
|
||||||
|
{
|
||||||
|
string strpath = filepath; //csv檔案的路徑
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int intColCount = 0;
|
||||||
|
bool blnFlag = true;
|
||||||
|
|
||||||
|
DataColumn mydc;
|
||||||
|
|
||||||
|
string strline;
|
||||||
|
string[] aryline;
|
||||||
|
StreamReader mysr = new StreamReader(strpath, System.Text.Encoding.Default);
|
||||||
|
|
||||||
|
int rowIndex = 0;
|
||||||
|
while ((strline = mysr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
rowIndex += 1;
|
||||||
|
if (rowIndex < 3) continue;
|
||||||
|
aryline = strline.Split(new char[] { ',' });
|
||||||
|
|
||||||
|
//給datatable加上列名
|
||||||
|
if (blnFlag)
|
||||||
|
{
|
||||||
|
blnFlag = false;
|
||||||
|
intColCount = aryline.Length;
|
||||||
|
int col = 0; int col6 = 0;
|
||||||
|
for (int i = 0; i < aryline.Length; i++)
|
||||||
|
{
|
||||||
|
col = i + 1;
|
||||||
|
mydc = new DataColumn(col.ToString());
|
||||||
|
mycsvdt.Columns.Add(mydc);
|
||||||
|
}
|
||||||
|
////最後一欄 放 Inv編號
|
||||||
|
//mydc = new DataColumn("inv");
|
||||||
|
//mycsvdt.Columns.Add(mydc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
//throw (Stack.GetErrorStack(strpath + "讀取CSV檔案中的資料出錯." + e.Message, "OpenCSVFile("));
|
||||||
|
//return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool readCsvFile(ref DataTable mycsvdt, string filepath, string InvID, int intColCount, bool readTitle)
|
||||||
|
{
|
||||||
|
string strpath = filepath; //csv檔案的路徑
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool blnFlag = true;
|
||||||
|
|
||||||
|
DataColumn mydc;
|
||||||
|
DataRow mydr;
|
||||||
|
|
||||||
|
string strline;
|
||||||
|
string[] aryline;
|
||||||
|
StreamReader mysr = new StreamReader(strpath, System.Text.Encoding.Default);
|
||||||
|
|
||||||
|
int rowIndex = 0;
|
||||||
|
while ((strline = mysr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
rowIndex += 1;
|
||||||
|
if (readTitle)
|
||||||
|
{
|
||||||
|
if (rowIndex < 3)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
// 欄位需要取:row 3 invId , row 4 欄位名稱也需要讀取完
|
||||||
|
}
|
||||||
|
else if (rowIndex <= 4)
|
||||||
|
{
|
||||||
|
readTitle = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (rowIndex < 5) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
aryline = strline.Split(new char[] { ',' });
|
||||||
|
|
||||||
|
//填充資料並加入到datatable中
|
||||||
|
mydr = mycsvdt.NewRow();
|
||||||
|
for (int i = 0; i < intColCount; i++)
|
||||||
|
{
|
||||||
|
mydr[i] = aryline[i];
|
||||||
|
}
|
||||||
|
//mydr["inv"] = InvID;
|
||||||
|
mycsvdt.Rows.Add(mydr);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
//throw (Stack.GetErrorStack(strpath + "讀取CSV檔案中的資料出錯." + e.Message, "OpenCSVFile("));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool insertHour2DB(ref DataTable dt) {
|
||||||
|
bool result = false;
|
||||||
|
StringBuilder ss = new StringBuilder();
|
||||||
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
int i = 0;
|
||||||
|
foreach (DataRow row in dt.Rows)
|
||||||
|
{
|
||||||
|
ss.Append(@"insert into solar_import.src_inv(c1 ,c2 ,c3 ,c4 ,c5 ,c6 ,c7 ,c8 ,c9 ,c10 ,c11 ,c12 ,c13 ,c14 ,c15 ,c16 ,c17 ,c18 ,c19 ,inv)
|
||||||
|
values( '"+ row.Field<string>("1").ToString() + "' ,'" + row.Field<string>("2").ToString() + "' ,'" + row.Field<string>("3").ToString() + "' ," +
|
||||||
|
"'" + row.Field<string>("4").ToString() + "' ,'" + row.Field<string>("5").ToString() + "' ,'" + row.Field<string>("6").ToString() + "' ," +
|
||||||
|
"'" + row.Field<string>("7").ToString() + "' ,'"+ row.Field<string>("8").ToString() + "' ,'" + row.Field<string>("9").ToString() + "' ," +
|
||||||
|
"'" + row.Field<string>("10").ToString() + "' ,'" + row.Field<string>("11").ToString() + "' ,'" + row.Field<string>("12").ToString() + "' ," +
|
||||||
|
"'" + row.Field<string>("13").ToString() + "' ,'" + row.Field<string>("14").ToString() + "' ,'" + row.Field<string>("15").ToString() + "' ," +
|
||||||
|
"'" + row.Field<string>("16").ToString() + "', '" + row.Field<string>("17").ToString() + "', '" + row.Field<string>("18").ToString() + "'," +
|
||||||
|
"'" + row.Field<string>("19").ToString() + "' ,'" + row.Field<string>("inv").ToString() + "' );");
|
||||||
|
|
||||||
|
if (i % 10 == 0)
|
||||||
|
{
|
||||||
|
conn.Execute(ss.ToString());
|
||||||
|
ss.Clear();
|
||||||
|
//ss.Append(@"insert into solar_import.src_inv(c1 ,c2 ,c3 ,c4 ,c5 ,c6 ,c7 ,c8 ,c9 ,c10 ,c11 ,c12 ,c13 ,c14 ,c15 ,c16 ,c17 ,c18 ,c19 ,inv)
|
||||||
|
// values( @c1 ,@c2 ,@c3 ,@c4 ,@c5 ,@c6 ,@c7 ,@c8 ,@c9 ,@c10 ,@c11 ,@c12 ,@c13 ,@c14 ,@c15 , @c16, @c17, @c18,@c19 ,@inv );");
|
||||||
|
//conn.Execute(ss.ToString(), new
|
||||||
|
//{
|
||||||
|
// c1 = row.Field<string>("1").ToString(), c2 = row.Field<string>("2").ToString(),
|
||||||
|
// c3 = row.Field<string>("3").ToString(), c4 = row.Field<string>("4").ToString(),
|
||||||
|
// c5 = row.Field<string>("5").ToString(), c6 = row.Field<string>("6").ToString(),
|
||||||
|
// c7 = row.Field<string>("7").ToString(), c8 = row.Field<string>("8").ToString(),
|
||||||
|
// c9 = row.Field<string>("9").ToString(), c10 = row.Field<string>("10").ToString(),
|
||||||
|
// c11 = row.Field<string>("11").ToString(), c12 = row.Field<string>("12").ToString(),
|
||||||
|
// c13 = row.Field<string>("13").ToString(), c14 = row.Field<string>("14").ToString(),
|
||||||
|
// c15 = row.Field<string>("15").ToString(), c16 = row.Field<string>("16").ToString(),
|
||||||
|
// c17 = row.Field<string>("17").ToString(), c18 = row.Field<string>("18").ToString(),
|
||||||
|
// c19 = row.Field<string>("19").ToString(), inv = row.Field<string>("inv").ToString()
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (ss.Length > 0)
|
||||||
|
{
|
||||||
|
conn.Execute(ss.ToString());
|
||||||
|
ss.Clear();
|
||||||
|
}
|
||||||
|
conn.Clone();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool insertDay2DB(ref DataTable dt)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
StringBuilder ss = new StringBuilder();
|
||||||
|
using (MySqlConnection conn = new MySqlConnection(Connection1))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
int i = 0;
|
||||||
|
foreach (DataRow row in dt.Rows)
|
||||||
|
{
|
||||||
|
ss.Append(@"INSERT INTO solar_import.src_inv_day( c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50, c51, c52, c53, c54, c55)
|
||||||
|
values( '"
|
||||||
|
+ row.Field<string>("1").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("2").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("3").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("4").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("5").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("6").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("7").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("8").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("9").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("10").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("11").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("12").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("13").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("14").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("15").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("16").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("17").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("18").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("19").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("20").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("21").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("22").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("23").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("24").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("25").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("26").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("27").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("28").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("29").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("30").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("31").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("32").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("33").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("34").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("35").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("36").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("37").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("38").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("39").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("40").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("41").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("42").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("43").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("44").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("45").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("46").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("47").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("48").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("49").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("50").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("51").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("52").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("53").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("54").ToString() + "' ,'"
|
||||||
|
+ row.Field<string>("55").ToString() + "');");
|
||||||
|
|
||||||
|
if (i % 10 == 0)
|
||||||
|
{
|
||||||
|
conn.Execute(ss.ToString());
|
||||||
|
ss.Clear();
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (ss.Length > 0)
|
||||||
|
{
|
||||||
|
conn.Execute(ss.ToString());
|
||||||
|
ss.Clear();
|
||||||
|
}
|
||||||
|
conn.Clone();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -180,10 +180,9 @@ namespace solarApp.Service
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
#region hour
|
#region hour
|
||||||
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, `Irradiance`, `Temperature`)
|
sql = @"insert into sensor_history_hour( `PowerStationId`, `TIMESTAMP`, Irradiance, Temperature, EnvTemperature, Humidity, Vane, Dust)
|
||||||
select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.modelTempAvg from
|
select a.powerstationID, a.reportdate, ifnull(b.irrAvg, 0) irrAvg, a.modelTempAvg, a.envTempAvg, a.humidityAvg, a.windAvg, a.dustAvg from
|
||||||
(
|
(
|
||||||
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, avg(" + modelTempCol + @") modelTempAvg,
|
select @powerStationID powerstationID, FROM_UNIXTIME(`TIMESTAMP`/1000,'%Y-%m-%d %H:%i') reportdate, avg(" + modelTempCol + @") modelTempAvg,
|
||||||
avg(" + evnTempCol + @") envTempAvg, avg(" + humCol + @") humidityAvg, avg(" + windCol + @") windAvg,
|
avg(" + evnTempCol + @") envTempAvg, avg(" + humCol + @") humidityAvg, avg(" + windCol + @") windAvg,
|
||||||
|
|||||||
273
solarApp/fmExcel.Designer.cs
generated
Normal file
273
solarApp/fmExcel.Designer.cs
generated
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
|
||||||
|
namespace solarApp
|
||||||
|
{
|
||||||
|
partial class fmExcel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.tb2 = new System.Windows.Forms.TabPage();
|
||||||
|
this.lbSiteDB_sensor = new System.Windows.Forms.Label();
|
||||||
|
this.lbSiteID_sensor = new System.Windows.Forms.Label();
|
||||||
|
this.bt_archive = new System.Windows.Forms.Button();
|
||||||
|
this.bt_openFile = new System.Windows.Forms.Button();
|
||||||
|
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.btVerifyData = new System.Windows.Forms.Button();
|
||||||
|
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||||
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
|
this.lbSiteName_sensor = new System.Windows.Forms.Label();
|
||||||
|
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.tb1 = new System.Windows.Forms.TabPage();
|
||||||
|
this.tabControl = new System.Windows.Forms.TabControl();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||||
|
this.panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
|
this.splitContainer1.Panel1.SuspendLayout();
|
||||||
|
this.splitContainer1.Panel2.SuspendLayout();
|
||||||
|
this.splitContainer1.SuspendLayout();
|
||||||
|
this.tb1.SuspendLayout();
|
||||||
|
this.tabControl.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// tb2
|
||||||
|
//
|
||||||
|
this.tb2.Location = new System.Drawing.Point(4, 31);
|
||||||
|
this.tb2.Name = "tb2";
|
||||||
|
this.tb2.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tb2.Size = new System.Drawing.Size(1774, 818);
|
||||||
|
this.tb2.TabIndex = 1;
|
||||||
|
this.tb2.Text = "tabPage2";
|
||||||
|
this.tb2.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// 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(49, 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";
|
||||||
|
//
|
||||||
|
// bt_archive
|
||||||
|
//
|
||||||
|
this.bt_archive.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.bt_archive.Location = new System.Drawing.Point(5, 528);
|
||||||
|
this.bt_archive.Name = "bt_archive";
|
||||||
|
this.bt_archive.Size = new System.Drawing.Size(282, 100);
|
||||||
|
this.bt_archive.TabIndex = 8;
|
||||||
|
this.bt_archive.Text = "單日歸檔";
|
||||||
|
this.bt_archive.UseVisualStyleBackColor = true;
|
||||||
|
this.bt_archive.Visible = false;
|
||||||
|
//
|
||||||
|
// bt_openFile
|
||||||
|
//
|
||||||
|
this.bt_openFile.Font = new System.Drawing.Font("Microsoft JhengHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.bt_openFile.Location = new System.Drawing.Point(5, 251);
|
||||||
|
this.bt_openFile.Name = "bt_openFile";
|
||||||
|
this.bt_openFile.Size = new System.Drawing.Size(172, 44);
|
||||||
|
this.bt_openFile.TabIndex = 7;
|
||||||
|
this.bt_openFile.Text = "慧景 - inv hour";
|
||||||
|
this.bt_openFile.UseVisualStyleBackColor = true;
|
||||||
|
this.bt_openFile.Click += new System.EventHandler(this.bt_openFile_Click);
|
||||||
|
//
|
||||||
|
// bt_clear_station
|
||||||
|
//
|
||||||
|
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.Visible = false;
|
||||||
|
//
|
||||||
|
// bt_clear_inv
|
||||||
|
//
|
||||||
|
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(172, 44);
|
||||||
|
this.bt_clear_inv.TabIndex = 5;
|
||||||
|
this.bt_clear_inv.Text = "慧景 - inv day";
|
||||||
|
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, 176);
|
||||||
|
this.fp_site.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// 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.Visible = false;
|
||||||
|
//
|
||||||
|
// 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, 687);
|
||||||
|
this.dataGridView1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
this.panel1.BackColor = System.Drawing.Color.LightYellow;
|
||||||
|
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;
|
||||||
|
//
|
||||||
|
// 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";
|
||||||
|
//
|
||||||
|
// 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.PaleGoldenrod;
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.bt_archive);
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.bt_openFile);
|
||||||
|
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);
|
||||||
|
//
|
||||||
|
// splitContainer1.Panel2
|
||||||
|
//
|
||||||
|
this.splitContainer1.Panel2.Controls.Add(this.dataGridView1);
|
||||||
|
this.splitContainer1.Panel2.Controls.Add(this.panel1);
|
||||||
|
this.splitContainer1.Size = new System.Drawing.Size(1768, 812);
|
||||||
|
this.splitContainer1.SplitterDistance = 300;
|
||||||
|
this.splitContainer1.SplitterWidth = 10;
|
||||||
|
this.splitContainer1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// tb1
|
||||||
|
//
|
||||||
|
this.tb1.Controls.Add(this.splitContainer1);
|
||||||
|
this.tb1.Location = new System.Drawing.Point(4, 31);
|
||||||
|
this.tb1.Name = "tb1";
|
||||||
|
this.tb1.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tb1.Size = new System.Drawing.Size(1774, 818);
|
||||||
|
this.tb1.TabIndex = 0;
|
||||||
|
this.tb1.Text = " excel ";
|
||||||
|
this.tb1.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// tabControl
|
||||||
|
//
|
||||||
|
this.tabControl.Appearance = System.Windows.Forms.TabAppearance.Buttons;
|
||||||
|
this.tabControl.Controls.Add(this.tb1);
|
||||||
|
this.tabControl.Controls.Add(this.tb2);
|
||||||
|
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.tabControl.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.tabControl.Name = "tabControl";
|
||||||
|
this.tabControl.SelectedIndex = 0;
|
||||||
|
this.tabControl.Size = new System.Drawing.Size(1782, 853);
|
||||||
|
this.tabControl.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// fmExcel
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1782, 853);
|
||||||
|
this.Controls.Add(this.tabControl);
|
||||||
|
this.Name = "fmExcel";
|
||||||
|
this.Text = "fmExcel";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||||
|
this.panel1.ResumeLayout(false);
|
||||||
|
this.panel1.PerformLayout();
|
||||||
|
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||||
|
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||||
|
this.splitContainer1.ResumeLayout(false);
|
||||||
|
this.tb1.ResumeLayout(false);
|
||||||
|
this.tabControl.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.TabPage tb2;
|
||||||
|
private System.Windows.Forms.Label lbSiteDB_sensor;
|
||||||
|
private System.Windows.Forms.Label lbSiteID_sensor;
|
||||||
|
private System.Windows.Forms.Button bt_archive;
|
||||||
|
private System.Windows.Forms.Button bt_openFile;
|
||||||
|
private System.Windows.Forms.Button bt_clear_station;
|
||||||
|
private System.Windows.Forms.Button bt_clear_inv;
|
||||||
|
private System.Windows.Forms.FlowLayoutPanel fp_site;
|
||||||
|
private System.Windows.Forms.Button btVerifyData;
|
||||||
|
private System.Windows.Forms.DataGridView dataGridView1;
|
||||||
|
private System.Windows.Forms.Panel panel1;
|
||||||
|
private System.Windows.Forms.Label lbSiteName_sensor;
|
||||||
|
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||||
|
private System.Windows.Forms.TabPage tb1;
|
||||||
|
private System.Windows.Forms.TabControl tabControl;
|
||||||
|
}
|
||||||
|
}
|
||||||
180
solarApp/fmExcel.cs
Normal file
180
solarApp/fmExcel.cs
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
// ref https://www.c-sharpcorner.com/article/read-excel-file-in-c-sharp-winform/
|
||||||
|
using Microsoft.Office.Interop.Excel;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace solarApp
|
||||||
|
{
|
||||||
|
public partial class fmExcel : Form
|
||||||
|
{
|
||||||
|
System.Data.DataTable dt_cap1 = new System.Data.DataTable();
|
||||||
|
|
||||||
|
public fmExcel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bt_openFile_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string fname = "";
|
||||||
|
OpenFileDialog fdlg = new OpenFileDialog();
|
||||||
|
fdlg.Title = "Excel File Dialog";
|
||||||
|
fdlg.InitialDirectory = @"c:\";
|
||||||
|
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
|
||||||
|
fdlg.FilterIndex = 2;
|
||||||
|
fdlg.RestoreDirectory = true;
|
||||||
|
if (fdlg.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
fname = fdlg.FileName;
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
//取得選取檔案的路徑
|
||||||
|
string dir = Path.GetDirectoryName(fname);
|
||||||
|
// 取得路徑下所有檔案
|
||||||
|
string[] fileEntries = System.IO.Directory.GetFiles(dir);
|
||||||
|
|
||||||
|
Service.operateCSV csvSvc = new Service.operateCSV(); // readCsvTxt
|
||||||
|
System.Data.DataTable dt = new System.Data.DataTable();
|
||||||
|
bool isFirst = true;
|
||||||
|
foreach (string fileName in fileEntries)
|
||||||
|
{
|
||||||
|
#region 取得 filename 中的 InvID
|
||||||
|
string fName = Path.GetFileName(fileName);
|
||||||
|
string[] ss = fName.Split("_");
|
||||||
|
string InvID = ss[0];
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (isFirst)
|
||||||
|
{
|
||||||
|
csvSvc.createColumnDay(ref dt, fileName);
|
||||||
|
csvSvc.readCsvFile(ref dt, fileName, InvID, dt.Columns.Count, isFirst);
|
||||||
|
isFirst = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
csvSvc.readCsvFile(ref dt, fileName, InvID, dt.Columns.Count, isFirst);
|
||||||
|
}
|
||||||
|
MessageBox.Show(" 共 "+ dt.Rows.Count.ToString());
|
||||||
|
|
||||||
|
//System.Data.DataTable dt = solarApp.Service.csvHelper.OpenCSV(fname);
|
||||||
|
dataGridView1.DataSource = dt;
|
||||||
|
csvSvc.insertDay2DB(ref dt);
|
||||||
|
MessageBox.Show("OK");
|
||||||
|
}
|
||||||
|
protected void ImportFile()
|
||||||
|
{
|
||||||
|
string fname = "";
|
||||||
|
OpenFileDialog fdlg = new OpenFileDialog();
|
||||||
|
fdlg.Title = "Excel File Dialog";
|
||||||
|
fdlg.InitialDirectory = @"c:\";
|
||||||
|
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
|
||||||
|
fdlg.FilterIndex = 2;
|
||||||
|
fdlg.RestoreDirectory = true;
|
||||||
|
if (fdlg.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
fname = fdlg.FileName;
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
|
||||||
|
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
|
||||||
|
Microsoft.Office.Interop.Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(fname);
|
||||||
|
Microsoft.Office.Interop.Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
|
||||||
|
Microsoft.Office.Interop.Excel.Range xlRange = xlWorksheet.UsedRange;
|
||||||
|
|
||||||
|
int rowCount = xlRange.Rows.Count;
|
||||||
|
int colCount = xlRange.Columns.Count;
|
||||||
|
|
||||||
|
// dt.Column = colCount;
|
||||||
|
dataGridView1.ColumnCount = colCount;
|
||||||
|
dataGridView1.RowCount = rowCount;
|
||||||
|
|
||||||
|
for (int i = 1; i <= rowCount; i++)
|
||||||
|
{
|
||||||
|
for (int j = 1; j <= colCount; j++)
|
||||||
|
{
|
||||||
|
//write the value to the Grid
|
||||||
|
if (xlRange.Cells[i, j] != null && xlRange.Cells[i, j].Value2 != null)
|
||||||
|
{
|
||||||
|
dataGridView1.Rows[i - 1].Cells[j - 1].Value = xlRange.Cells[i, j].Value2.ToString();
|
||||||
|
}
|
||||||
|
// Console.Write(xlRange.Cells[i, j].Value2.ToString() + "\t");
|
||||||
|
//add useful things here!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//cleanup
|
||||||
|
GC.Collect();
|
||||||
|
GC.WaitForPendingFinalizers();
|
||||||
|
|
||||||
|
//rule of thumb for releasing com objects:
|
||||||
|
// never use two dots, all COM objects must be referenced and released individually
|
||||||
|
// ex: [somthing].[something].[something] is bad
|
||||||
|
|
||||||
|
//release com objects to fully kill excel process from running in the background
|
||||||
|
Marshal.ReleaseComObject(xlRange);
|
||||||
|
Marshal.ReleaseComObject(xlWorksheet);
|
||||||
|
|
||||||
|
//close and release
|
||||||
|
xlWorkbook.Close();
|
||||||
|
Marshal.ReleaseComObject(xlWorkbook);
|
||||||
|
|
||||||
|
//quit and release
|
||||||
|
xlApp.Quit();
|
||||||
|
Marshal.ReleaseComObject(xlApp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bt_clear_inv_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string fname = "";
|
||||||
|
OpenFileDialog fdlg = new OpenFileDialog();
|
||||||
|
fdlg.Title = "Excel File Dialog";
|
||||||
|
fdlg.InitialDirectory = @"c:\";
|
||||||
|
fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
|
||||||
|
fdlg.FilterIndex = 2;
|
||||||
|
fdlg.RestoreDirectory = true;
|
||||||
|
if (fdlg.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
fname = fdlg.FileName;
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
//取得選取檔案的路徑
|
||||||
|
string dir = Path.GetDirectoryName(fname);
|
||||||
|
// 取得路徑下所有檔案
|
||||||
|
string[] fileEntries = System.IO.Directory.GetFiles(dir);
|
||||||
|
|
||||||
|
Service.operateCSV csvSvc = new Service.operateCSV(); // readCsvTxt
|
||||||
|
System.Data.DataTable dt = new System.Data.DataTable();
|
||||||
|
bool isFirst = true;
|
||||||
|
foreach (string fileName in fileEntries)
|
||||||
|
{
|
||||||
|
#region 取得 filename 中的 InvID
|
||||||
|
string fName = Path.GetFileName(fileName);
|
||||||
|
string[] ss = fName.Split("_");
|
||||||
|
string InvID = ss[0];
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (isFirst)
|
||||||
|
{
|
||||||
|
csvSvc.createColumnDay(ref dt, fileName);
|
||||||
|
csvSvc.readCsvFile(ref dt, fileName, "", dt.Columns.Count, isFirst);
|
||||||
|
isFirst = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
csvSvc.readCsvFile(ref dt, fileName, "", dt.Columns.Count, isFirst);
|
||||||
|
}
|
||||||
|
MessageBox.Show(" 共 " + dt.Rows.Count.ToString());
|
||||||
|
|
||||||
|
//System.Data.DataTable dt = solarApp.Service.csvHelper.OpenCSV(fname);
|
||||||
|
dataGridView1.DataSource = dt;
|
||||||
|
csvSvc.insertDay2DB(ref dt);
|
||||||
|
MessageBox.Show("OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
solarApp/fmMain.Designer.cs
generated
50
solarApp/fmMain.Designer.cs
generated
@ -236,7 +236,7 @@ namespace solarApp
|
|||||||
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.tabControl1.Name = "tabControl1";
|
this.tabControl1.Name = "tabControl1";
|
||||||
this.tabControl1.SelectedIndex = 0;
|
this.tabControl1.SelectedIndex = 0;
|
||||||
this.tabControl1.Size = new System.Drawing.Size(1743, 1074);
|
this.tabControl1.Size = new System.Drawing.Size(1743, 1055);
|
||||||
this.tabControl1.TabIndex = 0;
|
this.tabControl1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// tb_inv
|
// tb_inv
|
||||||
@ -246,7 +246,7 @@ namespace solarApp
|
|||||||
this.tb_inv.Location = new System.Drawing.Point(4, 28);
|
this.tb_inv.Location = new System.Drawing.Point(4, 28);
|
||||||
this.tb_inv.Name = "tb_inv";
|
this.tb_inv.Name = "tb_inv";
|
||||||
this.tb_inv.Padding = new System.Windows.Forms.Padding(3);
|
this.tb_inv.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tb_inv.Size = new System.Drawing.Size(1735, 1042);
|
this.tb_inv.Size = new System.Drawing.Size(1735, 1023);
|
||||||
this.tb_inv.TabIndex = 0;
|
this.tb_inv.TabIndex = 0;
|
||||||
this.tb_inv.Text = " Inverter ";
|
this.tb_inv.Text = " Inverter ";
|
||||||
//
|
//
|
||||||
@ -271,7 +271,7 @@ namespace solarApp
|
|||||||
// sp_main_inv.Panel2
|
// sp_main_inv.Panel2
|
||||||
//
|
//
|
||||||
this.sp_main_inv.Panel2.Controls.Add(this.sp_child_inv);
|
this.sp_main_inv.Panel2.Controls.Add(this.sp_child_inv);
|
||||||
this.sp_main_inv.Size = new System.Drawing.Size(1729, 1036);
|
this.sp_main_inv.Size = new System.Drawing.Size(1729, 1017);
|
||||||
this.sp_main_inv.SplitterDistance = 351;
|
this.sp_main_inv.SplitterDistance = 351;
|
||||||
this.sp_main_inv.TabIndex = 0;
|
this.sp_main_inv.TabIndex = 0;
|
||||||
//
|
//
|
||||||
@ -324,7 +324,7 @@ namespace solarApp
|
|||||||
this.lbInverterID.AutoSize = true;
|
this.lbInverterID.AutoSize = true;
|
||||||
this.lbInverterID.Dock = System.Windows.Forms.DockStyle.Bottom;
|
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.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, 367);
|
this.lbInverterID.Location = new System.Drawing.Point(0, 348);
|
||||||
this.lbInverterID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.lbInverterID.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.lbInverterID.Name = "lbInverterID";
|
this.lbInverterID.Name = "lbInverterID";
|
||||||
this.lbInverterID.Size = new System.Drawing.Size(142, 24);
|
this.lbInverterID.Size = new System.Drawing.Size(142, 24);
|
||||||
@ -337,7 +337,7 @@ namespace solarApp
|
|||||||
this.fp_inv.Controls.Add(this.label4);
|
this.fp_inv.Controls.Add(this.label4);
|
||||||
this.fp_inv.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.fp_inv.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.fp_inv.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
this.fp_inv.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
this.fp_inv.Location = new System.Drawing.Point(0, 391);
|
this.fp_inv.Location = new System.Drawing.Point(0, 372);
|
||||||
this.fp_inv.Margin = new System.Windows.Forms.Padding(4);
|
this.fp_inv.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.fp_inv.Name = "fp_inv";
|
this.fp_inv.Name = "fp_inv";
|
||||||
this.fp_inv.Size = new System.Drawing.Size(351, 645);
|
this.fp_inv.Size = new System.Drawing.Size(351, 645);
|
||||||
@ -395,7 +395,7 @@ namespace solarApp
|
|||||||
this.sp_child_inv.Panel2.Controls.Add(this.panel3);
|
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.gv_fic_inv_raw);
|
||||||
this.sp_child_inv.Panel2.Controls.Add(this.panel2);
|
this.sp_child_inv.Panel2.Controls.Add(this.panel2);
|
||||||
this.sp_child_inv.Size = new System.Drawing.Size(1374, 1036);
|
this.sp_child_inv.Size = new System.Drawing.Size(1374, 1017);
|
||||||
this.sp_child_inv.SplitterDistance = 666;
|
this.sp_child_inv.SplitterDistance = 666;
|
||||||
this.sp_child_inv.SplitterWidth = 13;
|
this.sp_child_inv.SplitterWidth = 13;
|
||||||
this.sp_child_inv.TabIndex = 0;
|
this.sp_child_inv.TabIndex = 0;
|
||||||
@ -430,7 +430,7 @@ namespace solarApp
|
|||||||
this.gv_web_inv_month.ReadOnly = true;
|
this.gv_web_inv_month.ReadOnly = true;
|
||||||
this.gv_web_inv_month.RowHeadersWidth = 51;
|
this.gv_web_inv_month.RowHeadersWidth = 51;
|
||||||
this.gv_web_inv_month.RowTemplate.Height = 25;
|
this.gv_web_inv_month.RowTemplate.Height = 25;
|
||||||
this.gv_web_inv_month.Size = new System.Drawing.Size(666, 145);
|
this.gv_web_inv_month.Size = new System.Drawing.Size(666, 126);
|
||||||
this.gv_web_inv_month.TabIndex = 7;
|
this.gv_web_inv_month.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// panel9
|
// panel9
|
||||||
@ -640,7 +640,7 @@ namespace solarApp
|
|||||||
this.gv_fic_inv_hour.ReadOnly = true;
|
this.gv_fic_inv_hour.ReadOnly = true;
|
||||||
this.gv_fic_inv_hour.RowHeadersWidth = 51;
|
this.gv_fic_inv_hour.RowHeadersWidth = 51;
|
||||||
this.gv_fic_inv_hour.RowTemplate.Height = 25;
|
this.gv_fic_inv_hour.RowTemplate.Height = 25;
|
||||||
this.gv_fic_inv_hour.Size = new System.Drawing.Size(695, 453);
|
this.gv_fic_inv_hour.Size = new System.Drawing.Size(695, 434);
|
||||||
this.gv_fic_inv_hour.TabIndex = 4;
|
this.gv_fic_inv_hour.TabIndex = 4;
|
||||||
this.gv_fic_inv_hour.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_inv_hour_CellFormatting);
|
this.gv_fic_inv_hour.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_inv_hour_CellFormatting);
|
||||||
//
|
//
|
||||||
@ -737,7 +737,7 @@ namespace solarApp
|
|||||||
this.tb2.Location = new System.Drawing.Point(4, 28);
|
this.tb2.Location = new System.Drawing.Point(4, 28);
|
||||||
this.tb2.Name = "tb2";
|
this.tb2.Name = "tb2";
|
||||||
this.tb2.Padding = new System.Windows.Forms.Padding(3);
|
this.tb2.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tb2.Size = new System.Drawing.Size(1735, 1042);
|
this.tb2.Size = new System.Drawing.Size(1735, 1023);
|
||||||
this.tb2.TabIndex = 1;
|
this.tb2.TabIndex = 1;
|
||||||
this.tb2.Text = " site ";
|
this.tb2.Text = " site ";
|
||||||
this.tb2.UseVisualStyleBackColor = true;
|
this.tb2.UseVisualStyleBackColor = true;
|
||||||
@ -760,7 +760,7 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
this.sp_main_station.Panel2.BackColor = System.Drawing.Color.OldLace;
|
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.Panel2.Controls.Add(this.sp_child_station);
|
||||||
this.sp_main_station.Size = new System.Drawing.Size(1729, 1036);
|
this.sp_main_station.Size = new System.Drawing.Size(1729, 1017);
|
||||||
this.sp_main_station.SplitterDistance = 257;
|
this.sp_main_station.SplitterDistance = 257;
|
||||||
this.sp_main_station.TabIndex = 0;
|
this.sp_main_station.TabIndex = 0;
|
||||||
//
|
//
|
||||||
@ -772,14 +772,14 @@ namespace solarApp
|
|||||||
this.fp_site.Location = new System.Drawing.Point(0, 0);
|
this.fp_site.Location = new System.Drawing.Point(0, 0);
|
||||||
this.fp_site.Margin = new System.Windows.Forms.Padding(4);
|
this.fp_site.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.fp_site.Name = "fp_site";
|
this.fp_site.Name = "fp_site";
|
||||||
this.fp_site.Size = new System.Drawing.Size(257, 315);
|
this.fp_site.Size = new System.Drawing.Size(257, 545);
|
||||||
this.fp_site.TabIndex = 14;
|
this.fp_site.TabIndex = 14;
|
||||||
//
|
//
|
||||||
// lbMsg_station
|
// lbMsg_station
|
||||||
//
|
//
|
||||||
this.lbMsg_station.AutoSize = true;
|
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.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(23, 443);
|
this.lbMsg_station.Location = new System.Drawing.Point(28, 666);
|
||||||
this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.lbMsg_station.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.lbMsg_station.Name = "lbMsg_station";
|
this.lbMsg_station.Name = "lbMsg_station";
|
||||||
this.lbMsg_station.Size = new System.Drawing.Size(22, 24);
|
this.lbMsg_station.Size = new System.Drawing.Size(22, 24);
|
||||||
@ -788,7 +788,7 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
// bt_find_station
|
// bt_find_station
|
||||||
//
|
//
|
||||||
this.bt_find_station.Location = new System.Drawing.Point(9, 405);
|
this.bt_find_station.Location = new System.Drawing.Point(14, 628);
|
||||||
this.bt_find_station.Name = "bt_find_station";
|
this.bt_find_station.Name = "bt_find_station";
|
||||||
this.bt_find_station.Size = new System.Drawing.Size(94, 29);
|
this.bt_find_station.Size = new System.Drawing.Size(94, 29);
|
||||||
this.bt_find_station.TabIndex = 7;
|
this.bt_find_station.TabIndex = 7;
|
||||||
@ -799,7 +799,7 @@ namespace solarApp
|
|||||||
// dtselect_station1
|
// 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.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(5, 357);
|
this.dtselect_station1.Location = new System.Drawing.Point(10, 580);
|
||||||
this.dtselect_station1.Name = "dtselect_station1";
|
this.dtselect_station1.Name = "dtselect_station1";
|
||||||
this.dtselect_station1.Size = new System.Drawing.Size(234, 31);
|
this.dtselect_station1.Size = new System.Drawing.Size(234, 31);
|
||||||
this.dtselect_station1.TabIndex = 6;
|
this.dtselect_station1.TabIndex = 6;
|
||||||
@ -826,7 +826,7 @@ namespace solarApp
|
|||||||
this.sp_child_station.Panel2.Controls.Add(this.panel5);
|
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.gv_fic_station_raw);
|
||||||
this.sp_child_station.Panel2.Controls.Add(this.panel6);
|
this.sp_child_station.Panel2.Controls.Add(this.panel6);
|
||||||
this.sp_child_station.Size = new System.Drawing.Size(1468, 1036);
|
this.sp_child_station.Size = new System.Drawing.Size(1468, 1017);
|
||||||
this.sp_child_station.SplitterDistance = 711;
|
this.sp_child_station.SplitterDistance = 711;
|
||||||
this.sp_child_station.SplitterWidth = 13;
|
this.sp_child_station.SplitterWidth = 13;
|
||||||
this.sp_child_station.TabIndex = 1;
|
this.sp_child_station.TabIndex = 1;
|
||||||
@ -861,7 +861,7 @@ namespace solarApp
|
|||||||
this.gv_web_station_month.ReadOnly = true;
|
this.gv_web_station_month.ReadOnly = true;
|
||||||
this.gv_web_station_month.RowHeadersWidth = 51;
|
this.gv_web_station_month.RowHeadersWidth = 51;
|
||||||
this.gv_web_station_month.RowTemplate.Height = 25;
|
this.gv_web_station_month.RowTemplate.Height = 25;
|
||||||
this.gv_web_station_month.Size = new System.Drawing.Size(711, 123);
|
this.gv_web_station_month.Size = new System.Drawing.Size(711, 104);
|
||||||
this.gv_web_station_month.TabIndex = 5;
|
this.gv_web_station_month.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// panel10
|
// panel10
|
||||||
@ -1060,7 +1060,7 @@ namespace solarApp
|
|||||||
this.gv_fic_station_day.ReadOnly = true;
|
this.gv_fic_station_day.ReadOnly = true;
|
||||||
this.gv_fic_station_day.RowHeadersWidth = 51;
|
this.gv_fic_station_day.RowHeadersWidth = 51;
|
||||||
this.gv_fic_station_day.RowTemplate.Height = 25;
|
this.gv_fic_station_day.RowTemplate.Height = 25;
|
||||||
this.gv_fic_station_day.Size = new System.Drawing.Size(744, 453);
|
this.gv_fic_station_day.Size = new System.Drawing.Size(744, 434);
|
||||||
this.gv_fic_station_day.TabIndex = 4;
|
this.gv_fic_station_day.TabIndex = 4;
|
||||||
this.gv_fic_station_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_station_day_CellFormatting);
|
this.gv_fic_station_day.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_station_day_CellFormatting);
|
||||||
//
|
//
|
||||||
@ -1157,7 +1157,7 @@ namespace solarApp
|
|||||||
this.tbSensor.Location = new System.Drawing.Point(4, 28);
|
this.tbSensor.Location = new System.Drawing.Point(4, 28);
|
||||||
this.tbSensor.Name = "tbSensor";
|
this.tbSensor.Name = "tbSensor";
|
||||||
this.tbSensor.Padding = new System.Windows.Forms.Padding(3);
|
this.tbSensor.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.tbSensor.Size = new System.Drawing.Size(1735, 1042);
|
this.tbSensor.Size = new System.Drawing.Size(1735, 1023);
|
||||||
this.tbSensor.TabIndex = 2;
|
this.tbSensor.TabIndex = 2;
|
||||||
this.tbSensor.Text = "Sensor";
|
this.tbSensor.Text = "Sensor";
|
||||||
this.tbSensor.UseVisualStyleBackColor = true;
|
this.tbSensor.UseVisualStyleBackColor = true;
|
||||||
@ -1183,7 +1183,7 @@ namespace solarApp
|
|||||||
// splitContainer1.Panel2
|
// splitContainer1.Panel2
|
||||||
//
|
//
|
||||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||||
this.splitContainer1.Size = new System.Drawing.Size(1729, 1036);
|
this.splitContainer1.Size = new System.Drawing.Size(1729, 1017);
|
||||||
this.splitContainer1.SplitterDistance = 351;
|
this.splitContainer1.SplitterDistance = 351;
|
||||||
this.splitContainer1.TabIndex = 1;
|
this.splitContainer1.TabIndex = 1;
|
||||||
//
|
//
|
||||||
@ -1236,7 +1236,7 @@ namespace solarApp
|
|||||||
this.label24.AutoSize = true;
|
this.label24.AutoSize = true;
|
||||||
this.label24.Dock = System.Windows.Forms.DockStyle.Bottom;
|
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.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.Location = new System.Drawing.Point(0, 348);
|
||||||
this.label24.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.label24.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.label24.Name = "label24";
|
this.label24.Name = "label24";
|
||||||
this.label24.Size = new System.Drawing.Size(132, 24);
|
this.label24.Size = new System.Drawing.Size(132, 24);
|
||||||
@ -1249,7 +1249,7 @@ namespace solarApp
|
|||||||
this.flowLayoutPanel1.Controls.Add(this.label25);
|
this.flowLayoutPanel1.Controls.Add(this.label25);
|
||||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 391);
|
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 372);
|
||||||
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
|
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(351, 645);
|
this.flowLayoutPanel1.Size = new System.Drawing.Size(351, 645);
|
||||||
@ -1306,7 +1306,7 @@ namespace solarApp
|
|||||||
this.splitContainer2.Panel2.Controls.Add(this.panel14);
|
this.splitContainer2.Panel2.Controls.Add(this.panel14);
|
||||||
this.splitContainer2.Panel2.Controls.Add(this.gv_fic_sensor_raw);
|
this.splitContainer2.Panel2.Controls.Add(this.gv_fic_sensor_raw);
|
||||||
this.splitContainer2.Panel2.Controls.Add(this.panel15);
|
this.splitContainer2.Panel2.Controls.Add(this.panel15);
|
||||||
this.splitContainer2.Size = new System.Drawing.Size(1374, 1036);
|
this.splitContainer2.Size = new System.Drawing.Size(1374, 1017);
|
||||||
this.splitContainer2.SplitterDistance = 666;
|
this.splitContainer2.SplitterDistance = 666;
|
||||||
this.splitContainer2.SplitterWidth = 13;
|
this.splitContainer2.SplitterWidth = 13;
|
||||||
this.splitContainer2.TabIndex = 0;
|
this.splitContainer2.TabIndex = 0;
|
||||||
@ -1341,7 +1341,7 @@ namespace solarApp
|
|||||||
this.gv_web_sensor_month.ReadOnly = true;
|
this.gv_web_sensor_month.ReadOnly = true;
|
||||||
this.gv_web_sensor_month.RowHeadersWidth = 51;
|
this.gv_web_sensor_month.RowHeadersWidth = 51;
|
||||||
this.gv_web_sensor_month.RowTemplate.Height = 25;
|
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.Size = new System.Drawing.Size(666, 143);
|
||||||
this.gv_web_sensor_month.TabIndex = 7;
|
this.gv_web_sensor_month.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// panel11
|
// panel11
|
||||||
@ -1551,7 +1551,7 @@ namespace solarApp
|
|||||||
this.gv_fic_sensor_hour.ReadOnly = true;
|
this.gv_fic_sensor_hour.ReadOnly = true;
|
||||||
this.gv_fic_sensor_hour.RowHeadersWidth = 51;
|
this.gv_fic_sensor_hour.RowHeadersWidth = 51;
|
||||||
this.gv_fic_sensor_hour.RowTemplate.Height = 25;
|
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.Size = new System.Drawing.Size(695, 434);
|
||||||
this.gv_fic_sensor_hour.TabIndex = 4;
|
this.gv_fic_sensor_hour.TabIndex = 4;
|
||||||
this.gv_fic_sensor_hour.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_sensor_hour_CellFormatting);
|
this.gv_fic_sensor_hour.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.gv_fic_sensor_hour_CellFormatting);
|
||||||
//
|
//
|
||||||
@ -1646,7 +1646,7 @@ namespace solarApp
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1743, 1074);
|
this.ClientSize = new System.Drawing.Size(1743, 1055);
|
||||||
this.Controls.Add(this.tabControl1);
|
this.Controls.Add(this.tabControl1);
|
||||||
this.Name = "fmMain";
|
this.Name = "fmMain";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
|||||||
@ -6,6 +6,18 @@
|
|||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<COMReference Include="Microsoft.Office.Interop.Excel">
|
||||||
|
<WrapperTool>tlbimp</WrapperTool>
|
||||||
|
<VersionMinor>9</VersionMinor>
|
||||||
|
<VersionMajor>1</VersionMajor>
|
||||||
|
<Guid>00020813-0000-0000-c000-000000000046</Guid>
|
||||||
|
<Lcid>0</Lcid>
|
||||||
|
<Isolated>false</Isolated>
|
||||||
|
<EmbedInteropTypes>true</EmbedInteropTypes>
|
||||||
|
</COMReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dapper" Version="2.0.90" />
|
<PackageReference Include="Dapper" Version="2.0.90" />
|
||||||
<PackageReference Include="MySql.Data" Version="8.0.26" />
|
<PackageReference Include="MySql.Data" Version="8.0.26" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user