WIP umsatz für Junker nach Straßen
This commit is contained in:
@@ -11,11 +11,26 @@ namespace XMLParser
|
|||||||
Dictionary<ECalculatedResult,decimal> result = new Dictionary<ECalculatedResult, decimal>();
|
Dictionary<ECalculatedResult,decimal> result = new Dictionary<ECalculatedResult, decimal>();
|
||||||
decimal HauptkanalLaenge =0.0m;
|
decimal HauptkanalLaenge =0.0m;
|
||||||
|
|
||||||
inspektionen
|
List<int> ranges = new List<int>()
|
||||||
|
{
|
||||||
|
250,
|
||||||
|
400,
|
||||||
|
600,
|
||||||
|
800,
|
||||||
|
1000,
|
||||||
|
int.MaxValue
|
||||||
|
};
|
||||||
|
var rangePairs = ranges.Select((r,i)=> new {Range = r,Index = i}).ToList();
|
||||||
|
var groupedInspektionen = inspektionen
|
||||||
.FindAll(s => s.Inspektionsdaten.Anlagentyp.Equals(EAnlagetyp.Haltung))
|
.FindAll(s => s.Inspektionsdaten.Anlagentyp.Equals(EAnlagetyp.Haltung))
|
||||||
.ForEach(g => HauptkanalLaenge += g.Inspektionsdaten.OptischeInspektion.Rohrleitung.Inspektionslaenge);
|
.OrderBy(a => a.Inspektionsdaten.OptischeInspektion.Rohrleitung.Grunddaten.Profilbreite)
|
||||||
result.Add(ECalculatedResult.HAUPTKANALLAENGE,HauptkanalLaenge);
|
.GroupBy(x => rangePairs.FirstOrDefault(r => r.Range >= x.Inspektionsdaten.OptischeInspektion.Rohrleitung.Grunddaten.Profilbreite)?.Index ?? -1);
|
||||||
|
|
||||||
|
//inspektionen
|
||||||
|
// .FindAll(s => s.Inspektionsdaten.Anlagentyp.Equals(EAnlagetyp.Haltung))
|
||||||
|
// .ForEach(g => HauptkanalLaenge += g.Inspektionsdaten.OptischeInspektion.Rohrleitung.Inspektionslaenge);
|
||||||
|
//result.Add(ECalculatedResult.HAUPTKANALLAENGE,HauptkanalLaenge);
|
||||||
|
//result.Add(ECalculatedResult.DN150DN250);
|
||||||
List<KanalObjekt> Anschlussleitungen = inspektionen.FindAll(x => x.Inspektionsdaten.Anlagentyp.Equals(EAnlagetyp.Anschlussleitung));
|
List<KanalObjekt> Anschlussleitungen = inspektionen.FindAll(x => x.Inspektionsdaten.Anlagentyp.Equals(EAnlagetyp.Anschlussleitung));
|
||||||
List<KanalObjekt> SEs = Anschlussleitungen.FindAll(x => x.Stammdaten.Knoten != null && x.Stammdaten.Knoten.Anschlusspunkt != null && x.Stammdaten.Knoten.Anschlusspunkt.Punktkennung.Equals("SE"));
|
List<KanalObjekt> SEs = Anschlussleitungen.FindAll(x => x.Stammdaten.Knoten != null && x.Stammdaten.Knoten.Anschlusspunkt != null && x.Stammdaten.Knoten.Anschlusspunkt.Punktkennung.Equals("SE"));
|
||||||
List<KanalObjekt> SOs = Anschlussleitungen.FindAll(x => x.Stammdaten.Knoten != null && x.Stammdaten.Knoten.Anschlusspunkt != null && !x.Stammdaten.Knoten.Anschlusspunkt.Punktkennung.Equals("SE"));
|
List<KanalObjekt> SOs = Anschlussleitungen.FindAll(x => x.Stammdaten.Knoten != null && x.Stammdaten.Knoten.Anschlusspunkt != null && !x.Stammdaten.Knoten.Anschlusspunkt.Punktkennung.Equals("SE"));
|
||||||
|
|||||||
@@ -71,7 +71,11 @@ namespace XMLParser
|
|||||||
SONSTIGEANZAHL,
|
SONSTIGEANZAHL,
|
||||||
STRASSENABLAUFUMSATZ,
|
STRASSENABLAUFUMSATZ,
|
||||||
SONSTIGEUMSATZ,
|
SONSTIGEUMSATZ,
|
||||||
HAUPTKANALLAENGE,
|
DN150DN250,
|
||||||
|
DN300DN400,
|
||||||
|
DN450DN600,
|
||||||
|
DN650DN800,
|
||||||
|
DN850DN1000,
|
||||||
HAUPTKANALUMSATZ,
|
HAUPTKANALUMSATZ,
|
||||||
SONSTIGELAENGEZULAGEMETER,
|
SONSTIGELAENGEZULAGEMETER,
|
||||||
STRASSENABLAUFLAENGEZULAGEMETER,
|
STRASSENABLAUFLAENGEZULAGEMETER,
|
||||||
|
|||||||
@@ -5,5 +5,9 @@ namespace XMLParser
|
|||||||
public string XmlFileName {get;set;}
|
public string XmlFileName {get;set;}
|
||||||
public AbwassertechnischeAnlage Stammdaten { get; internal set; }
|
public AbwassertechnischeAnlage Stammdaten { get; internal set; }
|
||||||
public InspizierteAbwassertechnischeAnlage Inspektionsdaten { get; internal set; }
|
public InspizierteAbwassertechnischeAnlage Inspektionsdaten { get; internal set; }
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Format("{0} ({1})",Stammdaten.Objektbezeichnung,Inspektionsdaten.OptischeInspektion.Rohrleitung.Grunddaten.Profilbreite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace XMLParser
|
|||||||
int knotenAblaufTyp;
|
int knotenAblaufTyp;
|
||||||
int knotenZulaufTyp;
|
int knotenZulaufTyp;
|
||||||
bool isFiktiveLeitung = true;
|
bool isFiktiveLeitung = true;
|
||||||
|
Profil profil;
|
||||||
|
|
||||||
public string knotenZulaufTemp;
|
public string knotenZulaufTemp;
|
||||||
public string knotenAblaufTemp;
|
public string knotenAblaufTemp;
|
||||||
@@ -20,5 +21,6 @@ namespace XMLParser
|
|||||||
public int KnotenAblaufTyp { get => knotenAblaufTyp; set => knotenAblaufTyp = value; }
|
public int KnotenAblaufTyp { get => knotenAblaufTyp; set => knotenAblaufTyp = value; }
|
||||||
public int KnotenZulaufTyp { get => knotenZulaufTyp; set => knotenZulaufTyp = value; }
|
public int KnotenZulaufTyp { get => knotenZulaufTyp; set => knotenZulaufTyp = value; }
|
||||||
public bool IsFiktiveLeitung { get => isFiktiveLeitung; set => isFiktiveLeitung = value; }
|
public bool IsFiktiveLeitung { get => isFiktiveLeitung; set => isFiktiveLeitung = value; }
|
||||||
|
public Profil Profil { get => profil; set => profil = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
20
XMLParser/Profil.cs
Normal file
20
XMLParser/Profil.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
namespace XMLParser
|
||||||
|
{
|
||||||
|
public class Profil
|
||||||
|
{
|
||||||
|
int profilart;
|
||||||
|
int profilbreite;
|
||||||
|
int profilhoehe;
|
||||||
|
|
||||||
|
public Profil(int profilart, int profilbreite, int profilhoehe)
|
||||||
|
{
|
||||||
|
Profilart = profilart;
|
||||||
|
Profilbreite = profilbreite;
|
||||||
|
Profilhoehe = profilhoehe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Profilart { get => profilart; set => profilart = value; }
|
||||||
|
public int Profilbreite { get => profilbreite; set => profilbreite = value; }
|
||||||
|
public int Profilhoehe { get => profilhoehe; set => profilhoehe = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -387,12 +387,30 @@ namespace XMLParser
|
|||||||
{
|
{
|
||||||
case "KnotenZulauf": result.knotenZulaufTemp = s.InnerText; break;
|
case "KnotenZulauf": result.knotenZulaufTemp = s.InnerText; break;
|
||||||
case "KnotenAblauf": result.knotenAblaufTemp = s.InnerText; break;
|
case "KnotenAblauf": result.knotenAblaufTemp = s.InnerText; break;
|
||||||
|
case "Profil": result.Profil = getProfil(s);break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Profil getProfil(XmlNode s)
|
||||||
|
{
|
||||||
|
int Profilart =0, Profilbreite=0, Profilhoehe =0;
|
||||||
|
foreach(XmlNode d in s.ChildNodes)
|
||||||
|
{
|
||||||
|
switch(d.Name)
|
||||||
|
{
|
||||||
|
case "SonderprofilVorhanden": break;
|
||||||
|
case "Profilart": Profilart = Convert.ToInt32(s.InnerText); break;
|
||||||
|
case "Profilbreite": Profilbreite = Convert.ToInt32(s.InnerText); break;
|
||||||
|
case "Profilhoehe": Profilhoehe = Convert.ToInt32(s.InnerText); break;
|
||||||
|
default: throw new NotImplementedException(d.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Profil(Profilart,Profilbreite,Profilhoehe);
|
||||||
|
}
|
||||||
|
|
||||||
private static Knoten parseStammdatenKnoten(XmlNode aktuell)
|
private static Knoten parseStammdatenKnoten(XmlNode aktuell)
|
||||||
{
|
{
|
||||||
Knoten result = new Knoten();
|
Knoten result = new Knoten();
|
||||||
|
|||||||
53
XMLProgramm/CSVWriter.cs
Normal file
53
XMLProgramm/CSVWriter.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using XMLParser;
|
||||||
|
|
||||||
|
namespace XMLProgramm
|
||||||
|
{
|
||||||
|
[DebuggerDisplay("{" + nameof(GetDebuggerDisplay) + "(),nq}")]
|
||||||
|
class CSVWriter
|
||||||
|
{
|
||||||
|
FileStream handle = null;
|
||||||
|
void writeToFile(string content)
|
||||||
|
{
|
||||||
|
content += Environment.NewLine;
|
||||||
|
byte[] bytes = Encoding.UTF8.GetBytes(content);
|
||||||
|
handle.Write(bytes,0,bytes.Length);
|
||||||
|
handle.Flush();
|
||||||
|
}
|
||||||
|
public CSVWriter()
|
||||||
|
{
|
||||||
|
handle = File.Create("./data.csv");
|
||||||
|
string WriteHeader = "Inspektionsdatum#Anzahl Straßenablaufe#Länge über 5m#SonstigeLeitungen#Sonstige Länge über 5m#Hauptkanallänge";
|
||||||
|
writeToFile(WriteHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
handle.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void WriteDay(Dictionary<ECalculatedResult, decimal> calculated, List<KanalObjekt> inspektionenAmTag)
|
||||||
|
{
|
||||||
|
int anzahlStraßenablaufe = (int)calculated[ECalculatedResult.STRASSENABLAUFANZAHL];
|
||||||
|
int sonstigeLeitungen = (int)calculated[ECalculatedResult.SONSTIGEANZAHL];
|
||||||
|
decimal Strassenablaufzulage = calculated[ECalculatedResult.STRASSENABLAUFLAENGEZULAGEMETER];
|
||||||
|
decimal Sonstigezulage = calculated[ECalculatedResult.SONSTIGELAENGEZULAGEMETER];
|
||||||
|
decimal HauptkanalLänge = calculated[ECalculatedResult.DN150DN250];
|
||||||
|
|
||||||
|
KanalObjekt last = inspektionenAmTag.Last();
|
||||||
|
|
||||||
|
string entry = last.Inspektionsdaten.OptischeInspektion.Inspektionsdatum + "#"+anzahlStraßenablaufe+"#"+Strassenablaufzulage+"#"+sonstigeLeitungen+"#"+Sonstigezulage+"#"+HauptkanalLänge;
|
||||||
|
writeToFile(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetDebuggerDisplay()
|
||||||
|
{
|
||||||
|
return ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,58 +3,32 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using XMLParser;
|
using XMLParser;
|
||||||
|
|
||||||
namespace XMLProgramm
|
namespace XMLProgramm
|
||||||
{
|
{
|
||||||
class CSVWriter
|
|
||||||
{
|
|
||||||
FileStream handle = null;
|
|
||||||
int handleOffset;
|
|
||||||
|
|
||||||
void writeToFile(string content)
|
|
||||||
{
|
|
||||||
content += Environment.NewLine;
|
|
||||||
byte[] bytes = Encoding.UTF8.GetBytes(content);
|
|
||||||
handle.Write(bytes,0,bytes.Length);
|
|
||||||
handle.Flush();
|
|
||||||
|
|
||||||
handleOffset += bytes.Length;
|
|
||||||
}
|
|
||||||
public CSVWriter()
|
|
||||||
{
|
|
||||||
handle = File.Create("./data.csv");
|
|
||||||
handleOffset = 0;
|
|
||||||
string WriteHeader = "Inspektionsdatum#Anzahl Straßenablaufe#Länge über 5m#SonstigeLeitungen#Sonstige Länge über 5m#Hauptkanallänge";
|
|
||||||
writeToFile(WriteHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save()
|
|
||||||
{
|
|
||||||
handle.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void WriteDay(Dictionary<ECalculatedResult, decimal> calculated, List<KanalObjekt> inspektionenAmTag)
|
|
||||||
{
|
|
||||||
int anzahlStraßenablaufe = (int)calculated[ECalculatedResult.STRASSENABLAUFANZAHL];
|
|
||||||
int sonstigeLeitungen = (int)calculated[ECalculatedResult.SONSTIGEANZAHL];
|
|
||||||
decimal Strassenablaufzulage = calculated[ECalculatedResult.STRASSENABLAUFLAENGEZULAGEMETER];
|
|
||||||
decimal Sonstigezulage = calculated[ECalculatedResult.SONSTIGELAENGEZULAGEMETER];
|
|
||||||
decimal HauptkanalLänge = calculated[ECalculatedResult.HAUPTKANALLAENGE];
|
|
||||||
|
|
||||||
KanalObjekt last = inspektionenAmTag.Last();
|
|
||||||
|
|
||||||
string entry = last.Inspektionsdaten.OptischeInspektion.Inspektionsdatum + "#"+anzahlStraßenablaufe+"#"+Strassenablaufzulage+"#"+sonstigeLeitungen+"#"+Sonstigezulage+"#"+HauptkanalLänge;
|
|
||||||
writeToFile(entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
CSVWriter csvWriter = new CSVWriter();
|
CSVWriter csvWriter = new CSVWriter();
|
||||||
List<KanalObjekt> objekte = new List<KanalObjekt>();
|
List<KanalObjekt> objekte = new List<KanalObjekt>();
|
||||||
|
|
||||||
|
StrassenUmsatz(csvWriter,objekte);
|
||||||
|
//TagesUmsatz(csvWriter,objekte);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void StrassenUmsatz(CSVWriter csvWriter, List<KanalObjekt> objekte)
|
||||||
|
{
|
||||||
|
// KS_Oldenburg_Lönsweg.xml
|
||||||
|
XMLParse ser = new XMLParse("2021-07-29_KR_H_L_Oldenburg_Eichenstraße.xml");
|
||||||
|
objekte.AddRange(ser.KanalObjekte);
|
||||||
|
Dictionary<ECalculatedResult,decimal> d = Calculate.CalculateDay(objekte);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TagesUmsatz(CSVWriter csvWriter, List<KanalObjekt> objekte)
|
||||||
|
{
|
||||||
DirectoryInfo info = new DirectoryInfo("./");
|
DirectoryInfo info = new DirectoryInfo("./");
|
||||||
FileInfo[] daten = info.GetFiles("*.xml");
|
FileInfo[] daten = info.GetFiles("*.xml");
|
||||||
foreach(FileInfo aktuell in daten) {
|
foreach(FileInfo aktuell in daten) {
|
||||||
@@ -77,7 +51,6 @@ namespace XMLProgramm
|
|||||||
decimal Durchschnitt = gesamt / anzahlTage;
|
decimal Durchschnitt = gesamt / anzahlTage;
|
||||||
int prognosedays = 63;
|
int prognosedays = 63;
|
||||||
Console.WriteLine(string.Format("Tage : {0} \nGesamt umsatz: {1}\nDurchschnitt : {2}\nPrognose für {3} tage {4}",anzahlTage,gesamt,Durchschnitt,prognosedays,prognosedays*Durchschnitt));
|
Console.WriteLine(string.Format("Tage : {0} \nGesamt umsatz: {1}\nDurchschnitt : {2}\nPrognose für {3} tage {4}",anzahlTage,gesamt,Durchschnitt,prognosedays,prognosedays*Durchschnitt));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user