From a9320eb1f69bed91709208f6179c0c42947f933e Mon Sep 17 00:00:00 2001 From: HuskyTeufel Date: Wed, 25 Mar 2020 13:00:28 +0100 Subject: [PATCH] Man kann jetzt einen Offset eingeben --- .../Sanierung/Renovation/AbstractSanieren.cs | 5 + .../Sanierung/Renovation/InlinerSanierung.cs | 10 +- SanShared/IMakeProtokol.cs | 2 +- SanSystem/MassenStatistik.cs | 4 +- SanSystem/SanSystem.csproj | 9 ++ SanSystem/UCInliner.Designer.cs | 2 +- SanSystem/UCInliner.cs | 48 +++++-- SanSystem/frmMain.cs | 2 +- SanSystem/frmOffsetSet.Designer.cs | 94 ++++++++++++++ SanSystem/frmOffsetSet.cs | 30 +++++ SanSystem/frmOffsetSet.resx | 120 ++++++++++++++++++ 11 files changed, 305 insertions(+), 21 deletions(-) create mode 100644 SanSystem/frmOffsetSet.Designer.cs create mode 100644 SanSystem/frmOffsetSet.cs create mode 100644 SanSystem/frmOffsetSet.resx diff --git a/KlassenBIB/Sanierung/Renovation/AbstractSanieren.cs b/KlassenBIB/Sanierung/Renovation/AbstractSanieren.cs index ec3858f..70d79f3 100644 --- a/KlassenBIB/Sanierung/Renovation/AbstractSanieren.cs +++ b/KlassenBIB/Sanierung/Renovation/AbstractSanieren.cs @@ -12,12 +12,17 @@ namespace KlassenBIB DateTime datum = new DateTime(); bool fertig = false; string verzeichnispfad; + /// + /// Dient zum Überschreiben + /// + DateTime offset; #region getSeters public string Besatzung { get; set; } public DateTime Datum { get => datum; set => datum = value; } public bool Fertig { get => fertig; set => fertig = value; } public string Verzeichnispfad { get => verzeichnispfad; protected set => verzeichnispfad = value; } + public DateTime Offset { get => offset; set => offset = value; } #endregion } } diff --git a/KlassenBIB/Sanierung/Renovation/InlinerSanierung.cs b/KlassenBIB/Sanierung/Renovation/InlinerSanierung.cs index 8ac5609..bb0fbb6 100644 --- a/KlassenBIB/Sanierung/Renovation/InlinerSanierung.cs +++ b/KlassenBIB/Sanierung/Renovation/InlinerSanierung.cs @@ -56,8 +56,8 @@ namespace KlassenBIB return path; } - - public Hashtable MakeProtokoll(string destinationPath, IProjekt projekt) + + public Hashtable MakeProtokoll(string destinationPath, IProjekt projekt, DateTime offset) { IEnumerable files = Directory.EnumerateFiles(destinationPath, "*.csv", SearchOption.AllDirectories); @@ -82,6 +82,12 @@ namespace KlassenBIB this.AnfangAushaertung = struktures.Select(x => x.Zeitstempel).Min(); this.EndeAushaertung = struktures.Select(x => x.Zeitstempel).Max(); + if (!(offset == DateTime.MinValue)) + { + TimeSpan duration = EndeAushaertung.Subtract(AnfangAushaertung); + AnfangAushaertung = offset; + EndeAushaertung = AnfangAushaertung.Add(duration); + } this.Rueckholgeschwindigkeit = 0; } catch (FileNotFoundException ex) diff --git a/SanShared/IMakeProtokol.cs b/SanShared/IMakeProtokol.cs index 37deeec..8c8718f 100644 --- a/SanShared/IMakeProtokol.cs +++ b/SanShared/IMakeProtokol.cs @@ -18,6 +18,6 @@ namespace SanShared /// /// Projekt /// - Hashtable MakeProtokoll(string destinationPath, IProjekt projekt); + Hashtable MakeProtokoll(string destinationPath, IProjekt projekt, DateTime offset); } } diff --git a/SanSystem/MassenStatistik.cs b/SanSystem/MassenStatistik.cs index 91787e7..c52cad6 100644 --- a/SanSystem/MassenStatistik.cs +++ b/SanSystem/MassenStatistik.cs @@ -32,7 +32,7 @@ namespace SanSystem void BuildBericht(List list) { - Hashtable grundDaten = MakeProtokoll("",null); + Hashtable grundDaten = MakeProtokoll("",null,DateTime.MinValue); DataTable inliner = getMassenTableInliner(); @@ -85,7 +85,7 @@ namespace SanSystem frmOptions.ShowDialog(); } - public Hashtable MakeProtokoll(string destinationPath, IProjekt projekt) + public Hashtable MakeProtokoll(string destinationPath, IProjekt projekt, DateTime offset) { Hashtable grundDaten = new Hashtable() { diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index 12972e9..230dbe7 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -167,6 +167,12 @@ frmObjekteList.cs + + Form + + + frmOffsetSet.cs + Form @@ -262,6 +268,9 @@ frmObjekteList.cs + + frmOffsetSet.cs + frmProjektList.cs diff --git a/SanSystem/UCInliner.Designer.cs b/SanSystem/UCInliner.Designer.cs index feb73c9..e4f3294 100644 --- a/SanSystem/UCInliner.Designer.cs +++ b/SanSystem/UCInliner.Designer.cs @@ -193,7 +193,7 @@ 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); + this.btn_create_protokol.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Btn_create_protokol_MouseDown); // // ftpProgress // diff --git a/SanSystem/UCInliner.cs b/SanSystem/UCInliner.cs index b9212a0..f02bd0a 100644 --- a/SanSystem/UCInliner.cs +++ b/SanSystem/UCInliner.cs @@ -66,7 +66,7 @@ namespace SanSystem break; } } - + private void UCInliner_Load(object sender, EventArgs e) { CheckDirectories(); @@ -78,7 +78,6 @@ namespace SanSystem cbb_wetter.DataBindings.Clear(); txt_besatzung.DataBindings.Clear(); cb_preliner.DataBindings.Clear(); - txt_besatzung.DataBindings.Add(new Binding("Text", inliner, "Besatzung")); cb_fertig.DataBindings.Add(new Binding("Checked", inliner, "fertig")); cb_preliner.DataBindings.Add(new Binding("Checked", inliner, "Preliner")); @@ -258,18 +257,7 @@ namespace SanSystem return makeGraphic.GetGraphics(struktures, destinationPath); } - 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,Database.Datenbank.Instance.loadedProjekt); - DirectoryInfo directory = Directory.GetParent(destinationPath); - string speicherpfad = directory.FullName; - BerichtGen.FrmOptions options = new BerichtGen.FrmOptions("JUME", "liner_einbauBlueLight.docx", speicherpfad,inliner.Inspektionsobjekt.Objektbezeichnung, hashtable, new List()); - options.ShowDialog(); - } + private void Btn_open_file_Click(object sender, EventArgs e) { @@ -285,5 +273,37 @@ namespace SanSystem MessageBox.Show("Es ist ein fehler aufgetreten beim öffnen vom Leitungsordner " + ex.Message); } } + + + private void Btn_create_protokol_MouseDown(object sender, MouseEventArgs e) + { + //DateTime offset = DateTime.MinValue; + + if(e.Button == MouseButtons.Right) + { + + frmOffsetSet frmOffsetSet; + if (inliner.Offset != DateTime.MinValue) + { + frmOffsetSet = new frmOffsetSet(inliner.Offset.TimeOfDay.ToString()); + } else + { + frmOffsetSet = new frmOffsetSet(); + } + frmOffsetSet.ShowDialog(); + inliner.Offset = frmOffsetSet.Offset; + + + } + if (!AccessCSV()) + { + MessageBox.Show("Warnung, es wurden keine Daten von der Anlage geladen, Grafik konnte nicht erstellt werden"); + } + Hashtable hashtable = inliner.MakeProtokoll(destinationPath, Database.Datenbank.Instance.loadedProjekt,inliner.Offset); + DirectoryInfo directory = Directory.GetParent(destinationPath); + string speicherpfad = directory.FullName; + BerichtGen.FrmOptions options = new BerichtGen.FrmOptions("JUME", "liner_einbauBlueLight.docx", speicherpfad, inliner.Inspektionsobjekt.Objektbezeichnung, hashtable, new List()); + options.ShowDialog(); + } } } diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs index abd1ebd..7b6a93e 100644 --- a/SanSystem/frmMain.cs +++ b/SanSystem/frmMain.cs @@ -214,7 +214,7 @@ namespace SanSystem { string destinationPath = san.CheckVerzeichnisse(Global.Instance.Projektpfad); - Hashtable hashtable = san.MakeProtokoll(destinationPath, Database.Datenbank.Instance.loadedProjekt); + Hashtable hashtable = san.MakeProtokoll(destinationPath, Database.Datenbank.Instance.loadedProjekt, DateTime.MinValue); DirectoryInfo directory = Directory.GetParent(destinationPath); string speicherpfad = Path.Combine(directory.FullName,"Einbauprotokolle"); BerichtGen.FrmOptions options = new BerichtGen.FrmOptions("JUME", "liner_einbauBlueLight.docx", speicherpfad, san.Inspektionsobjekt.Objektbezeichnung, hashtable, new List(),null,true); diff --git a/SanSystem/frmOffsetSet.Designer.cs b/SanSystem/frmOffsetSet.Designer.cs new file mode 100644 index 0000000..4611388 --- /dev/null +++ b/SanSystem/frmOffsetSet.Designer.cs @@ -0,0 +1,94 @@ +namespace SanSystem +{ + partial class frmOffsetSet + { + /// + /// 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.txt_offset = new System.Windows.Forms.MaskedTextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btn_save = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // txt_offset + // + this.txt_offset.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txt_offset.Location = new System.Drawing.Point(172, 9); + this.txt_offset.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txt_offset.Mask = "90:00:00"; + this.txt_offset.Name = "txt_offset"; + this.txt_offset.Size = new System.Drawing.Size(229, 30); + this.txt_offset.TabIndex = 0; + this.txt_offset.ValidatingType = typeof(System.DateTime); + // + // 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(18, 14); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(85, 25); + this.label1.TabIndex = 1; + this.label1.Text = "StartZeit"; + // + // btn_save + // + this.btn_save.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btn_save.Location = new System.Drawing.Point(18, 70); + this.btn_save.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btn_save.Name = "btn_save"; + this.btn_save.Size = new System.Drawing.Size(384, 80); + this.btn_save.TabIndex = 2; + this.btn_save.Text = "Festlegen"; + this.btn_save.UseVisualStyleBackColor = true; + this.btn_save.Click += new System.EventHandler(this.Btn_save_Click); + // + // frmOffsetSet + // + this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(435, 171); + this.ControlBox = false; + this.Controls.Add(this.btn_save); + this.Controls.Add(this.label1); + this.Controls.Add(this.txt_offset); + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.Name = "frmOffsetSet"; + this.Text = "frmOffsetSet"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MaskedTextBox txt_offset; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btn_save; + } +} \ No newline at end of file diff --git a/SanSystem/frmOffsetSet.cs b/SanSystem/frmOffsetSet.cs new file mode 100644 index 0000000..0218732 --- /dev/null +++ b/SanSystem/frmOffsetSet.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SanSystem +{ + public partial class frmOffsetSet : Form + { + public DateTime Offset; + public frmOffsetSet(string Uhrzeit = null) + { + InitializeComponent(); + if(Uhrzeit != null) + txt_offset.Text = Uhrzeit; + } + + private void Btn_save_Click(object sender, EventArgs e) + { + Offset = DateTime.Parse(txt_offset.Text); + this.Close(); + } + } +} diff --git a/SanSystem/frmOffsetSet.resx b/SanSystem/frmOffsetSet.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SanSystem/frmOffsetSet.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