diff --git a/3rdPackage/Syncfusion.Chart.Base.dll b/3rdPackage/Syncfusion.Chart.Base.dll new file mode 100644 index 0000000..4dba399 Binary files /dev/null and b/3rdPackage/Syncfusion.Chart.Base.dll differ diff --git a/3rdPackage/Syncfusion.Chart.Windows.dll b/3rdPackage/Syncfusion.Chart.Windows.dll new file mode 100644 index 0000000..48da6a7 Binary files /dev/null and b/3rdPackage/Syncfusion.Chart.Windows.dll differ diff --git a/3rdPackage/Syncfusion.Shared.Base.dll b/3rdPackage/Syncfusion.Shared.Base.dll new file mode 100644 index 0000000..be4e4a1 Binary files /dev/null and b/3rdPackage/Syncfusion.Shared.Base.dll differ diff --git a/BerichtGen/Bericht.cs b/BerichtGen/Bericht.cs new file mode 100644 index 0000000..79f11f5 --- /dev/null +++ b/BerichtGen/Bericht.cs @@ -0,0 +1,127 @@ +using SanShared; +using Syncfusion.DocIO.DLS; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BerichtGen +{ + public class Bericht + { + private List _listImages; + /// + /// Erstellt + /// + /// Die zuverwendete Vorlagenname + /// Die name zum Speichern der Datei + /// Pfad zum Speichern + /// Inhalt vom Dokument + /// Ein doc datei soll erzeugt werden + /// Ein Pdf datei soll erzeugt werden + public void Erzeuge(string firma, string vorlage, string savepath, Hashtable daten,List bilderObjects, bool erzeugeDOC = false , bool erzeugePDF = true) + { + _listImages = new List(); + foreach(BilderObject current in bilderObjects) + { + Image image = Image.FromFile(current.Path); + _listImages.Add(ResizeImage(image, CalculateImageSizeForDocument(image.Height, image.Width))); + image.Dispose(); + } + + WordDocument wordDocument = new WordDocument("./documents/JUME/liner_einbau.docx"); + + string[] fieldnames = null; + string[] fieldvalues = null; + + if(fieldnames == null || fieldvalues == null) + { + fieldnames = new string[daten.Count]; + fieldvalues = new string[daten.Count]; + } + + uint counter = 0; + foreach(DictionaryEntry hashtable in daten) + { + fieldnames[counter] = hashtable.Key.ToString(); + if (hashtable.Value == null) + { + fieldvalues[counter] = ""; + } + else + { + fieldvalues[counter] = hashtable.Value.ToString(); + } + counter++; + } + + + //wordDocument.MailMerge.Execute(fieldnames, fieldvalues); + wordDocument.MailMerge.MergeImageField += new MergeImageFieldEventHandler(MailMerge_MergeImageField); + + //string[] fieldNames = new string[] { "UVImage" }; + //string[] fieldValues = new string[] { "test.png" }; + wordDocument.MailMerge.Execute(fieldnames, fieldvalues); + wordDocument.Save("test.docx", Syncfusion.DocIO.FormatType.Docx); + wordDocument.Close(); + //wordDocument.MailMerge.ExecuteGroup() + } + private readonly double _cmPixel = 0.393700787; + private readonly int _dpi = 120; + private readonly double _imgWidthCmMax = 8.0; + + private Size CalculateImageSizeForDocument(int height, int width) + { + double num = (double)height / (double)width; + double num2 = this._imgWidthCmMax * num; + int h = (int)(num2 * _cmPixel * (double)_dpi); + int w = (int)(_imgWidthCmMax * _cmPixel * (double)_dpi); + return new Size(w, h); + } + + private Image ResizeImage(Image image, Size size) + { + int width = image.Width; + int height = image.Height; + float num = (float)size.Width / (float)width; + float num2 = (float)size.Height / (float)height; + float num3 = (num2 < num) ? num2 : num; + int width2 = (int)((float)width * num3); + int height2 = (int)((float)height * num3); + Bitmap bitmap = new Bitmap(width2, height2); + try + { + bitmap.SetResolution(120f, 120f); + Graphics graphics = Graphics.FromImage(bitmap); + graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; + graphics.DrawImage(image, 0, 0, width2, height2); + graphics.Dispose(); + + } + catch(Exception ex) + { + + } + finally + { + System.GC.Collect(); + } + return bitmap; + } + + private void MailMerge_MergeImageField(object sender, MergeImageFieldEventArgs args) + { + if(args.FieldName == "UVImage") + { + string source = args.FieldValue.ToString(); + args.Image = Image.FromFile(source); + } + } + + + + } +} diff --git a/BerichtGen/BerichtGen.csproj b/BerichtGen/BerichtGen.csproj new file mode 100644 index 0000000..0a50aaa --- /dev/null +++ b/BerichtGen/BerichtGen.csproj @@ -0,0 +1,93 @@ + + + + + Debug + AnyCPU + {3022DA07-FD06-4AEA-9FC8-00D318E95A82} + Library + Properties + BerichtGen + BerichtGen + v4.6.1 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\3rdPackage\Syncfusion.Compression.Base.dll + + + ..\3rdPackage\Syncfusion.Core.dll + + + False + ..\3rdPackage\Syncfusion.DocIO.Base.dll + + + False + ..\3rdPackage\Syncfusion.DocToPDFConverter.Base.dll + + + False + ..\3rdPackage\Syncfusion.OfficeChart.Base.dll + + + False + ..\3rdPackage\Syncfusion.Pdf.Base.dll + + + False + ..\3rdPackage\Syncfusion.PdfViewer.Windows.dll + + + + + + + + + + + + + + + + Form + + + Options.cs + + + + + + Options.cs + + + + + {C949087E-20E1-4A17-B021-FAEAD363C1D8} + SanShared + + + + \ No newline at end of file diff --git a/BerichtGen/Options.Designer.cs b/BerichtGen/Options.Designer.cs new file mode 100644 index 0000000..b4e17f5 --- /dev/null +++ b/BerichtGen/Options.Designer.cs @@ -0,0 +1,133 @@ +namespace BerichtGen +{ + partial class Options + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btn_start = new System.Windows.Forms.Button(); + this.cb_doc = new System.Windows.Forms.CheckBox(); + this.cb_pdf = new System.Windows.Forms.CheckBox(); + this.rb_yes = new System.Windows.Forms.RadioButton(); + this.rb_no = new System.Windows.Forms.RadioButton(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // btn_start + // + this.btn_start.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_start.Location = new System.Drawing.Point(374, 12); + this.btn_start.Name = "btn_start"; + this.btn_start.Size = new System.Drawing.Size(75, 67); + this.btn_start.TabIndex = 0; + this.btn_start.Text = "button1"; + this.btn_start.UseVisualStyleBackColor = true; + this.btn_start.Click += new System.EventHandler(this.btn_start_Click); + // + // cb_doc + // + this.cb_doc.AutoSize = true; + this.cb_doc.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cb_doc.Location = new System.Drawing.Point(6, 12); + this.cb_doc.Name = "cb_doc"; + this.cb_doc.Size = new System.Drawing.Size(173, 24); + this.cb_doc.TabIndex = 1; + this.cb_doc.Text = "DOC datei erzeugen"; + this.cb_doc.UseVisualStyleBackColor = true; + // + // cb_pdf + // + this.cb_pdf.AutoSize = true; + this.cb_pdf.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cb_pdf.Location = new System.Drawing.Point(6, 35); + this.cb_pdf.Name = "cb_pdf"; + this.cb_pdf.Size = new System.Drawing.Size(131, 24); + this.cb_pdf.TabIndex = 2; + this.cb_pdf.Text = "PDF erzeugen"; + this.cb_pdf.UseVisualStyleBackColor = true; + // + // rb_yes + // + this.rb_yes.AutoSize = true; + this.rb_yes.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rb_yes.Location = new System.Drawing.Point(221, 62); + this.rb_yes.Name = "rb_yes"; + this.rb_yes.Size = new System.Drawing.Size(39, 24); + this.rb_yes.TabIndex = 3; + this.rb_yes.TabStop = true; + this.rb_yes.Text = "ja"; + this.rb_yes.UseVisualStyleBackColor = true; + // + // rb_no + // + this.rb_no.AutoSize = true; + this.rb_no.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.rb_no.Location = new System.Drawing.Point(266, 62); + this.rb_no.Name = "rb_no"; + this.rb_no.Size = new System.Drawing.Size(57, 24); + this.rb_no.TabIndex = 4; + this.rb_no.TabStop = true; + this.rb_no.Text = "nein"; + this.rb_no.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(2, 62); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(202, 20); + this.label1.TabIndex = 5; + this.label1.Text = "Nach dem erzeugen öffnen"; + // + // Options + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(477, 113); + this.Controls.Add(this.label1); + this.Controls.Add(this.rb_no); + this.Controls.Add(this.rb_yes); + this.Controls.Add(this.cb_pdf); + this.Controls.Add(this.cb_doc); + this.Controls.Add(this.btn_start); + this.Name = "Options"; + this.Text = "Options"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btn_start; + private System.Windows.Forms.CheckBox cb_doc; + private System.Windows.Forms.CheckBox cb_pdf; + private System.Windows.Forms.RadioButton rb_yes; + private System.Windows.Forms.RadioButton rb_no; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/BerichtGen/Options.cs b/BerichtGen/Options.cs new file mode 100644 index 0000000..85c7889 --- /dev/null +++ b/BerichtGen/Options.cs @@ -0,0 +1,58 @@ +using SanShared; +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace BerichtGen +{ + public partial class Options : Form + { + Thread generateProtokollThread; + Hashtable grundDaten; + string firma; + string vorlage; + string speicherpfad; + List bilderObjects; + + + public Options(string firma, string vorlage, string speicherpfad, Hashtable grunddaten, List bilderObjects) + { + InitializeComponent(); + this.firma = firma; + this.vorlage = vorlage; + this.speicherpfad = speicherpfad; + this.grundDaten = grunddaten; + this.bilderObjects = bilderObjects; + } + + void Gen() + { + Bericht bericht = new Bericht(); + bericht.Erzeuge(firma,vorlage, speicherpfad, grundDaten,bilderObjects); + } + + private void btn_start_Click(object sender, EventArgs e) + { + generateProtokollThread = new Thread(Gen); + generateProtokollThread.IsBackground = true; + generateProtokollThread.Start(); + + while (generateProtokollThread.IsAlive) ; + + if(rb_yes.Checked) + { + + } + + this.Close(); + } + } +} diff --git a/BerichtGen/Options.resx b/BerichtGen/Options.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BerichtGen/Options.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BerichtGen/Properties/AssemblyInfo.cs b/BerichtGen/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e94677e --- /dev/null +++ b/BerichtGen/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("BerichtGen")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("BerichtGen")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("3022da07-fd06-4aea-9fc8-00d318e95a82")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/KlassenBIB/InlinerSanierung.cs b/KlassenBIB/InlinerSanierung.cs index ae27ed2..0d78cd1 100644 --- a/KlassenBIB/InlinerSanierung.cs +++ b/KlassenBIB/InlinerSanierung.cs @@ -1,4 +1,6 @@ -using System; +using SanShared; +using System; +using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -8,7 +10,7 @@ using System.Threading.Tasks; namespace KlassenBIB { - public sealed class InlinerSanierung : Sanieren + public sealed class InlinerSanierung : Sanieren, IMakeProtokol { double kalibrierUnterdruck = -0.5; double kalibierWalzenAbstand = 0.9; @@ -41,6 +43,94 @@ namespace KlassenBIB return mypath; } + public Hashtable MakeProtokoll(string destinationPath) + { + Hashtable grunddaten = new Hashtable() + { + {"AG_Vorname","" }, + {"KLP_Nummer","" }, + {"KLP_Datum","" }, + {"AG_Ort","" }, + {"AG_Strasse","" }, + {"AG_Ansprechpartner","" }, + {"BM_Ort","" }, + {"BM_Strasse","" }, + {"BM_Schacht_von","" }, + {"BM_Schacht_bis","" }, + {"BM_Haltungsmat","" }, + {"BM_Haltung_DN","" }, + {"BM_Haltunglaenge","" }, + { "KL_Wetter","" }, + { "Temp_Aussen","" }, + { "KL_Temp_Kanal","" }, + { "KL_Gen_true","" }, + { "KL_Gen_false","" }, + { "KL_WH_true","" }, + { "KL_WH_false", "" }, + { "KL_STVO_true","" }, + { "KL_STVO_false","" }, + { "KL_HD_true","" }, + { "KL_mech_true","" }, + { "KL_rob_true","" }, + { "KL_HD_date","" }, + { "KL_Besatzung", "" }, + {"liner_laenge","" }, + {"Charge_Liner","" }, + {"Charge_Harz","" }, + {"harz_bedarf_m","" }, + {"gesamt_harz","" }, + {"temperatur_harz","" }, + {"datum_kalibrierung","" }, + {"walzen_abstand","" }, + {"vakuum","" }, + {"time_start","" }, + {"time_ende","" }, + {"UVImage","" } + }; + + grunddaten["AG_Vorname"] = ""; + grunddaten["KLP_Nummer"] = ""; + grunddaten["KLP_Datum"] = DateTime.Now.ToShortDateString(); + grunddaten["AG_Ort"] = ""; + grunddaten["AG_Strasse"] = ""; + grunddaten["AG_Ansprechpartner"] = ""; + grunddaten["BM_Ort"] = Inspektionsobjekt.OrtName; + grunddaten["BM_Strasse"] = Inspektionsobjekt.StrasseName; + grunddaten["BM_Schacht_von"] = Inspektionsobjekt.VonPunkt; + grunddaten["BM_Schacht_bis"] = Inspektionsobjekt.BisPunkt ; + grunddaten["BM_Haltungsmat"] = Inspektionsobjekt.RohrMaterial; + grunddaten["BM_Haltung_DN"] = Inspektionsobjekt.Kanalrohrweite; + grunddaten["BM_Haltunglaenge"] = Inspektionsobjekt.Haltungslaenge; + grunddaten["KL_Wetter"] = this.Wetter; + grunddaten["Temp_Aussen"] = this.TempAusen; + grunddaten["KL_Temp_Kanal"] = this.TempKanal; + grunddaten["KL_Gen_true"] = this.GenehmigungVorhanden ? "X" : "" ; + grunddaten["KL_Gen_false"] = this.GenehmigungVorhanden ? "": "X"; + grunddaten["KL_WH_true"] = this.WasserhaltungEingerichtet ? "X" : ""; + grunddaten["KL_WH_false"] = this.WasserhaltungEingerichtet ? " ":"X" ; + grunddaten["KL_STVO_true"] = this.STVOAbsicherung ? "X" : ""; + grunddaten["KL_STVO_false"] = this.STVOAbsicherung ? "":"X"; + grunddaten["KL_HD_true"] = ""; + grunddaten["KL_mech_true"] = ""; + grunddaten["KL_rob_true"] = ""; + grunddaten["KL_HD_date"] = ""; + grunddaten["KL_Besatzung"] = ""; + grunddaten["liner_laenge"] = ""; + grunddaten["Charge_Liner"] = this.LinerChargenummer; + grunddaten["Charge_Harz"] = this.HarzChargenummer; + grunddaten["harz_bedarf_m"] = ""; + grunddaten["gesamt_harz"] = ""; + grunddaten["temperatur_harz"] = this.HarzKalibrierTemperatur; + grunddaten["datum_kalibrierung"] = this.DatumKalibrierung.ToShortDateString(); + grunddaten["walzen_abstand"] = this.KalibierWalzenAbstand; + grunddaten["vakuum"] = this.KalibrierUnterdruck; + grunddaten["time_start"] = ""; + grunddaten["time_ende"] = ""; + grunddaten["UVImage"] = Path.Combine(destinationPath, "linerGraph.jpg"); + + return grunddaten; + } + public InlinerSanierung() { //datumKalibrierung = new DateTime(); diff --git a/KlassenBIB/KlassenBIB.csproj b/KlassenBIB/KlassenBIB.csproj index 0cdd5e0..261db06 100644 --- a/KlassenBIB/KlassenBIB.csproj +++ b/KlassenBIB/KlassenBIB.csproj @@ -55,5 +55,11 @@ + + + {C949087E-20E1-4A17-B021-FAEAD363C1D8} + SanShared + + \ No newline at end of file diff --git a/SanShared/BilderObject.cs b/SanShared/BilderObject.cs new file mode 100644 index 0000000..c37a13b --- /dev/null +++ b/SanShared/BilderObject.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SanShared +{ + public class BilderObject + { + public string Kommentar { get; set; } + public string Path { get; set; } + public int ImgID { get; set; } + } +} diff --git a/SanShared/IMakeProtokol.cs b/SanShared/IMakeProtokol.cs new file mode 100644 index 0000000..fb2b1de --- /dev/null +++ b/SanShared/IMakeProtokol.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SanShared +{ + public interface IMakeProtokol + { + Hashtable MakeProtokoll(string destinationPath); + } +} diff --git a/SanShared/SanShared.csproj b/SanShared/SanShared.csproj index 414c886..8eb78c6 100644 --- a/SanShared/SanShared.csproj +++ b/SanShared/SanShared.csproj @@ -40,8 +40,10 @@ + + diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index e37dcab..9eb6456 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -38,8 +38,21 @@ ..\packages\Ionic.Zip.1.9.1.8\lib\Ionic.Zip.dll + + False + ..\3rdPackage\Syncfusion.Chart.Base.dll + + + False + ..\3rdPackage\Syncfusion.Chart.Windows.dll + + + False + ..\3rdPackage\Syncfusion.Shared.Base.dll + + @@ -127,6 +140,9 @@ UCSchachtanbindung.cs + + PreserveNewest + @@ -143,6 +159,10 @@ + + {3022da07-fd06-4aea-9fc8-00d318e95a82} + BerichtGen + {b0227727-6cf9-4e2e-9afe-5dd76deaa9db} Database diff --git a/SanSystem/UCInliner.Designer.cs b/SanSystem/UCInliner.Designer.cs index cc75f5a..e6b6bc8 100644 --- a/SanSystem/UCInliner.Designer.cs +++ b/SanSystem/UCInliner.Designer.cs @@ -30,6 +30,10 @@ { 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.ftpProgress = new System.Windows.Forms.ProgressBar(); + this.btn_transfer_ftp = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.dt_eingebaut = new System.Windows.Forms.DateTimePicker(); this.cb_fertig = new System.Windows.Forms.CheckBox(); @@ -67,8 +71,7 @@ this.label11 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); - this.btn_transfer_ftp = new System.Windows.Forms.Button(); - this.ftpProgress = new System.Windows.Forms.ProgressBar(); + this.btn_create_protokol = new System.Windows.Forms.Button(); this.tabControl1.SuspendLayout(); this.tabPage2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -90,6 +93,9 @@ // // 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); @@ -113,6 +119,43 @@ this.tabPage2.Text = "Vorraussetzungen"; this.tabPage2.UseVisualStyleBackColor = true; // + // btn_create_graph + // + 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); + // + // ftpProgress + // + this.ftpProgress.Location = new System.Drawing.Point(782, 487); + this.ftpProgress.Name = "ftpProgress"; + this.ftpProgress.Size = new System.Drawing.Size(280, 37); + this.ftpProgress.TabIndex = 29; + // + // btn_transfer_ftp + // + this.btn_transfer_ftp.Location = new System.Drawing.Point(820, 317); + 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.UseVisualStyleBackColor = true; + this.btn_transfer_ftp.Click += new System.EventHandler(this.btn_transfer_ftp_Click); + // // label1 // this.label1.AutoSize = true; @@ -515,22 +558,15 @@ this.label9.TabIndex = 0; this.label9.Text = "Harz"; // - // btn_transfer_ftp + // btn_create_protokol // - this.btn_transfer_ftp.Location = new System.Drawing.Point(820, 317); - 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.UseVisualStyleBackColor = true; - this.btn_transfer_ftp.Click += new System.EventHandler(this.btn_transfer_ftp_Click); - // - // ftpProgress - // - this.ftpProgress.Location = new System.Drawing.Point(782, 487); - this.ftpProgress.Name = "ftpProgress"; - this.ftpProgress.Size = new System.Drawing.Size(280, 37); - this.ftpProgress.TabIndex = 29; + 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 // @@ -598,5 +634,8 @@ 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; } } diff --git a/SanSystem/UCInliner.cs b/SanSystem/UCInliner.cs index d7c79eb..a7b56d8 100644 --- a/SanSystem/UCInliner.cs +++ b/SanSystem/UCInliner.cs @@ -12,6 +12,8 @@ using System.Diagnostics; using System.IO; using SanShared; using FluentFTP; +using System.Collections; +using Syncfusion.Windows.Forms.Chart; namespace SanSystem { @@ -196,5 +198,124 @@ namespace SanSystem } } } + + private void button1_Click(object sender, EventArgs e) + { + Hashtable grunddaten = new Hashtable() + { + {"KL_Wetter","Trocken" } + }; + List bilderO = new List(); + 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.Options options = new BerichtGen.Options("", "", "", grunddaten,bilderO); + options.ShowDialog(); + } + + + private static ChartControl getGraph(string csvFile) + { + Size size = new Size(600, 400); + + ChartControl chartControl = new ChartControl(); + chartControl.Size = size; + + ChartAxis axis = chartControl.PrimaryYAxis; + ChartAxis axis0 = new ChartAxis(ChartOrientation.Vertical); + ChartAxis axis1 = new ChartAxis(ChartOrientation.Vertical); + + ChartAxisLayout layout1 = new ChartAxisLayout(); + ChartAxisLayout layout2 = new ChartAxisLayout(); + + chartControl.Axes.Add(axis0); + chartControl.Axes.Add(axis1); + + layout1.Spacing = 12; + layout2.Spacing = 12; + layout1.Axes.Add(axis); + layout2.Axes.Add(axis0); + layout2.Axes.Add(axis1); + + chartControl.ChartArea.YLayouts.Add(layout1); + chartControl.ChartArea.YLayouts.Add(layout2); + + 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) + { + 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); + counter++; + + } + temperaturChart.YAxis = axis; + druckChart.YAxis = axis0; + + axis.Title = "°C"; + axis.TitleFont = new Font("Segeo UI", 14F); + + axis0.Title = "[bar]"; + axis0.TitleFont = new Font("Segeo UI", 14F); + + chartControl.LegendsPlacement = ChartPlacement.Outside; + chartControl.LegendPosition = ChartDock.Bottom; + chartControl.LegendAlignment = ChartAlignment.Center; + chartControl.Title.Visible = false; + + ChartAxis chartAxis = new ChartAxis(); + chartAxis.Orientation = ChartOrientation.Horizontal; + chartAxis.Range = new MinMaxInfo(0, 6, 1); + chartAxis.DrawGrid = false; + chartAxis.LineType.Width = 1F; + chartAxis.LineType.ForeColor = Color.Black; + chartControl.Axes.Add(chartAxis); + + chartControl.Series.Add(temperaturChart); + chartControl.Series.Add(druckChart); + chartControl.Skins = Skins.Metro; + + + axis1.OpposedPosition = true; + axis.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift; + axis0.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift; + axis1.EdgeLabelsDrawingMode = ChartAxisEdgeLabelsDrawingMode.Shift; + + return chartControl; + } + + private void btn_create_graph_Click(object sender, EventArgs e) + { + Stopwatch watch = new Stopwatch(); + + string myPath = Path.Combine(destinationPath, "Trend"); + IEnumerable files = Directory.EnumerateFiles(myPath, "*.csv", SearchOption.AllDirectories); + + ChartControl chart = getGraph(files.Last()); + if (chart == null) MessageBox.Show("Konnte CSV nicht finden!"); + else + chart.SaveImage(Path.Combine(destinationPath, "linerGraph.jpg")); + + watch.Stop(); + MessageBox.Show((watch.ElapsedTicks) + " s"); + } + + private void btn_create_protokol_Click(object sender, EventArgs e) + { + Hashtable hashtable = inliner.MakeProtokoll(destinationPath); + BerichtGen.Options options = new BerichtGen.Options("JUME", "liner_einbau.docx", "./", hashtable, new List()); + options.ShowDialog(); + } } } diff --git a/SanSystem/documents/JUME/liner_einbau.docx b/SanSystem/documents/JUME/liner_einbau.docx new file mode 100644 index 0000000..bdbdd0f Binary files /dev/null and b/SanSystem/documents/JUME/liner_einbau.docx differ diff --git a/SanSystem/frmObjektEdit.cs b/SanSystem/frmObjektEdit.cs index 973b945..9e390f5 100644 --- a/SanSystem/frmObjektEdit.cs +++ b/SanSystem/frmObjektEdit.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using SanShared; +using System.Collections; namespace SanSystem { @@ -46,14 +47,21 @@ namespace SanSystem tabControl1.TabPages.Add(tab); } } - + + if (Environment.MachineName.Equals("MEVES-LT")) + { + this.Width = 1512; + this.Height = 907; + } } private void frmObjektEdit_Load(object sender, EventArgs e) { + txt_laenge_schacht.DataBindings.Add(new Binding("Text", inspektionsobjekt, "Schachtlaenge")); txt_objekt_name.DataBindings.Add(new Binding("Text", inspektionsobjekt, "Objektbezeichnung")); + txt_punkt_von.DataBindings.Add(new Binding("Text", inspektionsobjekt, "VonPunkt")); txt_punkt_bis.DataBindings.Add(new Binding("Text", inspektionsobjekt, "BisPunkt")); txt_strasse.DataBindings.Add(new Binding("Text", inspektionsobjekt, "StrasseName")); @@ -63,7 +71,7 @@ namespace SanSystem txt_dn.DataBindings.Add(new Binding("Text", inspektionsobjekt, "Kanalrohrweite")); txt_pro_nr.DataBindings.Add(new Binding("Text", inspektionsobjekt, "ProjektNummer")); dt_haltunggemessen_datum.DataBindings.Add(new Binding("Value", inspektionsobjekt, "HaltungGemessen")); - + } private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) @@ -87,6 +95,24 @@ namespace SanSystem private void btn_close_Click(object sender, EventArgs e) { + int width = this.Width; + int height = this.Height; + + txt_laenge_schacht.DataBindings.Clear(); + txt_objekt_name.DataBindings.Clear(); + + txt_punkt_von.DataBindings.Clear(); + txt_punkt_bis.DataBindings.Clear(); + txt_strasse.DataBindings.Clear(); + txt_hausnummer.DataBindings.Clear(); + cb_material.DataBindings.Clear(); + txt_haltungslaenge.DataBindings.Clear(); + txt_dn.DataBindings.Clear(); + txt_pro_nr.DataBindings.Clear(); + dt_haltunggemessen_datum.DataBindings.Clear(); + + + //MessageBox.Show(string.Format("width: {0} height: {1}", width, height)); this.Close(); } diff --git a/SanVerwaltung.sln b/SanVerwaltung.sln index 79b80c8..045699c 100644 --- a/SanVerwaltung.sln +++ b/SanVerwaltung.sln @@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SanShared", "SanShared\SanS EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Language", "Language\Language.csproj", "{BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BerichtGen", "BerichtGen\BerichtGen.csproj", "{3022DA07-FD06-4AEA-9FC8-00D318E95A82}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -65,6 +67,10 @@ Global {BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}.Debug|Any CPU.Build.0 = Debug|Any CPU {BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {BE364E88-92DA-4A6C-97E7-DDD7D887B3D4}.Release|Any CPU.Build.0 = Release|Any CPU + {3022DA07-FD06-4AEA-9FC8-00D318E95A82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3022DA07-FD06-4AEA-9FC8-00D318E95A82}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3022DA07-FD06-4AEA-9FC8-00D318E95A82}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3022DA07-FD06-4AEA-9FC8-00D318E95A82}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE