diff --git a/AA-Forms/FormExpedit.Designer.cs b/AA-Forms/FormExpedit.Designer.cs index d9d699b..97319f4 100644 --- a/AA-Forms/FormExpedit.Designer.cs +++ b/AA-Forms/FormExpedit.Designer.cs @@ -29,8 +29,8 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormExpedit)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.label10 = new System.Windows.Forms.Label(); this.buttonDrucken = new System.Windows.Forms.Button(); this.buttonAbbrechen = new System.Windows.Forms.Button(); @@ -491,14 +491,14 @@ // this.dGArtikel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dGArtikel.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dGArtikel.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3; this.dGArtikel.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dGArtikel.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.KundeArtikelID, @@ -511,14 +511,14 @@ this.StandBearbeitet, this.FehlmengeBearbeitet, this.KorrekturBearbeitet}); - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dGArtikel.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dGArtikel.DefaultCellStyle = dataGridViewCellStyle4; this.dGArtikel.Location = new System.Drawing.Point(638, 42); this.dGArtikel.Name = "dGArtikel"; this.dGArtikel.RowHeadersWidth = 62; @@ -683,12 +683,12 @@ // // buttonEinstellung // - this.buttonEinstellung.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonEinstellung.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonEinstellung.FlatAppearance.BorderColor = System.Drawing.Color.White; this.buttonEinstellung.FlatAppearance.BorderSize = 3; this.buttonEinstellung.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonEinstellung.Image = global::Deckungsbeitrag.Properties.Resources.Monaco_Settings_16x; - this.buttonEinstellung.Location = new System.Drawing.Point(1431, 9); + this.buttonEinstellung.Location = new System.Drawing.Point(1022, 727); this.buttonEinstellung.Name = "buttonEinstellung"; this.buttonEinstellung.Size = new System.Drawing.Size(41, 41); this.buttonEinstellung.TabIndex = 45; diff --git a/AA-Forms/FormExpedit.cs b/AA-Forms/FormExpedit.cs index de2ba01..a75f54b 100644 --- a/AA-Forms/FormExpedit.cs +++ b/AA-Forms/FormExpedit.cs @@ -12,6 +12,7 @@ namespace Deckungsbeitrag { public partial class FormExpedit : Form { + private ToolTip cellTooltip = new ToolTip(); public Fehlermeldungen fehlermeldung = new Fehlermeldungen(); public Image etikett = null; public Auftrag auftrag; @@ -66,8 +67,10 @@ namespace Deckungsbeitrag { Cursor.Current = Cursors.WaitCursor; this.SuspendLayout(); + this.Visible = false; - imagelist.Images.Add(Resources.WarningRule_16x); + imagelist.Images.Add(Resources.Exclamation_Red); + imagelist.ImageSize = new Size(24, 24); // Controls aktivieren und deaktivieren nach BenutzerRolle switch (this.benutzer.Rolle) @@ -125,6 +128,7 @@ namespace Deckungsbeitrag this.ResumeLayout(); + this.Visible = true; Cursor.Current = Cursors.Default; WindowState = FormWindowState.Maximized; } @@ -165,7 +169,7 @@ namespace Deckungsbeitrag if(auftrag != null) { Auftrag _auftrag = Auftrag.GetAuftrag(auftrag.AuftragID); - Load_Gridview(_auftrag); + if(dGArtikel.Visible) Load_Gridview(_auftrag); } Cursor.Current = Cursors.Default; @@ -257,9 +261,16 @@ namespace Deckungsbeitrag // Alle Zeilenhöhen an Zellinhalt anpassen this.dGArtikel.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; + //TODO: Breite der GridView festlegen. this.dGArtikel = Funktionen.DGV_Size_Anpassen(this.dGArtikel); + this.dGArtikel.Width = this.Width - dGArtikel.Left; + + // Rechter Rand von letzter Spalte berechnen. + int x = 0; + foreach (ColumnHeader col in objectListViewAuftrag.Columns) x += col.Width;// x ist jetzt die Position direkt rechts von der letzten Spalte (relativ zu client origin) + - this.dGArtikel.Location = new Point(this.tabControlAuftragList.Right - dGArtikel.Width, this.dGArtikel.Location.Y); + this.dGArtikel.Location = new Point(this.objectListViewAuftrag.Left + x, this.dGArtikel.Location.Y); if (this.dGArtikel.Rows.Count > 0) this.dGArtikel.Visible = true; else this.dGArtikel.Visible = false; } @@ -379,9 +390,10 @@ namespace Deckungsbeitrag private void objectListViewAuftrag_CellClick(object sender, CellClickEventArgs e) { itemlocation = new Point(e.Location.X, e.Location.Y); - if(e.Model == null) return; ObjectListView olv = (ObjectListView)sender; Auftrag _auftrag = (Auftrag)e.Model; + + if (e.Model == null) { dGArtikel.Visible = false; return; } if (_auftrag.Status != AuftragStatus.Fertig) { this.auftrag = _auftrag; @@ -396,6 +408,7 @@ namespace Deckungsbeitrag } foreach (Control ctr in this.groupBoxEtikett.Controls) if (ctr.Enabled == false) ctr.Enabled = true; this.buttonKundeNr.Enabled = false; + olv.Focus(); } @@ -521,66 +534,99 @@ namespace Deckungsbeitrag Cursor.Current = Cursors.Default; } - private void OLV_Load(ObjectListView olv, List auftraglist) +private void OLV_Load(ObjectListView olv, List auftraglist) +{ + // Cursor auf Warte-Status setzen, um Benutzerfeedback zu geben + Cursor.Current = Cursors.WaitCursor; + + // Layout- und Update-Änderungen pausieren, um Flackern zu verhindern + olv.SuspendLayout(); // Stoppt Layout-Berechnungen (Anchor/Dock) + olv.BeginUpdate(); // Stoppt Datenaktualisierungen/Redraws + + // Automatisch alle Properties von Auftrag als Spalten generieren + Generator.GenerateColumns(olv, typeof(Auftrag), true); + + // ========== SPALTE 11: BUTTON-KOLUMNE ========== + // Spalte 11 (Index 11) als Button-Spalte konfigurieren + OLVColumn buttonColumn = (OLVColumn)olv.Columns[11]; + buttonColumn.IsButton = true; // Als Button rendern + buttonColumn.ButtonSizing = OLVColumn.ButtonSizingMode.CellBounds; // Button füllt gesamte Zelle + + // ========== IMAGE-LIST ZUWEISEN ========== + // SmallImageList für Icons in Detail-View (16x16 Pixel standard) + olv.SmallImageList = imagelist; // Voraussetzung: imagelist mit Icon Index 0 gefüllt + + // ========== SPALTE 10: ICON-KOLUMNE ========== + // Spalte 10 als Icon-Spalte: zeigt Icon wenn AufgabeID vorhanden + OLVColumn iconColumn = (OLVColumn)olv.Columns[10]; + iconColumn.ImageGetter = rowObject => { - Cursor.Current = Cursors.WaitCursor; - olv.SuspendLayout(); - olv.BeginUpdate(); - - Generator.GenerateColumns(olv, typeof(Auftrag), true); - - // Spalte zum Sortieren festlegen. - OLVColumn sortcolumn = (OLVColumn)olv.Columns[5]; - olv.Sort(sortcolumn); - - // Spalte mit Button anzeigen. - OLVColumn buttonColumn = new OLVColumn(); - buttonColumn = (OLVColumn)olv.Columns[11]; - buttonColumn.IsButton = true; - buttonColumn.ButtonSizing = OLVColumn.ButtonSizingMode.CellBounds; - - // Liste mit Images der ObjectListView zuweisen. - olv.SmallImageList = imagelist; - - // Spalte mit Image anzeigen. Wenn AufgabeID != null dann Image. KEINE UNTERSCHEIDUNG WELCHE AUFGABE. - OLVColumn iconColumn = (OLVColumn)olv.Columns[10]; - iconColumn.ImageGetter = rowObject => - { var auftrag = rowObject as Auftrag; + if (auftrag.AufgabeID == null) return null; // null = kein Icon anzeigen + else return 0; // Index 0 aus SmallImageList + }; - if (auftrag.AufgabeID == null) return null; // kein Icon - else return 0; // Icon an Position 0 - }; - - // Erst nach den Columns die Objecte einfügen. - olv.SetObjects(auftraglist); - - - olv.CheckedAspectName = "IsChecked"; - Funktionen.Columns_Resize(olv); - olv.Columns[0].Width = 0; - olv.Columns[7].Width = 0; - olv.Columns[8].Width = 0; - olv.Columns[9].Width = 0; - - if (olv.Name.Contains("Auftrag")) - { - this.labelauftragtag.Text = olv.Items.Count.ToString(); - int summe = 0; - foreach(var obj in olv.Objects) + // ========== TOOLTIP FÜR ICON-SPALTE ========== + // Automatischer Cell-Tooltip bei Mouse-Hover über Spalte 10 + olv.CellToolTipShowing += (s, e) => + { + // Nur für Icon-Spalte (Index 10) und gültiges Model + if (e.ColumnIndex == 10 && e.Model is Auftrag auftrag) { - Auftrag auf = (Auftrag)obj; - if(auf.Erstellt.Value.Date == DateTime.Now.Date) summe += auf.ContainerClean; + // Lade Bezeichnung der Aufgabe als Tooltip-Text + e.Text = Aufgabe.GetAufgabe(null, auftrag.AufgabeID).Bezeichnung; + } + }; + + // ========== DATEN LADEN ========== + // WICHTIG: SetObjects NACH Column-Konfiguration aufrufen! + olv.SetObjects(auftraglist); // Bindet die Auftragsliste an die View + + // ========== SORTIERUNG ========== + // Spalte 5 als primäre Sortier-Spalte festlegen (nach Datenbindung!) + OLVColumn sortcolumn = (OLVColumn)olv.Columns[5]; + olv.Sort(sortcolumn); // Sortiert aufsteigend nach Spalte 5 + + // ========== CHECKBOX-FUNKTIONALITÄT ========== + // Aktiviert Checkboxen basierend auf "IsChecked" Property des Auftrag-Modells + olv.CheckedAspectName = "IsChecked"; + + // ========== SPALTEN ANPASSEN ========== + Funktionen.Columns_Resize(olv); // Externe Funktion für responsive Spaltenbreiten + + // Unsichtbare Spalten (Width = 0 = versteckt) + olv.Columns[0].Width = 0; // Spalte 0 verstecken + olv.Columns[7].Width = 0; // Spalte 7 verstecken + olv.Columns[8].Width = 0; // Spalte 8 verstecken + olv.Columns[9].Width = 0; // Spalte 9 verstecken + + // ========== STATISTIKEN (nur bei Auftrags-OLV) ========== + if (olv.Name.Contains("Auftrag")) + { + // Anzahl sichtbarer Aufträge anzeigen + this.labelauftragtag.Text = olv.Items.Count.ToString(); + + // ContainerClean-Summe für heute berechnen + int summe = 0; + foreach (var obj in olv.Objects) // Durch alle Modelle iterieren + { + Auftrag auf = (Auftrag)obj; + // Nur Aufträge von heute zählen + if (auf.Erstellt.Value.Date == DateTime.Now.Date) + summe += auf.ContainerClean; } this.labelcontainertag.Text = summe.ToString(); - } - - - olv.EndUpdate(); - olv.ResumeLayout(); - Cursor.Current = Cursors.Default; } + // ========== AUFRÄUMEN & AKTIVIEREN ========== + olv.EndUpdate(); // Update-Pause beenden, Daten neu zeichnen + olv.ResumeLayout(); // Layout-Pause beenden, Positionen neu berechnen + olv.Focus(); // OLV fokussieren (Tastaturbedienung aktivieren) + + // Cursor zurücksetzen + Cursor.Current = Cursors.Default; +} + /// /// Liefertag wird ermittelt und in Day of Week umgerechnet. RadioButtons werden Checked oder Unchecked und Click wird registriert. /// @@ -707,5 +753,6 @@ namespace Deckungsbeitrag einstellung.ShowDialog(); } + } } diff --git a/AA-Forms/FormFehlmengeCount.cs b/AA-Forms/FormFehlmengeCount.cs index 7cc249c..e6aad7a 100644 --- a/AA-Forms/FormFehlmengeCount.cs +++ b/AA-Forms/FormFehlmengeCount.cs @@ -128,7 +128,7 @@ namespace Deckungsbeitrag case var nr when nr.ToString().StartsWith("6312") & nr.ToString().EndsWith("1"): //DUSCHTUCH BLAU this.buttonArt7.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("6354"): //GESICHTSTUCH + case var nr when nr.ToString().StartsWith("61115") & (nr.ToString().EndsWith("00") || nr.ToString().EndsWith("30")): //SPANNLEINTUCH SINGLE this.buttonArt8.Tag = artikel; break; default: @@ -287,9 +287,6 @@ namespace Deckungsbeitrag } } - // Focus auf TextBox damit Kundennummer eingegeben oder gescannt werden kann - //this.textBoxScann.Focus(); - //Kunde wird durch Scan oder Handeingabe Ausgewählt. this.kunde = Funktionen.KundenAuswahl(); ControlLaden(); diff --git a/AA-Forms/FormListe.cs b/AA-Forms/FormListe.cs index 44421b7..7bc2096 100644 --- a/AA-Forms/FormListe.cs +++ b/AA-Forms/FormListe.cs @@ -68,7 +68,6 @@ namespace Deckungsbeitrag timer.Interval = 1000; // 1 Sekunden timer.Tick += Timer_Tick; - this.buttonOK.Visible = this.buttonOK.Enabled = false; listViewKunde_Load(); diff --git a/AA-Forms/FormWSVerfolgung.Designer.cs b/AA-Forms/FormWSVerfolgung.Designer.cs index d6abc29..61672e5 100644 --- a/AA-Forms/FormWSVerfolgung.Designer.cs +++ b/AA-Forms/FormWSVerfolgung.Designer.cs @@ -29,8 +29,8 @@ private void InitializeComponent() { this.statusStripWSVerfolgung = new System.Windows.Forms.StatusStrip(); - this.tableLayoutPanelWSVerfolgung = new System.Windows.Forms.TableLayoutPanel(); this.toolStripDropDownButtonInfo = new System.Windows.Forms.ToolStripDropDownButton(); + this.tableLayoutPanelWSVerfolgung = new System.Windows.Forms.TableLayoutPanel(); this.statusStripWSVerfolgung.SuspendLayout(); this.SuspendLayout(); // @@ -46,20 +46,6 @@ this.statusStripWSVerfolgung.TabIndex = 0; this.statusStripWSVerfolgung.Text = "statusStrip1"; // - // tableLayoutPanelWSVerfolgung - // - this.tableLayoutPanelWSVerfolgung.BackColor = System.Drawing.Color.Transparent; - this.tableLayoutPanelWSVerfolgung.ColumnCount = 1; - this.tableLayoutPanelWSVerfolgung.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanelWSVerfolgung.Dock = System.Windows.Forms.DockStyle.Top; - this.tableLayoutPanelWSVerfolgung.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanelWSVerfolgung.Name = "tableLayoutPanelWSVerfolgung"; - this.tableLayoutPanelWSVerfolgung.RowCount = 2; - this.tableLayoutPanelWSVerfolgung.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanelWSVerfolgung.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanelWSVerfolgung.Size = new System.Drawing.Size(800, 422); - this.tableLayoutPanelWSVerfolgung.TabIndex = 1; - // // toolStripDropDownButtonInfo // this.toolStripDropDownButtonInfo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); @@ -74,6 +60,20 @@ this.toolStripDropDownButtonInfo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.toolStripDropDownButtonInfo.ToolTipText = "Wähle hier eine Info für die Ausschlager"; // + // tableLayoutPanelWSVerfolgung + // + this.tableLayoutPanelWSVerfolgung.BackColor = System.Drawing.Color.Transparent; + this.tableLayoutPanelWSVerfolgung.ColumnCount = 1; + this.tableLayoutPanelWSVerfolgung.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanelWSVerfolgung.Dock = System.Windows.Forms.DockStyle.Top; + this.tableLayoutPanelWSVerfolgung.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanelWSVerfolgung.Name = "tableLayoutPanelWSVerfolgung"; + this.tableLayoutPanelWSVerfolgung.RowCount = 2; + this.tableLayoutPanelWSVerfolgung.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanelWSVerfolgung.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanelWSVerfolgung.Size = new System.Drawing.Size(800, 422); + this.tableLayoutPanelWSVerfolgung.TabIndex = 1; + // // FormWSVerfolgung // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -86,7 +86,9 @@ this.KeyPreview = true; this.Name = "FormWSVerfolgung"; this.Text = "WSVerfolgung"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.WSVerfolgung_Load); + this.Shown += new System.EventHandler(this.FormWSVerfolgung_Shown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormWSVerfolgung_KeyDown); this.statusStripWSVerfolgung.ResumeLayout(false); this.statusStripWSVerfolgung.PerformLayout(); diff --git a/AA-Forms/FormWSVerfolgung.cs b/AA-Forms/FormWSVerfolgung.cs index 8ace28c..97b6030 100644 --- a/AA-Forms/FormWSVerfolgung.cs +++ b/AA-Forms/FormWSVerfolgung.cs @@ -32,6 +32,10 @@ namespace Deckungsbeitrag.AA_Forms public FormWSVerfolgung() { InitializeComponent(); + + this.BackColor = Color.Black; + this.WindowState = FormWindowState.Maximized; + this.FormBorderStyle = FormBorderStyle.None; } public FormWSVerfolgung(string userid) : this() { @@ -65,11 +69,10 @@ namespace Deckungsbeitrag.AA_Forms private void WSVerfolgung_Load(object sender, EventArgs e) { - // WaitCursor und Controls ausblenden. + // WaitCursor this.Cursor = Cursors.WaitCursor; - //Funktionen.HideControls(this.Controls); - // StatusStrip DropDown + // StatusStrip DropDown laden. this.toolStripDropDownButtonInfo.DropDownItems.Clear(); List aufgabenliste = Aufgabe.GetList((int)Kategorie.Waschstrasse); foreach(Aufgabe auf in aufgabenliste) @@ -81,65 +84,82 @@ namespace Deckungsbeitrag.AA_Forms } - this.BackColor = Color.Black; - this.WindowState = FormWindowState.Maximized; - this.FormBorderStyle = FormBorderStyle.None; + } + + /// + /// Controls werden hier bevor sie angezeigt werden berechnet. Danach werden sie Eingeblendet und der Cursor auf Default gestellt. + /// + /// + /// + private void FormWSVerfolgung_Shown(object sender, EventArgs e) + { + // Während dem Laden wird das Layout unterdrückt und der Screen ausgeblendet. + this.SuspendLayout(); + this.Visible = false; + + // Größer des TabelPanels anpassen. this.tableLayoutPanelWSVerfolgung.Height = this.statusStripWSVerfolgung.Top; + // Wenn bei Maschine TrocknerKaputt wird Anzahl Fächer um 1 reduziert. if (maschine.TrocknerKaputt) this.tableLayoutPanelWSVerfolgung.RowCount = maschine.Faecher - 1; else this.tableLayoutPanelWSVerfolgung.RowCount = maschine.Faecher; + + // Bei TabelPanel werden die Styles gelöscht und neu ertellt. Gleichmäßige Aufteilung in Prozent. this.tableLayoutPanelWSVerfolgung.RowStyles.Clear(); for (int i = 0; i < tableLayoutPanelWSVerfolgung.RowCount; i++) { tableLayoutPanelWSVerfolgung.RowStyles.Add(new RowStyle(SizeType.Percent, 100f / tableLayoutPanelWSVerfolgung.RowCount)); } - Panel_Laden(1); - //DefaultCursor und Controls einblenden. - //Funktionen.ShowControls(this.Controls); + // TabelPanel laden. + Panel_Laden(true); + + // Layout unterdrücken und Screen einblenden. Cursor wird auf Default gesetzt. + this.Visible = true; + this.ResumeLayout(true); this.Cursor = Cursors.Default; + } - private void AufgabeAuswaehlen_Click(object sender, EventArgs e) - { - ToolStripMenuItem item = (ToolStripMenuItem)sender; - if (((Aufgabe)item.Tag).Bezeichnung == "Extra Kunde") - { - FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.Userid); - if (neuerAuftrag.ShowDialog() == DialogResult.OK) - { - this.extraAuftrag = neuerAuftrag.Auftrag; - } - } - this.aufgabe = (Aufgabe)item.Tag; - Fach_speichern(); // Gleiches Fach mit neuem Auftrag = Update. - } - private void Panel_Laden(int start) + /// + /// ScreenControls in Panel von Fachliste laden. + /// + /// Wenn Neustart dann true sonst false. + private void Panel_Laden(bool neustart) { - + + // Fachliste holen damit letzter Auftrag vom Vortag übernommen werden kann. List fachliste = WSFach.GetFachliste(maschine); // Wenn erster Start dann Auftrag aus letztem Fach holen? - if (start == 1) + if (neustart) { + this.fach = new WSFach(); + if (meldung.MaschinenStart() == DialogResult.Yes) { + // Wenn holen, dann Auftrag und aufgabe aus fachliste holen. this.auftrag = Auftrag.GetAuftrag(fachliste[0].AuftragID); this.aufgabe = Aufgabe.GetAufgabe(null, fachliste[0].AufgabeID); - this.fach = new WSFach(); } else { + // Wenn nicht holen, dann Auftrag und Aufgabe enfernen. this.auftrag = null; this.aufgabe = null; + + // Neuen Auftrag eingeben. Wenn kein ExtraKunde wird false als extra weitergegeben. + Open_NeuerAuftrag(false); + + // Fachliste neu laden damit neuer Auftrag in erstes Fach geladen werden kann. + fachliste = WSFach.GetFachliste(maschine); } } // Alle Controls aus dem Panel entfernen. this.tableLayoutPanelWSVerfolgung.Controls.Clear(); - // UserControls mit Daten aus Fachliste in Panel laden. if (fachliste.Count > 0) { @@ -188,7 +208,10 @@ namespace Deckungsbeitrag.AA_Forms } } - ucfach.KundeName = Kunde.GetKunde(null, auftrag.KundeID, null).Suchtext; + // Wenn Kunde hat keinen Suchtext, dann Kundename anzeigen. + if(string.IsNullOrWhiteSpace(Kunde.GetKunde(null, auftrag.KundeID, null).Suchtext))ucfach.KundeName = Kunde.GetKunde(null, auftrag.KundeID, null).KundeName; + else ucfach.KundeName = Kunde.GetKunde(null, auftrag.KundeID, null).Suchtext; + CultureInfo deCult = new CultureInfo("de-DE"); ucfach.LieferTag = ((Liefertag)auftrag.Liefertag.DayOfWeek).ToString(); @@ -198,7 +221,7 @@ namespace Deckungsbeitrag.AA_Forms // Wenn Aufgabe ist ein Extra Kunde. if (aufgabe.Bezeichnung == "Extra Kunde") ucfach.Aufgabe = "Extra Kunde " + Kunde.GetKunde(null, Auftrag.GetAuftrag(fachliste[row].ExtraAuftragID).KundeID, null).Suchtext; else ucfach.Aufgabe = aufgabe.Bezeichnung; - + // Hintergrund des Fachs in der Farbe der Aufgabe. ACHTUNG WEGEN KONTRAST ZU SCHRIFTFARBE. ucfach.BackColor = aufgabe.Farbe; } @@ -207,20 +230,50 @@ namespace Deckungsbeitrag.AA_Forms this.tableLayoutPanelWSVerfolgung.Controls.Add(ucfach, 0, row); } } + } - private void Open_NeuerAuftrag() + /// + /// Wenn eine Info von der Statusleiste gewählt wurde. + /// + /// + /// + private void AufgabeAuswaehlen_Click(object sender, EventArgs e) + { + ToolStripMenuItem item = (ToolStripMenuItem)sender; + + // Aufgabe wird aus dem StatusStripItem geholt. + this.aufgabe = (Aufgabe)item.Tag; + + // Wenn Aufgabe ist ExtraKunde wird NeuerAuftrag geöffnet. + if (((Aufgabe)item.Tag).Bezeichnung == "Extra Kunde") + { + // Wenn ExtraKunde wird true als extra weitergegeben. + Open_NeuerAuftrag(true); + } + Fach_speichern(); // Gleiches Fach mit neuem Auftrag = Update. + } + + /// + /// NeuerAuftrag wird geöffnet und Ergebnis verarbeitet. + /// + /// Wenn ExtraKunde in Fach dann true, sonst false + private void Open_NeuerAuftrag(bool extra) { FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.Userid); if (neuerAuftrag.ShowDialog() == DialogResult.OK) { - this.auftrag = neuerAuftrag.Auftrag; + if (extra) this.extraAuftrag = neuerAuftrag.Auftrag; + else this.auftrag = neuerAuftrag.Auftrag; Fach_speichern(); // Gleiches Fach mit neuem Auftrag = Update. } } + + /// + /// Fach wird gespeichert. Bei Änderungen wird Fach überschrieben. Wenn FachID = 0 oder null wird neues Fach erstellt, sonst überschrieben. + /// private void Fach_speichern() { - //this.fach = new WSFach(); this.fach.AuftragID = (int)this.auftrag.AuftragID; this.fach.MaschineID = (int)this.maschine.MaschineID; this.fach.Gewaschen = DateTime.Now; @@ -231,7 +284,7 @@ namespace Deckungsbeitrag.AA_Forms if (this.extraAuftrag != null) this.fach.ExtraAuftragID = this.extraAuftrag.AuftragID; else this.fach.ExtraAuftragID = null; - if (this.fach.Save() == 1) Panel_Laden(2); + if (this.fach.Save() == 1) Panel_Laden(false); } /// @@ -241,8 +294,6 @@ namespace Deckungsbeitrag.AA_Forms /// private void Transport_ValueChanged(object sender, EventArgs e) { - //this.SuspendLayout(); - // Warten bis erster Transport durchgeführt wurde. while (_monitor.WS_1_Transport == true & _monitor.WS_2_Transport == true) { @@ -250,16 +301,21 @@ namespace Deckungsbeitrag.AA_Forms if (_monitor.WS_1_Transport || _monitor.WS_2_Transport) { Maschine ms = (Maschine)this.maschine; + + // Fehlermeldung falls kein Auftrag erstellt wurde. if (this.auftrag != null) { + // Nach Transport wird FachAufgabe und FachExtraAuftrag entfernt da diese nur für ein Fach gelten. this.aufgabe = null; this.extraAuftrag = null; + + // Wenn Fach nicht null ist wird für ein neues Fach die ID entfernt. Dadurch wird bei Save() neues Fach erzeugt. if (this.fach != null) this.fach.FachID = null; - Fach_speichern(); // Neues Fach mit gleichem Inhalt = + Fach_speichern(); } else { - MessageBox.Show($"Kein Auftrag erstellt. LEERFACH wird eingegeben. Bitte in BB1 bearbeiten."); + MessageBox.Show($"Kein Auftrag erstellt. LEERFACH wird eingegeben. Fach bitte im nachhinein bearbeiten."); } //WENN kein Kunde gewählt dann Fach mit KundeID 0. _monitor.WS_2_Transport = _monitor.WS_1_Transport = false; @@ -277,16 +333,24 @@ namespace Deckungsbeitrag.AA_Forms protected override bool ProcessDialogKey(Keys keyData) { //TODO: Umbau in Switch. + + // Escape [ESC] schließt den Screen. if (Form.ModifierKeys == Keys.None && keyData == Keys.Escape) { this.Close(); return true; } + + // Insert [Einfg] öffnet neuen Auftrag. if (Form.ModifierKeys == Keys.None && keyData == Keys.Insert) { - Open_NeuerAuftrag(); + // Neuer Auftrag wird geöffnet. Wenn nicht ExtraKunde wird false weitergegeben, sonst true. + Open_NeuerAuftrag(false); return true; } + + // R-Taste [R] simuliert Transport. Sollte wenn SPS angeschlossen ist nicht mehr notwendig sein und deaktiviert werden. + //TODO: Deaktivieren wenn SPS funktioniert. Transport wird simuliert. if (Form.ModifierKeys == Keys.None && keyData == Keys.R) { Cursor.Current = Cursors.WaitCursor; @@ -322,5 +386,6 @@ namespace Deckungsbeitrag.AA_Forms toolStripDropDownButtonInfo.DropDown.Show(); } } + } } diff --git a/AA-Klassen/Fehlermeldungen.cs b/AA-Klassen/Fehlermeldungen.cs index 600c84d..13fcef8 100644 --- a/AA-Klassen/Fehlermeldungen.cs +++ b/AA-Klassen/Fehlermeldungen.cs @@ -278,7 +278,7 @@ namespace DatenDB { DialogResult result = DialogResult.Cancel; - string s = $"Möchtest du den Auftrag des letzten Faches wiederherstellen?"; + string s = $"Möchtest du den Auftrag des letzten Faches wiederherstellen? Wenn NEIN erstelle einen neuen Auftrag."; string caption = "ACHTUNG"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; MessageBoxIcon icon = MessageBoxIcon.Exclamation; diff --git a/App.config b/App.config index 79ad880..638466a 100644 --- a/App.config +++ b/App.config @@ -6,7 +6,7 @@ - + diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 06b25f7..5df6570 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -90,6 +90,16 @@ namespace Deckungsbeitrag.Properties { } } + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Exclamation_Red { + get { + object obj = ResourceManager.GetObject("Exclamation_Red", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 74795fc..f4ca72a 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -142,4 +142,7 @@ ..\Resources\WarningRule_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\weather_warning_signal_alert_exclamation_icon_124159.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Resources/weather_warning_signal_alert_exclamation_icon_124159.png b/Resources/weather_warning_signal_alert_exclamation_icon_124159.png new file mode 100644 index 0000000..7ae658a Binary files /dev/null and b/Resources/weather_warning_signal_alert_exclamation_icon_124159.png differ