Man kann jetzt einen Offset eingeben

This commit is contained in:
HuskyTeufel
2020-03-25 13:00:28 +01:00
parent bb59ec3665
commit a9320eb1f6
11 changed files with 305 additions and 21 deletions

View File

@@ -12,12 +12,17 @@ namespace KlassenBIB
DateTime datum = new DateTime();
bool fertig = false;
string verzeichnispfad;
/// <summary>
/// Dient zum Überschreiben
/// </summary>
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
}
}

View File

@@ -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<string> 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)

View File

@@ -18,6 +18,6 @@ namespace SanShared
/// <param name="destinationPath"></param>
/// <param name="projekt">Projekt</param>
/// <returns></returns>
Hashtable MakeProtokoll(string destinationPath, IProjekt projekt);
Hashtable MakeProtokoll(string destinationPath, IProjekt projekt, DateTime offset);
}
}

View File

@@ -32,7 +32,7 @@ namespace SanSystem
void BuildBericht(List<Inspektionsobjekt> 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()
{

View File

@@ -167,6 +167,12 @@
<Compile Include="frmObjekteList.Designer.cs">
<DependentUpon>frmObjekteList.cs</DependentUpon>
</Compile>
<Compile Include="frmOffsetSet.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmOffsetSet.Designer.cs">
<DependentUpon>frmOffsetSet.cs</DependentUpon>
</Compile>
<Compile Include="frmProjektList.cs">
<SubType>Form</SubType>
</Compile>
@@ -262,6 +268,9 @@
<EmbeddedResource Include="frmObjekteList.resx">
<DependentUpon>frmObjekteList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmOffsetSet.resx">
<DependentUpon>frmOffsetSet.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmProjektList.resx">
<DependentUpon>frmProjektList.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -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
//

View File

@@ -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<BilderObject>());
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<BilderObject>());
options.ShowDialog();
}
}
}

View File

@@ -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<BilderObject>(),null,true);

94
SanSystem/frmOffsetSet.Designer.cs generated Normal file
View File

@@ -0,0 +1,94 @@
namespace SanSystem
{
partial class frmOffsetSet
{
/// <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.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;
}
}

30
SanSystem/frmOffsetSet.cs Normal file
View File

@@ -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();
}
}
}

120
SanSystem/frmOffsetSet.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>