From a8c785fd41feaaefa8a9d12432216ef8abda6a69 Mon Sep 17 00:00:00 2001 From: Kilian Wirl Date: Thu, 18 Dec 2025 18:31:43 +0100 Subject: [PATCH 1/2] 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 ===================================== From e2f0d9b410add197cc3cdefcc34501b93a10f2cb Mon Sep 17 00:00:00 2001 From: Kilian Wirl Date: Fri, 19 Dec 2025 11:24:16 +0100 Subject: [PATCH 2/2] =?UTF-8?q?FormMain=20-=20Buttons=20hinzugef=C3=BCgt?= =?UTF-8?q?=20f=C3=BCr=20Inventur=20und=20Standveraenderung.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AA-Forms/FormExpedit.cs | 3 +- AA-Forms/FormListe.cs | 8 +- AA-Forms/FormMain.Designer.cs | 116 ++++++++++++++++++++--------- AA-Forms/FormMain.cs | 73 +++++++++++++----- AA-Forms/FormNeuerAuftrag.cs | 134 +++++++++++++++++++--------------- AA-Klassen/Kunde.cs | 3 +- Program.cs | 2 +- Verwaltung_ReadMe.txt | 25 ++++--- 8 files changed, 232 insertions(+), 132 deletions(-) diff --git a/AA-Forms/FormExpedit.cs b/AA-Forms/FormExpedit.cs index 95afef9..7ceff18 100644 --- a/AA-Forms/FormExpedit.cs +++ b/AA-Forms/FormExpedit.cs @@ -414,7 +414,7 @@ namespace Deckungsbeitrag } private void buttonNeuerAuftrag_Click(object sender, EventArgs e) { - FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(benutzer, this.letzterLiefertag); + FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(benutzer, this.letzterLiefertag, AuftragTyp.Standart); if (neuerAuftrag.ShowDialog() == DialogResult.OK) { this.letzterLiefertag = neuerAuftrag.letzterLiefertag; @@ -953,6 +953,7 @@ namespace Deckungsbeitrag } //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) +//CHANGES: Es werden jetzt Meldungen gezeigt damit Aufgaben erledigt und Containeranzahl zuverlässig 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/FormListe.cs b/AA-Forms/FormListe.cs index 901d8ab..b81b9aa 100644 --- a/AA-Forms/FormListe.cs +++ b/AA-Forms/FormListe.cs @@ -72,7 +72,7 @@ namespace Deckungsbeitrag } if(this.type_of_list == (int)Listentyp.Kundenliste) { - this.Kundenliste = objliste.OfType().GroupBy(k => k.KundeID).Select(g => g.First()).ToList(); + if (objliste != null) this.Kundenliste = objliste.OfType().GroupBy(k => k.KundeID).Select(g => g.First()).ToList(); } } #endregion @@ -118,7 +118,7 @@ namespace Deckungsbeitrag } //KUNDEN LADEN this.Text = "KUNDE WÄHLEN"; - if (this.Kundenliste == null) this.Kundenliste = Kunde.GetTmpList(textBoxKunde.Text); + if (this.Kundenliste == null) this.Kundenliste = Kunde.GetTmpList(string.Empty); foreach (Kunde kunde in this.Kundenliste) { ListViewItem item = new ListViewItem(); @@ -225,7 +225,7 @@ namespace Deckungsbeitrag private void TextBoxKunde_Enter(object sender, EventArgs e) { this.textBoxKunde.ForeColor = Color.Black; - + this.textBoxKunde.Clear(); //GetKeyboard(); } private void textBoxKunde_TextChanged(object sender, EventArgs e) @@ -241,7 +241,7 @@ namespace Deckungsbeitrag // Wenn kein Fragezeichen am Anfang wird Kundenliste erstellt. if (!textBoxKunde.Text.StartsWith("?")) { - if(this.Kundenliste == null) this.Kundenliste = Kunde.GetTmpList(this.textBoxKunde.Text); + this.Kundenliste = Kunde.GetTmpList(this.textBoxKunde.Text); listViewKunde_Load(); } diff --git a/AA-Forms/FormMain.Designer.cs b/AA-Forms/FormMain.Designer.cs index 1e56766..05558d8 100644 --- a/AA-Forms/FormMain.Designer.cs +++ b/AA-Forms/FormMain.Designer.cs @@ -46,6 +46,7 @@ namespace Deckungsbeitrag this.tSBEinstellung = new System.Windows.Forms.ToolStripButton(); this.toolStripBeenden = new System.Windows.Forms.ToolStripButton(); this.panelMain = new System.Windows.Forms.Panel(); + this.buttonNeueAufgabe = new System.Windows.Forms.Button(); this.buttonNeuerUser = new System.Windows.Forms.Button(); this.groupBoxStatistik = new System.Windows.Forms.GroupBox(); this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); @@ -84,7 +85,8 @@ namespace Deckungsbeitrag this.textBoxScannTest = new System.Windows.Forms.TextBox(); this.buttonScannTest = new System.Windows.Forms.Button(); this.labelScannTest = new System.Windows.Forms.Label(); - this.buttonNeueAufgabe = new System.Windows.Forms.Button(); + this.buttonNeueInventur = new System.Windows.Forms.Button(); + this.buttonNeuerStand = new System.Windows.Forms.Button(); this.toolStripMenu.SuspendLayout(); this.panelMain.SuspendLayout(); this.groupBoxStatistik.SuspendLayout(); @@ -400,16 +402,18 @@ namespace Deckungsbeitrag // this.panelMain.AllowDrop = true; this.panelMain.BackColor = System.Drawing.Color.White; + this.panelMain.Controls.Add(this.buttonNeuerStand); + this.panelMain.Controls.Add(this.buttonNeueInventur); this.panelMain.Controls.Add(this.buttonNeueAufgabe); + this.panelMain.Controls.Add(this.buttonNeuerAuftrag); this.panelMain.Controls.Add(this.buttonNeuerUser); this.panelMain.Controls.Add(this.groupBoxStatistik); this.panelMain.Controls.Add(this.groupBoxUpdate); - this.panelMain.Controls.Add(this.buttonNeuerAuftrag); this.panelMain.Controls.Add(this.groupBoxAuftrag); this.panelMain.Controls.Add(this.groupBoxScannTest); this.panelMain.Dock = System.Windows.Forms.DockStyle.Right; this.panelMain.Location = new System.Drawing.Point(218, 0); - this.panelMain.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.panelMain.Margin = new System.Windows.Forms.Padding(2); this.panelMain.Name = "panelMain"; this.panelMain.Size = new System.Drawing.Size(938, 689); this.panelMain.TabIndex = 5; @@ -417,6 +421,27 @@ namespace Deckungsbeitrag this.panelMain.DragEnter += new System.Windows.Forms.DragEventHandler(this.panelMain_DragEnter); this.panelMain.Paint += new System.Windows.Forms.PaintEventHandler(this.panelMain_Paint); // + // buttonNeueAufgabe + // + this.buttonNeueAufgabe.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); + this.buttonNeueAufgabe.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.buttonNeueAufgabe.FlatAppearance.BorderSize = 0; + this.buttonNeueAufgabe.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonNeueAufgabe.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonNeueAufgabe.ForeColor = System.Drawing.Color.Black; + this.buttonNeueAufgabe.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; + this.buttonNeueAufgabe.Location = new System.Drawing.Point(8, 107); + this.buttonNeueAufgabe.Margin = new System.Windows.Forms.Padding(5); + this.buttonNeueAufgabe.Name = "buttonNeueAufgabe"; + this.buttonNeueAufgabe.Size = new System.Drawing.Size(250, 41); + this.buttonNeueAufgabe.TabIndex = 63; + this.buttonNeueAufgabe.Text = "Neue Aufgabe"; + this.buttonNeueAufgabe.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.buttonNeueAufgabe.UseVisualStyleBackColor = false; + this.buttonNeueAufgabe.Click += new System.EventHandler(this.buttonNeueAufgabe_Click); + this.buttonNeueAufgabe.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Button_MouseDown); + this.buttonNeueAufgabe.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Button_MouseMove); + // // buttonNeuerUser // this.buttonNeuerUser.BackColor = System.Drawing.Color.Yellow; @@ -426,10 +451,10 @@ namespace Deckungsbeitrag this.buttonNeuerUser.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonNeuerUser.ForeColor = System.Drawing.Color.Black; this.buttonNeuerUser.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.buttonNeuerUser.Location = new System.Drawing.Point(8, 65); - this.buttonNeuerUser.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.buttonNeuerUser.Location = new System.Drawing.Point(8, 56); + this.buttonNeuerUser.Margin = new System.Windows.Forms.Padding(5); this.buttonNeuerUser.Name = "buttonNeuerUser"; - this.buttonNeuerUser.Size = new System.Drawing.Size(200, 41); + this.buttonNeuerUser.Size = new System.Drawing.Size(250, 41); this.buttonNeuerUser.TabIndex = 62; this.buttonNeuerUser.Text = "Neuer User"; this.buttonNeuerUser.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; @@ -696,7 +721,7 @@ namespace Deckungsbeitrag this.buttonSortimentUpdate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonSortimentUpdate.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.buttonSortimentUpdate.Location = new System.Drawing.Point(2, 32); - this.buttonSortimentUpdate.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.buttonSortimentUpdate.Margin = new System.Windows.Forms.Padding(2); this.buttonSortimentUpdate.Name = "buttonSortimentUpdate"; this.buttonSortimentUpdate.Size = new System.Drawing.Size(137, 24); this.buttonSortimentUpdate.TabIndex = 61; @@ -711,7 +736,7 @@ namespace Deckungsbeitrag this.buttonArtikelUpdate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonArtikelUpdate.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.buttonArtikelUpdate.Location = new System.Drawing.Point(2, 2); - this.buttonArtikelUpdate.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.buttonArtikelUpdate.Margin = new System.Windows.Forms.Padding(2); this.buttonArtikelUpdate.Name = "buttonArtikelUpdate"; this.buttonArtikelUpdate.Size = new System.Drawing.Size(137, 24); this.buttonArtikelUpdate.TabIndex = 59; @@ -734,7 +759,7 @@ namespace Deckungsbeitrag this.buttonAllUpdate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonAllUpdate.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.buttonAllUpdate.Location = new System.Drawing.Point(2, 62); - this.buttonAllUpdate.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.buttonAllUpdate.Margin = new System.Windows.Forms.Padding(2); this.buttonAllUpdate.Name = "buttonAllUpdate"; this.buttonAllUpdate.Size = new System.Drawing.Size(137, 25); this.buttonAllUpdate.TabIndex = 60; @@ -752,10 +777,10 @@ namespace Deckungsbeitrag 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.White; this.buttonNeuerAuftrag.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.buttonNeuerAuftrag.Location = new System.Drawing.Point(8, 9); - this.buttonNeuerAuftrag.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.buttonNeuerAuftrag.Location = new System.Drawing.Point(8, 5); + this.buttonNeuerAuftrag.Margin = new System.Windows.Forms.Padding(5); this.buttonNeuerAuftrag.Name = "buttonNeuerAuftrag"; - this.buttonNeuerAuftrag.Size = new System.Drawing.Size(200, 41); + this.buttonNeuerAuftrag.Size = new System.Drawing.Size(250, 41); this.buttonNeuerAuftrag.TabIndex = 56; this.buttonNeuerAuftrag.Text = "Neuer Auftrag"; this.buttonNeuerAuftrag.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; @@ -891,7 +916,7 @@ namespace Deckungsbeitrag this.buttonAufAbruf.ForeColor = System.Drawing.Color.White; this.buttonAufAbruf.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.buttonAufAbruf.Location = new System.Drawing.Point(10, 215); - this.buttonAufAbruf.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.buttonAufAbruf.Margin = new System.Windows.Forms.Padding(2); this.buttonAufAbruf.Name = "buttonAufAbruf"; this.buttonAufAbruf.Size = new System.Drawing.Size(150, 41); this.buttonAufAbruf.TabIndex = 56; @@ -911,7 +936,7 @@ namespace Deckungsbeitrag this.buttonAusgeliefert.ForeColor = System.Drawing.Color.White; this.buttonAusgeliefert.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.buttonAusgeliefert.Location = new System.Drawing.Point(10, 170); - this.buttonAusgeliefert.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.buttonAusgeliefert.Margin = new System.Windows.Forms.Padding(2); this.buttonAusgeliefert.Name = "buttonAusgeliefert"; this.buttonAusgeliefert.Size = new System.Drawing.Size(150, 41); this.buttonAusgeliefert.TabIndex = 55; @@ -978,26 +1003,47 @@ namespace Deckungsbeitrag this.labelScannTest.Text = "label1"; this.labelScannTest.Visible = false; // - // buttonNeueAufgabe + // buttonNeueInventur // - this.buttonNeueAufgabe.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128))))); - this.buttonNeueAufgabe.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); - this.buttonNeueAufgabe.FlatAppearance.BorderSize = 0; - this.buttonNeueAufgabe.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonNeueAufgabe.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonNeueAufgabe.ForeColor = System.Drawing.Color.Black; - this.buttonNeueAufgabe.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.buttonNeueAufgabe.Location = new System.Drawing.Point(8, 124); - this.buttonNeueAufgabe.Margin = new System.Windows.Forms.Padding(2); - this.buttonNeueAufgabe.Name = "buttonNeueAufgabe"; - this.buttonNeueAufgabe.Size = new System.Drawing.Size(200, 41); - this.buttonNeueAufgabe.TabIndex = 63; - this.buttonNeueAufgabe.Text = "Neue Aufgabe"; - this.buttonNeueAufgabe.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.buttonNeueAufgabe.UseVisualStyleBackColor = false; - this.buttonNeueAufgabe.Click += new System.EventHandler(this.buttonNeueAufgabe_Click); - this.buttonNeueAufgabe.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Button_MouseDown); - this.buttonNeueAufgabe.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Button_MouseMove); + this.buttonNeueInventur.BackColor = System.Drawing.Color.Green; + this.buttonNeueInventur.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.buttonNeueInventur.FlatAppearance.BorderSize = 0; + this.buttonNeueInventur.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonNeueInventur.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonNeueInventur.ForeColor = System.Drawing.Color.White; + this.buttonNeueInventur.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; + this.buttonNeueInventur.Location = new System.Drawing.Point(268, 5); + this.buttonNeueInventur.Margin = new System.Windows.Forms.Padding(5); + this.buttonNeueInventur.Name = "buttonNeueInventur"; + this.buttonNeueInventur.Size = new System.Drawing.Size(250, 41); + this.buttonNeueInventur.TabIndex = 64; + this.buttonNeueInventur.Text = "Neue Inventur"; + this.buttonNeueInventur.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.buttonNeueInventur.UseVisualStyleBackColor = false; + this.buttonNeueInventur.Click += new System.EventHandler(this.buttonNeueInventur_Click); + this.buttonNeueInventur.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Button_MouseDown); + this.buttonNeueInventur.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Button_MouseMove); + // + // buttonNeuerStand + // + this.buttonNeuerStand.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0))))); + this.buttonNeuerStand.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.buttonNeuerStand.FlatAppearance.BorderSize = 0; + this.buttonNeuerStand.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonNeuerStand.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonNeuerStand.ForeColor = System.Drawing.Color.White; + this.buttonNeuerStand.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; + this.buttonNeuerStand.Location = new System.Drawing.Point(528, 5); + this.buttonNeuerStand.Margin = new System.Windows.Forms.Padding(5); + this.buttonNeuerStand.Name = "buttonNeuerStand"; + this.buttonNeuerStand.Size = new System.Drawing.Size(250, 41); + this.buttonNeuerStand.TabIndex = 65; + this.buttonNeuerStand.Text = "Neue Standveränderung"; + this.buttonNeuerStand.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.buttonNeuerStand.UseVisualStyleBackColor = false; + this.buttonNeuerStand.Click += new System.EventHandler(this.buttonNeuerStand_Click); + this.buttonNeuerStand.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Button_MouseDown); + this.buttonNeuerStand.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Button_MouseMove); // // FormMain // @@ -1009,7 +1055,7 @@ namespace Deckungsbeitrag this.Controls.Add(this.panelMain); this.HelpButton = true; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "FormMain"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Wolfgang Wirl GmbH - GRUNDPROGRAMM"; @@ -1094,6 +1140,8 @@ namespace Deckungsbeitrag private System.Windows.Forms.DateTimePicker dateTimePicker1; private System.Windows.Forms.Button buttonNeuerUser; private System.Windows.Forms.Button buttonNeueAufgabe; + private System.Windows.Forms.Button buttonNeueInventur; + private System.Windows.Forms.Button buttonNeuerStand; } } diff --git a/AA-Forms/FormMain.cs b/AA-Forms/FormMain.cs index 696de75..53578b0 100644 --- a/AA-Forms/FormMain.cs +++ b/AA-Forms/FormMain.cs @@ -47,7 +47,8 @@ namespace Deckungsbeitrag public FormMain(Benutzer benutzer) : this() { this.benutzer = benutzer; - //AKTIVE ELEMENTE JE BENUTZER ROLLE + + // AKTIVE ELEMENTE JE BENUTZER ROLLE switch (benutzer.Rolle) { case BenutzerRolle.Verwaltung: @@ -55,12 +56,21 @@ namespace Deckungsbeitrag this.groupBoxUpdate.Visible = this.toolStripDB.Visible = this.toolStripButtonImport.Visible = this.tSBExpedit.Enabled = false; break; case BenutzerRolle.Fahrer: + + // ToolStripButtons werden deaktiviert. foreach(ToolStripButton tsb in this.toolStripMenu.Items) { + // Ausgewählter ToolStripButton bleibt aktiv. if(!tsb.Name.Contains("Auftrag")) tsb.Enabled = false; } - this.groupBoxStatistik.Enabled = this.buttonNeueAufgabe.Enabled = this.buttonNeuerUser.Enabled = false; - this.groupBoxStatistik.Visible = this.buttonNeueAufgabe.Visible = this.buttonNeuerUser.Visible = this.groupBoxUpdate.Visible = false; + + // Controls im PanelMain werden deaktiviert. + foreach(Control ctr in this.panelMain.Controls) + { + // Ausgewählte Buttons bleiben aktiv. + if (ctr.Text == "Neuer Auftrag") ctr.Enabled = ctr.Visible = true; + else ctr.Enabled = ctr.Visible = false; + } break; case BenutzerRolle.Admin: this.groupBoxUpdate.Visible = false; @@ -94,7 +104,7 @@ namespace Deckungsbeitrag if (ctr.GetType() == typeof(GroupBox)) { GroupBox gb = (GroupBox)ctr; - if(!gb.Name.Contains("Update") & !gb.Name.Contains("Statistik")) + if(!gb.Name.Contains("Update") & !gb.Name.Contains("Statistik") & !gb.Name.Contains("Neuer")) { gb.Visible = false; gb.Location = new Point(0, 0); @@ -263,7 +273,7 @@ namespace Deckungsbeitrag /// private void buttonNeuerAuftrag_Click(object sender, EventArgs e) { - FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.benutzer); neuerAuftrag.ShowDialog(); + FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.benutzer, AuftragTyp.Standart); neuerAuftrag.ShowDialog(); } private void buttonScannTest_Click(object sender, EventArgs e) { @@ -271,13 +281,43 @@ namespace Deckungsbeitrag int pos = s.IndexOf('#'); this.textBoxScannTest.Text = this.labelScannTest.Text = s.Substring(pos + 1); } + private void buttonNeueAufgabe_Click(object sender, EventArgs e) + { + FormNeueAufgabe neueAufgabe = new FormNeueAufgabe(); + neueAufgabe.ShowDialog(); + } + private void buttonNeuerStand_Click(object sender, EventArgs e) + { + FormNeuerAuftrag neuerAuftrag; + DialogResult result = meldung.GetFrage(this, "Möchtest du eine Standverminderung oder Standerhöhung erstellen? \n\n [JA = Standverminerung | NEIN = Standerhöhung]", true); - /// - /// Scan QR-Code Test. - /// - /// - /// - private void textBoxScannTest_TextChanged(object sender, EventArgs e) + switch (result) + { + case DialogResult.Cancel: + return; + case DialogResult.Yes: + neuerAuftrag = new FormNeuerAuftrag(this.benutzer, AuftragTyp.Standverminderung); neuerAuftrag.ShowDialog(); + break; + case DialogResult.No: + neuerAuftrag = new FormNeuerAuftrag(this.benutzer, AuftragTyp.Standerhöhung); neuerAuftrag.ShowDialog(); + break; + default: + break; + } + } + + private void buttonNeueInventur_Click(object sender, EventArgs e) + { + FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.benutzer, AuftragTyp.Inventur); neuerAuftrag.ShowDialog(); + } + + + /// + /// Scan QR-Code Test. + /// + /// + /// + private void textBoxScannTest_TextChanged(object sender, EventArgs e) { TextBox textBox1 = (TextBox)sender; using (Graphics g = textBox1.CreateGraphics()) @@ -982,14 +1022,9 @@ namespace Deckungsbeitrag } } - private void buttonNeueAufgabe_Click(object sender, EventArgs e) - { - FormNeueAufgabe neueAufgabe = new FormNeueAufgabe(); - neueAufgabe.ShowDialog(); - } } } -//DONE: Wenn Fahrer registriert kann nur NeuerAuftrag aufgerufen werden. Dort kann er Aufträge erstellen mit dem Status "Abgeholt" (Wichtig für Auftragauswahl bei Waschstraße) -//DONE: Wenn Fahrer Auftragverwaltung öffnet werden Aufträge mit AuftragStatus "Fertig" angezeigt. Fahrer können dann als "Ausgeliefert" markieren. //CHANGES: Fahrer können abgeholte Aufträge erstellen und ausgelieferte Aufträge markieren. -//CHANGES: Auftragverwaltung Spalten wurden aktualisiert. Mit Icons, Buttons und Sortierung auf Liefertag. \ No newline at end of file +//CHANGES: Auftragverwaltung Spalten wurden aktualisiert. Mit Icons, Buttons und Sortierung auf Liefertag. +//DONE: 2 neue Buttons für "Neue Inventur" und "Neue Standveränderung" +//DONE: Bei Fahrer neue Deaktivierung von Controls. \ No newline at end of file diff --git a/AA-Forms/FormNeuerAuftrag.cs b/AA-Forms/FormNeuerAuftrag.cs index 18729b7..34d31ee 100644 --- a/AA-Forms/FormNeuerAuftrag.cs +++ b/AA-Forms/FormNeuerAuftrag.cs @@ -20,7 +20,8 @@ namespace Deckungsbeitrag { public partial class FormNeuerAuftrag : Form { - public Meldungen meldung = new Meldungen(); + #region Properties + public Meldungen meldung = new Meldungen(); public Kunde kunde; public Auftrag Auftrag; public Auftrag extraAuftrag; @@ -34,7 +35,10 @@ namespace Deckungsbeitrag private Kunde knd; public DataGridViewCell aktivCell; private string userid; + private AuftragTyp auftragtyp = AuftragTyp.Standart; + #endregion + #region Form-Konstruktor public FormNeuerAuftrag() { InitializeComponent(); @@ -44,7 +48,11 @@ namespace Deckungsbeitrag this.benutzer = benutzer; } - public FormNeuerAuftrag(Benutzer benutzer, DateTime? letzterLiefertag) : this(benutzer) + public FormNeuerAuftrag(Benutzer benutzer, AuftragTyp auftragTyp) : this(benutzer) + { + this.auftragtyp = auftragTyp; + } + public FormNeuerAuftrag(Benutzer benutzer, DateTime? letzterLiefertag, AuftragTyp auftragTyp) : this(benutzer, auftragTyp) { this.letzterLiefertag = letzterLiefertag; } @@ -54,7 +62,7 @@ namespace Deckungsbeitrag if (userid.Contains("wstrasse01")) this.benutzer = Benutzer.GetBenutzer("ws1", null); if (userid.Contains("wstrasse02")) this.benutzer = Benutzer.GetBenutzer("ws2", null); } - + #endregion private void FormNeuerAuftrag_Load(object sender, EventArgs e) { // SortimentListe holen @@ -63,7 +71,7 @@ namespace Deckungsbeitrag // Kunde holen this.kunde = Funktionen.KundenAuswahl(); - // ComboBox Laden unbeding vor Daten Laden. + // ComboBox AuftragTyp wird geladen und richtiges Item selected. comboBox_Load(); // Falls KundenAuswahl null liefert wird Form geschlossen oder wenn Waschstrasse neu geladen. @@ -85,34 +93,6 @@ namespace Deckungsbeitrag // RadioButtons und ComboBoxen laden. if(this.kunde != null) Funktionen.Get_RadioButtons(this); - //Unterscheidung zwischen BenutzerRollen. Verschiedene Controls werden gesperrt, angezeigt oder verändert - if (this.benutzer != null) - { - if (this.benutzer.Rolle == BenutzerRolle.Verwaltung || this.benutzer.Rolle == BenutzerRolle.Admin || this.benutzer.Rolle == BenutzerRolle.Master) - { - if((AuftragTyp)comboBoxTyp.SelectedItem != AuftragTyp.Geschäft) - { - 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 - { - this.comboBoxTyp.Enabled = false; - this.dGArtikel.Enabled = this.dGArtikel.Visible = false; - this.Width = textBoxKundeName.Right + 10; - this.Height = 405; - this.comboBoxTyp.SelectedIndex = 1; - } } @@ -126,19 +106,21 @@ namespace Deckungsbeitrag else this.textBoxKundeName.Text = kunde.Suchtext; if (letzterLiefertag.HasValue) this.dTPLiefertag.Value = letzterLiefertag.Value; else this.dTPLiefertag.Value = DateTime.Today.AddDays(1); - if (kunde.Service == "Geschäft") - { - this.comboBoxTyp.SelectedItem = AuftragTyp.Geschäft; - this.comboBoxTyp.Enabled = false; - } - - + dTPLiefertag_Leave(this.dTPLiefertag, EventArgs.Empty); textBoxCont_TextChanged(this.textBoxCont, EventArgs.Empty); } private void comboBox_Load() { + // Items werden von AuftragTyp geladen. this.comboBoxTyp.DataSource = Enum.GetValues(typeof(AuftragTyp)); + + //TODO: Wenn kunde null dann return. + // Wenn der Kunde ein Geschäftskunde ist, wird AuftragTyp.Geschäft ausgewählt. Andernfalls wird der AuftragTyp aus dem Konstruktor gewählt. + if (kunde.Service == "Geschäft") this.comboBoxTyp.SelectedItem = AuftragTyp.Geschäft; + else this.comboBoxTyp.SelectedItem = auftragtyp; + + this.comboBoxTyp.Enabled = false; } private void Load_Gridview(string kundeid, AuftragTyp auftragTyp) { @@ -486,29 +468,61 @@ namespace Deckungsbeitrag private void comboBoxTyp_SelectedValueChanged(object sender, EventArgs e) { - if((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Inventur) + switch ((AuftragTyp)comboBoxTyp.SelectedValue) { - if (this.kunde != null) Load_Gridview(this.kunde.KundeID.ToString(), (AuftragTyp)comboBoxTyp.SelectedValue); - this.dGArtikel.Enabled = this.dGArtikel.Visible = true; - this.Width = this.dGArtikel.Right + 25; - this.Height = this.dGArtikel.Bottom + this.buttonSpeichern.Height + 60; - } - if ((AuftragTyp)comboBoxTyp.SelectedValue >= AuftragTyp.Standerhöhung) - { - if (this.kunde != null) Load_Gridview(this.kunde.KundeID.ToString(), (AuftragTyp)comboBoxTyp.SelectedValue); - this.dGArtikel.Enabled = this.dGArtikel.Visible = true; - this.Width = this.dGArtikel.Right + 25; - this.Height = this.dGArtikel.Bottom + this.buttonSpeichern.Height + 60; - } - if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Standart) - { - this.dGArtikel.Enabled = this.dGArtikel.Visible = false; - this.Width = textBoxKundeName.Right + 30; - this.Height = 405; + case AuftragTyp.Geschäft: // Wird derzeit wenig verwendet da die Auswahl in DatenLaden nach KundenService erfolgt. + this.dGArtikel.Enabled = this.dGArtikel.Visible = false; + this.Width = textBoxKundeName.Right + 30; + this.Height = 405; + break; + case AuftragTyp.Standart: + this.dGArtikel.Enabled = this.dGArtikel.Visible = false; + this.Width = textBoxKundeName.Right + 30; + this.Height = 405; + break; + case AuftragTyp.Inventur: + if (this.kunde != null) Load_Gridview(this.kunde.KundeID.ToString(), (AuftragTyp)comboBoxTyp.SelectedValue); + this.dGArtikel.Enabled = this.dGArtikel.Visible = true; + this.Width = this.dGArtikel.Right + 25; + this.Height = this.dGArtikel.Bottom + this.buttonSpeichern.Height + 60; + break; + case AuftragTyp.Standerhöhung: + if (this.kunde != null) Load_Gridview(this.kunde.KundeID.ToString(), (AuftragTyp)comboBoxTyp.SelectedValue); + this.dGArtikel.Enabled = this.dGArtikel.Visible = true; + this.Width = this.dGArtikel.Right + 25; + this.Height = this.dGArtikel.Bottom + this.buttonSpeichern.Height + 60; + break; + case AuftragTyp.Standverminderung: + if (this.kunde != null) Load_Gridview(this.kunde.KundeID.ToString(), (AuftragTyp)comboBoxTyp.SelectedValue); + this.dGArtikel.Enabled = this.dGArtikel.Visible = true; + this.Width = this.dGArtikel.Right + 25; + this.Height = this.dGArtikel.Bottom + this.buttonSpeichern.Height + 60; + break; + default: + break; } + + //if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Inventur) + //{ + // if (this.kunde != null) Load_Gridview(this.kunde.KundeID.ToString(), (AuftragTyp)comboBoxTyp.SelectedValue); + // this.dGArtikel.Enabled = this.dGArtikel.Visible = true; + // this.Width = this.dGArtikel.Right + 25; + // this.Height = this.dGArtikel.Bottom + this.buttonSpeichern.Height + 60; + //} + //if ((AuftragTyp)comboBoxTyp.SelectedValue >= AuftragTyp.Standerhöhung) + //{ + // if (this.kunde != null) Load_Gridview(this.kunde.KundeID.ToString(), (AuftragTyp)comboBoxTyp.SelectedValue); + // this.dGArtikel.Enabled = this.dGArtikel.Visible = true; + // this.Width = this.dGArtikel.Right + 25; + // this.Height = this.dGArtikel.Bottom + this.buttonSpeichern.Height + 60; + //} + //if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Standart) + //{ + // this.dGArtikel.Enabled = this.dGArtikel.Visible = false; + // this.Width = textBoxKundeName.Right + 30; + // this.Height = 405; + //} } } } -//DONE: AuftragStatus mit Switch nach BenutzerRolle ermöglichen. -//DONE: FahrerAufträge erhalten Status "Abgeholt". -//DONE: Wenn der Auftrag nicht gefunden wird, wird neuer Auftrag erstellt und mit Status "Aufgelegt" versehen. \ No newline at end of file +//CHANGES: NeuerAuftrag wird jetzt mit Propertie AuftragTyp aufgerufen. Dadurch ist die Auswahl des AuftragTyp konstanter. \ No newline at end of file diff --git a/AA-Klassen/Kunde.cs b/AA-Klassen/Kunde.cs index 65f6807..752e991 100644 --- a/AA-Klassen/Kunde.cs +++ b/AA-Klassen/Kunde.cs @@ -24,7 +24,8 @@ namespace DatenDB } // LEER public static List GetTmpList(string text) { - bool endsWithSpecial = !char.IsLetterOrDigit(text[text.Length-1]); + bool endsWithSpecial = false; + if(!string.IsNullOrWhiteSpace(text)) endsWithSpecial = !char.IsLetterOrDigit(text[text.Length-1]); DatenbankConnection.GetConnection().Open(); List resultList = new List(); using (NpgsqlCommand command = new NpgsqlCommand()) diff --git a/Program.cs b/Program.cs index 46d0127..09402db 100644 --- a/Program.cs +++ b/Program.cs @@ -99,7 +99,7 @@ namespace Deckungsbeitrag Application.Run(new FormMain(loginForm.Person)); break; case BenutzerRolle.Waschstrasse: //Bediener einer Waschstraße - Application.Run(new FormNeuerAuftrag(loginForm.Person)); + Application.Run(new FormNeuerAuftrag(loginForm.Person, AuftragTyp.Standart)); break; case BenutzerRolle.Master: //Entwickler oder Claudia und Kevin Application.Run(new FormMain(loginForm.Person)); diff --git a/Verwaltung_ReadMe.txt b/Verwaltung_ReadMe.txt index 5c96b4b..191bfd2 100644 --- a/Verwaltung_ReadMe.txt +++ b/Verwaltung_ReadMe.txt @@ -6,33 +6,34 @@ Build-Info: - Build-Typ: Release Build - Erledigte TODOs: 19 - Offene TODOs: 21 -- Install-Reminders: 5 -- Changes: 7 +- Install-Reminders: 3 +- Changes: 10 -=== ⚙️ INSTALL-REMINDER (5) === +=== ⚙️ INSTALL-REMINDER (3) === - ⚙️ AufgabeErledigt als Spalte in DB hinzufügen. [Auftrag.cs] - ⚙️ AufgabeID als Spalte in DB hinzufügen. [Auftrag.cs] - ⚙️ Spalte Aktiv in DB einfügen. [Aufgabe.cs] -- ⚙️ Spalte Anmerkung in DB hinzufügen. [Kunde.cs] -- ⚙️ Spalte Aufgabe Count in DB hinzufügen. [Kunde.cs] -=== ✨ CHANGES (7) === +=== ✨ CHANGES (10) === - ✨ Aufleger muss keine Aufträge mehr erstellen da Fahrer das machen können. [FormWSVerfolgung.cs] - ✨ Auftragsliste zeigt hier nur AuftragStatus "Abgeholt" Aufträge. [FormWSVerfolgung.cs] - ✨ Auftragverwaltung Spalten wurden aktualisiert. Mit Icons, Buttons und Sortierung auf Liefertag. [FormMain.cs] - ✨ Die Liste zeigt jetzt auch die Aufträge und die Kunden der möglich Aufträge an. (Erleichtert die Kundenauswahl bei Fehlmengecount) [FormListe.cs] +- ✨ Es werden jetzt Meldungen gezeigt damit Aufgaben erledigt und Containeranzahl zuverlässig stimmt. [FormExpedit.cs] - ✨ Fahrer können abgeholte Aufträge erstellen und ausgelieferte Aufträge markieren. [FormMain.cs] -- ✨ Statistik für Expedit. (Same as in Main) [FormExpedit.cs] +- ✨ NeuerAuftrag wird jetzt mit Propertie AuftragTyp aufgerufen. Dadurch ist die Auswahl des AuftragTyp konstanter. [FormNeuerAuftrag.cs] +- ✨ Wenn Auftrag als Vorbereitet markiert wird, wird nachgefragt ob die Aufgabe erledigt wurde. [FormExpedit.cs] - ✨ Wenn Auftrag nicht gefunden kann er trotzdem einen neuen Erstellen. [FormWSVerfolgung.cs] +- ✨ Wenn saubere Container sind 0 kann Auftrag nicht als Vorbereitet markiert werden. (Damit die Statistik stimmt) [FormExpedit.cs] === ✅ ERLEDIGTE TODOs (19) === - ✅ : Auch wenn Extra Auftrag benötigt wird funktioniert es über die Auftragsliste. [FormWSVerfolgung.cs] +- ✅ : Aufgabe wird bei "Vorbereiten ohne Etikett" verarbeitet. [FormExpedit.cs] +- ✅ : Auftrag als Vorbereitet markieren geht nur wenn saubere Container nicht 0 sind. [FormExpedit.cs] - ✅ : Auftrag über FormListe holen und daraus den Kunden für Fehlmenge holen. [FormFehlmengeCount.cs] -- ✅ : AuftragStatus mit Switch nach BenutzerRolle ermöglichen. [FormNeuerAuftrag.cs] - ✅ : Bei Transport wir ein Fach mit Aktuellem Auftrag erstellt. Das Alte wird bei Transport gespeichert. [FormAusschlager.cs] -- ✅ : FahrerAufträge erhalten Status "Abgeholt". [FormNeuerAuftrag.cs] - ✅ : Kunde anzeigen Reihenfolge der Spalten zuerst Suchtext danach Name. [FormListe.cs] - ✅ : Listentyp.Auftragliste implementiert um über FormWSVerfolgung die Auftragliste abrufen zu können. [FormListe.cs] - ✅ : Logik überlegen wie ein bearbeiteter Auftrag nicht doppelt gewählt werden kann. (Abteilungen zu Auftrag hinzufügen und bei Ausschlager Druck definieren?) [FormFehlmengeCount.cs] @@ -40,8 +41,8 @@ Build-Info: - ✅ : Neuer Konstruktor für Auftragliste "Finishing" oder "Aufgelegt". (aufgelegte Aufträge die noch nicht [Auftrag.cs] - ✅ : Neuer Konstruktor für Auftragliste "Rampe". (abgeholte Aufträge die noch nicht aufgelegt sind) [Auftrag.cs] - ✅ : Nur die Kunden der Aufträge als Liste anzeigen wäre möglich. Macht die Auswahl für das Personal einfacher weil 90% bereits weg fallen. [FormFehlmengeCount.cs] +- ✅ : Spalten besser erkennbar gestalten damit Mirka die Spalte trifft wenn RechtsClick. [FormExpedit.cs] - ✅ : Statt Neuen Auftrag wird Auftragsliste mit Status "abgeholt" angezeigt. Dadurch muss Aufleger weder scannen noch Namen eintippen und suchen. [FormWSVerfolgung.cs] -- ✅ : Wenn der Auftrag nicht gefunden wird, wird neuer Auftrag erstellt und mit Status "Aufgelegt" versehen. [FormNeuerAuftrag.cs] - ✅ : Wenn Fahrer Auftragverwaltung öffnet werden Aufträge mit AuftragStatus "Fertig" angezeigt. Fahrer können dann als "Ausgeliefert" markieren. [FormMain.cs] - ✅ : Wenn Fahrer registriert kann nur NeuerAuftrag aufgerufen werden. Dort kann er Aufträge erstellen mit dem Status "Abgeholt" (Wichtig für Auftragauswahl bei Waschstraße) [FormMain.cs] - ✅ : Wenn kein Auftrag gefunden wird, kann ein neuer erstellt werden. [FormWSVerfolgung.cs] @@ -63,14 +64,14 @@ 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] - 🔄 Umbau in Switch. [FormWSVerfolgung.cs] - 🔄 UserSetting Properties eintragen und in EinstellungsScreen abrufen. [UserSettingsManager.cs] - 🔄 Weitere Properties von oben hier zuweisen [UserSettingsManager.cs] +- 🔄 Wenn kunde null dann return. [FormNeuerAuftrag.cs] - 🔄 Wenn Nachwäsche oder Müllwäsche alle Artikel anzeigen. [FormFehlmengeCount.cs] -Installation: 18.12.2025 17:03 +Installation: 19.12.2025 11:14 =====================================