From d5675e81dc3626bb7062c3daeb7621d5567c5e22 Mon Sep 17 00:00:00 2001 From: Kilian Wirl Date: Tue, 7 Apr 2026 17:00:16 +0200 Subject: [PATCH] ArtikelVW anpassen, ComboBox adaptieren, div. Adaptierungen --- AA-Forms/FormArtikelVW.Designer.cs | 1 + AA-Forms/FormArtikelVW.cs | 20 ++++---- AA-Forms/FormAuftragDetail.Designer.cs | 1 + AA-Forms/FormAuftragDetail.cs | 35 ++++++++++++-- AA-Forms/FormExpedit.Designer.cs | 65 +++++++++++++++++--------- AA-Forms/FormExpedit.cs | 15 ++++-- AA-Forms/FormFehlmengeCount.cs | 26 +++++++++-- AA-Klassen/Artikel.cs | 8 ++-- AA-Klassen/Funktionen.cs | 38 +++++++++------ AA-Klassen/KundeArtikel.cs | 2 +- App.config | 2 +- Program.cs | 30 +++++++++++- Properties/Settings.Designer.cs | 2 +- Verwaltung_ReadMe.txt | 11 ++--- 14 files changed, 182 insertions(+), 74 deletions(-) diff --git a/AA-Forms/FormArtikelVW.Designer.cs b/AA-Forms/FormArtikelVW.Designer.cs index 191b9a8..364c956 100644 --- a/AA-Forms/FormArtikelVW.Designer.cs +++ b/AA-Forms/FormArtikelVW.Designer.cs @@ -98,6 +98,7 @@ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "FormArtikelVW"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "ARTIKELVERWALTUNG"; this.Load += new System.EventHandler(this.FormArtikelVW_Load); ((System.ComponentModel.ISupportInitialize)(this.objectListViewArtikel)).EndInit(); diff --git a/AA-Forms/FormArtikelVW.cs b/AA-Forms/FormArtikelVW.cs index 155f91c..3720ff3 100644 --- a/AA-Forms/FormArtikelVW.cs +++ b/AA-Forms/FormArtikelVW.cs @@ -21,6 +21,7 @@ namespace Deckungsbeitrag private Benutzer user; private List artikelList; private List artNWList; + private int dropdownWidth; public FormArtikelVW() { InitializeComponent(); @@ -37,6 +38,12 @@ namespace Deckungsbeitrag this.comboBoxArtikel.SelectedIndexChanged -= comboBoxArtikel_SelectedIndexChanged; this.comboBoxArtikel.DataSource = artlist; this.comboBoxArtikel.DisplayMember = "Bezeichnung"; + foreach (Artikel art in artlist) + { + int bezWidth = TextRenderer.MeasureText(art.Bezeichnung, comboBoxArtikel.Font).Width; + if (dropdownWidth < bezWidth) dropdownWidth = bezWidth; + } + this.comboBoxArtikel.DropDownWidth = dropdownWidth; this.comboBoxArtikel.SelectedIndex = -1; this.comboBoxArtikel.SelectedIndexChanged += comboBoxArtikel_SelectedIndexChanged; @@ -63,9 +70,7 @@ namespace Deckungsbeitrag } private void OLV_Load_with_Artikel() - { - //foreach (OLVColumn col in this.objectListViewArtikel.Columns) col.IsEditable = false; - + { if (this.user.Rolle == BenutzerRolle.Expedit || this.user.Rolle == BenutzerRolle.Frottee || this.user.Rolle == BenutzerRolle.Master) { //TODO: Einbinden der NachwaescheArtikelData... @@ -74,7 +79,6 @@ namespace Deckungsbeitrag var NWArtikelList = new List(); foreach (Artikel art in this.artikelList) { - NWArtikelList.Add(new NachwaescheArtikelData { ArtikelID = art.ArtikelID, @@ -85,11 +89,8 @@ namespace Deckungsbeitrag Muell = 0, Kategorie = art.Kategorie }); - } - //foreach (OLVColumn col in this.objectListViewArtikel.Columns) if (col.Text == "Kategorie" || col.Text == "Abkürzung") col.IsVisible = col.IsEditable = false; this.objectListViewArtikel.Font = new Font(this.objectListViewArtikel.Font.FontFamily, 16, FontStyle.Regular); - //this.objectListViewArtikel.SetObjects(this.artikelList); this.objectListViewArtikel.SetObjects(NWArtikelList); this.objectListViewArtikel.PrimarySortColumn = (OLVColumn)this.objectListViewArtikel.AllColumns[6]; this.objectListViewArtikel.SecondarySortColumn = (OLVColumn)this.objectListViewArtikel.Columns["Abkürzung"]; @@ -185,6 +186,7 @@ namespace Deckungsbeitrag DateTime timestamp = DateTime.Now.Date; if (col == null) return; + if (e.NewValue == e.Value) return; if (int.TryParse(e.NewValue.ToString(), out int i)) { @@ -225,11 +227,12 @@ namespace Deckungsbeitrag } else { - if (col.Text == "Nachwäsche") + if (col.Text == "NW") { NWData nw = (NWData)e.RowObject; KundeArtikel kndart = KundeArtikel.GetItem((int)nw.KndArtID); kndart.Fehlmenge = i; + kndart.FehlmengeBearbeitet = this.user.BenutzerName + " am " + DateTime.Now.ToString(); kndart.Save(); } } @@ -256,7 +259,6 @@ namespace Deckungsbeitrag private void objectListViewArtikel_Resize(object sender, EventArgs e) { this.ClientSize = new Size(this.objectListViewArtikel.Width + this.objectListViewArtikel.Left, this.ClientSize.Height); - } } } diff --git a/AA-Forms/FormAuftragDetail.Designer.cs b/AA-Forms/FormAuftragDetail.Designer.cs index 37ea83c..3be87cb 100644 --- a/AA-Forms/FormAuftragDetail.Designer.cs +++ b/AA-Forms/FormAuftragDetail.Designer.cs @@ -442,6 +442,7 @@ this.MaximizeBox = false; this.Name = "FormAuftragDetail"; this.Text = "Auftrag Detail"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormAuftragDetail_FormClosing); this.Load += new System.EventHandler(this.FormAuftragDetail_Load); this.Shown += new System.EventHandler(this.FormAuftragDetail_Shown); this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.FormAuftragDetail_MouseClick); diff --git a/AA-Forms/FormAuftragDetail.cs b/AA-Forms/FormAuftragDetail.cs index cb2f2f0..32bd302 100644 --- a/AA-Forms/FormAuftragDetail.cs +++ b/AA-Forms/FormAuftragDetail.cs @@ -263,6 +263,7 @@ namespace Deckungsbeitrag WriteToCSV(dictionary); } } + tosave = false; } @@ -274,6 +275,21 @@ namespace Deckungsbeitrag //AUFTRAG ABBRECHEN private void buttonAbbrechen_Click(object sender, EventArgs e) { + //if (_tosave) + //{ + // if (MessageBox.Show("Möchtest du die Änderungen wirklich verwerfen?", "ÄNDERUNGEN VERWERFEN", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + // { + // this.DialogResult = DialogResult.Cancel; + // this.Close(); + // } + // else return; + //} + //else + //{ + // this.DialogResult = DialogResult.Cancel; + // this.Close(); + //} + this.DialogResult = DialogResult.Cancel; this.Close(); } @@ -352,6 +368,7 @@ namespace Deckungsbeitrag File.Delete(Path.Combine(loadPath, invFiles[0])); } } + toclose = tosave = false; } this.DialogResult = DialogResult.OK; @@ -367,7 +384,7 @@ namespace Deckungsbeitrag //TODO: Erstellen von SonderAuftrag und Drucken von Etikett testen. if (MessageBox.Show("Möchtest du Etiketten für die Änderung drucken?", "FRAGE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - Funktionen.SonderEtikett_Drucken(this.auftrag, bestand); + Funktionen.SonderEtikett_Drucken(this.auftrag, dictionary); etikettgedruckt = true; @@ -604,12 +621,24 @@ namespace Deckungsbeitrag { this.ClientSize = new Size(oLVArtikel.Right + 10, oLVArtikel.Bottom + buttonAbbrechen.Height + 25); } + + private void FormAuftragDetail_FormClosing(object sender, FormClosingEventArgs e) + { + if (tosave) + { + if (MessageBox.Show("Möchtest du die Änderungen wirklich verwerfen?", "ÄNDERUNGEN VERWERFEN", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + else { e.Cancel = true; return; } + } + + } } } -//TODO: Standverminderung und Standerhöhung mit einem Aufruf (Standveränderung?) Bei Verminderung -Zahlen sonst Plus. //DONE: Korrigiere Bestand: Wenn -Zahl dann Stand - Zahl. //TODO: Speichern etc. durchgehen und adaptieren -//TODO: Liste vorher/nachher durchdenken //DONE: Feedback Button hinzufügen //DONE: ComboBox Fahrer und Priorität implementieren //DONE: Container schmutzig bearbeitbar machen \ No newline at end of file diff --git a/AA-Forms/FormExpedit.Designer.cs b/AA-Forms/FormExpedit.Designer.cs index 4848478..a3b8aa6 100644 --- a/AA-Forms/FormExpedit.Designer.cs +++ b/AA-Forms/FormExpedit.Designer.cs @@ -56,6 +56,7 @@ this.tabControlAuftragList = new System.Windows.Forms.TabControl(); this.tabPageVorbereitet = new System.Windows.Forms.TabPage(); this.objectListViewVorbereitet = new BrightIdeasSoftware.ObjectListView(); + this.buttonNW = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.chartFehlmenge)).BeginInit(); this.groupBoxKndInfo.SuspendLayout(); this.tableLayoutPanelInfo.SuspendLayout(); @@ -99,7 +100,7 @@ this.buttonSuchen.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSuchen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonSuchen.ForeColor = System.Drawing.Color.Black; - this.buttonSuchen.Location = new System.Drawing.Point(209, 649); + this.buttonSuchen.Location = new System.Drawing.Point(284, 649); this.buttonSuchen.Margin = new System.Windows.Forms.Padding(2); this.buttonSuchen.Name = "buttonSuchen"; this.buttonSuchen.Size = new System.Drawing.Size(200, 41); @@ -116,7 +117,7 @@ this.buttonReklamation.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonReklamation.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonReklamation.ForeColor = System.Drawing.Color.White; - this.buttonReklamation.Location = new System.Drawing.Point(4, 649); + this.buttonReklamation.Location = new System.Drawing.Point(79, 649); this.buttonReklamation.Name = "buttonReklamation"; this.buttonReklamation.Size = new System.Drawing.Size(200, 41); this.buttonReklamation.TabIndex = 64; @@ -192,12 +193,12 @@ this.tableLayoutPanelInfo.Controls.Add(this.labelAnmerkung, 0, 0); this.tableLayoutPanelInfo.Controls.Add(this.labelAufgabe, 0, 1); this.tableLayoutPanelInfo.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanelInfo.Location = new System.Drawing.Point(3, 22); + this.tableLayoutPanelInfo.Location = new System.Drawing.Point(3, 26); this.tableLayoutPanelInfo.Name = "tableLayoutPanelInfo"; this.tableLayoutPanelInfo.RowCount = 2; this.tableLayoutPanelInfo.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanelInfo.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanelInfo.Size = new System.Drawing.Size(287, 158); + this.tableLayoutPanelInfo.Size = new System.Drawing.Size(287, 154); this.tableLayoutPanelInfo.TabIndex = 0; // // labelAnmerkung @@ -207,7 +208,7 @@ this.labelAnmerkung.ForeColor = System.Drawing.Color.Red; this.labelAnmerkung.Location = new System.Drawing.Point(3, 0); this.labelAnmerkung.Name = "labelAnmerkung"; - this.labelAnmerkung.Size = new System.Drawing.Size(281, 79); + this.labelAnmerkung.Size = new System.Drawing.Size(281, 77); this.labelAnmerkung.TabIndex = 0; this.labelAnmerkung.Text = "label2"; // @@ -215,9 +216,9 @@ // this.labelAufgabe.AutoSize = true; this.labelAufgabe.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelAufgabe.Location = new System.Drawing.Point(3, 79); + this.labelAufgabe.Location = new System.Drawing.Point(3, 77); this.labelAufgabe.Name = "labelAufgabe"; - this.labelAufgabe.Size = new System.Drawing.Size(281, 79); + this.labelAufgabe.Size = new System.Drawing.Size(281, 77); this.labelAufgabe.TabIndex = 1; this.labelAufgabe.Text = "label3"; // @@ -230,7 +231,7 @@ this.buttonTourenListe.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonTourenListe.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonTourenListe.ForeColor = System.Drawing.Color.Black; - this.buttonTourenListe.Location = new System.Drawing.Point(413, 649); + this.buttonTourenListe.Location = new System.Drawing.Point(488, 649); this.buttonTourenListe.Margin = new System.Windows.Forms.Padding(2); this.buttonTourenListe.Name = "buttonTourenListe"; this.buttonTourenListe.Size = new System.Drawing.Size(200, 41); @@ -270,9 +271,9 @@ // tabPageRampe // this.tabPageRampe.Controls.Add(this.objectListViewRampe); - this.tabPageRampe.Location = new System.Drawing.Point(4, 34); + this.tabPageRampe.Location = new System.Drawing.Point(4, 39); this.tabPageRampe.Name = "tabPageRampe"; - this.tabPageRampe.Size = new System.Drawing.Size(890, 584); + this.tabPageRampe.Size = new System.Drawing.Size(890, 579); this.tabPageRampe.TabIndex = 3; this.tabPageRampe.Text = "Rampe"; this.tabPageRampe.UseVisualStyleBackColor = true; @@ -291,7 +292,7 @@ this.objectListViewRampe.Location = new System.Drawing.Point(0, 0); this.objectListViewRampe.Name = "objectListViewRampe"; this.objectListViewRampe.SelectColumnsOnRightClickBehaviour = BrightIdeasSoftware.ObjectListView.ColumnSelectBehaviour.Submenu; - this.objectListViewRampe.Size = new System.Drawing.Size(890, 584); + this.objectListViewRampe.Size = new System.Drawing.Size(890, 579); this.objectListViewRampe.Sorting = System.Windows.Forms.SortOrder.Ascending; this.objectListViewRampe.TabIndex = 2; this.objectListViewRampe.TintSortColumn = true; @@ -309,10 +310,10 @@ // tabPageSonder // this.tabPageSonder.Controls.Add(this.objectListViewSonder); - this.tabPageSonder.Location = new System.Drawing.Point(4, 34); + this.tabPageSonder.Location = new System.Drawing.Point(4, 39); this.tabPageSonder.Name = "tabPageSonder"; this.tabPageSonder.Padding = new System.Windows.Forms.Padding(3); - this.tabPageSonder.Size = new System.Drawing.Size(890, 584); + this.tabPageSonder.Size = new System.Drawing.Size(890, 579); this.tabPageSonder.TabIndex = 1; this.tabPageSonder.Text = "Sonderaufträge"; this.tabPageSonder.UseVisualStyleBackColor = true; @@ -330,7 +331,7 @@ this.objectListViewSonder.Location = new System.Drawing.Point(3, 3); this.objectListViewSonder.Name = "objectListViewSonder"; this.objectListViewSonder.SelectColumnsOnRightClickBehaviour = BrightIdeasSoftware.ObjectListView.ColumnSelectBehaviour.Submenu; - this.objectListViewSonder.Size = new System.Drawing.Size(884, 578); + this.objectListViewSonder.Size = new System.Drawing.Size(884, 573); this.objectListViewSonder.Sorting = System.Windows.Forms.SortOrder.Ascending; this.objectListViewSonder.TabIndex = 2; this.objectListViewSonder.TintSortColumn = true; @@ -348,10 +349,10 @@ // tabPageGeschaeft // this.tabPageGeschaeft.Controls.Add(this.objectListViewGeschaeft); - this.tabPageGeschaeft.Location = new System.Drawing.Point(4, 34); + this.tabPageGeschaeft.Location = new System.Drawing.Point(4, 39); this.tabPageGeschaeft.Name = "tabPageGeschaeft"; this.tabPageGeschaeft.Padding = new System.Windows.Forms.Padding(3); - this.tabPageGeschaeft.Size = new System.Drawing.Size(890, 584); + this.tabPageGeschaeft.Size = new System.Drawing.Size(890, 579); this.tabPageGeschaeft.TabIndex = 2; this.tabPageGeschaeft.Text = "Geschäft"; this.tabPageGeschaeft.UseVisualStyleBackColor = true; @@ -370,7 +371,7 @@ this.objectListViewGeschaeft.Location = new System.Drawing.Point(3, 3); this.objectListViewGeschaeft.Name = "objectListViewGeschaeft"; this.objectListViewGeschaeft.SelectColumnsOnRightClickBehaviour = BrightIdeasSoftware.ObjectListView.ColumnSelectBehaviour.Submenu; - this.objectListViewGeschaeft.Size = new System.Drawing.Size(884, 578); + this.objectListViewGeschaeft.Size = new System.Drawing.Size(884, 573); this.objectListViewGeschaeft.Sorting = System.Windows.Forms.SortOrder.Ascending; this.objectListViewGeschaeft.TabIndex = 2; this.objectListViewGeschaeft.TintSortColumn = true; @@ -393,10 +394,10 @@ // tabPageAll // this.tabPageAll.Controls.Add(this.objectListViewAuftrag); - this.tabPageAll.Location = new System.Drawing.Point(4, 34); + this.tabPageAll.Location = new System.Drawing.Point(4, 39); this.tabPageAll.Name = "tabPageAll"; this.tabPageAll.Padding = new System.Windows.Forms.Padding(3); - this.tabPageAll.Size = new System.Drawing.Size(890, 584); + this.tabPageAll.Size = new System.Drawing.Size(890, 579); this.tabPageAll.TabIndex = 0; this.tabPageAll.Text = "Aufträge heute"; this.tabPageAll.UseVisualStyleBackColor = true; @@ -415,7 +416,7 @@ this.objectListViewAuftrag.Location = new System.Drawing.Point(3, 3); this.objectListViewAuftrag.Name = "objectListViewAuftrag"; this.objectListViewAuftrag.SelectColumnsOnRightClickBehaviour = BrightIdeasSoftware.ObjectListView.ColumnSelectBehaviour.Submenu; - this.objectListViewAuftrag.Size = new System.Drawing.Size(884, 578); + this.objectListViewAuftrag.Size = new System.Drawing.Size(884, 573); this.objectListViewAuftrag.Sorting = System.Windows.Forms.SortOrder.Ascending; this.objectListViewAuftrag.TabIndex = 1; this.objectListViewAuftrag.TintSortColumn = true; @@ -458,9 +459,9 @@ // tabPageVorbereitet // this.tabPageVorbereitet.Controls.Add(this.objectListViewVorbereitet); - this.tabPageVorbereitet.Location = new System.Drawing.Point(4, 34); + this.tabPageVorbereitet.Location = new System.Drawing.Point(4, 39); this.tabPageVorbereitet.Name = "tabPageVorbereitet"; - this.tabPageVorbereitet.Size = new System.Drawing.Size(890, 584); + this.tabPageVorbereitet.Size = new System.Drawing.Size(890, 579); this.tabPageVorbereitet.TabIndex = 4; this.tabPageVorbereitet.Text = "Vorbereitet"; this.tabPageVorbereitet.UseVisualStyleBackColor = true; @@ -480,7 +481,7 @@ this.objectListViewVorbereitet.Location = new System.Drawing.Point(0, 0); this.objectListViewVorbereitet.Name = "objectListViewVorbereitet"; this.objectListViewVorbereitet.SelectColumnsOnRightClickBehaviour = BrightIdeasSoftware.ObjectListView.ColumnSelectBehaviour.Submenu; - this.objectListViewVorbereitet.Size = new System.Drawing.Size(890, 584); + this.objectListViewVorbereitet.Size = new System.Drawing.Size(890, 579); this.objectListViewVorbereitet.Sorting = System.Windows.Forms.SortOrder.Ascending; this.objectListViewVorbereitet.TabIndex = 2; this.objectListViewVorbereitet.TintSortColumn = true; @@ -498,11 +499,28 @@ this.objectListViewVorbereitet.CellClick += new System.EventHandler(this.objectListViewAuftrag_CellClick); this.objectListViewVorbereitet.FormatCell += new System.EventHandler(this.objectListViewAuftrag_FormatCell); // + // buttonNW + // + this.buttonNW.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonNW.FlatAppearance.BorderColor = System.Drawing.Color.White; + this.buttonNW.FlatAppearance.BorderSize = 3; + this.buttonNW.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonNW.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonNW.ForeColor = System.Drawing.Color.White; + this.buttonNW.Location = new System.Drawing.Point(4, 649); + this.buttonNW.Name = "buttonNW"; + this.buttonNW.Size = new System.Drawing.Size(69, 41); + this.buttonNW.TabIndex = 67; + this.buttonNW.Text = "NW"; + this.buttonNW.UseVisualStyleBackColor = true; + this.buttonNW.Click += new System.EventHandler(this.buttonNW_Click); + // // FormExpedit // 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(1221, 703); + this.Controls.Add(this.buttonNW); this.Controls.Add(this.buttonTourenListe); this.Controls.Add(this.groupBoxKndInfo); this.Controls.Add(this.chartFehlmenge); @@ -569,5 +587,6 @@ private System.Windows.Forms.TabControl tabControlAuftragList; private System.Windows.Forms.TabPage tabPageVorbereitet; private BrightIdeasSoftware.ObjectListView objectListViewVorbereitet; + private System.Windows.Forms.Button buttonNW; } } \ No newline at end of file diff --git a/AA-Forms/FormExpedit.cs b/AA-Forms/FormExpedit.cs index 1d90c7a..2314727 100644 --- a/AA-Forms/FormExpedit.cs +++ b/AA-Forms/FormExpedit.cs @@ -128,9 +128,10 @@ namespace Deckungsbeitrag catch (Exception ex) { // Vermeide $ für C# älter - this.BeginInvoke(new Action(() => MessageBox.Show( - string.Format($"Laden fehlgeschlagen: {0}", ex.Message)))); - Program.AddFehler(this.benutzer, ex.Message, ex.StackTrace, null); + Random rnd = new Random(); + int zahl = rnd.Next(1, 10001); + this.BeginInvoke(new Action(() => MessageBox.Show(string.Format($"Laden fehlgeschlagen. Leite den Fehler {zahl} an Kilian weiter. ", ex.Message)))); + Program.AddFehler(this.benutzer, $"Fehler {zahl} - ex.Message", ex.StackTrace, null); } }); } @@ -471,7 +472,6 @@ namespace Deckungsbeitrag e.Text = Kunde.GetKunde(null, _auftrag.KundeID, null).Anmerkung; } } - //TODO: Alle Icons in einer Spalte anzeigen? I für Anmerkung und ! für Aufgabe?? if (e.Column.Text == "Fahrer" && e.Model is Auftrag auftrag1) { e.Text = auftrag1.ZusatzInfo; @@ -932,7 +932,6 @@ namespace Deckungsbeitrag } else if (meldung.GetFrage(this, $"Möchtest du die gewählte Zelle wirklich bearbeiten?", false) == DialogResult.No) e.Cancel = true; - //TODO: Soll hier ebenfalls der nächste Liefertag laut Rhythmus vorgeschlagen werden? } #endregion @@ -1276,5 +1275,11 @@ namespace Deckungsbeitrag olv.RefreshObject(olv.SelectedObject); e.Cancel = true; } + + private void buttonNW_Click(object sender, EventArgs e) + { + FormArtikelVW artikelVW = new FormArtikelVW(this.benutzer); + artikelVW.ShowDialog(); + } } } diff --git a/AA-Forms/FormFehlmengeCount.cs b/AA-Forms/FormFehlmengeCount.cs index 647754f..8b92497 100644 --- a/AA-Forms/FormFehlmengeCount.cs +++ b/AA-Forms/FormFehlmengeCount.cs @@ -5,6 +5,7 @@ using System; using System.CodeDom; using System.Collections.Generic; using System.ComponentModel; +using System.Configuration; using System.Data; using System.Diagnostics; using System.Drawing; @@ -106,8 +107,21 @@ namespace Deckungsbeitrag if (this.kunde.HatNachwaesche) this.artikelListe = KundeArtikel.GetFehlmengeList(kunde.KundeID.ToString(), null); this.textBoxScann.Text = this.kunde.KundeNummer; this.textBoxScann.Enabled = false; - if ((userid != null && userid.Contains("reklamation")) || (this.benutzer != null && this.benutzer.Rolle == BenutzerRolle.Expedit)) Reklamation_GroupBox(); - else GroupBox_Load(); + if (userid != null && !userid.Contains("reklamation")) GroupBox_Load(); + else + { + if (this.benutzer != null && (this.benutzer.Rolle == BenutzerRolle.Expedit || this.benutzer.Rolle == BenutzerRolle.Frottee)) Reklamation_GroupBox(); + else + { + Random rnd = new Random(); + int zahl = rnd.Next(1, 10001); // 1 bis 10000 + Program.AddFehler(this.benutzer, $"Fehler{zahl} Falsche userid oder BenutzerRolle.", "FormFehlmengeCount.ControlLaden/Zeilen: 109 - 119", null); + MessageBox.Show($"Falsche userid oder BenutzerRolle. Bitte Kilian Fehler: {zahl} nennen.", "FEHLER", MessageBoxButtons.OK, MessageBoxIcon.Error); return; + + } + } + //if ((userid != null && userid.Contains("reklamation")) || (this.benutzer != null && (this.benutzer.Rolle == BenutzerRolle.Expedit || this.benutzer.Rolle == BenutzerRolle.Frottee))) Reklamation_GroupBox(); + //else GroupBox_Load(); if (kunde.Aufgabe != null) { @@ -129,7 +143,7 @@ namespace Deckungsbeitrag } /// - /// Die GroupBox mit den Artikel-Buttons wird geladen + /// Die GroupBox mit den Artikel-Buttons wird geladen wenn BenutzerRolle ist nicht Expedit oder Frottee. /// private void GroupBox_Load() { @@ -321,6 +335,9 @@ namespace Deckungsbeitrag } } + /// + /// GroupBox wird für Reklamationen geladen. Passiert nur wenn BenutzerRolle ist Expedit oder Frottee. + /// private void Reklamation_GroupBox() { this.groupBoxArtikel.Controls.Clear(); @@ -375,6 +392,7 @@ namespace Deckungsbeitrag groupBoxArtikel.ResumeLayout(); groupBoxArtikel.Visible = true; } + /// /// Wenn der Kunde Fertig gemacht wurde, werden Controls deaktiviert und ausgeblendet bis neuer Kunde gewählt /// @@ -431,6 +449,7 @@ namespace Deckungsbeitrag Open_Liste(); ControlLaden(); } + /// /// Auftragliste aufrufen. /// @@ -464,7 +483,6 @@ namespace Deckungsbeitrag /// private void textBoxScann_Leave(object sender, EventArgs e) { - //TODO: Wenn Nachwäsche oder Müllwäsche alle Artikel anzeigen. // Kundennummer wird ausgelesen und Kunde aus DB geholt. Form_Load wird danach ausgelöst if (this.kunde == null) { diff --git a/AA-Klassen/Artikel.cs b/AA-Klassen/Artikel.cs index 9af194c..2a3e9c0 100644 --- a/AA-Klassen/Artikel.cs +++ b/AA-Klassen/Artikel.cs @@ -53,13 +53,14 @@ namespace DatenDB DatenbankConnection.GetConnection().Close(); return result; } - internal static string GetShort(int? artikelID) + internal static string GetShort(int? artikelID, string artname) { DatenbankConnection.GetConnection().Open(); string result = null; NpgsqlCommand command = new NpgsqlCommand(); command.Connection = DatenbankConnection.GetConnection(); - command.CommandText = $"select short from {TABLE} where artikel_id = {artikelID}"; + if (artikelID != null) command.CommandText = $"select short from {TABLE} where artikel_id = {artikelID}"; + if (!string.IsNullOrWhiteSpace(artname)) command.CommandText = $"select short from {TABLE} where bezeichnung = '{artname}'"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) result = reader.IsDBNull(0) ? string.Empty : reader.GetString(0); reader.Close(); @@ -105,7 +106,8 @@ namespace DatenDB command.Connection = DatenbankConnection.GetConnection(); if (s == "Alle") command.CommandText = $"select {COLUMNS} from {TABLE}"; - if (s == "Nachwaesche") command.CommandText = $"select {COLUMNS} from {TABLE} where kategorie > 0 and SUBSTRING(nummer::text, 1, 1) = '6' order by kategorie ASC"; + if (s == "Nachwaesche") command.CommandText = $"select {COLUMNS} from {TABLE} where kategorie > 0 and SUBSTRING(nummer::text, 1, 1) = '6' order by kategorie ASC, nummer ASC"; + if (s == "MitNachwaesche") command.CommandText = $"select {COLUMNS} from {TABLE} where nachwaesche > 0"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) resultList.Add(new Artikel(reader)); diff --git a/AA-Klassen/Funktionen.cs b/AA-Klassen/Funktionen.cs index 99d5c70..e225f59 100644 --- a/AA-Klassen/Funktionen.cs +++ b/AA-Klassen/Funktionen.cs @@ -3,6 +3,7 @@ using BrightIdeasSoftware; using DatenDB; using Deckungsbeitrag.AA_Klassen; using Deckungsbeitrag.Properties; +using Deckungsbeitrag.UserControls; using System; using System.Collections.Generic; using System.Configuration; @@ -49,7 +50,7 @@ namespace Deckungsbeitrag private static Benutzer _benutzer; private static PrintDocument printdoc; public static bool IsPhysicalPrint = false; // Globaler Schalter - static int[] _bestand; + static Dictionary _dictionary; public Funktionen() { @@ -1120,7 +1121,7 @@ namespace Deckungsbeitrag } } } - public static Image SonderEtikett_Entwurf(Auftrag auftrag, int[] bestand) + public static Image SonderEtikett_Entwurf(Auftrag auftrag, Dictionary dictionary) { Kunde kunde = Kunde.GetKunde(string.Empty, auftrag.KundeID, string.Empty); if (kunde.Suchtext.StartsWith("?") | kunde.KundeNummer == "2320000") kunde.Suchtext = auftrag.ZusatzInfo; @@ -1144,24 +1145,33 @@ namespace Deckungsbeitrag g.FillRectangle(Brushes.White, 0, 0, bitmap.Width, bitmap.Height); //Etikett-Text - g.DrawString($"{kunde.KundeNummer}", font1, Brushes.Black, startpoint); - nextposition += (int)height_font1; - g.DrawString($"{kunde.Suchtext}", font1, Brushes.Black, einzug, nextposition); - nextposition += (int)height_font1; - foreach (AuftragArtikel artikel in artliste) + g.DrawString($"{kunde.KundeNummer}", font2, Brushes.Black, startpoint); + nextposition += (int)height_font2; + g.DrawString($"{kunde.Suchtext}", font2, Brushes.Black, einzug, nextposition); + nextposition += (int)height_font2; + g.DrawString($"{auftrag.Liefertag.Date.ToString("dd.MM.yyyy")}", font2, Brushes.Black, einzug, nextposition); + nextposition += (int)height_font2; + g.DrawString("Artikel Rekl/NW/Stand/Inv", font1, Brushes.Black, einzug, nextposition + 20); + nextposition += 20 + (int)height_font1; + + foreach (var kvp in dictionary) { - g.DrawString($"{Artikel.GetShort(artikel.ArtikelID)}", font1, Brushes.Black, einzug, nextposition); - g.DrawString($"{bestand[0].ToString()}/{bestand[1].ToString()}/{bestand[2].ToString()}", font1, Brushes.Black, einzug + 50, nextposition); + string artikelKey = kvp.Key; // z.B. "ART1" + int[] artbestand = kvp.Value; // z.B. [3, 0, 5] + g.DrawString($"{Artikel.GetShort(null, artikelKey)}", font1, Brushes.Black, einzug, nextposition); + if (artbestand[2] < 0) g.DrawString($"{artbestand[0].ToString()}/{artbestand[1].ToString()}/({artbestand[2].ToString()})/{artbestand[3].ToString()}", font1, Brushes.Black, einzug + 50, nextposition); + else g.DrawString($"{artbestand[0].ToString()}/{artbestand[1].ToString()}/{artbestand[2].ToString()}/{artbestand[3].ToString()}", font1, Brushes.Black, einzug + 50, nextposition); nextposition += (int)height_font1; + } Image img = bitmap; return img; } - public static void SonderEtikett_Drucken(Auftrag auftrag, int[] bestand) + public static void SonderEtikett_Drucken(Auftrag auftrag, Dictionary dictionary) { _auftrag = auftrag; - _bestand = bestand; + _dictionary = dictionary; int x = auftrag.ContainerClean; PrintDialog dialog = new PrintDialog(); PrintPreviewDialog preview = new PrintPreviewDialog(); @@ -1214,8 +1224,8 @@ namespace Deckungsbeitrag // Event abschließen (keine weiteren Seiten) e.HasMorePages = false; } - if (sender.ToString().Contains("Etikett")) e.Graphics.DrawImage(Funktionen.Etikett_Entwurf(null, _auftrag, _nocont), e.PageBounds); - if (sender.ToString().Contains("Sonder")) e.Graphics.DrawImage(SonderEtikett_Entwurf(_auftrag, _bestand), e.PageBounds); + if (sender.ToString().Contains("Etikett")) e.Graphics.DrawImage(Etikett_Entwurf(null, _auftrag, _nocont), e.PageBounds); + if (sender.ToString().Contains("Sonder")) e.Graphics.DrawImage(SonderEtikett_Entwurf(_auftrag, _dictionary), e.PageBounds); if (sender.ToString().Contains("TourenListe")) { if (pagesToPrint == currentPage) currentPage = 0; @@ -1568,7 +1578,7 @@ namespace Deckungsbeitrag } // Label setzen (X-Achse zeigt Artikelnamen) - string label = Artikel.GetShort(daten.ArtikelID); + string label = Artikel.GetShort(daten.ArtikelID, null); //if (label.Length > 10) // label = label.Substring(0, 10) + "..."; diff --git a/AA-Klassen/KundeArtikel.cs b/AA-Klassen/KundeArtikel.cs index e97abf8..1b148ff 100644 --- a/AA-Klassen/KundeArtikel.cs +++ b/AA-Klassen/KundeArtikel.cs @@ -98,7 +98,7 @@ namespace DatenDB NpgsqlCommand command = new NpgsqlCommand(); command.Connection = DatenbankConnection.GetConnection(); if (!string.IsNullOrWhiteSpace(kundeid)) command.CommandText = $"select {COLUMNS} from {TABLE} where kunde_id = {kundeid} order by reihung asc"; - else command.CommandText = $"select {COLUMNS} from {TABLE} where artikel_id = {artikelID}"; + else command.CommandText = $"select {COLUMNS} from {TABLE} where artikel_id = {artikelID} order by artikel_nr"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) resultList.Add(new KundeArtikel(reader)); reader.Close(); diff --git a/App.config b/App.config index 6484ec4..3a65338 100644 --- a/App.config +++ b/App.config @@ -6,7 +6,7 @@ - + diff --git a/Program.cs b/Program.cs index 1341634..c076a8a 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,6 @@ using DatenDB; using Deckungsbeitrag.AA_Forms; +using Deckungsbeitrag.AA_Klassen; using Deckungsbeitrag.Properties; using Microsoft.Win32; using System; @@ -77,6 +78,31 @@ namespace Deckungsbeitrag // Importieren und Updaten der Artikelliste wenn Datei vorhanden. ArtikelList_Laden(); + // EINMALIG BEI SWITCH AUF NW_Artikel + DateTime timestamp = DateTime.Today; + List artikellist = Artikel.GetArtikelList("MitNachwaesche"); + foreach (Artikel art in artikellist) + { + ArtikelNachwaesche nw = ArtikelNachwaesche.FindeDatensatz(art.ArtikelID, timestamp); + if (nw.NachwaescheID != null) nw.Nachwaesche++; + else + { + nw = new ArtikelNachwaesche() + { + ArtikelID = art.ArtikelID, + Datum = timestamp, + Nachwaesche = art.Nachwaesche + }; + } + if (nw.Save() == 1) + { + art.Nachwaesche = 0; + art.Save(); + } + + } + + Settings.Default.Save(); Cursor.Current = Cursors.Default; @@ -411,9 +437,9 @@ namespace Deckungsbeitrag { string[] linedata = line.Split(';'); - // Wenn 1. Datensatz von linedata keine Zahlen sind oder 5. Datensatz Preisgruppe enthält wird Zeile ignoriert. + // Wenn 1. Datensatz von linedata keine Zahlen sind oder 6. Datensatz Preisgruppe enthält wird Zeile ignoriert. if (!int.TryParse(linedata[0], out _)) continue; - if (linedata[4].Contains("Preisgruppe")) continue; + if (linedata[5].Contains("Preisgruppe")) continue; tosave++; diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 308d83f..31344cc 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Deckungsbeitrag.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "18.4.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/Verwaltung_ReadMe.txt b/Verwaltung_ReadMe.txt index 6779745..e99e6bc 100644 --- a/Verwaltung_ReadMe.txt +++ b/Verwaltung_ReadMe.txt @@ -5,7 +5,7 @@ NEUIGKEITEN - Version 1.0.8.5 Build-Info: - Build-Typ: Release Build - Erledigte TODOs: 18 -- Offene TODOs: 44 +- Offene TODOs: 39 - Install-Reminders: 4 - Changes: 15 @@ -55,10 +55,9 @@ Build-Info: - ✅ : Wenn RegAuftrag wird als augeliefert markiert, wird dieser automatisch neu erstellt laut hinterlegtem Rhythmus. [FormMain.cs] -=== 🔄 OFFENE TODOs (44) === +=== 🔄 OFFENE TODOs (39) === - 🔄 !!ÜBERLEGE!! DB-Query für Kundenanzahl und Containeranzahl Abgleich. (Aufträge haben TourID hinterlegt. So sollte alles vergleichbar sein.) [Tour.cs] - 🔄 !!ÜBERLEGE!! Tour Start und Ende automatisch erfassen. [Tour.cs] -- 🔄 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] - 🔄 Alle Icons in einer Spalte anzeigen? I für Anmerkung und ! für Aufgabe?? [UCAuftragListe.cs] - 🔄 Auftrag Schnellerfassung erstellen. Kundenliste aus JSON in OLV einfügen wenn schmutzig > 0 dann Auftrag erstellen. Spalten: "Kunde, schmutzig, liefertag, zustellfahrer" evnetuell in AuftragVW? [FormMain.cs] @@ -79,7 +78,6 @@ Build-Info: - 🔄 Hier Settings speichern mit UserSettingsManager Klasse. [FormEinstellung.cs] - 🔄 JSON nach angemeldeten Fahrer durchsuchen und Kundenliste des aktuellen Wochentag anzeigen. [FormMain.cs] - 🔄 Kundenanzahl bei Tourenliste erstellen vergleichen und anpassen. [Tour.cs] -- 🔄 Liste vorher/nachher durchdenken [FormAuftragDetail.cs] - 🔄 Mit AddFehler in Obsidian eine Fehlerliste betreiben. (Wichtige Infos feststellen und bereitstellen) [Program.cs] - 🔄 Nach Test und Rücksprache eventuell wieder umbauen. Benutzer.Rolle etc. [FormFehlmengeCount.cs] - 🔄 nicht ganze Aufträge holen sondern nur die Zahlen? [FormMain.cs] @@ -88,9 +86,7 @@ Build-Info: - 🔄 Reg.Aufträge einbauen. Besonderheit: Die Artikel sollen ebenfalls erscheinen. [Funktionen.cs] - 🔄 Reihenfolge Spalten richtig stellen. [FormExpedit.cs] - 🔄 Settings hier ändern auf UserSettingsManager Klasse. [FormEinstellung.cs] -- 🔄 Soll hier ebenfalls der nächste Liefertag laut Rhythmus vorgeschlagen werden? [FormExpedit.cs] - 🔄 Speichern etc. durchgehen und adaptieren [FormAuftragDetail.cs] -- 🔄 Standverminderung und Standerhöhung mit einem Aufruf (Standveränderung?) Bei Verminderung -Zahlen sonst Plus. [FormAuftragDetail.cs] - 🔄 TourenListe Entwurf muss überarbeitet werden. [FormNeuerAuftrag.cs] - 🔄 Umbau in Switch. [FormWSVerfolgung.cs] - 🔄 UserSetting Properties eintragen und in EinstellungsScreen abrufen. [UserSettingsManager.cs] @@ -98,8 +94,7 @@ Build-Info: - 🔄 Weitere Properties von oben hier zuweisen [UserSettingsManager.cs] - 🔄 Wenn Auftrag abgeschlossen wird muss die Containerzahl sauber addiert werden. Kundenanzahl und Containeranzahl schmutzig darf nicht erhöht werden. [Tour.cs] - 🔄 Wenn Frottee-Expedit auch Relamation bearbeitet, muss BenutzerRolle abgefragt werden. siehe CHANGES. [FormFehlmengeCount.cs] -- 🔄 Wenn Nachwäsche oder Müllwäsche alle Artikel anzeigen. [FormFehlmengeCount.cs] - 🔄 Zuweisung zu Fahrer muss geklärt werden. [Funktionen.cs] -Installation: 03.04.2026 16:05 +Installation: 07.04.2026 12:59 =====================================