From a8c785fd41feaaefa8a9d12432216ef8abda6a69 Mon Sep 17 00:00:00 2001 From: Kilian Wirl Date: Thu, 18 Dec 2025 18:31:43 +0100 Subject: [PATCH] FormExpedit wurde Aufgabe erweitert, --- AA-Forms/FormExpedit.Designer.cs | 117 +++--------------- AA-Forms/FormExpedit.cs | 202 ++++++++++++++++++------------- AA-Forms/FormKundeVW.cs | 2 +- AA-Klassen/Artikel.cs | 3 +- AA-Klassen/Benutzer.cs | 16 +-- AA-Klassen/Kunde.cs | 4 +- AA-Klassen/Meldungen.cs | 35 +++--- App.config | 2 +- Verwaltung_ReadMe.txt | 7 +- 9 files changed, 170 insertions(+), 218 deletions(-) diff --git a/AA-Forms/FormExpedit.Designer.cs b/AA-Forms/FormExpedit.Designer.cs index 5d76939..0c48649 100644 --- a/AA-Forms/FormExpedit.Designer.cs +++ b/AA-Forms/FormExpedit.Designer.cs @@ -49,11 +49,6 @@ this.pictureBoxEntwurf = new System.Windows.Forms.PictureBox(); this.buttonKundeNr = new System.Windows.Forms.Button(); this.buttonSWS_Drucken = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.labelauftragtag = new System.Windows.Forms.Label(); - this.labelcontainertag = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); this.buttonNeuerAuftrag = new System.Windows.Forms.Button(); this.dGArtikel = new System.Windows.Forms.DataGridView(); this.KundeArtikelID = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -150,7 +145,7 @@ this.groupBoxEtikett.Controls.Add(this.label10); this.groupBoxEtikett.Controls.Add(this.buttonKundeNr); this.groupBoxEtikett.ForeColor = System.Drawing.Color.White; - this.groupBoxEtikett.Location = new System.Drawing.Point(1170, 310); + this.groupBoxEtikett.Location = new System.Drawing.Point(907, 222); this.groupBoxEtikett.Margin = new System.Windows.Forms.Padding(2); this.groupBoxEtikett.Name = "groupBoxEtikett"; this.groupBoxEtikett.Padding = new System.Windows.Forms.Padding(2); @@ -400,7 +395,7 @@ this.buttonSWS_Drucken.FlatAppearance.BorderSize = 0; this.buttonSWS_Drucken.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSWS_Drucken.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonSWS_Drucken.Location = new System.Drawing.Point(1179, 727); + this.buttonSWS_Drucken.Location = new System.Drawing.Point(916, 650); this.buttonSWS_Drucken.Margin = new System.Windows.Forms.Padding(2); this.buttonSWS_Drucken.Name = "buttonSWS_Drucken"; this.buttonSWS_Drucken.Size = new System.Drawing.Size(200, 41); @@ -409,67 +404,6 @@ this.buttonSWS_Drucken.UseVisualStyleBackColor = false; this.buttonSWS_Drucken.Click += new System.EventHandler(this.buttonSWS_Drucken_Click); // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(6, 740); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(209, 25); - this.label2.TabIndex = 36; - this.label2.Text = "AUFTRÄGE HEUTE:"; - // - // label3 - // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label3.ForeColor = System.Drawing.Color.White; - this.label3.Location = new System.Drawing.Point(320, 740); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(309, 25); - this.label3.TabIndex = 37; - this.label3.Text = "CONTAINER SAUBER HEUTE:"; - // - // labelauftragtag - // - this.labelauftragtag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelauftragtag.AutoSize = true; - this.labelauftragtag.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelauftragtag.ForeColor = System.Drawing.Color.White; - this.labelauftragtag.Location = new System.Drawing.Point(235, 733); - this.labelauftragtag.Name = "labelauftragtag"; - this.labelauftragtag.Size = new System.Drawing.Size(47, 33); - this.labelauftragtag.TabIndex = 38; - this.labelauftragtag.Text = "00"; - // - // labelcontainertag - // - this.labelcontainertag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelcontainertag.AutoSize = true; - this.labelcontainertag.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelcontainertag.ForeColor = System.Drawing.Color.White; - this.labelcontainertag.Location = new System.Drawing.Point(650, 733); - this.labelcontainertag.Name = "labelcontainertag"; - this.labelcontainertag.Size = new System.Drawing.Size(47, 33); - this.labelcontainertag.TabIndex = 39; - this.labelcontainertag.Text = "00"; - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label4.ForeColor = System.Drawing.Color.White; - this.label4.Location = new System.Drawing.Point(634, 9); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(172, 31); - this.label4.TabIndex = 41; - this.label4.Text = "Artikelstände"; - this.label4.Visible = false; - // // buttonNeuerAuftrag // this.buttonNeuerAuftrag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -479,7 +413,7 @@ this.buttonNeuerAuftrag.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonNeuerAuftrag.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonNeuerAuftrag.ForeColor = System.Drawing.Color.Black; - this.buttonNeuerAuftrag.Location = new System.Drawing.Point(975, 727); + this.buttonNeuerAuftrag.Location = new System.Drawing.Point(712, 650); this.buttonNeuerAuftrag.Margin = new System.Windows.Forms.Padding(2); this.buttonNeuerAuftrag.Name = "buttonNeuerAuftrag"; this.buttonNeuerAuftrag.Size = new System.Drawing.Size(200, 41); @@ -490,8 +424,7 @@ // // dGArtikel // - this.dGArtikel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Right))); + this.dGArtikel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | 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))); @@ -520,10 +453,10 @@ dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dGArtikel.DefaultCellStyle = dataGridViewCellStyle2; - this.dGArtikel.Location = new System.Drawing.Point(638, 42); + this.dGArtikel.Location = new System.Drawing.Point(576, 42); this.dGArtikel.Name = "dGArtikel"; this.dGArtikel.RowHeadersWidth = 62; - this.dGArtikel.Size = new System.Drawing.Size(527, 679); + this.dGArtikel.Size = new System.Drawing.Size(527, 592); this.dGArtikel.TabIndex = 44; this.dGArtikel.Visible = false; this.dGArtikel.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dGArtikel_CellBeginEdit); @@ -613,7 +546,7 @@ this.tabPageSonder.Location = new System.Drawing.Point(4, 34); this.tabPageSonder.Name = "tabPageSonder"; this.tabPageSonder.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSonder.Size = new System.Drawing.Size(1153, 675); + this.tabPageSonder.Size = new System.Drawing.Size(890, 587); this.tabPageSonder.TabIndex = 1; this.tabPageSonder.Text = "Sonderaufträge"; this.tabPageSonder.UseVisualStyleBackColor = true; @@ -628,7 +561,7 @@ this.objectListViewSonder.HideSelection = false; this.objectListViewSonder.Location = new System.Drawing.Point(3, 3); this.objectListViewSonder.Name = "objectListViewSonder"; - this.objectListViewSonder.Size = new System.Drawing.Size(1147, 669); + this.objectListViewSonder.Size = new System.Drawing.Size(884, 581); this.objectListViewSonder.TabIndex = 2; this.objectListViewSonder.UseCompatibleStateImageBehavior = false; this.objectListViewSonder.UseHotControls = false; @@ -642,14 +575,14 @@ this.tabPageAll.Location = new System.Drawing.Point(4, 34); this.tabPageAll.Name = "tabPageAll"; this.tabPageAll.Padding = new System.Windows.Forms.Padding(3); - this.tabPageAll.Size = new System.Drawing.Size(1153, 675); + this.tabPageAll.Size = new System.Drawing.Size(890, 587); this.tabPageAll.TabIndex = 0; this.tabPageAll.Text = "Aufträge heute"; this.tabPageAll.UseVisualStyleBackColor = true; // // objectListViewAuftrag // - this.objectListViewAuftrag.AlternateRowBackColor = System.Drawing.Color.LightSteelBlue; + this.objectListViewAuftrag.AlternateRowBackColor = System.Drawing.Color.LightBlue; this.objectListViewAuftrag.CellEditUseWholeCell = false; this.objectListViewAuftrag.Cursor = System.Windows.Forms.Cursors.Default; this.objectListViewAuftrag.Dock = System.Windows.Forms.DockStyle.Fill; @@ -658,15 +591,17 @@ this.objectListViewAuftrag.HideSelection = false; this.objectListViewAuftrag.Location = new System.Drawing.Point(3, 3); this.objectListViewAuftrag.Name = "objectListViewAuftrag"; - this.objectListViewAuftrag.Size = new System.Drawing.Size(1147, 669); + this.objectListViewAuftrag.Size = new System.Drawing.Size(884, 581); this.objectListViewAuftrag.TabIndex = 1; this.objectListViewAuftrag.UseAlternatingBackColors = true; + this.objectListViewAuftrag.UseCellFormatEvents = true; this.objectListViewAuftrag.UseCompatibleStateImageBehavior = false; this.objectListViewAuftrag.UseHotControls = false; this.objectListViewAuftrag.View = System.Windows.Forms.View.Details; this.objectListViewAuftrag.ButtonClick += new System.EventHandler(this.objectListViewAuftrag_ButtonClick); this.objectListViewAuftrag.CellClick += new System.EventHandler(this.objectListViewAuftrag_CellClick); this.objectListViewAuftrag.CellRightClick += new System.EventHandler(this.objectListViewAuftrag_CellRightClick); + this.objectListViewAuftrag.FormatCell += new System.EventHandler(this.objectListViewAuftrag_FormatCell); // // tabControlAuftragList // @@ -679,7 +614,7 @@ this.tabControlAuftragList.Location = new System.Drawing.Point(4, 9); this.tabControlAuftragList.Name = "tabControlAuftragList"; this.tabControlAuftragList.SelectedIndex = 0; - this.tabControlAuftragList.Size = new System.Drawing.Size(1161, 713); + this.tabControlAuftragList.Size = new System.Drawing.Size(898, 625); this.tabControlAuftragList.TabIndex = 0; this.tabControlAuftragList.Visible = false; this.tabControlAuftragList.SelectedIndexChanged += new System.EventHandler(this.tabControlAuftragList_SelectedIndexChanged); @@ -692,7 +627,7 @@ this.buttonStats.FlatAppearance.BorderSize = 3; this.buttonStats.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonStats.Image = global::Deckungsbeitrag.Properties.Resources.StatisticsWarning_16x; - this.buttonStats.Location = new System.Drawing.Point(1384, 727); + this.buttonStats.Location = new System.Drawing.Point(1121, 650); this.buttonStats.Name = "buttonStats"; this.buttonStats.Size = new System.Drawing.Size(41, 41); this.buttonStats.TabIndex = 46; @@ -706,7 +641,7 @@ 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, 727); + this.buttonEinstellung.Location = new System.Drawing.Point(1168, 650); this.buttonEinstellung.Name = "buttonEinstellung"; this.buttonEinstellung.Size = new System.Drawing.Size(41, 41); this.buttonEinstellung.TabIndex = 45; @@ -719,7 +654,7 @@ this.groupBoxStatistik.Controls.Add(this.dateTimePicker1); this.groupBoxStatistik.Controls.Add(this.tableLayoutPanelStatistik); this.groupBoxStatistik.ForeColor = System.Drawing.Color.White; - this.groupBoxStatistik.Location = new System.Drawing.Point(1171, 12); + this.groupBoxStatistik.Location = new System.Drawing.Point(908, 12); this.groupBoxStatistik.Name = "groupBoxStatistik"; this.groupBoxStatistik.Size = new System.Drawing.Size(301, 197); this.groupBoxStatistik.TabIndex = 62; @@ -926,23 +861,17 @@ // // FormExpedit // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); - this.ClientSize = new System.Drawing.Size(1481, 777); + this.ClientSize = new System.Drawing.Size(1221, 703); this.Controls.Add(this.groupBoxStatistik); this.Controls.Add(this.buttonStats); this.Controls.Add(this.buttonEinstellung); - this.Controls.Add(this.dGArtikel); this.Controls.Add(this.buttonNeuerAuftrag); - this.Controls.Add(this.label4); - this.Controls.Add(this.labelcontainertag); - this.Controls.Add(this.labelauftragtag); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); this.Controls.Add(this.buttonSWS_Drucken); this.Controls.Add(this.tabControlAuftragList); this.Controls.Add(this.groupBoxEtikett); + this.Controls.Add(this.dGArtikel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.HelpButton = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -968,7 +897,6 @@ this.tableLayoutPanelStatistik.ResumeLayout(false); this.tableLayoutPanelStatistik.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -988,12 +916,7 @@ private System.Windows.Forms.RadioButton rBDO; private System.Windows.Forms.RadioButton rBFR; private System.Windows.Forms.RadioButton rBMO; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label labelauftragtag; - private System.Windows.Forms.Label labelcontainertag; private System.Windows.Forms.CheckBox cBNoCont; - private System.Windows.Forms.Label label4; private System.Windows.Forms.Button buttonNeuerAuftrag; private System.Windows.Forms.DataGridView dGArtikel; private System.Windows.Forms.Label label5; diff --git a/AA-Forms/FormExpedit.cs b/AA-Forms/FormExpedit.cs index 2202bc5..95afef9 100644 --- a/AA-Forms/FormExpedit.cs +++ b/AA-Forms/FormExpedit.cs @@ -15,6 +15,7 @@ namespace Deckungsbeitrag { public partial class FormExpedit : Form { + #region Properties private ToolTip cellTooltip = new ToolTip(); public Meldungen fehlermeldung = new Meldungen(); public Image etikett = null; @@ -40,7 +41,8 @@ namespace Deckungsbeitrag private volatile bool _isProcessing = false; // Thread-sicherer Flag gegen Überlappung private int _consecutiveFailures = 0; private const int MAX_FAILURES = 3; - + private bool aufgabeDone = false; + #endregion public FormExpedit(Benutzer benutzer) { InitializeComponent(); @@ -55,7 +57,6 @@ namespace Deckungsbeitrag timer1.Start(); } - public FormExpedit(Benutzer benutzer, Screen[] screens) : this(benutzer) { this.screens = screens; @@ -138,11 +139,6 @@ namespace Deckungsbeitrag WindowState = FormWindowState.Maximized; } - private void GetUnvisibleButtonColumn() - { - foreach (OLVColumn col in this.objectListViewAuftrag.Columns) if (col.IsButton) col.IsVisible = false; - } - /// /// Auftragslisten erstellen und in ObjectListViews laden. /// @@ -387,13 +383,14 @@ namespace Deckungsbeitrag else { nocont = false; nocontclicked = true; } } - /// - /// Button Events (SWS-Drucken, Etikette-Drucken, Kundeauswahl, Abbrechen) - /// - /// - /// + #region Button_Click-Events private void buttonDrucken_Click(object sender, EventArgs e) { + if (this.auftrag.AufgabeID != null) + { + if (meldung.GetAchtung(this, $"Bei dem ausgewählten Auftrag ist die Aufgabe {Aufgabe.GetAufgabe(null, auftrag.AufgabeID).Bezeichnung} zu erledigen. Hast du die Aufgabe erledigt? ", false) == DialogResult.No) return; + } + if (this.textBoxCont.Text != "0") { //AUFTRAG UPDATE @@ -429,9 +426,34 @@ namespace Deckungsbeitrag { Kunde knd = Funktionen.KundenAuswahl(); if(knd != null) Funktionen.SWS_Drucken(null, knd, this); + } + private void buttonEinstellung_Click(object sender, EventArgs e) + { + FormEinstellung einstellung = new FormEinstellung(this); + einstellung.ShowDialog(); } + #endregion #region ObjectListView-Events + private void objectListViewAuftrag_FormatCell(object sender, FormatCellEventArgs e) + { + + if (e.ColumnIndex == 11) + { // jede zweite Spalte + if(e.SubItem.BackColor != Color.LightBlue) + { + e.SubItem.BackColor = Color.AliceBlue; + e.SubItem.ForeColor = Color.Black; + + } + else + { + e.SubItem.BackColor = Color.LightSteelBlue; + e.SubItem.ForeColor = Color.Black; + + } + } + } private void objectListViewAuftrag_CellClick(object sender, CellClickEventArgs e) { itemlocation = new Point(e.Location.X, e.Location.Y); @@ -461,17 +483,37 @@ namespace Deckungsbeitrag { ObjectListView olv = (ObjectListView)sender; - // Überprüfung ob Click war auch auf einem Item. + // Überprüfung ob Click auf einem Item war. if (e.Model == null) return; Auftrag _auftrag = (Auftrag)e.Model; + Kunde _kunde = Kunde.GetKunde(null, _auftrag.KundeID, null); + string name = string.Empty; + if (string.IsNullOrWhiteSpace(_kunde.Suchtext)) name = _kunde.KundeName; + else name = _kunde.Suchtext; + // Überprüfung welche Spalte geclickt wurde. switch (e.Column.Text) { case "Abschließen": + + // Wenn Click in Gruppe Vorbereitet dann ignorieren. if (e.Item.Group.Header == "Vorbereitet") return; - if (meldung.AuftragVorbereitetOhneEtikettDruck() == DialogResult.Yes) + + if (meldung.GetFrage(this, $"Für den Auftrag wurden keine Etiketten gedruckt, ohne Etikettendruck als Vorbereitet markieren?", false) == DialogResult.Yes) { + // Wenn Aufgabe hinterlegt ist wir nachgefragt ob diese erledigt wurde. + if (_auftrag.AufgabeID != null) + { + // Wenn NEIN wird der Click abgebrochen. + if (meldung.GetAchtung(this, $"Bei dem ausgewählten Auftrag ist die Aufgabe {Aufgabe.GetAufgabe(null, auftrag.AufgabeID).Bezeichnung} zu erledigen. Hast du die Aufgabe erledigt? ", false) == DialogResult.No) return; + else Aufgabe_erledigt(_auftrag, _kunde, name); + } + + // Wenn TextBox für saubere Container 0 ist wird der Click abgebrochen. + if (this.textBoxCont.Text == "0") { meldung.GetFehler(this, "Du kannst den Auftrag nicht als vorbereitet markieren. Wähle zuerst die Anzahl der sauberen Container."); return; } + + // Auftrag wird bearbeitet und gespeichert. _auftrag.Status = AuftragStatus.Vorbereitet; _auftrag.Save(); olv.RefreshObject(e); @@ -482,18 +524,10 @@ namespace Deckungsbeitrag break; case "Aufgabe": if (_auftrag.AufgabeID == null) return; - Kunde _kunde = Kunde.GetKunde(null, _auftrag.KundeID, null); - string name = string.Empty; - if (string.IsNullOrWhiteSpace(_kunde.Suchtext)) name = _kunde.KundeName; - else name = _kunde.Suchtext; Aufgabe _aufgabe = Aufgabe.GetAufgabe(null, ((Auftrag)e.Model).AufgabeID); if (meldung.GetFrage(this, $"Hast du beim Kunden {name} die Aufgabe {_aufgabe.Bezeichnung} erledigt und möchtest sie als erledigt markieren?", false) == DialogResult.Yes) { - if (_kunde.AufgabeCount <= 0) _kunde.Aufgabe = null; - else _kunde.AufgabeCount--; - _auftrag.AufgabeErledigt = true; - if (_auftrag.Save()[0] != 1) meldung.GetFehler(this, $"Der Auftrag konnte nicht gespeichert und die Aufgabe nicht als erledigt markiert werden. Melde das bitte deinem Vorgesetzten.", false); - if (_kunde.Save() != 1) meldung.GetFehler(this, $"Der Kunde {name} konnte nicht gespeichert und die Aufgabe nicht entfernt werden. Melde das bitte deinem Vorgesetzten.", false); + Aufgabe_erledigt(_auftrag, _kunde, name); } break; default: @@ -523,9 +557,7 @@ namespace Deckungsbeitrag case AuftragTyp.Inventur: if (meldung.SonderNoCleanContainer() == DialogResult.Yes) { - this.auftrag.Status = AuftragStatus.Fertig; - this.auftrag.Save(); - this.auftrag = null; + Auftrag_Fertig(); Load_Etikett_GroupBox(); } else return; @@ -533,9 +565,7 @@ namespace Deckungsbeitrag case AuftragTyp.Standverminderung: if (meldung.SonderNoCleanContainer() == DialogResult.Yes) { - this.auftrag.Status = AuftragStatus.Fertig; - this.auftrag.Save(); - this.auftrag = null; + Auftrag_Fertig(); Load_Etikett_GroupBox(); } else return; @@ -543,9 +573,7 @@ namespace Deckungsbeitrag case AuftragTyp.Standerhöhung: if (meldung.SonderNoCleanContainer() == DialogResult.Yes) { - this.auftrag.Status = AuftragStatus.Fertig; - this.auftrag.Save(); - this.auftrag = null; + Auftrag_Fertig(); Load_Etikett_GroupBox(); } else return; @@ -561,7 +589,7 @@ namespace Deckungsbeitrag switch (meldung.DifferentCleanContainer()) { case DialogResult.Cancel: - break; + return; case DialogResult.Yes: { this.auftrag.ContainerClean = (int)neuecontclean; @@ -570,7 +598,6 @@ namespace Deckungsbeitrag //WENN BEARBEITET UND AUSGEDRUCKT WIRD GEDRUCKT VERÄNDERT UND ERSTELLT IST URSPRUNGSDATUM this.auftrag.Gedruckt = DateTime.Now; this.auftrag.GedrucktVon = benutzer.BenutzerID; - this.auftrag.Status = AuftragStatus.Fertig; bool nocont = false; if (MessageBox.Show("Möchtest du die Containeranzahl am Etikett anzeigen?", "FRAGE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) @@ -582,8 +609,7 @@ namespace Deckungsbeitrag DialogResult result = Funktionen.Etikett_Drucken(auftrag, nocont); if (result == DialogResult.OK) { - this.auftrag.Save(); - this.auftrag = null; + Auftrag_Fertig(); } } break; @@ -595,10 +621,8 @@ namespace Deckungsbeitrag //WENN BEARBEITET UND NICHT GEDRUCKT WIRD ERSTELLT VERÄNDERT UND GEDRUCKT IST URSPRUNGSDATUM this.auftrag.Erstellt = DateTime.Now; this.auftrag.ErstelltVon = (int)benutzer.BenutzerID; - this.auftrag.Status = AuftragStatus.Fertig; - this.auftrag.Save(); - this.auftrag = null; + Auftrag_Fertig(); } break; default: @@ -607,9 +631,7 @@ namespace Deckungsbeitrag } else { - this.auftrag.Status = AuftragStatus.Fertig; - this.auftrag.Save(); - this.auftrag = null; + Auftrag_Fertig(); Load_Etikett_GroupBox(); } @@ -633,13 +655,21 @@ namespace Deckungsbeitrag // Automatisch alle Properties von Auftrag als Spalten generieren Generator.GenerateColumns(olv, typeof(Auftrag), true); - + + foreach (OLVColumn col in olv.Columns) + { + if (col.Index == 0) col.IsVisible = false; + if (col.Index >= 7 && col.Index <= 9) col.IsVisible |= false; + } + // ========== SPALTE 11: BUTTON-COLUMNE ========== // 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 @@ -705,24 +735,7 @@ namespace Deckungsbeitrag 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(); - } + // ========== AUFRÄUMEN & AKTIVIEREN ========== olv.EndUpdate(); // Update-Pause beenden, Daten neu zeichnen @@ -732,9 +745,31 @@ namespace Deckungsbeitrag // Cursor zurücksetzen Cursor.Current = Cursors.Default; } + private void GetUnvisibleButtonColumn() + { + foreach (OLVColumn col in this.objectListViewAuftrag.Columns) if (col.IsButton) col.IsVisible = false; + } #endregion - + private void Aufgabe_erledigt(Auftrag _auftrag,Kunde _kunde, string name) + { + if (_kunde.AufgabeCount <= 0) _kunde.Aufgabe = null; + else _kunde.AufgabeCount--; + _auftrag.AufgabeErledigt = true; + if (_auftrag.Save()[0] != 1) meldung.GetFehler(this, $"Der Auftrag konnte nicht gespeichert und die Aufgabe nicht als erledigt markiert werden. Melde das bitte deinem Vorgesetzten."); + if (_kunde.Save() != 1) meldung.GetFehler(this, $"Der Kunde {name} konnte nicht gespeichert und die Aufgabe nicht entfernt werden. Melde das bitte deinem Vorgesetzten."); + + } + /// + /// Wird aufgerufen wenn ein Auftrag Fertig ist und so gespeichert werden soll. + /// + private void Auftrag_Fertig() + { + this.auftrag.Status = AuftragStatus.Fertig; + this.auftrag.Save(); + this.auftrag = null; + } + /// /// Liefertag wird ermittelt und in Day of Week umgerechnet. RadioButtons werden Checked oder Unchecked und Click wird registriert. /// @@ -787,7 +822,18 @@ namespace Deckungsbeitrag if(tabControl.SelectedIndex == 3) { this.groupBoxEtikett.Visible = false; } } - + /// + /// Beim Wechsel der Tabs wird die DataGridView geleert. + /// + /// + /// + private void tabControlAuftragList_SelectedIndexChanged(object sender, EventArgs e) + { + this.dGArtikel.DataSource = null; + this.dGArtikel.Rows.Clear(); + this.dGArtikel.Visible = false; + } + /// /// Vor Beginn der Editierung wird Wert gespeichert um nach der Editierung vergleichen und eventuell speichern zu können. /// @@ -837,29 +883,6 @@ namespace Deckungsbeitrag } } - /// - /// Beim Wechsel der Tabs wird die DataGridView geleert. - /// - /// - /// - private void tabControlAuftragList_SelectedIndexChanged(object sender, EventArgs e) - { - this.dGArtikel.DataSource = null; - this.dGArtikel.Rows.Clear(); - this.dGArtikel.Visible = false; - } - - /// - /// Einstellungen vor allem Drucker für SWS und Etikett funktioniert nicht weil schreiben auf .config nicht möglich. - /// - /// - /// - private void buttonEinstellung_Click(object sender, EventArgs e) - { - FormEinstellung einstellung = new FormEinstellung(this); - einstellung.ShowDialog(); - } - #region Statistik private void buttonStats_Click(object sender, EventArgs e) { @@ -925,6 +948,11 @@ namespace Deckungsbeitrag GetStatistik(); } #endregion + } } -//CHANGES: Statistik für Expedit. (Same as in Main) \ No newline at end of file +//CHANGES: Wenn Auftrag als Vorbereitet markiert wird, wird nachgefragt ob die Aufgabe erledigt wurde. +//CHANGES: Wenn saubere Container sind 0 kann Auftrag nicht als Vorbereitet markiert werden. (Damit die Statistik stimmt) +//DONE: Spalten besser erkennbar gestalten damit Mirka die Spalte trifft wenn RechtsClick. +//DONE: Aufgabe wird bei "Vorbereiten ohne Etikett" verarbeitet. +//DONE: Auftrag als Vorbereitet markieren geht nur wenn saubere Container nicht 0 sind. diff --git a/AA-Forms/FormKundeVW.cs b/AA-Forms/FormKundeVW.cs index 11c840f..021fab1 100644 --- a/AA-Forms/FormKundeVW.cs +++ b/AA-Forms/FormKundeVW.cs @@ -524,7 +524,7 @@ namespace Deckungsbeitrag private void FormKundeVW_FormClosing(object sender, FormClosingEventArgs e) { if (anmerkungChanged) textBoxAnmerkung_Leave(this, null); - if (this.comboBoxAufgabe.SelectedItem != null && this.numericUpDownAufgabeCount.Value == 0) { meldung.GetFehler(this, $"Du hast für deine Aufgabe noch keine Auftraganzahl eingegeben. Hole das bitte jetzt nach.", false); e.Cancel = true; return; } + if (this.comboBoxAufgabe.SelectedItem != null && this.numericUpDownAufgabeCount.Value == 0) { meldung.GetFehler(this, $"Du hast für deine Aufgabe noch keine Auftraganzahl eingegeben. Hole das bitte jetzt nach."); e.Cancel = true; return; } if (aufgabeChanged) numericUpDownAufgabeCount_Leave(this, null); if (serviceChanged) { diff --git a/AA-Klassen/Artikel.cs b/AA-Klassen/Artikel.cs index 2c15f5a..fb87b6d 100644 --- a/AA-Klassen/Artikel.cs +++ b/AA-Klassen/Artikel.cs @@ -145,7 +145,7 @@ namespace DatenDB this.Kategorie = (ArtikelKategorie)reader.GetInt16(7); } - + #region Properties [OLVIgnore] public int? ArtikelID { get; set; } @@ -183,5 +183,6 @@ namespace DatenDB } set { } } + #endregion } } diff --git a/AA-Klassen/Benutzer.cs b/AA-Klassen/Benutzer.cs index 09b0909..f152fa7 100644 --- a/AA-Klassen/Benutzer.cs +++ b/AA-Klassen/Benutzer.cs @@ -86,11 +86,13 @@ namespace DatenDB return benutzer; } - /// - /// Benutzer ID - /// - - [OLVIgnore] + #region Properties + + /// + /// Benutzer ID + /// + + [OLVIgnore] public int? BenutzerID { get; set; } /// @@ -132,9 +134,9 @@ namespace DatenDB /// [OLVColumn("Benutzername", DisplayIndex = 3)] public string BenutzerName { get; set; } + #endregion - - public static Benutzer Get(string benutzerName, string passwort) + public static Benutzer Get(string benutzerName, string passwort) { try { diff --git a/AA-Klassen/Kunde.cs b/AA-Klassen/Kunde.cs index cafb0d1..65f6807 100644 --- a/AA-Klassen/Kunde.cs +++ b/AA-Klassen/Kunde.cs @@ -374,6 +374,4 @@ namespace DatenDB public string Anmerkung { get; set; } #endregion } -} -//INSTALL-REMINDER: Spalte Anmerkung in DB hinzufügen. -//INSTALL-REMINDER: Spalte Aufgabe Count in DB hinzufügen. \ No newline at end of file +} \ No newline at end of file diff --git a/AA-Klassen/Meldungen.cs b/AA-Klassen/Meldungen.cs index 66d7857..d246d3e 100644 --- a/AA-Klassen/Meldungen.cs +++ b/AA-Klassen/Meldungen.cs @@ -287,19 +287,6 @@ namespace DatenDB return result; } - internal DialogResult AuftragVorbereitetOhneEtikettDruck() - { - DialogResult result = DialogResult.Cancel; - - string s = $"Für den Auftrag wurden keine Etiketten gedruckt, ohne Etikettendruck als Vorbereitet markieren?"; - string caption = "ACHTUNG"; - MessageBoxButtons buttons = MessageBoxButtons.YesNo; - MessageBoxIcon icon = MessageBoxIcon.Exclamation; - - result = MessageBox.Show(s, caption, buttons, icon); - return result; - } - #region ALLGEMEINE MELDUNGEN RETURN DIALOGRESULT @@ -354,21 +341,33 @@ namespace DatenDB /// Fehlertext. Wenn null dann Fallbacktext. /// Button Cancel anzeigen dann true. /// DialogResult - internal DialogResult GetFehler(object sender, string s, bool cancel) + internal void GetFehler(object sender, string s) { - DialogResult result = DialogResult.Cancel; MessageBoxIcon icon = MessageBoxIcon.Error; MessageBoxButtons buttons; string caption = "FEHLER"; - if (cancel) buttons = MessageBoxButtons.OKCancel; - else buttons = MessageBoxButtons.OK; - if (s == null) s = $"Da ist ein Fehler aufgetreten. Frag Kilian welcher Ehler hier ({sender.ToString()}) passiert ist."; + buttons = MessageBoxButtons.OK; + if (s == null) s = $"Da ist ein Fehler aufgetreten. Frag Kilian welcher Fehler hier ({sender.ToString()}) passiert ist."; + + MessageBox.Show(s, caption, buttons, icon); + } + internal DialogResult GetAchtung(object sender, string s, bool cancel) + { + DialogResult result = DialogResult.Cancel; + MessageBoxIcon icon = MessageBoxIcon.Exclamation; + MessageBoxButtons buttons; + + string caption = "ACHTUNG"; + if (cancel) buttons = MessageBoxButtons.YesNoCancel; + else buttons = MessageBoxButtons.YesNo; + if (s == null) s = $"Hier ist ACHTUNG angebracht. Frag Kilian warum hier ({sender.ToString()})."; result = MessageBox.Show(s, caption, buttons, icon); return result; } + #endregion diff --git a/App.config b/App.config index ba669e3..735e1c5 100644 --- a/App.config +++ b/App.config @@ -6,7 +6,7 @@ - + diff --git a/Verwaltung_ReadMe.txt b/Verwaltung_ReadMe.txt index 3ad45e9..5c96b4b 100644 --- a/Verwaltung_ReadMe.txt +++ b/Verwaltung_ReadMe.txt @@ -5,7 +5,7 @@ NEUIGKEITEN - Version 1.0.4.2 Build-Info: - Build-Typ: Release Build - Erledigte TODOs: 19 -- Offene TODOs: 20 +- Offene TODOs: 21 - Install-Reminders: 5 - Changes: 7 @@ -49,7 +49,7 @@ Build-Info: - ✅ : Wenn NeuerAuftrag gewählt wie gehts weiter? [FormAusschlager.cs] -=== 🔄 OFFENE TODOs (20) === +=== 🔄 OFFENE TODOs (21) === - 🔄 Alle Icons in einer Spalte anzeigen? I für Anmerkung und ! für Aufgabe?? [FormExpedit.cs] - 🔄 Alle Icons in einer Spalte anzeigen? I für Anmerkung und ! für Aufgabe?? [FormMain.cs] - 🔄 Artikel Update weiter testen und programmieren. Für ArtikelKurzliste ausprogrammieren. [FormMain.cs] @@ -63,6 +63,7 @@ Build-Info: - 🔄 LadenScreen anzeigen etc. [FormMain.cs] - 🔄 Nach Test und Rücksprache eventuell wieder umbauen. Benutzer.Rolle etc. [FormFehlmengeCount.cs] - 🔄 Settings hier ändern auf UserSettingsManager Klasse. [FormEinstellung.cs] +- 🔄 Spalten besser erkennbar gestalten damit Mirka die Spalte trifft wenn RechtsClick. [FormExpedit.cs] - 🔄 Testen ob Get_ArtikelKurzliste funktioniert. [FormMain.cs] - 🔄 Testen ob SWS-QRCodes gelesen werden können. Nur notwendig bis alle SWS-QRCodes richtig gedruckt und gelesen werden. [Kunde.cs] - 🔄 Überlegen ob das der richtige Weg ist. Eventuell in Expedit sowohl KundeAufgabe wie auch AuftragAufgabe anzeigen? NOTWENDIG? [FormNeuerAuftrag.cs] @@ -71,5 +72,5 @@ Build-Info: - 🔄 Weitere Properties von oben hier zuweisen [UserSettingsManager.cs] - 🔄 Wenn Nachwäsche oder Müllwäsche alle Artikel anzeigen. [FormFehlmengeCount.cs] -Installation: 16.12.2025 16:57 +Installation: 18.12.2025 17:03 =====================================