diff --git a/AA-Forms/FormAusschlager.Designer.cs b/AA-Forms/FormAusschlager.Designer.cs index e88c341..27c23b5 100644 --- a/AA-Forms/FormAusschlager.Designer.cs +++ b/AA-Forms/FormAusschlager.Designer.cs @@ -28,15 +28,32 @@ /// private void InitializeComponent() { + this.tableLayoutPanelWS = new System.Windows.Forms.TableLayoutPanel(); this.SuspendLayout(); // + // tableLayoutPanelWS + // + this.tableLayoutPanelWS.ColumnCount = 2; + this.tableLayoutPanelWS.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanelWS.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanelWS.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanelWS.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanelWS.Name = "tableLayoutPanelWS"; + this.tableLayoutPanelWS.RowCount = 2; + this.tableLayoutPanelWS.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanelWS.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanelWS.Size = new System.Drawing.Size(600, 366); + this.tableLayoutPanelWS.TabIndex = 0; + // // FormAusschlager // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(600, 366); + this.Controls.Add(this.tableLayoutPanelWS); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormAusschlager"; @@ -52,5 +69,7 @@ } #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanelWS; } } \ No newline at end of file diff --git a/AA-Forms/FormAusschlager.cs b/AA-Forms/FormAusschlager.cs index 8d951ae..97c7012 100644 --- a/AA-Forms/FormAusschlager.cs +++ b/AA-Forms/FormAusschlager.cs @@ -1,4 +1,5 @@ using DatenDB; +using Deckungsbeitrag.AA_Klassen; using Deckungsbeitrag.Properties; using System; using System.Collections.Generic; @@ -11,120 +12,284 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using System.Windows.Forms.DataVisualization.Charting; using System.Xml.Serialization; namespace Deckungsbeitrag { public partial class FormAusschlager : Form { - + private Fehlermeldungen meldung = new Fehlermeldungen(); + private Auftrag auftrag; public Maschine maschine; public List fachliste; bool maximised = false; int height; Point loc; + public bool ws1transport = false; public bool ws2transport = false; - public FormAusschlager(Maschine ms) + private string Userid { get; } + + public FormAusschlager() { - maschine = ms; InitializeComponent(); } - public FormAusschlager(Maschine ms, Screen[] screens) :this(ms) + public FormAusschlager(string userid) : this() { - //maschine = ms; - if (maschine.TrocknerKaputt == true) maschine.Faecher = maschine.Faecher - 1; //Wenn Trockner kaputt wird Fachanzahl um 1 reduziert. - if (screens.Length > 1) - { - if (WindowState == FormWindowState.Maximized) - { - WindowState = FormWindowState.Normal; - maximised = true; - } - foreach (Screen screen in screens) if (screen.Primary == false) { this.Location = screen.WorkingArea.Location; } - if (maximised) - { - WindowState = FormWindowState.Maximized; - } - } //Wenn nur ein Screen vorhanden wird alles auf eine Screen gelegt. Wenn mehrere Screens muss Zuordnung getroffen werden. + this.Userid = userid; + if (userid.Contains("01")) this.maschine = Maschine.GetMaschine(null, "Waschstrasse 1"); + if (userid.Contains("02")) this.maschine = Maschine.GetMaschine(null, "Waschstrasse 2"); } + private void FormAusschlager_Load(object sender, EventArgs e) { - height = (this.Height / maschine.Faecher) - 1; //Label Height wird berechnet anhand Screen Height und Mschinenfächer. - loc = new Point(this.Width / 2 - 250, 10); //Die Location des ersten KundenLabels wird berechnet. + // WaitCursor und Controls ausblenden. + this.Cursor = Cursors.WaitCursor; + Funktionen.HideControls(this.Controls); - for (int i = 1; i <= maschine.Faecher; i++) - { - Funktionen funk = new Funktionen(); - this.Controls.AddRange(funk.GetFachLabels(i, maschine, height, loc, this.Width, "Ausschlager")); - } //Label für neuen Screen von Funktionen holen. + + this.BackColor = Properties.Settings.Default.Wirlblau; + this.WindowState = FormWindowState.Maximized; + this.FormBorderStyle = FormBorderStyle.None; + + if (maschine.TrocknerKaputt) this.tableLayoutPanelWS.RowCount = maschine.Faecher - 1; + else this.tableLayoutPanelWS.RowCount = maschine.Faecher; + this.tableLayoutPanelWS.ColumnCount = 4; + + Get_TableLayoutPanel(this.tableLayoutPanelWS); + Load_TableLayoutPanel(this.tableLayoutPanelWS); + + //DefaultCursor und Controls einblenden. + Funktionen.ShowControls(this.Controls); + this.Cursor = Cursors.Default; } - public void Form_Refresh(Maschine ms, SPSDaten spsdaten) + + private void Load_TableLayoutPanel(TableLayoutPanel tlp) { - this.SuspendLayout(); - - foreach (Label lbl in this.Controls) + // Fachliste für Maschine holen. + List fachliste = WSFach.GetFachliste(this.maschine); + if (fachliste.Count > 0) { - if (spsdaten.WS_1_Transport || spsdaten.WS_2_Transport) + // Alle Zellen einer Spalte durchlaufen + int columnIndex = 1; + for (int row = 0; row < tlp.RowCount; row++) { - Call_Funktionen(lbl, ms, spsdaten); - } - else - { - if (ms.Bezeichnung == "Waschstrasse 1") - { - if (spsdaten.Presse1_Leer) - { - if (lbl.Name.Contains("14") || lbl.Name.Contains("15")) Call_Funktionen(lbl, maschine, spsdaten); - } //SPS Steuerung hat Presse 1 entladen und auf true geschaltet. - if (spsdaten.Trockner11_Beladen || spsdaten.Trockner12_Beladen) - { - if (lbl.Name.Contains("15") || lbl.Name.Contains("16") || lbl.Name.Contains("17")) Call_Funktionen(lbl, maschine, spsdaten); - } //SPS Steuerung hat Trockner beladen und auf true geschaltet. - if (spsdaten.Trockner11_Entladen || spsdaten.Trockner12_Entladen) - { - if (lbl.Name.Contains("18") || lbl.Name.Contains("16") || lbl.Name.Contains("17")) Call_Funktionen(lbl, maschine, spsdaten); - } //SPS Steuerung hat Trockner entladen und auf true geschaltet. - } + Control cellControl = tlp.GetControlFromPosition(columnIndex, row); - if (ms.Bezeichnung == "Waschstrasse 2") + if (cellControl != null && cellControl is Label lbl) { - if (spsdaten.Presse2_Leer) - { - if (lbl.Name.Contains("17") || lbl.Name.Contains("18")) Call_Funktionen(lbl, maschine, spsdaten); - } //SPS Steuerung hat Presse 2 entladen und auf true geschaltet. - if (spsdaten.Trockner21_Beladen || spsdaten.Trockner22_Beladen) - { - if (lbl.Name.Contains("18") || lbl.Name.Contains("19") || lbl.Name.Contains("20")) Call_Funktionen(lbl, maschine, spsdaten); - } //SPS Steuerung hat Trockner beladen und auf true geschaltet. - if (spsdaten.Trockner21_Entladen || spsdaten.Trockner22_Entladen) - { - if (lbl.Name.Contains("21") || lbl.Name.Contains("19") || lbl.Name.Contains("20")) Call_Funktionen(lbl, maschine, spsdaten); - } //SPS Steuerung hat Trockner entladen und auf true geschalltet. + // Label in Zelle (col=2, row) bearbeiten + lbl.BackColor = Color.LightBlue; + lbl.Text = $"Col {columnIndex} Row {row}"; } } } - //this.Refresh(); - this.ResumeLayout(); + else { meldung.MaschineIstLeer(null); } } - private void Call_Funktionen(Label lbl, Maschine maschine, SPSDaten spsdaten) + + /// + /// Label in jede Zelle des Panels einfügen und mit Schriftfarben aus den Settings versehen. Fach Label hat auch Text erhalten. + /// + /// + private void Get_TableLayoutPanel(TableLayoutPanel tlp) + { + int rows = tlp.RowCount; + int cols = tlp.ColumnCount; + + // Alle Spalten und Zeilen Styles entfernen. + tlp.ColumnStyles.Clear(); + tlp.RowStyles.Clear(); + + + // Labels in jeder Zelle erstellen + for (int row = 0; row < rows; row++) + { + // Reihen gleichmäßig am Screen verteilen. + tlp.RowStyles.Add(new RowStyle(SizeType.Percent, 100F / rows)); + + for (int col = 0; col < cols; col++) + { + tlp.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute)); + Label lbl = new Label(); + lbl.Name = $"Zeile {row}, Spalte {col}"; + lbl.Dock = DockStyle.Fill; + lbl.Tag = Tuple.Create(row, col); + lbl.BackColor = Color.Transparent; + + // Content Alignment pro Spalte festlegen. + switch (col) + { + case 0: + lbl.TextAlign = ContentAlignment.MiddleRight; + lbl.Text = "Fach"; + break; + case 1: + lbl.TextAlign = ContentAlignment.MiddleCenter; + lbl.Text = "Kunde"; + break; + case 2: + lbl.TextAlign = ContentAlignment.MiddleLeft; + lbl.Text = "Liefertag"; + break; + case 3: + lbl.TextAlign = ContentAlignment.MiddleLeft; + lbl.Text = "Aufgabe"; + break; + default: + break; + } + + // Schriftfarbe nach Fachzahl zuordnen. + if(this.maschine.Bezeichnung == "Waschstrasse 1") + { + switch (row) + { + case int n when (n <= 4): + lbl.ForeColor = Config.FarbenConfig.Farben["Beladeband"]; + if (lbl.Text == "Fach") lbl.Text = $"F"; + break; + case int n when (n >= 5 && n <= 13): + lbl.ForeColor = Config.FarbenConfig.Farben["Waschstrasse"]; + if (lbl.Text == "Fach") lbl.Text = $"W"; + break; + case int n when (n == 14): + lbl.ForeColor = Config.FarbenConfig.Farben["Presse"]; + if (lbl.Text == "Fach") lbl.Text = $"P"; + break; + case int n when (n == 15): + lbl.ForeColor = Config.FarbenConfig.Farben["Hubband"]; + if (lbl.Text == "Fach") lbl.Text = $"H"; + break; + case int n when (n == 16): + lbl.ForeColor = Config.FarbenConfig.Farben["Trockner"]; + if (lbl.Text == "Fach") lbl.Text = $"T"; + break; + case int n when (n == 17): + if (maschine.TrocknerKaputt) { lbl.ForeColor = Config.FarbenConfig.Farben["Entladeband"]; if (lbl.Text == "Fach") lbl.Text = $"E"; } + else { lbl.ForeColor = Config.FarbenConfig.Farben["Trockner"]; if (lbl.Text == "Fach") lbl.Text = $"T"; } + break; + case int n when (n == 18): + lbl.ForeColor = Config.FarbenConfig.Farben["Entladeband"]; + if (lbl.Text == "Fach") lbl.Text = $"E"; + break; + default: + break; + } + + } + if(this.maschine.Bezeichnung == "Waschstrasse 2") + { + switch (row) + { + case int n when (n <= 5): + lbl.ForeColor = Config.FarbenConfig.Farben["Beladeband"]; + if (lbl.Text == "Fach") lbl.Text = $"F"; + break; + case int n when (n >= 6 && n <= 17): + lbl.ForeColor = Config.FarbenConfig.Farben["Waschstrasse"]; + if (lbl.Text == "Fach") lbl.Text = $"W"; + break; + case int n when (n == 18): + lbl.ForeColor = Config.FarbenConfig.Farben["Presse"]; + if (lbl.Text == "Fach") lbl.Text = $"P"; + break; + case int n when (n == 19): + lbl.ForeColor = Config.FarbenConfig.Farben["Hubband"]; + if (lbl.Text == "Fach") lbl.Text = $"H"; + break; + case int n when (n == 20): + lbl.ForeColor = Config.FarbenConfig.Farben["Trockner"]; + if (lbl.Text == "Fach") lbl.Text = $"T"; + break; + case int n when (n == 21): + if (maschine.TrocknerKaputt) { lbl.ForeColor = Config.FarbenConfig.Farben["Entladeband"]; if (lbl.Text == "Fach") lbl.Text = $"E"; } + else { lbl.ForeColor = Config.FarbenConfig.Farben["Trockner"]; if (lbl.Text == "Fach") lbl.Text = $"T"; } + break; + case int n when (n == 22): + lbl.ForeColor = Config.FarbenConfig.Farben["Entladeband"]; + if (lbl.Text == "Fach") lbl.Text = $"E"; + break; + default: + break; + } + + } + + // Schriftgröße an Zellenhöhe anpassen. + lbl.Font = Funktionen.Get_Label_Font(lbl.Font, lbl.Text, GetCellSizeInPixels(tlp, cols, rows)); + + + tlp.Controls.Add(lbl, col, row); + } + } + } + + + public void Form_Refresh(Maschine ms, SPSDaten spsdaten) { - Funktionen.Label_Refresh(lbl, maschine, spsdaten, "Ausschlager"); } private void FormAusschlager_SizeChanged(object sender, EventArgs e) { - if(WindowState == FormWindowState.Maximized) - { - this.Controls.Clear(); - FormAusschlager_Load(this, null); - } } private void FormAusschlager_ResizeEnd(object sender, EventArgs e) { - this.Controls.Clear(); - FormAusschlager_Load(this, null); } + + /// + /// Umrechnen der Prozentgröße der Zeile in Pixelhöhe (int). + /// + /// + /// + /// + /// + public static Size GetCellSizeInPixels(TableLayoutPanel tlp, int column, int row) + { + float colPercent = 0; + float rowPercent = tlp.RowStyles[0].Height; + + int pixelWidth = colPercent == 0 ? 0 : (int)(tlp.Width * (colPercent / 100f)); + int pixelHeight = rowPercent == 0 ? 0 : (int)(tlp.Height * (rowPercent / 100f)); + + return new Size(pixelWidth, pixelHeight); + } + + + /// + /// KEIN VERWEIS NOTWENDIG + /// Wenn ESC gedrückt wird schließt sich das Fenster. + /// + /// + /// + protected override bool ProcessDialogKey(Keys keyData) + { + if (Form.ModifierKeys == Keys.None && keyData == Keys.Escape) + { + this.Close(); + return true; + } + if (Form.ModifierKeys == Keys.None && keyData == Keys.Insert) + { + Open_NeuerAuftrag(); + return true; + } + return base.ProcessDialogKey(keyData); + } + private void Open_NeuerAuftrag() + { + FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.Userid); + if (neuerAuftrag.ShowDialog() == DialogResult.OK) + { + this.auftrag = neuerAuftrag.Auftrag; + } + } + + //TODO: Wenn NeuerAuftrag gewählt wie gehts weiter? + //TODO: Bei Transport wir ein Fach mit Aktuellem Auftrag erstellt. Das Alte wird bei Transport gespeichert. + //TODO: Wenn NeuerAuftrag gewählt Fach ändern nicht vergessen. + //TODO: Eventuell einen "Nächsten Auftrag" erstellen damit im Vorraus erstellt werden kann? + } } diff --git a/AA-Forms/FormNeuerAuftrag.cs b/AA-Forms/FormNeuerAuftrag.cs index 561b1e3..07f1ed3 100644 --- a/AA-Forms/FormNeuerAuftrag.cs +++ b/AA-Forms/FormNeuerAuftrag.cs @@ -33,6 +33,7 @@ namespace Deckungsbeitrag public DateTime? letzterLiefertag; private Kunde knd; public DataGridViewCell aktivCell; + private string userid; public FormNeuerAuftrag() { @@ -48,6 +49,13 @@ namespace Deckungsbeitrag this.letzterLiefertag = letzterLiefertag; } + public FormNeuerAuftrag(string userid) : this() + { + this.userid = userid; + if (userid.Contains("wstrasse01")) this.benutzer = Benutzer.GetBenutzer("ws1", null); + if (userid.Contains("wstrasse02")) this.benutzer = Benutzer.GetBenutzer("ws2", null); + } + private void FormNeuerAuftrag_Load(object sender, EventArgs e) { // SortimentListe holen @@ -61,8 +69,10 @@ namespace Deckungsbeitrag else { // Wenn NICHT Waschstrasse dann Fenster schließen. - if (benutzer.Rolle == BenutzerRolle.Waschstrasse) FormNeuerAuftrag_Load(this, e); - else this.Close(); + //if (this.userid.Contains("wstrasse")) FormNeuerAuftrag_Load(this, e); + //else this.Close(); + this.DialogResult = DialogResult.Cancel; + this.Close(); } this.dGArtikel.ForeColor = Color.Black; @@ -75,10 +85,21 @@ namespace Deckungsbeitrag comboBox_Load(); //Unterscheidung zwischen BenutzerRollen. Verschiedene Controls werden gesperrt, angezeigt oder verändert - if (this.benutzer.Rolle == BenutzerRolle.Verwaltung || this.benutzer.Rolle == BenutzerRolle.Admin || this.benutzer.Rolle == BenutzerRolle.Master) + if (this.benutzer != null) { - this.comboBoxTyp.Enabled = true; - this.comboBoxTyp.SelectedIndex = 1; + if (this.benutzer.Rolle == BenutzerRolle.Verwaltung || this.benutzer.Rolle == BenutzerRolle.Admin || this.benutzer.Rolle == BenutzerRolle.Master) + { + this.comboBoxTyp.Enabled = true; + this.comboBoxTyp.SelectedIndex = 1; + } + else + { + this.comboBoxTyp.Enabled = false; + this.dGArtikel.Enabled = this.dGArtikel.Visible = false; + this.Width = textBoxKundeName.Right + 10; + this.Height = 405; + this.comboBoxTyp.SelectedIndex = 1; + } } else { @@ -88,6 +109,7 @@ namespace Deckungsbeitrag this.Height = 405; this.comboBoxTyp.SelectedIndex = 1; } + } /// diff --git a/AA-Klassen/Fehlermeldungen.cs b/AA-Klassen/Fehlermeldungen.cs index bdbda15..383aba2 100644 --- a/AA-Klassen/Fehlermeldungen.cs +++ b/AA-Klassen/Fehlermeldungen.cs @@ -264,5 +264,14 @@ namespace DatenDB return result; } + internal void MaschineIstLeer(string s) + { + if (s == null) s = $"Die Maschine ist leer. Es konnten keine Fächer gefunden werden."; + + string caption = "FEHLER"; + MessageBoxButtons buttons = MessageBoxButtons.OK; + MessageBoxIcon icon = MessageBoxIcon.Error; + MessageBox.Show(s, caption, buttons, icon); + } } } diff --git a/AA-Klassen/Funktionen.cs b/AA-Klassen/Funktionen.cs index 44b67d7..ee796b8 100644 --- a/AA-Klassen/Funktionen.cs +++ b/AA-Klassen/Funktionen.cs @@ -37,6 +37,7 @@ namespace Deckungsbeitrag public Funktionen() { } + public static HeaderFormatStyle GetHeader() { HeaderFormatStyle headerFormat = new HeaderFormatStyle(); diff --git a/AA-Klassen/WSFach.cs b/AA-Klassen/WSFach.cs new file mode 100644 index 0000000..c685daa --- /dev/null +++ b/AA-Klassen/WSFach.cs @@ -0,0 +1,86 @@ +using DatenDB; +using Npgsql; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deckungsbeitrag.AA_Klassen +{ + public class WSFach + { + private const string COLUMNS = "fach_id, auftrag_id, maschine_id, gewaschen, extraauftrag_id, gewicht, wprogramm_id"; + private const string TABLE = "kundenverwaltung.wsfach"; + + public WSFach() + { + } + + + public int? FachID { get; set; } + public int AuftragID { get; set; } + public int MaschineID { get; set; } + public DateTime Gewaschen { get; set; } + public int? ExtraAuftragID { get; set; } + public double Gewicht { get; set; } = 0; + public int? WProgrammID { get; set; } + + internal static List GetFachliste(Maschine maschine) + { + int faecher = 0; + if (maschine.TrocknerKaputt) faecher = maschine.Faecher - 1; + else faecher = maschine.Faecher; + DatenbankConnection.GetConnection().Open(); + List resultlist = new List(); + NpgsqlCommand command = new NpgsqlCommand(); + command.Connection = DatenbankConnection.GetConnection(); + command.CommandText = $"select {COLUMNS} from {TABLE} where maschine_id = {maschine.MaschineID} order by fach_id desc limit {faecher}"; + NpgsqlDataReader reader = command.ExecuteReader(); + while (reader.Read()) resultlist.Add(new WSFach(reader)); + reader.Close(); + DatenbankConnection.GetConnection().Close(); + return resultlist; + } + + public WSFach(NpgsqlDataReader reader) + { + this.FachID = reader.GetInt32(0); + this.AuftragID = reader.GetInt32(1); + this.MaschineID = reader.GetInt32(2); + this.Gewaschen = reader.GetDateTime(3); + this.ExtraAuftragID = reader.IsDBNull(4) ? null : (int?)reader.GetInt32(4); + this.Gewicht = reader.GetDouble(5); + this.WProgrammID = reader.IsDBNull(6) ? null : (int?)reader.GetInt32(6); + } + public int Save() + { + DatenbankConnection.GetConnection().Open(); + NpgsqlCommand command = new NpgsqlCommand(); + command.Connection = DatenbankConnection.GetConnection(); + + if (this.FachID.HasValue & this.FachID != 0) + { + command.CommandText = $"update {TABLE} set auftrag_id = :p1, maschine_id = :p2, gewaschen = :p3, extraauftrag_id = :p4, gewicht = :p5, wprogramm_id = :p6 where fach_id = :p0"; + } + else + { + command.CommandText = "select nextval('kundenverwaltung.wsfach_seq')"; + this.FachID = (int)(long)command.ExecuteScalar(); + command.CommandText = $"insert into {TABLE} ({COLUMNS}) values (:p0, :p1, :p2, :p3, :p4, :p5, :p6)"; + } + command.Parameters.AddWithValue("p0", this.FachID); + command.Parameters.AddWithValue("p1", this.AuftragID); + command.Parameters.AddWithValue("p2", this.MaschineID); + command.Parameters.AddWithValue("p3", this.Gewaschen); + command.Parameters.AddWithValue("p4", this.ExtraAuftragID.HasValue ? this.ExtraAuftragID.Value : (object)DBNull.Value); + command.Parameters.AddWithValue("p5", this.Gewicht); + command.Parameters.AddWithValue("p6", this.WProgrammID.HasValue ? this.WProgrammID.Value : (object)DBNull.Value); + + int result = command.ExecuteNonQuery(); + DatenbankConnection.GetConnection().Close(); + return result; + } + + } +} diff --git a/App.config b/App.config index 425d060..beb2533 100644 --- a/App.config +++ b/App.config @@ -9,7 +9,7 @@ - + @@ -113,22 +113,22 @@ False - + Yellow - + White - + Red - + LightBlue - + Green - + Violet diff --git a/Config.cs b/Config.cs new file mode 100644 index 0000000..9f99f17 --- /dev/null +++ b/Config.cs @@ -0,0 +1,27 @@ +using Deckungsbeitrag.Properties; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deckungsbeitrag +{ + public static class Config + { + public static class FarbenConfig + { + public static readonly IReadOnlyDictionary Farben = new Dictionary + { + ["Beladeband"] = Settings.Default.Beladeband, + ["Waschstrasse"] = Settings.Default.Waschstrasse, + ["Presse"] = Settings.Default.Presse, + ["Trockner"] = Settings.Default.Trockner, + ["Entladeband"] = Settings.Default.Entladeband, + ["Hubband"] = Settings.Default.Hubband + }; + } + + } +} diff --git a/Program.cs b/Program.cs index c86508f..3987786 100644 --- a/Program.cs +++ b/Program.cs @@ -29,8 +29,8 @@ namespace Deckungsbeitrag //TODO: Wenn mit Anmeldung dann if-Clause entfernen und Switch alleine verwenden. if (userid.StartsWith("ms") | userid.StartsWith("ps")) { - // Maschinen Einstiegspunkt. Keine Anmeldung notwendig. - Application.Run(new FormFehlmengeCount(userid)); + if (userid.Contains("wstrasse")) Application.Run(new FormAusschlager(userid)); + else Application.Run(new FormFehlmengeCount(userid)); } else { diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 58828f9..9ce26e6 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -139,6 +139,7 @@ namespace Deckungsbeitrag.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Yellow")] public global::System.Drawing.Color Beladeband { get { return ((global::System.Drawing.Color)(this["Beladeband"])); @@ -150,6 +151,7 @@ namespace Deckungsbeitrag.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("White")] public global::System.Drawing.Color Waschstrasse { get { return ((global::System.Drawing.Color)(this["Waschstrasse"])); @@ -161,6 +163,7 @@ namespace Deckungsbeitrag.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Red")] public global::System.Drawing.Color Presse { get { return ((global::System.Drawing.Color)(this["Presse"])); @@ -172,6 +175,7 @@ namespace Deckungsbeitrag.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("LightBlue")] public global::System.Drawing.Color Hubband { get { return ((global::System.Drawing.Color)(this["Hubband"])); @@ -183,6 +187,7 @@ namespace Deckungsbeitrag.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Green")] public global::System.Drawing.Color Trockner { get { return ((global::System.Drawing.Color)(this["Trockner"])); @@ -194,6 +199,7 @@ namespace Deckungsbeitrag.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Violet")] public global::System.Drawing.Color Entladeband { get { return ((global::System.Drawing.Color)(this["Entladeband"])); diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 10aec7e..0099f09 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -33,22 +33,22 @@ False - + Yellow - + White - + Red - + LightBlue - + Green - + Violet diff --git a/Verwaltung.csproj b/Verwaltung.csproj index 66665fd..6ab76fc 100644 --- a/Verwaltung.csproj +++ b/Verwaltung.csproj @@ -330,6 +330,8 @@ + +