Protokolll inhalt erweitert
This commit is contained in:
41
SanSystem/HelpFunktion.cs
Normal file
41
SanSystem/HelpFunktion.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using SanShared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanSystem
|
||||
{
|
||||
static class HelpFunktion
|
||||
{
|
||||
public static List<UVcsvStrukture> ParseCSVFile(string csvFile)
|
||||
{
|
||||
List<UVcsvStrukture> result = new List<UVcsvStrukture>();
|
||||
|
||||
if (!File.Exists(csvFile)) return null;
|
||||
string[] input = File.ReadAllLines(csvFile);
|
||||
int counter = 0;
|
||||
|
||||
DateTime zeit;
|
||||
foreach (string pars in input)
|
||||
{
|
||||
UVcsvStrukture uVcsvStrukture = new UVcsvStrukture();
|
||||
string[] parts = pars.Split(',');
|
||||
if (parts[0].Equals("Group1") || parts[1].Equals("(END)")) continue;
|
||||
DateTime.TryParse(parts[0], out zeit);
|
||||
double temperatur = double.Parse(parts[1].Replace('.', ','));
|
||||
double druck = double.Parse(parts[2].Replace('.', ','));
|
||||
counter++;
|
||||
|
||||
uVcsvStrukture.Zeitstempel = zeit;
|
||||
uVcsvStrukture.Druck = druck;
|
||||
uVcsvStrukture.Temperatur = temperatur;
|
||||
result.Add(uVcsvStrukture);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@
|
||||
<DependentUpon>frmMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Global.cs" />
|
||||
<Compile Include="HelpFunktion.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UCInliner.cs">
|
||||
|
||||
46
SanSystem/UCInliner.Designer.cs
generated
46
SanSystem/UCInliner.Designer.cs
generated
@@ -30,8 +30,7 @@
|
||||
{
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.btn_create_graph = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.btn_create_protokol = new System.Windows.Forms.Button();
|
||||
this.ftpProgress = new System.Windows.Forms.ProgressBar();
|
||||
this.btn_transfer_ftp = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
@@ -71,7 +70,6 @@
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.btn_create_protokol = new System.Windows.Forms.Button();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
@@ -94,8 +92,6 @@
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.btn_create_protokol);
|
||||
this.tabPage2.Controls.Add(this.btn_create_graph);
|
||||
this.tabPage2.Controls.Add(this.button1);
|
||||
this.tabPage2.Controls.Add(this.ftpProgress);
|
||||
this.tabPage2.Controls.Add(this.btn_transfer_ftp);
|
||||
this.tabPage2.Controls.Add(this.label1);
|
||||
@@ -119,25 +115,15 @@
|
||||
this.tabPage2.Text = "Vorraussetzungen";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_create_graph
|
||||
// btn_create_protokol
|
||||
//
|
||||
this.btn_create_graph.Location = new System.Drawing.Point(443, 487);
|
||||
this.btn_create_graph.Name = "btn_create_graph";
|
||||
this.btn_create_graph.Size = new System.Drawing.Size(138, 67);
|
||||
this.btn_create_graph.TabIndex = 32;
|
||||
this.btn_create_graph.Text = "UVGraphic erzeugen";
|
||||
this.btn_create_graph.UseVisualStyleBackColor = true;
|
||||
this.btn_create_graph.Click += new System.EventHandler(this.btn_create_graph_Click);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(829, 197);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(199, 66);
|
||||
this.button1.TabIndex = 30;
|
||||
this.button1.Text = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
this.btn_create_protokol.Location = new System.Drawing.Point(626, 484);
|
||||
this.btn_create_protokol.Name = "btn_create_protokol";
|
||||
this.btn_create_protokol.Size = new System.Drawing.Size(107, 69);
|
||||
this.btn_create_protokol.TabIndex = 33;
|
||||
this.btn_create_protokol.Text = "Protokoll erzeugen";
|
||||
this.btn_create_protokol.UseVisualStyleBackColor = true;
|
||||
this.btn_create_protokol.Click += new System.EventHandler(this.btn_create_protokol_Click);
|
||||
//
|
||||
// ftpProgress
|
||||
//
|
||||
@@ -152,7 +138,7 @@
|
||||
this.btn_transfer_ftp.Name = "btn_transfer_ftp";
|
||||
this.btn_transfer_ftp.Size = new System.Drawing.Size(224, 126);
|
||||
this.btn_transfer_ftp.TabIndex = 28;
|
||||
this.btn_transfer_ftp.Text = "button1";
|
||||
this.btn_transfer_ftp.Text = "Daten von der Anlage downloaden";
|
||||
this.btn_transfer_ftp.UseVisualStyleBackColor = true;
|
||||
this.btn_transfer_ftp.Click += new System.EventHandler(this.btn_transfer_ftp_Click);
|
||||
//
|
||||
@@ -558,16 +544,6 @@
|
||||
this.label9.TabIndex = 0;
|
||||
this.label9.Text = "Harz";
|
||||
//
|
||||
// btn_create_protokol
|
||||
//
|
||||
this.btn_create_protokol.Location = new System.Drawing.Point(626, 484);
|
||||
this.btn_create_protokol.Name = "btn_create_protokol";
|
||||
this.btn_create_protokol.Size = new System.Drawing.Size(107, 69);
|
||||
this.btn_create_protokol.TabIndex = 33;
|
||||
this.btn_create_protokol.Text = "Protokoll erzeugen";
|
||||
this.btn_create_protokol.UseVisualStyleBackColor = true;
|
||||
this.btn_create_protokol.Click += new System.EventHandler(this.btn_create_protokol_Click);
|
||||
//
|
||||
// UCInliner
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
@@ -634,8 +610,6 @@
|
||||
private System.Windows.Forms.DateTimePicker dt_eingebaut;
|
||||
private System.Windows.Forms.Button btn_transfer_ftp;
|
||||
private System.Windows.Forms.ProgressBar ftpProgress;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button btn_create_graph;
|
||||
private System.Windows.Forms.Button btn_create_protokol;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,10 +111,11 @@ namespace SanSystem
|
||||
private void btn_get_temp_Click(object sender, EventArgs e)
|
||||
{
|
||||
ITemperature temperature = TempCAN.TemperaturBuilder.Temperatur(TempCAN.TemperaturSchnittstellen.TINKERFORGE);
|
||||
|
||||
double temperatur = temperature.GetTemperatur();
|
||||
string message = "";
|
||||
double temperatur = temperature.GetTemperatur(out message);
|
||||
inliner.TempAusen = temperatur;
|
||||
|
||||
|
||||
if (!message.Equals("")) MessageBox.Show(message);
|
||||
|
||||
txt_temp_aussen.Update();
|
||||
}
|
||||
@@ -163,7 +164,7 @@ namespace SanSystem
|
||||
string ordner = _tdateiname[_tdateiname.Length - 2];
|
||||
|
||||
newClient.DownloadFile(Path.Combine(destinationPath, ordner, dateiname), file);
|
||||
//client.DeleteFile(file);
|
||||
newClient.DeleteFile(file);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ namespace SanSystem
|
||||
private void btn_transfer_ftp_Click(object sender, EventArgs e)
|
||||
{
|
||||
filenames.Clear();
|
||||
if (MessageBox.Show("Bitte stellen Sie sicher, dass der Server antwortet und dass nur die Dateien vorhanden sind!", "WARNUNG", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK)
|
||||
if (MessageBox.Show("Bitte stellen Sie sicher, dass der Server antwortet und dass nur die Dateien vorhanden sind!, Bitte beachten Sie, dass das fenster einfrieren kann", "WARNUNG", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK)
|
||||
{
|
||||
DownloadFromUV();
|
||||
}
|
||||
@@ -199,25 +200,8 @@ namespace SanSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Hashtable grunddaten = new Hashtable()
|
||||
{
|
||||
{"KL_Wetter","Trocken" }
|
||||
};
|
||||
List<BilderObject> bilderO = new List<BilderObject>();
|
||||
bilderO.Add(new BilderObject()
|
||||
{
|
||||
ImgID = 1,
|
||||
Kommentar = "TestBild",
|
||||
Path = @"C:\Users\Damian\Desktop\SanVerwaltung\SanSystem\bin\Debug\projekte\18-850\SW01-SW02\Schachtanbindung\4d0a1627-bd51-48d6-a27e-a4c6691b02d2.jpg"
|
||||
});
|
||||
BerichtGen.FrmOptions options = new BerichtGen.FrmOptions("", "", "","", grunddaten,bilderO);
|
||||
options.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private static ChartControl getGraph(string csvFile)
|
||||
|
||||
private static ChartControl getGraph(List<UVcsvStrukture> input)
|
||||
{
|
||||
Size size = new Size(600, 400);
|
||||
|
||||
@@ -245,21 +229,16 @@ namespace SanSystem
|
||||
|
||||
ChartSeries temperaturChart = new ChartSeries("Temperatur", ChartSeriesType.Line);
|
||||
ChartSeries druckChart = new ChartSeries("Druck", ChartSeriesType.Line);
|
||||
if (!File.Exists(csvFile)) return null;
|
||||
string[] input = File.ReadAllLines(csvFile);
|
||||
|
||||
int counter = 0;
|
||||
foreach (string pars in input)
|
||||
|
||||
foreach (UVcsvStrukture pars in input)
|
||||
{
|
||||
string[] parts = pars.Split(',');
|
||||
if (parts[0].Equals("Group1") || parts[1].Equals("(END)")) continue;
|
||||
double temperatur = double.Parse(parts[1].Replace('.', ','));
|
||||
double druck = double.Parse(parts[2].Replace('.', ','));
|
||||
|
||||
temperaturChart.Points.Add(counter, temperatur);
|
||||
druckChart.Points.Add(counter, druck);
|
||||
temperaturChart.Points.Add(counter, pars.Temperatur);
|
||||
druckChart.Points.Add(counter, pars.Druck);
|
||||
counter++;
|
||||
|
||||
}
|
||||
|
||||
temperaturChart.YAxis = axis;
|
||||
druckChart.YAxis = axis0;
|
||||
|
||||
@@ -295,24 +274,32 @@ namespace SanSystem
|
||||
return chartControl;
|
||||
}
|
||||
|
||||
private void btn_create_graph_Click(object sender, EventArgs e)
|
||||
{
|
||||
Stopwatch watch = new Stopwatch();
|
||||
|
||||
private bool AccessCSV()
|
||||
{
|
||||
string myPath = Path.Combine(destinationPath, "Trend");
|
||||
if (!Directory.Exists(myPath))
|
||||
return false;
|
||||
|
||||
IEnumerable<string> files = Directory.EnumerateFiles(myPath, "*.csv", SearchOption.AllDirectories);
|
||||
|
||||
ChartControl chart = getGraph(files.Last());
|
||||
if (chart == null) MessageBox.Show("Konnte CSV nicht finden!");
|
||||
|
||||
List<UVcsvStrukture> struktures = HelpFunktion.ParseCSVFile(files.Last());
|
||||
|
||||
inliner.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min();
|
||||
inliner.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max();
|
||||
ChartControl chart = getGraph(struktures);
|
||||
if (chart == null) return false;
|
||||
else
|
||||
chart.SaveImage(Path.Combine(destinationPath, "linerGraph.jpg"));
|
||||
|
||||
watch.Stop();
|
||||
MessageBox.Show((watch.ElapsedTicks) + " s");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void btn_create_protokol_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!AccessCSV())
|
||||
{
|
||||
MessageBox.Show("Warnung, es wurden keine Daten von der Anlage geladen, Grafik konnte nicht erstellt werden");
|
||||
}
|
||||
Hashtable hashtable = inliner.MakeProtokoll(destinationPath);
|
||||
DirectoryInfo directory = Directory.GetParent(destinationPath);
|
||||
string speicherpfad = directory.FullName;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user