From 85cf30420a1be86d3aa9b05f7c7c96eff01de17e Mon Sep 17 00:00:00 2001 From: Kilian Wirl Date: Wed, 22 Apr 2026 13:37:22 +0200 Subject: [PATCH] Umbau Fahrer und Tour --- AA-Forms/FormAuftragDetail.cs | 4 +- AA-Forms/FormExpedit.Designer.cs | 101 ++++++++------- AA-Forms/FormExpedit.cs | 33 +++-- AA-Forms/FormLogin.cs | 10 +- AA-Forms/FormLogin.designer.cs | 59 +++++---- AA-Forms/FormMain.Designer.cs | 30 ++++- AA-Forms/FormMain.cs | 60 ++++++--- AA-Forms/FormNeuerAuftrag.Designer.cs | 53 +++++--- AA-Forms/FormNeuerAuftrag.cs | 152 ++++++++++++---------- AA-Forms/FormShowUserControl.cs | 16 ++- AA-Klassen/Auftrag.cs | 84 +------------ AA-Klassen/DataClass.cs | 28 +++-- AA-Klassen/Funktionen.cs | 108 ++++++---------- AA-Klassen/Tour.cs | 85 ++++++------- Program.cs | 18 ++- UserControls/UCAuftragSuchen.cs | 2 +- UserControls/UCInventur.Designer.cs | 173 +++++++++++--------------- UserControls/UCInventur.cs | 119 ++++++++++-------- UserControls/UCInventur.resx | 21 ++++ UserControls/UCTourenplan.cs | 15 ++- Verwaltung_ReadMe.txt | 29 ++--- 21 files changed, 634 insertions(+), 566 deletions(-) diff --git a/AA-Forms/FormAuftragDetail.cs b/AA-Forms/FormAuftragDetail.cs index d78791b..b010354 100644 --- a/AA-Forms/FormAuftragDetail.cs +++ b/AA-Forms/FormAuftragDetail.cs @@ -175,7 +175,7 @@ namespace Deckungsbeitrag this.comboBoxFahrer.DataSource = benutzerliste; this.comboBoxFahrer.ValueMember = "BenutzerName"; - this.comboBoxPriority.DataSource = Enum.GetValues(typeof(AuftragPriority)); + this.comboBoxPriority.DataSource = Enum.GetValues(typeof(Priority)); } private void comboBox_SelectedValueChanged(object sender, EventArgs e) { @@ -266,7 +266,7 @@ namespace Deckungsbeitrag auftrag.ContainerClean = int.Parse(this.labelContainer.Text); auftrag.Container = int.Parse(this.labelContDirt.Text); auftrag.ArbeiterID = this.comboBoxFahrer.SelectedIndex == -1 ? null : ((Benutzer)this.comboBoxFahrer.SelectedItem).BenutzerID; - auftrag.Priority = this.comboBoxPriority.SelectedIndex == -1 ? AuftragPriority.None : ((AuftragPriority)this.comboBoxPriority.SelectedItem); + auftrag.Priority = this.comboBoxPriority.SelectedIndex == -1 ? Priority.None : ((Priority)this.comboBoxPriority.SelectedItem); auftrag.ZusatzInfo = this.textBoxZusatz.Text; auftrag.Save(); diff --git a/AA-Forms/FormExpedit.Designer.cs b/AA-Forms/FormExpedit.Designer.cs index ad03dd2..6a14b2f 100644 --- a/AA-Forms/FormExpedit.Designer.cs +++ b/AA-Forms/FormExpedit.Designer.cs @@ -39,9 +39,6 @@ this.buttonSWS_Drucken = new System.Windows.Forms.Button(); this.chartFehlmenge = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.groupBoxKndInfo = new System.Windows.Forms.GroupBox(); - this.tableLayoutPanelInfo = new System.Windows.Forms.TableLayoutPanel(); - this.labelAnmerkung = new System.Windows.Forms.Label(); - this.labelAufgabe = new System.Windows.Forms.Label(); this.buttonTourenListe = new System.Windows.Forms.Button(); this.buttonStats = new System.Windows.Forms.Button(); this.buttonEinstellung = new System.Windows.Forms.Button(); @@ -57,9 +54,12 @@ this.tabPageVorbereitet = new System.Windows.Forms.TabPage(); this.objectListViewVorbereitet = new BrightIdeasSoftware.ObjectListView(); this.buttonNW = new System.Windows.Forms.Button(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.labelAnmerkung = new System.Windows.Forms.Label(); + this.labelAufgabe = new System.Windows.Forms.Label(); + this.labelZusatz = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chartFehlmenge)).BeginInit(); this.groupBoxKndInfo.SuspendLayout(); - this.tableLayoutPanelInfo.SuspendLayout(); this.tabPageRampe.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.objectListViewRampe)).BeginInit(); this.tabPageSonder.SuspendLayout(); @@ -71,6 +71,7 @@ this.tabControlAuftragList.SuspendLayout(); this.tabPageVorbereitet.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.objectListViewVorbereitet)).BeginInit(); + this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // buttonNeuerAuftrag @@ -173,7 +174,7 @@ // groupBoxKndInfo // this.groupBoxKndInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxKndInfo.Controls.Add(this.tableLayoutPanelInfo); + this.groupBoxKndInfo.Controls.Add(this.flowLayoutPanel1); this.groupBoxKndInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBoxKndInfo.ForeColor = System.Drawing.Color.Red; this.groupBoxKndInfo.Location = new System.Drawing.Point(916, 452); @@ -186,42 +187,6 @@ this.groupBoxKndInfo.VisibleChanged += new System.EventHandler(this.GroupBoxKndInfo_VisibleChanged); this.groupBoxKndInfo.Paint += new System.Windows.Forms.PaintEventHandler(this.GroupBoxKndInfo_Paint); // - // tableLayoutPanelInfo - // - this.tableLayoutPanelInfo.ColumnCount = 1; - this.tableLayoutPanelInfo.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - 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, 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, 154); - this.tableLayoutPanelInfo.TabIndex = 0; - // - // labelAnmerkung - // - this.labelAnmerkung.AutoSize = true; - this.labelAnmerkung.Dock = System.Windows.Forms.DockStyle.Fill; - 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, 77); - this.labelAnmerkung.TabIndex = 0; - this.labelAnmerkung.Text = "label2"; - // - // labelAufgabe - // - this.labelAufgabe.AutoSize = true; - this.labelAufgabe.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelAufgabe.Location = new System.Drawing.Point(3, 77); - this.labelAufgabe.Name = "labelAufgabe"; - this.labelAufgabe.Size = new System.Drawing.Size(281, 77); - this.labelAufgabe.TabIndex = 1; - this.labelAufgabe.Text = "label3"; - // // buttonTourenListe // this.buttonTourenListe.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -516,6 +481,49 @@ this.buttonNW.UseVisualStyleBackColor = true; this.buttonNW.Click += new System.EventHandler(this.ButtonNW_Click); // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.labelAnmerkung); + this.flowLayoutPanel1.Controls.Add(this.labelAufgabe); + this.flowLayoutPanel1.Controls.Add(this.labelZusatz); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 26); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(287, 154); + this.flowLayoutPanel1.TabIndex = 0; + // + // labelAnmerkung + // + this.labelAnmerkung.AutoSize = true; + this.labelAnmerkung.Dock = System.Windows.Forms.DockStyle.Fill; + 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(70, 25); + this.labelAnmerkung.TabIndex = 2; + this.labelAnmerkung.Text = "label2"; + // + // labelAufgabe + // + this.labelAufgabe.AutoSize = true; + this.labelAufgabe.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelAufgabe.Location = new System.Drawing.Point(3, 25); + this.labelAufgabe.Name = "labelAufgabe"; + this.labelAufgabe.Size = new System.Drawing.Size(70, 25); + this.labelAufgabe.TabIndex = 3; + this.labelAufgabe.Text = "label3"; + // + // labelZusatz + // + this.labelZusatz.AutoSize = true; + this.labelZusatz.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelZusatz.Location = new System.Drawing.Point(3, 50); + this.labelZusatz.Name = "labelZusatz"; + this.labelZusatz.Size = new System.Drawing.Size(70, 25); + this.labelZusatz.TabIndex = 4; + this.labelZusatz.Text = "label4"; + // // FormExpedit // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -547,8 +555,6 @@ this.Resize += new System.EventHandler(this.FormExpedit_Resize); ((System.ComponentModel.ISupportInitialize)(this.chartFehlmenge)).EndInit(); this.groupBoxKndInfo.ResumeLayout(false); - this.tableLayoutPanelInfo.ResumeLayout(false); - this.tableLayoutPanelInfo.PerformLayout(); this.tabPageRampe.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.objectListViewRampe)).EndInit(); this.tabPageSonder.ResumeLayout(false); @@ -560,6 +566,8 @@ this.tabControlAuftragList.ResumeLayout(false); this.tabPageVorbereitet.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.objectListViewVorbereitet)).EndInit(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } @@ -573,9 +581,6 @@ private System.Windows.Forms.Button buttonReklamation; private System.Windows.Forms.DataVisualization.Charting.Chart chartFehlmenge; private System.Windows.Forms.GroupBox groupBoxKndInfo; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanelInfo; - private System.Windows.Forms.Label labelAnmerkung; - private System.Windows.Forms.Label labelAufgabe; private System.Windows.Forms.Button buttonTourenListe; private System.Windows.Forms.TabPage tabPageRampe; private BrightIdeasSoftware.ObjectListView objectListViewRampe; @@ -589,5 +594,9 @@ private System.Windows.Forms.TabPage tabPageVorbereitet; private BrightIdeasSoftware.ObjectListView objectListViewVorbereitet; private System.Windows.Forms.Button buttonNW; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Label labelAnmerkung; + private System.Windows.Forms.Label labelAufgabe; + private System.Windows.Forms.Label labelZusatz; } } \ No newline at end of file diff --git a/AA-Forms/FormExpedit.cs b/AA-Forms/FormExpedit.cs index 35bd580..77364b9 100644 --- a/AA-Forms/FormExpedit.cs +++ b/AA-Forms/FormExpedit.cs @@ -491,9 +491,15 @@ namespace Deckungsbeitrag labelAufgabe.Visible = true; } else { labelAufgabe.Visible = false; } + if (auftrag.ZusatzInfo != null) + { + labelZusatz.Text = auftrag.ZusatzInfo; + labelZusatz.Visible = true; + } + else { labelZusatz.Visible = false; } // GroupBox einblenden wenn notwendig. - if (labelAufgabe.Visible || labelAnmerkung.Visible || chartFehlmenge.Visible) this.groupBoxKndInfo.Visible = true; + if (labelAufgabe.Visible || labelAnmerkung.Visible || chartFehlmenge.Visible || labelZusatz.Visible) this.groupBoxKndInfo.Visible = true; else this.groupBoxKndInfo.Visible = false; } @@ -916,12 +922,12 @@ namespace Deckungsbeitrag } } break; - case var t when t == "Fahrer": - { + case var t when t == "Tour": + { //TODO: Mit Tour statt Fahrer durchgehen. if (e.NewValue != null) { - this.auftrag.ArbeiterID = ((Benutzer)e.NewValue).BenutzerID; - this.auftrag.Priority = Funktionen.GetPriority((Benutzer)e.NewValue); + this.auftrag.TourID = ((Tour)e.NewValue).TourID; + this.auftrag.Priority = ((Tour)e.NewValue).Priority; } } break; @@ -961,17 +967,18 @@ namespace Deckungsbeitrag } else if (meldung.GetFrage(this, $"Möchtest du die gewählte Zelle wirklich bearbeiten?", false) == DialogResult.No) { e.Cancel = true; return; } - if (e.Column.AspectName == "Fahrer") + if (e.Column.AspectName == "Tour") { - List list = Benutzer.GetFahrerList(); - ComboBox fahrer = new ComboBox + Saison saison = Saison.GetAktivSaison(); + List list = Tour.GetSaisonListe(saison); + ComboBox touren = new ComboBox { Bounds = e.CellBounds, DropDownStyle = ComboBoxStyle.DropDownList, - DisplayMember = "BenutzerName", + DisplayMember = "Bezeichnung", DataSource = list }; - e.Control = fahrer; + e.Control = touren; } if (e.Control is NumericUpDown num) num.Select(0, int.MaxValue); } @@ -1062,14 +1069,14 @@ namespace Deckungsbeitrag { if (liste == null || liste == ListenArt.Auftragliste) listAuftragToday = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Vorbereitet, minStatusFilter: AuftragStatus.Gewaschen); if (liste == null || liste == ListenArt.Geschäftliste) listAuftragGeschaeft = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Fertig, minStatusFilter: AuftragStatus.Abgeholt, typFilter: AuftragTyp.Geschäft); - if (liste == null || liste == ListenArt.Vorbereitetliste) listVorbereitet = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Vorbereitet); - if (liste == null || liste == ListenArt.Sonderliste) listSonderAuftrag = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Fertig, minStatusFilter: AuftragStatus.Herrichten, typFilter: AuftragTyp.Einmalig, minTypFilter: AuftragTyp.Inventur); + if (liste == null || liste == ListenArt.Vorbereitetliste) listVorbereitet = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Vorbereitet, minTypFilter: AuftragTyp.Geschäft); + if (liste == null || liste == ListenArt.Sonderliste) listSonderAuftrag = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Fertig, minStatusFilter: AuftragStatus.Herrichten, typFilter: AuftragTyp.Laufzettel, minTypFilter: AuftragTyp.Inventur); if (liste == null || liste == ListenArt.Rampenliste) listRampe = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Abgeholt, typFilter: AuftragTyp.Standart); } else { if (liste == null || liste == ListenArt.Auftragliste) listAuftragToday = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Vorbereitet, minStatusFilter: AuftragStatus.Gewaschen, frottee: true); - if (liste == null || liste == ListenArt.Sonderliste) listSonderAuftrag = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Fertig, minStatusFilter: AuftragStatus.Herrichten, typFilter: AuftragTyp.Einmalig, minTypFilter: AuftragTyp.Inventur, frottee: true); + if (liste == null || liste == ListenArt.Sonderliste) listSonderAuftrag = await View_Auftrag_Expedit.GetAuftragExpeditAsync(statusFilter: AuftragStatus.Fertig, minStatusFilter: AuftragStatus.Herrichten, typFilter: AuftragTyp.Laufzettel, minTypFilter: AuftragTyp.Inventur, frottee: true); } } diff --git a/AA-Forms/FormLogin.cs b/AA-Forms/FormLogin.cs index d18e076..e3dcb36 100644 --- a/AA-Forms/FormLogin.cs +++ b/AA-Forms/FormLogin.cs @@ -7,6 +7,7 @@ using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; +using System.Reflection; using System.Security.Cryptography; using System.Text; using System.Threading; @@ -25,10 +26,10 @@ namespace Deckungsbeitrag public FormLogin() { InitializeComponent(); + this.Text += Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } - } - - private void buttonAnmelden_Click(object sender, EventArgs e) + private void buttonAnmelden_Click(object sender, EventArgs e) { if(string.IsNullOrWhiteSpace(this.textBoxPasswort.Text)) textBoxBenutzer_Leave(sender, e); try @@ -60,7 +61,6 @@ namespace Deckungsbeitrag break; case -3: MessageBox.Show(lex.Message, "Registrieren", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - if (Program.ShowOnBoarding(string.Empty, onBoardingArt) == DialogResult.Cancel) Application.Exit(); this.buttonRegistrieren.Visible = true; this.buttonAnmelden.Enabled = false; this.groupBox1.Height = 146; @@ -112,7 +112,7 @@ namespace Deckungsbeitrag if (MessageBox.Show($"Benutzer {this.textBoxBenutzer.Text} wurde erfolgreich angelegt.\n\nMöchtest du einen eigenen Benutzername angeben?\n\n[JA] -> Neuen Benutzername anlegen\n[NEIN] -> Alten Benutzername behalten", "Hinweis", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { string eingabe = Interaction.InputBox("Welchen Benutzername möchtest du verwenden?\n\nBenutzername:", "Neuer Benutzername", ""); - person.BenutzerName = eingabe; + if (!string.IsNullOrWhiteSpace(eingabe)) person.BenutzerName = eingabe; if (person.Save() != 1) MessageBox.Show("Benutzername konnte nicht gespeichert werden. Melde dich bei deinem Vorgesetzten.", "SPEICHERFEHLER", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.textBoxBenutzer.Focus(); diff --git a/AA-Forms/FormLogin.designer.cs b/AA-Forms/FormLogin.designer.cs index cd1b3d1..959a0bd 100644 --- a/AA-Forms/FormLogin.designer.cs +++ b/AA-Forms/FormLogin.designer.cs @@ -53,9 +53,11 @@ namespace Deckungsbeitrag this.groupBox1.Controls.Add(this.label1); this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox1.ForeColor = System.Drawing.Color.White; - this.groupBox1.Location = new System.Drawing.Point(18, 21); + this.groupBox1.Location = new System.Drawing.Point(27, 32); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(463, 100); + this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.groupBox1.Size = new System.Drawing.Size(694, 154); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "Login-Daten"; @@ -63,9 +65,10 @@ namespace Deckungsbeitrag // textBoxPwdWh // this.textBoxPwdWh.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBoxPwdWh.Location = new System.Drawing.Point(185, 110); + this.textBoxPwdWh.Location = new System.Drawing.Point(278, 169); + this.textBoxPwdWh.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.textBoxPwdWh.Name = "textBoxPwdWh"; - this.textBoxPwdWh.Size = new System.Drawing.Size(264, 26); + this.textBoxPwdWh.Size = new System.Drawing.Size(394, 35); this.textBoxPwdWh.TabIndex = 5; this.textBoxPwdWh.UseSystemPasswordChar = true; // @@ -74,18 +77,20 @@ namespace Deckungsbeitrag this.labelPwdWh.AutoSize = true; this.labelPwdWh.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelPwdWh.ForeColor = System.Drawing.Color.White; - this.labelPwdWh.Location = new System.Drawing.Point(26, 113); + this.labelPwdWh.Location = new System.Drawing.Point(39, 174); + this.labelPwdWh.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.labelPwdWh.Name = "labelPwdWh"; - this.labelPwdWh.Size = new System.Drawing.Size(153, 20); + this.labelPwdWh.Size = new System.Drawing.Size(230, 29); this.labelPwdWh.TabIndex = 4; this.labelPwdWh.Text = "Passwort bestätigen"; // // textBoxPasswort // this.textBoxPasswort.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBoxPasswort.Location = new System.Drawing.Point(185, 62); + this.textBoxPasswort.Location = new System.Drawing.Point(278, 95); + this.textBoxPasswort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.textBoxPasswort.Name = "textBoxPasswort"; - this.textBoxPasswort.Size = new System.Drawing.Size(264, 26); + this.textBoxPasswort.Size = new System.Drawing.Size(394, 35); this.textBoxPasswort.TabIndex = 3; this.textBoxPasswort.UseSystemPasswordChar = true; this.textBoxPasswort.Enter += new System.EventHandler(this.textBoxPasswort_Enter); @@ -96,18 +101,20 @@ namespace Deckungsbeitrag this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Location = new System.Drawing.Point(105, 65); + this.label2.Location = new System.Drawing.Point(158, 100); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(74, 20); + this.label2.Size = new System.Drawing.Size(112, 29); this.label2.TabIndex = 2; this.label2.Text = "Passwort"; // // textBoxBenutzer // this.textBoxBenutzer.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBoxBenutzer.Location = new System.Drawing.Point(185, 30); + this.textBoxBenutzer.Location = new System.Drawing.Point(278, 46); + this.textBoxBenutzer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.textBoxBenutzer.Name = "textBoxBenutzer"; - this.textBoxBenutzer.Size = new System.Drawing.Size(264, 26); + this.textBoxBenutzer.Size = new System.Drawing.Size(394, 35); this.textBoxBenutzer.TabIndex = 1; this.textBoxBenutzer.Enter += new System.EventHandler(this.textBoxBenutzer_Enter); this.textBoxBenutzer.Leave += new System.EventHandler(this.textBoxBenutzer_Leave); @@ -117,9 +124,10 @@ namespace Deckungsbeitrag this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.White; - this.label1.Location = new System.Drawing.Point(105, 33); + this.label1.Location = new System.Drawing.Point(158, 51); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(74, 20); + this.label1.Size = new System.Drawing.Size(108, 29); this.label1.TabIndex = 0; this.label1.Text = "Benutzer"; // @@ -132,10 +140,11 @@ namespace Deckungsbeitrag this.buttonAnmelden.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonAnmelden.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonAnmelden.ForeColor = System.Drawing.Color.White; - this.buttonAnmelden.Location = new System.Drawing.Point(330, 138); + this.buttonAnmelden.Location = new System.Drawing.Point(495, 212); + this.buttonAnmelden.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.buttonAnmelden.Name = "buttonAnmelden"; - this.buttonAnmelden.Padding = new System.Windows.Forms.Padding(2); - this.buttonAnmelden.Size = new System.Drawing.Size(150, 41); + this.buttonAnmelden.Padding = new System.Windows.Forms.Padding(3); + this.buttonAnmelden.Size = new System.Drawing.Size(225, 63); this.buttonAnmelden.TabIndex = 1; this.buttonAnmelden.Text = "Anmelden"; this.buttonAnmelden.UseVisualStyleBackColor = false; @@ -151,9 +160,10 @@ namespace Deckungsbeitrag this.buttonAbbrechen.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonAbbrechen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonAbbrechen.ForeColor = System.Drawing.Color.White; - this.buttonAbbrechen.Location = new System.Drawing.Point(174, 138); + this.buttonAbbrechen.Location = new System.Drawing.Point(261, 212); + this.buttonAbbrechen.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.buttonAbbrechen.Name = "buttonAbbrechen"; - this.buttonAbbrechen.Size = new System.Drawing.Size(150, 41); + this.buttonAbbrechen.Size = new System.Drawing.Size(225, 63); this.buttonAbbrechen.TabIndex = 2; this.buttonAbbrechen.Text = "Abbrechen"; this.buttonAbbrechen.UseVisualStyleBackColor = false; @@ -167,9 +177,10 @@ namespace Deckungsbeitrag this.buttonRegistrieren.FlatAppearance.BorderSize = 0; this.buttonRegistrieren.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonRegistrieren.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonRegistrieren.Location = new System.Drawing.Point(18, 139); + this.buttonRegistrieren.Location = new System.Drawing.Point(27, 214); + this.buttonRegistrieren.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.buttonRegistrieren.Name = "buttonRegistrieren"; - this.buttonRegistrieren.Size = new System.Drawing.Size(150, 41); + this.buttonRegistrieren.Size = new System.Drawing.Size(225, 63); this.buttonRegistrieren.TabIndex = 3; this.buttonRegistrieren.Text = "Registrieren"; this.buttonRegistrieren.UseVisualStyleBackColor = false; @@ -178,11 +189,11 @@ namespace Deckungsbeitrag // FormLogin // this.AcceptButton = this.buttonAnmelden; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); this.CancelButton = this.buttonAbbrechen; - this.ClientSize = new System.Drawing.Size(492, 191); + this.ClientSize = new System.Drawing.Size(738, 294); this.Controls.Add(this.buttonRegistrieren); this.Controls.Add(this.buttonAbbrechen); this.Controls.Add(this.buttonAnmelden); @@ -190,10 +201,12 @@ namespace Deckungsbeitrag this.ForeColor = System.Drawing.SystemColors.ControlText; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormLogin"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "LOGIN Version: "; this.Load += new System.EventHandler(this.FormLogin_Load); this.Shown += new System.EventHandler(this.FormLogin_Shown); this.groupBox1.ResumeLayout(false); diff --git a/AA-Forms/FormMain.Designer.cs b/AA-Forms/FormMain.Designer.cs index ed8e8f6..65a292a 100644 --- a/AA-Forms/FormMain.Designer.cs +++ b/AA-Forms/FormMain.Designer.cs @@ -111,6 +111,7 @@ namespace Deckungsbeitrag this.textBoxScannTest = new System.Windows.Forms.TextBox(); this.buttonScannTest = new System.Windows.Forms.Button(); this.labelScannTest = new System.Windows.Forms.Label(); + this.buttonSonderAuftrag = new System.Windows.Forms.Button(); this.toolStripMenu.SuspendLayout(); this.panelMain.SuspendLayout(); this.groupBoxAuftrag.SuspendLayout(); @@ -474,6 +475,7 @@ namespace Deckungsbeitrag // this.panelMain.AllowDrop = true; this.panelMain.BackColor = System.Drawing.Color.White; + this.panelMain.Controls.Add(this.buttonSonderAuftrag); this.panelMain.Controls.Add(this.groupBoxAuftrag); this.panelMain.Controls.Add(this.buttonNeuerRegAuft); this.panelMain.Controls.Add(this.panelProgress); @@ -732,7 +734,7 @@ namespace Deckungsbeitrag 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.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.buttonTourenliste.Location = new System.Drawing.Point(11, 80); + this.buttonTourenliste.Location = new System.Drawing.Point(11, 141); this.buttonTourenliste.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6); this.buttonTourenliste.Name = "buttonTourenliste"; this.buttonTourenliste.Size = new System.Drawing.Size(333, 50); @@ -1271,7 +1273,7 @@ namespace Deckungsbeitrag 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(11, 206); + this.buttonNeueAufgabe.Location = new System.Drawing.Point(11, 265); this.buttonNeueAufgabe.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6); this.buttonNeueAufgabe.Name = "buttonNeueAufgabe"; this.buttonNeueAufgabe.Size = new System.Drawing.Size(333, 50); @@ -1313,7 +1315,7 @@ 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(11, 143); + this.buttonNeuerUser.Location = new System.Drawing.Point(11, 203); this.buttonNeuerUser.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6); this.buttonNeuerUser.Name = "buttonNeuerUser"; this.buttonNeuerUser.Size = new System.Drawing.Size(333, 50); @@ -1502,6 +1504,27 @@ namespace Deckungsbeitrag this.labelScannTest.TabIndex = 11; this.labelScannTest.Text = "label1"; // + // buttonSonderAuftrag + // + this.buttonSonderAuftrag.BackColor = System.Drawing.Color.CadetBlue; + this.buttonSonderAuftrag.Enabled = false; + this.buttonSonderAuftrag.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); + this.buttonSonderAuftrag.FlatAppearance.BorderSize = 0; + this.buttonSonderAuftrag.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonSonderAuftrag.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonSonderAuftrag.ForeColor = System.Drawing.Color.Black; + this.buttonSonderAuftrag.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; + this.buttonSonderAuftrag.Location = new System.Drawing.Point(11, 79); + this.buttonSonderAuftrag.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6); + this.buttonSonderAuftrag.Name = "buttonSonderAuftrag"; + this.buttonSonderAuftrag.Size = new System.Drawing.Size(333, 50); + this.buttonSonderAuftrag.TabIndex = 72; + this.buttonSonderAuftrag.Text = "Neuer Sonderauftrag"; + this.buttonSonderAuftrag.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.buttonSonderAuftrag.UseVisualStyleBackColor = false; + this.buttonSonderAuftrag.Visible = false; + this.buttonSonderAuftrag.Click += new System.EventHandler(this.buttonSonderAuftrag_Click); + // // FormMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1629,6 +1652,7 @@ namespace Deckungsbeitrag private System.Windows.Forms.ProgressBar progressBarKundeArtikelUpdate; private System.Windows.Forms.Panel panelProgress; private System.Windows.Forms.Button buttonNeuerRegAuft; + private System.Windows.Forms.Button buttonSonderAuftrag; } } diff --git a/AA-Forms/FormMain.cs b/AA-Forms/FormMain.cs index 3d59ee4..789dc5e 100644 --- a/AA-Forms/FormMain.cs +++ b/AA-Forms/FormMain.cs @@ -55,6 +55,7 @@ namespace Deckungsbeitrag private UCInventur uCInventur; private readonly Screen screen = Screen.PrimaryScreen; private Kunde kunde; + private Tour tour; #endregion public FormMain() { @@ -104,6 +105,18 @@ namespace Deckungsbeitrag GetInventuren(); GetSaison(); } + else + { + if (this.benutzer.Rolle == BenutzerRolle.Fahrer) + { + Saison saison = Saison.GetAktivSaison(); + if (saison.Bezeichnung == "Zwischensaison") + { + var data = ShowTourenplan(); + tour = Tour.GetTour(saison.SaisonId, data.tour); + } + } + } if (this.groupBoxContAnz.Visible) { @@ -126,18 +139,19 @@ namespace Deckungsbeitrag private void FormMain_Shown(object sender, EventArgs e) { - - // Meldung wenn Updates oder Imports erledigt wurden. - if (Program.Artikelliste_Importiert | Program.Kundenliste_Importiert | Program.Software_Updated) + + if (this.benutzer.Rolle != BenutzerRolle.Fahrer) { - string[] updates = new string[3]; - updates[0] = Program.Artikelliste_Importiert ? "Artikelliste: ✅" : "Artikelliste: ❌"; - updates[1] = Program.Kundenliste_Importiert ? "Kundenliste: ✅" : "Kundenliste: ❌"; - updates[2] = Program.Software_Updated ? "Software: ✅" : "Sofware: ❌"; - MessageBox.Show($"Folgende Updates wurden heute durchgeführt:\n\n{updates[0]}\n{updates[1]}\n{updates[2]}", "UPDATES DURCHGEFÜHRT", MessageBoxButtons.OK, MessageBoxIcon.Information); + // Meldung wenn Updates oder Imports erledigt wurden. + if (Program.Artikelliste_Importiert | Program.Kundenliste_Importiert | Program.Software_Updated) + { + string[] updates = new string[3]; + updates[0] = Program.Artikelliste_Importiert ? "Artikelliste: ✅" : "Artikelliste: ❌"; + updates[1] = Program.Kundenliste_Importiert ? "Kundenliste: ✅" : "Kundenliste: ❌"; + updates[2] = Program.Software_Updated ? "Software: ✅" : "Sofware: ❌"; + MessageBox.Show($"Folgende Updates wurden heute durchgeführt:\n\n{updates[0]}\n{updates[1]}\n{updates[2]}", "UPDATES DURCHGEFÜHRT", MessageBoxButtons.OK, MessageBoxIcon.Information); + } } - // OnBoarding nur bei den Fahrern anzeigen. Bis die anderen Fertig sind. - if (this.benutzer.Rolle == BenutzerRolle.Fahrer) ZeigeOnboarding(); this.ResumeLayout(); this.Cursor = Cursors.Default; @@ -194,6 +208,16 @@ namespace Deckungsbeitrag } #endregion + private (DateTime? datum, string[] touren, string tour) ShowTourenplan() + { + FormShowUserControl showUserControl = new FormShowUserControl("Tourenplan", this.benutzer, this.kunde); + if (showUserControl.ShowDialog() == DialogResult.OK) + { + var data = showUserControl.lieferDaten; + return (data.datum, data.touren, data.text); + } + return (null, null, null); + } #region ToolStripButton-Events private void Get_Border_Paint(object sender, PaintEventArgs e) @@ -341,8 +365,8 @@ namespace Deckungsbeitrag /// private void ButtonNeuerAuftrag_Click(object sender, EventArgs e) { - onBoardingArt = OnboardingSchritt.NeuerAuftrag; - if (this.benutzer.Rolle == BenutzerRolle.Fahrer) ZeigeOnboarding(); + //onBoardingArt = OnboardingSchritt.NeuerAuftrag; + //if (this.benutzer.Rolle == BenutzerRolle.Fahrer) ZeigeOnboarding(); FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.benutzer, AuftragTyp.Standart); if (neuerAuftrag.ShowDialog() == DialogResult.Abort) { this.kunde = neuerAuftrag.kunde; ButtonNeueInventur_Click(this.buttonNeueInventur, null); } @@ -416,7 +440,7 @@ namespace Deckungsbeitrag ++tosave; Auftrag a = (Auftrag)item.RowObject; - + a.ArbeiterID = this.benutzer.BenutzerID; a.Erledigt = DateTime.Now; a.ErledigtVon = this.benutzer.BenutzerID; a.Status = AuftragStatus.Ausgeliefert; @@ -441,6 +465,7 @@ namespace Deckungsbeitrag newAuftrag.Status = AuftragStatus.Herrichten; newAuftrag.ErstelltVon = (int)this.benutzer.BenutzerID; newAuftrag.Erstellt = DateTime.Now; + newAuftrag.TourID = a.TourID; // Werte des alten Auftrags zurücksetzen. newAuftrag.Erledigt = null; @@ -549,6 +574,11 @@ namespace Deckungsbeitrag FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.benutzer, AuftragTyp.Regelmäßig); neuerAuftrag.ShowDialog(); } + private void buttonSonderAuftrag_Click(object sender, EventArgs e) + { + FormNeuerAuftrag neuerAuftrag = new FormNeuerAuftrag(this.benutzer, null); + if (neuerAuftrag.ShowDialog() == DialogResult.Abort) { this.kunde = neuerAuftrag.kunde; ButtonNeueInventur_Click(this.buttonNeueInventur, null); } + } #endregion @@ -606,7 +636,8 @@ namespace Deckungsbeitrag try { await conn.OpenAsync(); - if (status == null & this.benutzer.Rolle == BenutzerRolle.Fahrer) alist = await Auftrag.GetFahrerListAsync(this.benutzer.BenutzerID, conn); + //TODO: Richtige Liste holen, wahrscheinlich mit TourID von ShowTourenplan. + if (status == null & this.benutzer.Rolle == BenutzerRolle.Fahrer) alist = await Auftrag.GetFahrerListAsync(tour.TourID, conn); else alist = await Auftrag.GetStatusListAsync(status, conn); } finally @@ -1469,6 +1500,7 @@ namespace Deckungsbeitrag textBox1.Width = (int)size.Width + 10; // +10 als Puffer } } + } } //CHANGES: Fahrer können abgeholte Aufträge erstellen und ausgelieferte Aufträge markieren. diff --git a/AA-Forms/FormNeuerAuftrag.Designer.cs b/AA-Forms/FormNeuerAuftrag.Designer.cs index 19cfbe6..4bbc0f0 100644 --- a/AA-Forms/FormNeuerAuftrag.Designer.cs +++ b/AA-Forms/FormNeuerAuftrag.Designer.cs @@ -51,10 +51,11 @@ namespace Deckungsbeitrag this.comboBoxFahrer = new System.Windows.Forms.ComboBox(); this.buttonEinstellung = new System.Windows.Forms.Button(); this.panelRegAuftrag = new System.Windows.Forms.Panel(); + this.textBoxText = new System.Windows.Forms.TextBox(); this.pictureBoxAddArtikel = new System.Windows.Forms.PictureBox(); this.label8 = new System.Windows.Forms.Label(); this.comboBoxArtikel = new System.Windows.Forms.ComboBox(); - this.label7 = new System.Windows.Forms.Label(); + this.labelText = new System.Windows.Forms.Label(); this.comboBoxRhythmus = new System.Windows.Forms.ComboBox(); this.fLPArtikel = new System.Windows.Forms.FlowLayoutPanel(); this.pictureBoxMinus = new System.Windows.Forms.PictureBox(); @@ -172,7 +173,7 @@ namespace Deckungsbeitrag // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label5.Location = new System.Drawing.Point(7, 340); + this.label5.Location = new System.Drawing.Point(7, 407); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(196, 25); this.label5.TabIndex = 24; @@ -311,7 +312,7 @@ namespace Deckungsbeitrag // textBoxCont // this.textBoxCont.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBoxCont.Location = new System.Drawing.Point(281, 316); + this.textBoxCont.Location = new System.Drawing.Point(281, 383); this.textBoxCont.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.textBoxCont.Name = "textBoxCont"; this.textBoxCont.Size = new System.Drawing.Size(50, 49); @@ -324,11 +325,11 @@ namespace Deckungsbeitrag // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.Location = new System.Drawing.Point(8, 409); + this.label1.Location = new System.Drawing.Point(7, 333); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(125, 25); + this.label1.Size = new System.Drawing.Size(59, 25); this.label1.TabIndex = 33; - this.label1.Text = "Zustellfahrer:"; + this.label1.Text = "Tour:"; // // comboBoxFahrer // @@ -337,10 +338,10 @@ namespace Deckungsbeitrag this.comboBoxFahrer.FlatStyle = System.Windows.Forms.FlatStyle.System; this.comboBoxFahrer.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.comboBoxFahrer.FormattingEnabled = true; - this.comboBoxFahrer.Location = new System.Drawing.Point(157, 393); + this.comboBoxFahrer.Location = new System.Drawing.Point(92, 320); this.comboBoxFahrer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.comboBoxFahrer.Name = "comboBoxFahrer"; - this.comboBoxFahrer.Size = new System.Drawing.Size(224, 38); + this.comboBoxFahrer.Size = new System.Drawing.Size(291, 38); this.comboBoxFahrer.TabIndex = 34; this.comboBoxFahrer.Validating += new System.ComponentModel.CancelEventHandler(this.ComboBoxFahrer_Validating); // @@ -363,10 +364,11 @@ namespace Deckungsbeitrag // // panelRegAuftrag // + this.panelRegAuftrag.Controls.Add(this.textBoxText); this.panelRegAuftrag.Controls.Add(this.pictureBoxAddArtikel); this.panelRegAuftrag.Controls.Add(this.label8); this.panelRegAuftrag.Controls.Add(this.comboBoxArtikel); - this.panelRegAuftrag.Controls.Add(this.label7); + this.panelRegAuftrag.Controls.Add(this.labelText); this.panelRegAuftrag.Controls.Add(this.comboBoxRhythmus); this.panelRegAuftrag.Controls.Add(this.fLPArtikel); this.panelRegAuftrag.Enabled = false; @@ -378,6 +380,16 @@ namespace Deckungsbeitrag this.panelRegAuftrag.Visible = false; this.panelRegAuftrag.EnabledChanged += new System.EventHandler(this.PanelRegAuftrag_EnabledChanged); // + // textBoxText + // + this.textBoxText.Location = new System.Drawing.Point(25, 52); + this.textBoxText.Multiline = true; + this.textBoxText.Name = "textBoxText"; + this.textBoxText.Size = new System.Drawing.Size(518, 459); + this.textBoxText.TabIndex = 48; + this.textBoxText.Visible = false; + this.textBoxText.VisibleChanged += new System.EventHandler(this.textBoxText_VisibleChanged); + // // pictureBoxAddArtikel // this.pictureBoxAddArtikel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -418,15 +430,15 @@ namespace Deckungsbeitrag this.comboBoxArtikel.TabIndex = 37; this.comboBoxArtikel.SelectedIndexChanged += new System.EventHandler(this.ComboBoxArtikel_SelectedIndexChanged); // - // label7 + // labelText // - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label7.Location = new System.Drawing.Point(20, 25); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(105, 25); - this.label7.TabIndex = 36; - this.label7.Text = "Rhythmus:"; + this.labelText.AutoSize = true; + this.labelText.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelText.Location = new System.Drawing.Point(20, 25); + this.labelText.Name = "labelText"; + this.labelText.Size = new System.Drawing.Size(105, 25); + this.labelText.TabIndex = 36; + this.labelText.Text = "Rhythmus:"; // // comboBoxRhythmus // @@ -459,7 +471,7 @@ namespace Deckungsbeitrag // this.pictureBoxMinus.BackColor = System.Drawing.Color.Red; this.pictureBoxMinus.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxMinus.Image"))); - this.pictureBoxMinus.Location = new System.Drawing.Point(232, 315); + this.pictureBoxMinus.Location = new System.Drawing.Point(232, 382); this.pictureBoxMinus.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBoxMinus.Name = "pictureBoxMinus"; this.pictureBoxMinus.Size = new System.Drawing.Size(51, 50); @@ -472,7 +484,7 @@ namespace Deckungsbeitrag // this.pictureBoxPlus.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0))))); this.pictureBoxPlus.Image = ((System.Drawing.Image)(resources.GetObject("pictureBoxPlus.Image"))); - this.pictureBoxPlus.Location = new System.Drawing.Point(332, 315); + this.pictureBoxPlus.Location = new System.Drawing.Point(332, 382); this.pictureBoxPlus.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBoxPlus.Name = "pictureBoxPlus"; this.pictureBoxPlus.Size = new System.Drawing.Size(51, 50); @@ -561,10 +573,11 @@ namespace Deckungsbeitrag private System.Windows.Forms.Button buttonEinstellung; private System.Windows.Forms.Panel panelRegAuftrag; private System.Windows.Forms.FlowLayoutPanel fLPArtikel; - private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label labelText; private System.Windows.Forms.ComboBox comboBoxRhythmus; private System.Windows.Forms.PictureBox pictureBoxAddArtikel; private System.Windows.Forms.Label label8; private System.Windows.Forms.ComboBox comboBoxArtikel; + private System.Windows.Forms.TextBox textBoxText; } } \ No newline at end of file diff --git a/AA-Forms/FormNeuerAuftrag.cs b/AA-Forms/FormNeuerAuftrag.cs index 1b83273..3e7f9f4 100644 --- a/AA-Forms/FormNeuerAuftrag.cs +++ b/AA-Forms/FormNeuerAuftrag.cs @@ -38,11 +38,11 @@ namespace Deckungsbeitrag public DateTime? letzterLiefertag; public DataGridViewCell aktivCell; private readonly string userid; - private readonly AuftragTyp auftragtyp = AuftragTyp.Standart; + private readonly AuftragTyp? auftragtyp = AuftragTyp.Standart; private string eingabe = string.Empty; private readonly OnboardingSchritt onBoardingArt = OnboardingSchritt.NeuerAuftrag; string[] touren; - string tour; + private Tour tour; string kundeName = string.Empty; #endregion @@ -58,7 +58,7 @@ namespace Deckungsbeitrag this.benutzer = benutzer; } - public FormNeuerAuftrag(Benutzer benutzer, AuftragTyp auftragTyp) : this(benutzer) + public FormNeuerAuftrag(Benutzer benutzer, AuftragTyp? auftragTyp) : this(benutzer) { this.auftragtyp = auftragTyp; } @@ -83,7 +83,8 @@ namespace Deckungsbeitrag if (this.auftragtyp == AuftragTyp.Regelmäßig) {kndService = "Geschäft"; labelLiefertag.Text = "Erster Liefertag:"; } if (this.benutzer.Rolle == BenutzerRolle.Fahrer) kndService = "Geschäft"; - DatenLaden(kndService); + if (this.auftragtyp == null) SonderDatenLaden(kndService); + else DatenLaden(kndService); } private async void FormNeuerAuftrag_HelpButtonClicked(object sender, CancelEventArgs e) { @@ -92,9 +93,15 @@ namespace Deckungsbeitrag ZeigeOnboarding(); } - /// - /// Kundendaten Liefertag werden eingefügt. - /// + private void SonderDatenLaden(string kndService) + { + // Kunde laden + GetKunde(kndService); + + // ComboBox Typ & Fahrer wird mit Items geladen + ComboBoxTyp_Load(); + ComboBoxFahrer_Load(); + } private void DatenLaden(string kndService) { // Kunde laden @@ -109,14 +116,6 @@ namespace Deckungsbeitrag // ComboBox Typ & Fahrer wird mit Items geladen ComboBoxTyp_Load(); ComboBoxFahrer_Load(); - - if (this.benutzer.Rolle == BenutzerRolle.Fahrer) - { - if (this.benutzer.Tour == tour) this.comboBoxFahrer.SelectedItem = this.comboBoxFahrer.Items.Cast().FirstOrDefault(t => t.Tour == tour); - else this.comboBoxFahrer.SelectedItem = this.comboBoxFahrer.Items.Cast().FirstOrDefault(t => t.Tour == tour); - } - else this.comboBoxFahrer.SelectedIndex = -1; - } private void GetNextLiefertag() { @@ -157,7 +156,7 @@ namespace Deckungsbeitrag { // Wenn ShowTourenplan Daten retour gibt, werden diese geladen. nextLiefertag = (DateTime)data.datum; - tour = data.tour ?? null; + tour = Tour.GetTour(Saison.SaisonId, data.tour); } } @@ -175,6 +174,11 @@ namespace Deckungsbeitrag try { this.kunde = Funktionen.Open_List(kndService); + if (this.kunde == null) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } this.textBoxKndNr.Text = kunde.KundeNummer; this.kundeName = this.textBoxKundeName.Text = this.kunde.Suchtext ?? this.kunde.KundeName; @@ -221,17 +225,15 @@ namespace Deckungsbeitrag // Items werden von AuftragTyp geladen. this.comboBoxTyp.DataSource = Enum.GetValues(typeof(AuftragTyp)); // Wenn der Kunde ein Geschäftskunde ist, wird AuftragTyp.Geschäft ausgewählt. Andernfalls wird der AuftragTyp aus dem Konstruktor gewählt. - this.comboBoxTyp.SelectedValueChanged += ComboBoxTyp_SelectedValueChanged; - - if (kunde.Service == "Geschäft") this.comboBoxTyp.SelectedItem = AuftragTyp.Geschäft; - else this.comboBoxTyp.SelectedItem = auftragtyp; - //if (this.benutzer.Rolle == BenutzerRolle.Fahrer) - //{ - // this.comboBoxTyp.Enabled = true; - //} - //else this.comboBoxTyp.Enabled = false; + if (this.auftragtyp == null) this.comboBoxTyp.SelectedIndex = -1; + else + { + if (kunde.Service == "Geschäft") this.comboBoxTyp.SelectedItem = AuftragTyp.Geschäft; + else this.comboBoxTyp.SelectedItem = auftragtyp; + } + this.ResumeLayout(false); } catch (Exception ex) @@ -248,12 +250,19 @@ namespace Deckungsbeitrag /// private void ComboBoxFahrer_Load() { - List benutzerliste = Benutzer.GetFahrerList(); - this.comboBoxFahrer.DataSource = benutzerliste; Saison saison = Saison.GetAktivSaison(); - if (saison.Bezeichnung == "Zwischensaison") this.comboBoxFahrer.DisplayMember = "BenutzerName"; - else this.comboBoxFahrer.DisplayMember = "Tour"; - + this.comboBoxFahrer.Validating -= ComboBoxFahrer_Validating; + List tourliste = Tour.GetSaisonListe(saison); + this.comboBoxFahrer.DataSource = tourliste; + this.comboBoxFahrer.DisplayMember = "Bezeichnung"; + + // ComboBox-Auswahl vordefinieren. + if (this.benutzer.Rolle == BenutzerRolle.Fahrer) + { + this.comboBoxFahrer.SelectedItem = tour; + } + else this.comboBoxFahrer.SelectedIndex = -1; + this.comboBoxFahrer.Validating += ComboBoxFahrer_Validating; } private void ComboBoxTyp_SelectedValueChanged(object sender, EventArgs e) { @@ -266,7 +275,9 @@ namespace Deckungsbeitrag return; } } - switch ((AuftragTyp)comboBoxTyp.SelectedValue) + if (comboBoxTyp.SelectedValue != null) + { + switch ((AuftragTyp)comboBoxTyp.SelectedValue) { case AuftragTyp.Geschäft: // Wird derzeit wenig verwendet da die Auswahl in DatenLaden nach KundenService erfolgt. this.Width = textBoxKundeName.Right + 30; @@ -306,15 +317,22 @@ namespace Deckungsbeitrag this.Width = textBoxKundeName.Right + 30; this.Height = 470; break; - case AuftragTyp.Einmalig: + case AuftragTyp.Laufzettel: this.panelRegAuftrag.Enabled = this.panelRegAuftrag.Visible = true; - this.pictureBoxPlus.Enabled = this.pictureBoxMinus.Enabled = this.textBoxCont.Enabled = false; + this.textBoxText.Visible = true; + this.labelText.Text = "Laufzetteltext:"; this.Width = this.panelRegAuftrag.Right + 25; this.Height = 470; break; default: break; } + } + else + { + this.Width = textBoxKundeName.Right + 30; + this.Height = 470; + } } private void ComboBoxArtikel_SelectedIndexChanged(object sender, EventArgs e) { @@ -338,15 +356,15 @@ namespace Deckungsbeitrag } private void ComboBoxFahrer_Validating(object sender, CancelEventArgs e) { - if (((ComboBox)sender).SelectedIndex == -1) return; - if (((Benutzer)((ComboBox)sender).SelectedItem).BenutzerID == this.benutzer.BenutzerID) return; + ComboBox cb = sender as ComboBox; + if (cb.SelectedIndex == -1) return; + if (cb.SelectedItem is Tour selected && selected.TourID == tour.TourID) return; if (this.benutzer.Rolle == BenutzerRolle.Verwaltung || this.benutzer.Rolle == BenutzerRolle.Admin || this.benutzer.Rolle == BenutzerRolle.Expedit) return; - if (meldung.GetFrage(this, "Möchtest du den Auftrag wirklich einem anderen Fahrer zuteilen?", false) == DialogResult.No) { ((ComboBox)sender).SelectedIndex = -1; e.Cancel = true; } + if (meldung.GetFrage(this, "Möchtest du den Auftrag wirklich einer anderen Tour zuteilen?", false) == DialogResult.No) { ((ComboBox)sender).SelectedIndex = -1; e.Cancel = true; } else { eingabe = Interaction.InputBox("Warum möchtest du den Auftrag einem anderen Fahrer zuteilen?\n\nGrund:", "Sonderzuteilung", ""); if (string.IsNullOrWhiteSpace(eingabe)) e.Cancel = true; - else eingabe += " / "; } } #endregion @@ -365,7 +383,7 @@ namespace Deckungsbeitrag int dropdownWidth = comboBoxArtikel.DropDownWidth; if (panel.Enabled) { - if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Regelmäßig || (AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Einmalig) + if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Regelmäßig) { List artikelListe; if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Regelmäßig) artikelListe = Artikel.GetRegArtikelList(); @@ -383,7 +401,6 @@ namespace Deckungsbeitrag comboBoxRhythmus.DataSource = Enum.GetValues(typeof(RegRhythmen)); comboBoxRhythmus.SelectedIndex = -1; - if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Einmalig) comboBoxRhythmus.Enabled = false; } if ((AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Standerhöhung || (AuftragTyp)comboBoxTyp.SelectedValue == AuftragTyp.Standverminderung) { @@ -425,7 +442,7 @@ namespace Deckungsbeitrag this.Auftrag = Aktualisieren(kunde); // Wenn Fahrer den Auftrag speichert - if (this.benutzer.Rolle == BenutzerRolle.Fahrer) { FahrerAuftraegeSpeichern(this.Auftrag); } + if (this.benutzer.Rolle == BenutzerRolle.Fahrer) { FahrerAuftraegeSpeichern(this.Auftrag); return; } // Wenn Expedit/Waschstrasse/Verwaltung/Admin den Auftrag speichert switch ((AuftragTyp)comboBoxTyp.SelectedItem) @@ -436,8 +453,6 @@ namespace Deckungsbeitrag return; case AuftragTyp.Regelmäßig: SpezialAuftragSpeichern(Auftrag); return; - case AuftragTyp.Einmalig: SpezialAuftragSpeichern(Auftrag); - return; default: break; } @@ -540,19 +555,23 @@ namespace Deckungsbeitrag private Auftrag Aktualisieren(Kunde knd) { - int? arbeiterID; DateTime liefertag; string zusatz = string.Empty; - // Wenn Kundennummer ist Div.Barzahler(in FormListe wenn mit ? am Anfang) wird individueller Kundename als Zusatzinfo gespeichert. - if (knd.KundeNummer == "2320000") zusatz = string.IsNullOrWhiteSpace(knd.Suchtext) ? "Kunde: " + knd.KundeName : "Kunde: " + knd.Suchtext; - else if (!string.IsNullOrWhiteSpace(eingabe)) zusatz = "Fahrerwechsel: " + eingabe; + // ZusatzInfo wird geladen. + // Wenn textBoxText wurde eingetragen (Auftrag Laufzettel) + if (!string.IsNullOrWhiteSpace(textBoxText.Text)) zusatz = textBoxText.Text; + // Wenn Kundennummer ist Div.Barzahler(in FormListe wenn mit ? am Anfang) wird individueller Kundename eingetrage + // Wenn Fahrerwechsel durchgeführt wird Grund eingetragen + if (knd.KundeNummer == "2320000") zusatz += string.IsNullOrWhiteSpace(knd.Suchtext) ? "Kunde: " + knd.KundeName : "Kunde: " + knd.Suchtext; + else if (!string.IsNullOrWhiteSpace(eingabe)) zusatz += "Fahrerwechsel: " + eingabe; + + Tour selectedTour = this.comboBoxFahrer.SelectedIndex == -1 ? null : (Tour)this.comboBoxFahrer.SelectedItem; Auftrag _auftrag = new Auftrag { AuftragID = this.Auftrag?.AuftragID, KundeID = (int)knd.KundeID, - ArbeiterID = arbeiterID = this.comboBoxFahrer.SelectedIndex == -1 ? null : ((Benutzer)this.comboBoxFahrer.SelectedItem).BenutzerID, AufgabeID = knd.Aufgabe != null ? knd.Aufgabe : null, Liefertag = liefertag = this.dTPLiefertag.Value, Container = int.TryParse(this.textBoxCont.Text, out int i) ? i : 0, @@ -560,28 +579,28 @@ namespace Deckungsbeitrag Erstellt = DateTime.Now, Typ = (AuftragTyp)comboBoxTyp.SelectedItem, Abteilungen = AbteilungsStatus.Keine, - Priority = Funktionen.GetPriority((Benutzer)this.comboBoxFahrer.SelectedItem), - Status = this.benutzer.Rolle == BenutzerRolle.Fahrer ? AuftragStatus.Abgeholt : AuftragStatus.Herrichten, - Rhythmus = this.comboBoxRhythmus.Enabled ? (RegRhythmen)this.comboBoxRhythmus.SelectedItem : RegRhythmen.Unbekannt, - //TourID = this.Auftrag == null ? GetTour(arbeiterID, liefertag) : this.Auftrag.TourID, + Status = this.benutzer.Rolle == BenutzerRolle.Fahrer ? AuftragStatus.Abgeholt : AuftragStatus.Herrichten, // Wenn Fahrer Auftrag erstellt dann abgeholt sonst Herrichten. + Rhythmus = this.comboBoxRhythmus.Enabled ? (RegRhythmen)this.comboBoxRhythmus.SelectedItem : RegRhythmen.Unbekannt, // Wenn Rhythmus ist nicht Enabled dann RegRhythmus Unbekannt. + TourID = selectedTour?.TourID, // Wenn Tour hinterlegt dann TourID speichern. + ArbeiterID = selectedTour?.BenutzerID, // Wenn Tour hinterlegt dann BenutzerID der Tour speichern. KANN AUCH null SEIN!! + Priority = selectedTour.Priority, // Wenn Tour hinterlegt dann Priority der Tour speichern. ZusatzInfo = zusatz, }; - return _auftrag; } - private int? GetTour(int? arbeiterID, DateTime liefertag) - { - Tour tour; - do - { - tour = Tour.FindeTour(null, arbeiterID, liefertag); - if (tour == null) Funktionen.UpdateOrSaveTour(Auftrag.TourID, Auftrag); + //private int? GetTour(int? arbeiterID, DateTime liefertag) + //{ + // Tour tour; + // do + // { + // tour = Tour.FindeTour(null, arbeiterID, liefertag); + // if (tour == null) Funktionen.UpdateOrSaveTour(Auftrag.TourID, Auftrag); - } while (tour == null); + // } while (tour == null); - return tour.TourID; - } + // return tour.TourID; + //} private void SpezialAuftragSpeichern(Auftrag Auftrag) { if (Auftrag.FindeAuftrag(true).Gefunden) @@ -662,7 +681,6 @@ namespace Deckungsbeitrag if (this.benutzer.Rolle == BenutzerRolle.Fahrer) { this.Auftrag = null; - DatenLaden(string.Empty); } } @@ -725,6 +743,14 @@ namespace Deckungsbeitrag //this.Close(); // Onboarding beendet } } + + private void textBoxText_VisibleChanged(object sender, EventArgs e) + { + if (textBoxText.Visible) + { + foreach (Control ctr in this.panelRegAuftrag.Controls) if (!ctr.Name.Contains("Text")) ctr.Enabled = false; + } + } } } //TODO: TourenListe Entwurf muss überarbeitet werden. \ No newline at end of file diff --git a/AA-Forms/FormShowUserControl.cs b/AA-Forms/FormShowUserControl.cs index bcdc3a4..d1a2cfe 100644 --- a/AA-Forms/FormShowUserControl.cs +++ b/AA-Forms/FormShowUserControl.cs @@ -54,8 +54,15 @@ namespace Deckungsbeitrag.AA_Forms public FormShowUserControl(string groupBox, Benutzer user, Kunde kunde) : this(groupBox, user) { - this.Text = string.IsNullOrWhiteSpace(kunde.Suchtext) ? kunde.KundeName : kunde.Suchtext; - this.Text += " " + kunde.Ort; + if (kunde != null) + { + this.Text = string.IsNullOrWhiteSpace(kunde.Suchtext) ? kunde.KundeName : kunde.Suchtext; + this.Text += " " + kunde.Ort; + } + else + { + this.Text = "HEUTIGE TOUR WÄHLEN"; + } } private void FormShowUserControl_Load(object sender, EventArgs e) @@ -103,6 +110,11 @@ namespace Deckungsbeitrag.AA_Forms UCTourenplan uc = (UCTourenplan)form.Controls[0]; lieferDaten = uc.lieferDaten; } + //TODO: Wenn Cancel... + if (form.ActiveControl.Name == "UCTourenplan") + { + + } } } } diff --git a/AA-Klassen/Auftrag.cs b/AA-Klassen/Auftrag.cs index 3a7b6f4..e6781f7 100644 --- a/AA-Klassen/Auftrag.cs +++ b/AA-Klassen/Auftrag.cs @@ -18,17 +18,6 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace DatenDB { #region Enums - public enum AuftragPriority - { - None = 0, - First = 1, - Second = 2, - Third = 3, - Fourth = 4, - Fifth = 5 - } - - /// /// Enum AuftragStatus /// @@ -58,7 +47,7 @@ namespace DatenDB Standverminderung = 4, Regelmäßig = 5, AufAbruf = 6, - Einmalig = 7 + Laufzettel = 7 } [Flags] @@ -97,67 +86,6 @@ namespace DatenDB } #region async Tasks - public static async Task> GetAuftragListTodayAsync(AuftragStatus? status, NpgsqlConnection conn, AuftragTyp? typ, int? abtstatus) - { - List resultList = new List(); - bool isExpedit = true; - using (var command = new NpgsqlCommand()) - { - command.Connection = conn; - // Listen für FROTTEE EXPEDIT - if (abtstatus != null) - { - if (status != null) command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE status < {(int)status} AND status > {(int)AuftragStatus.Aufgelegt} AND (a.abteilungen_status & 2) = 0 ORDER BY liefertag ASC"; - else command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE typ = {(int)typ} and status < {(int)AuftragStatus.Vorbereitet} AND (a.abteilungen_status & 2) <> 0 ORDER BY liefertag ASC"; - } - else - { - // Liste für EXPEDIT AUFTRÄGE HEUTE - if (typ == null) command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE status < {(int)status} AND status > {(int)AuftragStatus.Aufgelegt} ORDER BY liefertag ASC"; - else - { - // Liste für EXPEDIT GESCHÄFT - if (status == null) command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE typ = {(int)typ} and status < {(int)AuftragStatus.Fertig} ORDER BY liefertag ASC"; - else - { // Liste für EXPEDIT VORBEREITET - command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE typ = {(int)typ} AND status = {(int)status} ORDER BY liefertag ASC"; - } - } - } - - - - - using (var reader = await command.ExecuteReaderAsync()) - { - while (await reader.ReadAsync()) - resultList.Add(new Auftrag(reader, isExpedit)); - } - } - - //isExpedit1 = false; - return resultList; - } - public static async Task> GetSonderListsAsync(int? typ, NpgsqlConnection conn, int? abtstatus) - { - List resultList = new List(); - isExpedit = true; - using (var command = new NpgsqlCommand()) - { - command.Connection = conn; - if (abtstatus != null) command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join Kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE typ >= @typ AND status < {(int)AuftragStatus.Fertig} AND a.abteilungen_status <= {abtstatus} ORDER BY status DESC, liefertag ASC"; - else command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join Kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE typ >= @typ AND status < {(int)AuftragStatus.Fertig} ORDER BY status DESC, liefertag ASC"; - command.Parameters.AddWithValue("@typ", typ ?? 0); // Parameterized + Null-Handling - - using (var reader = await command.ExecuteReaderAsync()) - { - while (await reader.ReadAsync()) - resultList.Add(new Auftrag(reader, isExpedit)); - } - } - //isExpedit = false; - return resultList; - } public static async Task> GetStatusListAsync(int? status, NpgsqlConnection conn) { List resultList = new List(); @@ -178,7 +106,7 @@ namespace DatenDB //isExpedit = false; return resultList; } - public static async Task> GetFahrerListAsync(int? fahrerID, NpgsqlConnection conn) + public static async Task> GetFahrerListAsync(int? tourID, NpgsqlConnection conn) { List resultList = new List(); isExpedit = true; @@ -186,7 +114,7 @@ namespace DatenDB { command.Connection = conn; - command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE a.benutzer_id = {fahrerID} and liefertag = CURRENT_DATE and status < {(int)AuftragStatus.Ausgeliefert} ORDER BY status DESC"; + command.CommandText = $"SELECT {ACOLUMNS}, k.name1 as kunde_name, k.suchtext as suchtext, u.benutzer_name as fahrer FROM {TABLE} a left join kundenverwaltung.kunde k on a.kunde_id = k.kunde_id left join kundenverwaltung.benutzer u on a.benutzer_id = u.benutzer_id WHERE a.tour_id = {tourID} and liefertag = CURRENT_DATE and status < {(int)AuftragStatus.Ausgeliefert} ORDER BY status DESC"; using (var reader = await command.ExecuteReaderAsync()) { @@ -594,7 +522,7 @@ namespace DatenDB this.AufgabeErledigt = !reader.IsDBNull(18) && reader.GetBoolean(18); this.Abteilungen = reader.IsDBNull(19) ? AbteilungsStatus.Keine : (AbteilungsStatus)reader.GetInt16(19); this.Rhythmus = reader.IsDBNull(20) ? RegRhythmen.Unbekannt : (RegRhythmen)reader.GetInt32(20); - this.Priority = (AuftragPriority)reader.GetInt32(21); + this.Priority = (Priority)reader.GetInt32(21); if (isExpedit) { @@ -629,7 +557,7 @@ namespace DatenDB this.AufgabeErledigt = !reader.IsDBNull(18) && reader.GetBoolean(18); this.Abteilungen = reader.IsDBNull(19) ? AbteilungsStatus.Keine : (AbteilungsStatus)reader.GetInt16(19); this.Rhythmus = reader.IsDBNull(20) ? RegRhythmen.Unbekannt : (RegRhythmen)reader.GetInt32(20); - this.Priority = (AuftragPriority)reader.GetInt32(21); + this.Priority = (Priority)reader.GetInt32(21); } #region Properties @@ -821,7 +749,7 @@ namespace DatenDB [OLVIgnore] public RegRhythmen Rhythmus { get; set; } [OLVIgnore] - public AuftragPriority Priority { get; set; } = 0; + public Priority Priority { get; set; } = 0; #endregion private void SpeicherStatus() diff --git a/AA-Klassen/DataClass.cs b/AA-Klassen/DataClass.cs index 2d3d751..2722452 100644 --- a/AA-Klassen/DataClass.cs +++ b/AA-Klassen/DataClass.cs @@ -167,6 +167,14 @@ namespace Deckungsbeitrag.AA_Klassen parameters.Add(new NpgsqlParameter("@typ", (int)typFilter.Value)); } } + else + { + if (minTypFilter.HasValue) + { + conditions.Add("typ > @typ"); + parameters.Add(new NpgsqlParameter("@typ", (int)minTypFilter.Value)); + } + } // Frottee-Filter if (frottee.HasValue && frottee.Value) @@ -199,11 +207,11 @@ namespace Deckungsbeitrag.AA_Klassen AufgabeErledigt = SafeBool(reader, "aufgabe_erledigt"), AbteilungenStatus = (AbteilungsStatus)SafeInt(reader, "abteilungen_status"), Rhythmus = (RegRhythmen)SafeInt(reader, "rhythmus"), - Priority = (AuftragPriority)SafeInt(reader, "priority"), + Priority = (Priority)SafeInt(reader, "priority"), Gedruckt = SafeDateTime(reader, "gedruckt"), AufgabeBezeichnung = SafeString(reader, "aufgabe_bez"), KundeName = SafeString(reader, "suchtext"), - Fahrer = SafeString(reader, "fahrer"), + Tour = SafeString(reader, "tour"), FrotteeStatus = SafeInt(reader, "frottee_status"), KleinteileStatus = SafeInt(reader, "kleinteile_status"), GrossteileStatus = SafeInt(reader, "grossteile_status") @@ -232,24 +240,24 @@ namespace Deckungsbeitrag.AA_Klassen [OLVIgnore]public int BenutzerID { get; set; } [OLVIgnore]public int? AufgabeID { get; set; } [OLVIgnore]public int KundeID { get; set; } - [OLVIgnore]public string Zusatz { get; set; } - [OLVColumn("Liefertag", AspectToStringFormat = "{0:ddd dd.MM}", DisplayIndex = 10)]public DateTime? Liefertag { get; set; } - [OLVColumn("Status", DisplayIndex = 40)]public AuftragStatus Status { get; set; } [OLVIgnore]public int? TourID { get; set; } - [OLVColumn("Schmutzig", DisplayIndex = 20, TextAlign = HorizontalAlignment.Center)]public int ContainerDirt { get; set; } - [OLVColumn("Sauber", DisplayIndex = 30, TextAlign = HorizontalAlignment.Center)]public int ContainerClean { get; set; } - [OLVColumn("Typ", DisplayIndex = 50, IsEditable = false)]public AuftragTyp Typ { get; set; } [OLVIgnore]public bool AufgabeErledigt { get; set; } [OLVIgnore]public AbteilungsStatus AbteilungenStatus { get; set; } [OLVIgnore]public RegRhythmen Rhythmus { get; set; } - [OLVColumn("Priority", DisplayIndex = 15)]public AuftragPriority Priority { get; set; } [OLVIgnore]private DateTime? Gedruckt { get; set; } + [OLVIgnore]public string Zusatz { get; set; } + [OLVColumn("Liefertag", AspectToStringFormat = "{0:ddd dd.MM}", DisplayIndex = 10)]public DateTime? Liefertag { get; set; } + [OLVColumn("Status", DisplayIndex = 40)]public AuftragStatus Status { get; set; } + [OLVColumn("Schmutzig", DisplayIndex = 20, TextAlign = HorizontalAlignment.Center)]public int ContainerDirt { get; set; } + [OLVColumn("Sauber", DisplayIndex = 30, TextAlign = HorizontalAlignment.Center)]public int ContainerClean { get; set; } + [OLVColumn("Typ", DisplayIndex = 50, IsEditable = false)]public AuftragTyp Typ { get; set; } + [OLVColumn("Priority", DisplayIndex = 15)]public Priority Priority { get; set; } // Join-Felder aus Table kunde & benutzer [OLVColumn("Aufgabe", DisplayIndex = 55)]public string AufgabeBezeichnung { get; set; } [OLVColumn("Kunde", DisplayIndex = 0)]public string KundeName { get; set; } - [OLVColumn("Fahrer", DisplayIndex = 70)]public string Fahrer { get; set; } + [OLVColumn("Tour", DisplayIndex = 70)]public string Tour { get; set; } // **3 Status-Spalten statt 12 Flags** [OLVIgnore]public int FrotteeStatus { get; set; } diff --git a/AA-Klassen/Funktionen.cs b/AA-Klassen/Funktionen.cs index 4f7f781..4f6a5bd 100644 --- a/AA-Klassen/Funktionen.cs +++ b/AA-Klassen/Funktionen.cs @@ -1011,10 +1011,14 @@ namespace Deckungsbeitrag if (auftragliste != null) _auftragliste = auftragliste; if (fahrer != null) _fahrer = fahrer; if (benutzer != null) _benutzer = benutzer; - + string dateiName = $"{_auftragliste[0].Liefertag}_{_fahrer.BenutzerName}"; currentPage = 0; // WICHTIG: reset vor jedem Druck + + string path = ConfigurationManager.AppSettings["DateiSavePfad"]; + string tmpPdf = Path.Combine(path, "Tourenlisten", dateiName); - string tmpPdf = @"C:\tmp\output2.pdf"; + + //string tmpPdf = @"C:\tmp\output2.pdf"; PrintDialog dialog = new PrintDialog(); PrintPreviewDialog preview = new PrintPreviewDialog(); @@ -1074,42 +1078,6 @@ namespace Deckungsbeitrag if (IsPhysicalPrint) { GeneratePdfFromPrintDocument(tmpPdf); - - if (WaitForFileReady(tmpPdf)) - { - - Tour tour = null; - if (_auftragliste[0].TourID != null) tour = Tour.GetTour(_auftragliste[0].TourID); - else tour = Tour.FindeTour(_auftragliste[0].TourID, _fahrer.BenutzerID, _auftragliste[0].Liefertag); - if (tour == null) - { - UpdateOrSaveTour(_auftragliste[0].TourID, _auftragliste[0]); - tour = Tour.FindeTour(_auftragliste[0].TourID, _fahrer.BenutzerID, _auftragliste[0].Liefertag); - } - - int kndanzahl = 0; - int contanzahl = 0; - int dirtanzahl = 0; - foreach (Auftrag _auftrag in _auftragliste) - { - contanzahl += _auftrag.ContainerClean; - dirtanzahl += _auftrag.Container; - _auftrag.TourID = tour.TourID; - _auftrag.Save(); - kndanzahl++; - - } - tour.ContainerClean = contanzahl; - tour.ContainerDirt = dirtanzahl; - tour.Tourenliste = File.ReadAllBytes(tmpPdf); - tour.Kundenanzahl = kndanzahl; - tour.ListeGedruckt = DateTime.Now; - tour.GedrucktVon = _benutzer.BenutzerID; - if (tour.Save() == 0) meldung.GetFehler(null, "PDF konnte nicht gespeichert werden. Bitte melde dich bei einem Vorgesetzten."); - - } - - File.Delete(tmpPdf); } } } @@ -1627,48 +1595,48 @@ namespace Deckungsbeitrag } } - public static void UpdateOrSaveTour(int? tourid, Auftrag auftrag) - { - int? arbeiterID = null; - DateTime? liefertag = null; - int? tourID = tourid; - Tour tour = null; + //public static void UpdateOrSaveTour(int? tourid, Auftrag auftrag) + //{ + // int? arbeiterID = null; + // DateTime? liefertag = null; + // int? tourID = tourid; + // Tour tour = null; - if (auftrag != null) - { - arbeiterID = auftrag.ArbeiterID; - liefertag = auftrag.Liefertag; - tourID = auftrag.TourID; - } + // if (auftrag != null) + // { + // arbeiterID = auftrag.ArbeiterID; + // liefertag = auftrag.Liefertag; + // tourID = auftrag.TourID; + // } - if (tourID != null) tour = Tour.GetTour(tourID); - if (tour == null) - { - tour = new Tour(); - tour.TourID = null; - tour.BenutzerID = auftrag.ArbeiterID; - tour.Liefertag = auftrag.Liefertag; - tour.SaisonID = Saison.GetAktivSaison().SaisonId; - } - tour.Kundenanzahl++; - tour.ContainerDirt += auftrag.Container; - tour.ContainerClean += auftrag.ContainerClean; + // if (tourID != null) tour = Tour.GetTour(tourID); + // if (tour == null) + // { + // tour = new Tour(); + // tour.TourID = null; + // tour.BenutzerID = auftrag.ArbeiterID; + // tour.Liefertag = auftrag.Liefertag; + // tour.SaisonID = Saison.GetAktivSaison().SaisonId; + // } + // tour.Kundenanzahl++; + // tour.ContainerDirt += auftrag.Container; + // tour.ContainerClean += auftrag.ContainerClean; - if (tour.Save() == 0) meldung.GetFehler(null, "Speichern oder Updaten der Tour war nicht möglich.\nBitte informiere deinen Vorgesetzten."); - } + // if (tour.Save() == 0) meldung.GetFehler(null, "Speichern oder Updaten der Tour war nicht möglich.\nBitte informiere deinen Vorgesetzten."); + //} - internal static AuftragPriority GetPriority(Benutzer user) + internal static Priority GetPriority(Benutzer user) { string vorname; if (user == null) vorname = string.Empty; else vorname = user.Vorname; switch (vorname) { - case var n when n == "Gerald": return AuftragPriority.First; - case var n when n == "Jochen": return AuftragPriority.Second; - case var n when n == "Thomas": return AuftragPriority.Third; - case var n when n == "Alil": return AuftragPriority.Fourth; - default: return AuftragPriority.None; + case var n when n == "Gerald": return Priority.First; + case var n when n == "Jochen": return Priority.Second; + case var n when n == "Thomas": return Priority.Third; + case var n when n == "Alil": return Priority.Fourth; + default: return Priority.None; } } diff --git a/AA-Klassen/Tour.cs b/AA-Klassen/Tour.cs index 330f4c4..aa75d0f 100644 --- a/AA-Klassen/Tour.cs +++ b/AA-Klassen/Tour.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using ZXing; @@ -11,8 +12,8 @@ namespace Deckungsbeitrag.AA_Klassen { public class Tour { - // 0 1 2 3 4 5 6 7 8 9 10 11 - public const string COLUMNS = "tour_id, benutzer_id, kundenanzahl, liefertag, start, ende, container_dirt, container_clean, saison_id, tourenliste, listegedruckt, gedruckt_von"; + // 0 1 2 3 4 + public const string COLUMNS = "tour_id, benutzer_id, saison_id, bezeichnung, priority"; public const string TABLE = "kundenverwaltung.tour"; #region Class-Standarts (Properties, Save, reader) @@ -21,15 +22,8 @@ namespace Deckungsbeitrag.AA_Klassen public int? TourID { get; set; } public int? BenutzerID { get; set; } public int? SaisonID { get; set; } - public int? Kundenanzahl { get; set; } - public DateTime Liefertag { get; set; } - public DateTime? Start { get; set; } - public DateTime? Ende { get; set; } - public int ContainerDirt { get; set; } - public int ContainerClean { get; set; } - public byte[] Tourenliste { get; set; } - public DateTime? ListeGedruckt { get; set; } - public int? GedrucktVon { get; set; } + public string Bezeichnung { get; set; } + public Priority Priority { get; set; } public int? Save() { @@ -42,28 +36,23 @@ namespace Deckungsbeitrag.AA_Klassen int? result; if (this.TourID.HasValue & this.TourID != 0) { - command.CommandText = $"update {TABLE} set benutzer_id = :p1, kundenanzahl = :p2, liefertag = :p3, start = :p4, ende = :p5, container_dirt = :p6, container_clean = :p7, saison_id = :p8, tourenliste = :p9, listegedruckt = :p10, gedruckt_von = :p11 WHERE tour_id = :p0"; + command.CommandText = $"update {TABLE} set benutzer_id = :p1, saison_id = :p2, bezeichnung = :p3, priority = :p4 WHERE tour_id = :p0"; } else { command.CommandText = "select nextval('kundenverwaltung.tour_seq')"; this.TourID = (int)(long)command.ExecuteScalar(); - command.CommandText = $"insert into {TABLE} ({COLUMNS}) values (:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11)"; + command.CommandText = $"insert into {TABLE} ({COLUMNS}) values (:p0, :p1, :p2, :p3, :p4)"; } - command.Parameters.AddWithValue("p0", this.TourID); - command.Parameters.AddWithValue("p1", this.BenutzerID); - command.Parameters.AddWithValue("p2", this.Kundenanzahl ?? 0); - command.Parameters.AddWithValue("p3", this.Liefertag); - command.Parameters.AddWithValue("p4", this.Start ?? (object)DBNull.Value); - command.Parameters.AddWithValue("p5", this.Ende ?? (object)DBNull.Value); - command.Parameters.AddWithValue("p6", this.ContainerDirt); - command.Parameters.AddWithValue("p7", this.ContainerClean); - command.Parameters.AddWithValue("p8", this.SaisonID ?? (object)DBNull.Value); - command.Parameters.AddWithValue("p9", this.Tourenliste ?? (object)DBNull.Value); - command.Parameters.AddWithValue("p10", this.ListeGedruckt.HasValue ? (DateTime?)this.ListeGedruckt.Value : (DateTime?)DateTime.Now); - command.Parameters.AddWithValue("p11", this.GedrucktVon ?? (object)DBNull.Value); + Match match = Regex.Match(this.Bezeichnung ?? "", @"\d+"); + int zahl = match.Success ? int.Parse(match.Value) : 0; // oder throw bei Fehler + command.Parameters.AddWithValue("p0", this.TourID); + command.Parameters.AddWithValue("p1", this.BenutzerID.HasValue ? this.BenutzerID.Value : (object)DBNull.Value); + command.Parameters.AddWithValue("p2", this.SaisonID ?? (object)DBNull.Value); + command.Parameters.AddWithValue("p3", this.Bezeichnung); + command.Parameters.AddWithValue("p4", zahl); result = command.ExecuteNonQuery(); DatenbankConnection.GetConnection().Close(); @@ -75,17 +64,10 @@ namespace Deckungsbeitrag.AA_Klassen public Tour(NpgsqlDataReader reader) { this.TourID = reader.GetInt32(0); - this.BenutzerID = reader.GetInt32(1); - this.Kundenanzahl = reader.GetInt32(2); - this.Liefertag = reader.GetDateTime(3); - this.Start = reader.IsDBNull(4) ? (DateTime?)null : reader.GetDateTime(4); - this.Ende = reader.IsDBNull(5) ? (DateTime?)null : reader.GetDateTime(5); - this.ContainerDirt = reader.IsDBNull(6) ? 0 : reader.GetInt32(6); - this.ContainerClean = reader.IsDBNull(7) ? 0 : reader.GetInt32(7); - this.SaisonID = reader.GetInt32(8); - this.Tourenliste = reader.IsDBNull(9) ? null : (byte[])reader[9]; - this.ListeGedruckt = reader.IsDBNull(10) ? (DateTime?)null : reader.GetDateTime(10); - this.GedrucktVon = reader.IsDBNull(11) ? (int?)null : reader.GetInt32(11); + this.BenutzerID = reader.IsDBNull(1) ? (int?)null : reader.GetInt32(1); + this.SaisonID = reader.GetInt32(2); + this.Bezeichnung = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); + this.Priority = reader.IsDBNull(4) ? Priority.None : (Priority)reader.GetInt32(4); } #endregion @@ -122,14 +104,14 @@ namespace Deckungsbeitrag.AA_Klassen return result; } - internal static Tour GetTour(int? tourID) + internal static Tour GetTour(int? saison, string bez) { Tour result = null; DatenbankConnection.GetConnection().Open(); using (NpgsqlCommand command = new NpgsqlCommand()) { command.Connection = DatenbankConnection.GetConnection(); - command.CommandText = $"select {COLUMNS} from {TABLE} where tour_id = {tourID}"; + command.CommandText = $"select {COLUMNS} from {TABLE} where saison_id = {saison} and bezeichnung = '{bez}'"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) result = new Tour(reader); reader.Close(); @@ -140,6 +122,25 @@ namespace Deckungsbeitrag.AA_Klassen return result; } + internal static List GetSaisonListe(Saison saison) + { + List resultList = new List(); + DatenbankConnection.GetConnection().Open(); + using (NpgsqlCommand command = new NpgsqlCommand()) + { + command.Connection = DatenbankConnection.GetConnection(); + command.CommandText = $"select {COLUMNS} from {TABLE} where saison_id = {saison.SaisonId}"; + using (var reader = command.ExecuteReader()) + { + while (reader.Read()) + resultList.Add(new Tour(reader)); + } + } + DatenbankConnection.GetConnection().Close(); + + return resultList; + } + #endregion } public class TDaten @@ -155,11 +156,3 @@ namespace Deckungsbeitrag.AA_Klassen } } -//INSTALL-REMINDER: Tabelle Tour in Datenbank einfügen -//CHANGES: Class Tour wurde erstellt. Speichern, Laden und Bearbeiten von Touren sollte möglich sein. -//DONE: Wenn Fahrer neuen Auftrag erstellt, wird Tour (BenutzerID & Liefertag) gesucht und gespeichert oder upgedatet. Dabei werden die Containerzahlen schmutzig addiert und die Kundenanzahl um 1 erhöht. -//TODO: Wenn Auftrag abgeschlossen wird muss die Containerzahl sauber addiert werden. Kundenanzahl und Containeranzahl schmutzig darf nicht erhöht werden. -//TODO: !!ÜBERLEGE!! Tour Start und Ende automatisch erfassen. (Beladenscan und Entladescan?) -//TODO: Eingabemöglichkeit von Tour Start und Ende muss erledigt werden. -//TODO: Kundenanzahl bei Tourenliste erstellen vergleichen und anpassen. -//TODO: !!ÜBERLEGE!! DB-Query für Kundenanzahl und Containeranzahl Abgleich. (Aufträge haben TourID hinterlegt. So sollte alles vergleichbar sein.) \ No newline at end of file diff --git a/Program.cs b/Program.cs index d54dd50..6442c1a 100644 --- a/Program.cs +++ b/Program.cs @@ -26,7 +26,17 @@ using System.Windows.Forms; namespace Deckungsbeitrag { - static class Program + public enum Priority + { + None = 0, + First = 1, + Second = 2, + Third = 3, + Fourth = 4, + Fifth = 5 + } + + static class Program { public static Color Wirlblau = Settings.Default.Wirlblau; public static ImageList imagelist = new ImageList(); @@ -537,11 +547,11 @@ namespace Deckungsbeitrag foreach (Process p in Process.GetProcessesByName("SetupVerwaltung")) p.Kill(); - // 3. 2 Sekunden warten (Restart Manager) - Thread.Sleep(2000); + // 3. 10 Sekunden warten (Restart Manager) + //Thread.Sleep(10000); - Process.Start(psi)?.Dispose(); + //Process.Start(psi)?.Dispose(); return true; } catch (Exception ex) diff --git a/UserControls/UCAuftragSuchen.cs b/UserControls/UCAuftragSuchen.cs index 2f52265..1f8239d 100644 --- a/UserControls/UCAuftragSuchen.cs +++ b/UserControls/UCAuftragSuchen.cs @@ -84,7 +84,7 @@ namespace Deckungsbeitrag.UserControls { this.SuspendLayout(); if (!this.groupBoxSuchen.Visible) return; - this.comboBoxTyp.DataSource = Enum.GetValues(typeof(AuftragPriority)); + this.comboBoxTyp.DataSource = Enum.GetValues(typeof(Priority)); this.comboBoxTyp.SelectedIndex = -1; this.comboBoxStatus.DataSource = Enum.GetValues(typeof(AuftragStatus)); this.comboBoxStatus.SelectedIndex = -1; diff --git a/UserControls/UCInventur.Designer.cs b/UserControls/UCInventur.Designer.cs index 2fb1432..5e2ef11 100644 --- a/UserControls/UCInventur.Designer.cs +++ b/UserControls/UCInventur.Designer.cs @@ -38,6 +38,10 @@ this.dTPInvDatum = new System.Windows.Forms.DateTimePicker(); this.pictureBoxPlus = new System.Windows.Forms.PictureBox(); this.dGArtikel = new System.Windows.Forms.DataGridView(); + this.buttonFreigeben = new System.Windows.Forms.Button(); + this.panelButtons = new System.Windows.Forms.Panel(); + this.buttonAbbrechen = new System.Windows.Forms.Button(); + this.labelInvText = new System.Windows.Forms.Label(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -45,11 +49,6 @@ this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.buttonFreigeben = new System.Windows.Forms.Button(); - this.panelButtons = new System.Windows.Forms.Panel(); - this.buttonAbbrechen = new System.Windows.Forms.Button(); - this.buttonSpeichern = new System.Windows.Forms.Button(); - this.labelInvText = new System.Windows.Forms.Label(); this.groupBoxInventur.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlus)).BeginInit(); @@ -187,6 +186,69 @@ this.dGArtikel.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.DGArtikel_CellValueChanged); this.dGArtikel.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.DGArtikel_DataBindingComplete); // + // buttonFreigeben + // + this.buttonFreigeben.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonFreigeben.BackColor = System.Drawing.Color.Gray; + this.buttonFreigeben.CausesValidation = false; + this.buttonFreigeben.Enabled = false; + this.buttonFreigeben.FlatAppearance.BorderSize = 0; + this.buttonFreigeben.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonFreigeben.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonFreigeben.ForeColor = System.Drawing.Color.Black; + this.buttonFreigeben.Location = new System.Drawing.Point(849, 5); + this.buttonFreigeben.Margin = new System.Windows.Forms.Padding(0); + this.buttonFreigeben.Name = "buttonFreigeben"; + this.buttonFreigeben.Size = new System.Drawing.Size(250, 40); + this.buttonFreigeben.TabIndex = 38; + this.buttonFreigeben.Text = "Speichern/Freigeben"; + this.buttonFreigeben.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; + this.buttonFreigeben.UseVisualStyleBackColor = false; + this.buttonFreigeben.Click += new System.EventHandler(this.ButtonFreigeben_Click); + // + // panelButtons + // + this.panelButtons.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelButtons.Controls.Add(this.buttonAbbrechen); + this.panelButtons.Controls.Add(this.labelInvText); + this.panelButtons.Controls.Add(this.buttonFreigeben); + this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panelButtons.Location = new System.Drawing.Point(3, 570); + this.panelButtons.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.panelButtons.Name = "panelButtons"; + this.panelButtons.Size = new System.Drawing.Size(1106, 52); + this.panelButtons.TabIndex = 43; + // + // buttonAbbrechen + // + this.buttonAbbrechen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonAbbrechen.BackColor = System.Drawing.Color.Red; + this.buttonAbbrechen.FlatAppearance.BorderSize = 0; + this.buttonAbbrechen.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonAbbrechen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.buttonAbbrechen.ForeColor = System.Drawing.Color.Black; + this.buttonAbbrechen.Location = new System.Drawing.Point(594, 5); + this.buttonAbbrechen.Margin = new System.Windows.Forms.Padding(0, 0, 5, 0); + this.buttonAbbrechen.Name = "buttonAbbrechen"; + this.buttonAbbrechen.Size = new System.Drawing.Size(250, 40); + this.buttonAbbrechen.TabIndex = 41; + this.buttonAbbrechen.Text = "Abbrechen"; + this.buttonAbbrechen.UseVisualStyleBackColor = false; + this.buttonAbbrechen.Click += new System.EventHandler(this.ButtonAbbrechen_Click); + // + // labelInvText + // + this.labelInvText.AutoSize = true; + this.labelInvText.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelInvText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); + this.labelInvText.Location = new System.Drawing.Point(3, 15); + this.labelInvText.Name = "labelInvText"; + this.labelInvText.Size = new System.Drawing.Size(70, 25); + this.labelInvText.TabIndex = 39; + this.labelInvText.Text = "label1"; + this.labelInvText.Visible = false; + this.labelInvText.Click += new System.EventHandler(this.LabelInvText_Click); + // // Column1 // this.Column1.DataPropertyName = "ArtikelNR"; @@ -208,11 +270,11 @@ // Column3 // this.Column3.DataPropertyName = "Stand"; - this.Column3.HeaderText = "Ist-Stand"; + this.Column3.HeaderText = "Soll-Stand"; this.Column3.MinimumWidth = 6; this.Column3.Name = "Column3"; this.Column3.ReadOnly = true; - this.Column3.Width = 129; + this.Column3.Width = 143; // // Column4 // @@ -249,90 +311,6 @@ this.Column7.ReadOnly = true; this.Column7.Width = 171; // - // buttonFreigeben - // - this.buttonFreigeben.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonFreigeben.BackColor = System.Drawing.Color.Gray; - this.buttonFreigeben.CausesValidation = false; - this.buttonFreigeben.Enabled = false; - this.buttonFreigeben.FlatAppearance.BorderSize = 0; - this.buttonFreigeben.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonFreigeben.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonFreigeben.ForeColor = System.Drawing.Color.Black; - this.buttonFreigeben.Location = new System.Drawing.Point(899, 5); - this.buttonFreigeben.Margin = new System.Windows.Forms.Padding(0); - this.buttonFreigeben.Name = "buttonFreigeben"; - this.buttonFreigeben.Size = new System.Drawing.Size(200, 40); - this.buttonFreigeben.TabIndex = 38; - this.buttonFreigeben.Text = "Inventur freigeben"; - this.buttonFreigeben.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; - this.buttonFreigeben.UseVisualStyleBackColor = false; - this.buttonFreigeben.Click += new System.EventHandler(this.ButtonFreigeben_Click); - // - // panelButtons - // - this.panelButtons.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panelButtons.Controls.Add(this.buttonAbbrechen); - this.panelButtons.Controls.Add(this.buttonSpeichern); - this.panelButtons.Controls.Add(this.labelInvText); - this.panelButtons.Controls.Add(this.buttonFreigeben); - this.panelButtons.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panelButtons.Location = new System.Drawing.Point(3, 570); - this.panelButtons.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.panelButtons.Name = "panelButtons"; - this.panelButtons.Size = new System.Drawing.Size(1106, 52); - this.panelButtons.TabIndex = 43; - // - // buttonAbbrechen - // - this.buttonAbbrechen.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonAbbrechen.BackColor = System.Drawing.Color.Red; - this.buttonAbbrechen.FlatAppearance.BorderSize = 0; - this.buttonAbbrechen.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonAbbrechen.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonAbbrechen.ForeColor = System.Drawing.Color.Black; - this.buttonAbbrechen.Location = new System.Drawing.Point(489, 5); - this.buttonAbbrechen.Margin = new System.Windows.Forms.Padding(0); - this.buttonAbbrechen.Name = "buttonAbbrechen"; - this.buttonAbbrechen.Size = new System.Drawing.Size(200, 40); - this.buttonAbbrechen.TabIndex = 41; - this.buttonAbbrechen.Text = "Abbrechen"; - this.buttonAbbrechen.UseVisualStyleBackColor = false; - this.buttonAbbrechen.Click += new System.EventHandler(this.ButtonAbbrechen_Click); - // - // buttonSpeichern - // - this.buttonSpeichern.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonSpeichern.BackColor = System.Drawing.Color.Gray; - this.buttonSpeichern.CausesValidation = false; - this.buttonSpeichern.Enabled = false; - this.buttonSpeichern.FlatAppearance.BorderSize = 0; - this.buttonSpeichern.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonSpeichern.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonSpeichern.ForeColor = System.Drawing.Color.Black; - this.buttonSpeichern.Location = new System.Drawing.Point(694, 5); - this.buttonSpeichern.Margin = new System.Windows.Forms.Padding(5); - this.buttonSpeichern.Name = "buttonSpeichern"; - this.buttonSpeichern.Size = new System.Drawing.Size(200, 40); - this.buttonSpeichern.TabIndex = 40; - this.buttonSpeichern.Text = "Speichern"; - this.buttonSpeichern.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; - this.buttonSpeichern.UseVisualStyleBackColor = false; - this.buttonSpeichern.Click += new System.EventHandler(this.ButtonSpeichern_Click); - // - // labelInvText - // - this.labelInvText.AutoSize = true; - this.labelInvText.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelInvText.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); - this.labelInvText.Location = new System.Drawing.Point(3, 15); - this.labelInvText.Name = "labelInvText"; - this.labelInvText.Size = new System.Drawing.Size(70, 25); - this.labelInvText.TabIndex = 39; - this.labelInvText.Text = "label1"; - this.labelInvText.Visible = false; - this.labelInvText.Click += new System.EventHandler(this.LabelInvText_Click); - // // UCInventur // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -366,6 +344,11 @@ private System.Windows.Forms.PictureBox pictureBoxClose; private System.Windows.Forms.Panel panelButtons; private System.Windows.Forms.Label labelInvText; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label labelLieferDat; + private System.Windows.Forms.DateTimePicker dTPLieferDat; + private System.Windows.Forms.Label labelInvDat; + private System.Windows.Forms.Button buttonAbbrechen; private System.Windows.Forms.DataGridViewTextBoxColumn Column1; private System.Windows.Forms.DataGridViewTextBoxColumn Column2; private System.Windows.Forms.DataGridViewTextBoxColumn Column3; @@ -373,11 +356,5 @@ private System.Windows.Forms.DataGridViewTextBoxColumn Column5; private System.Windows.Forms.DataGridViewTextBoxColumn Column6; private System.Windows.Forms.DataGridViewTextBoxColumn Column7; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button buttonSpeichern; - private System.Windows.Forms.Label labelLieferDat; - private System.Windows.Forms.DateTimePicker dTPLieferDat; - private System.Windows.Forms.Label labelInvDat; - private System.Windows.Forms.Button buttonAbbrechen; - } + } } diff --git a/UserControls/UCInventur.cs b/UserControls/UCInventur.cs index 1f950e1..8a68390 100644 --- a/UserControls/UCInventur.cs +++ b/UserControls/UCInventur.cs @@ -41,14 +41,11 @@ namespace Deckungsbeitrag.UserControls _tosave = value; if (_tosave) { - buttonSpeichern.Enabled = true; - buttonSpeichern.BackColor = Color.FromArgb(0, 192, 0); - if ((this.user.Rolle == BenutzerRolle.Verwaltung) || (this.user.Rolle == BenutzerRolle.Admin)) { this.buttonFreigeben.Enabled = true; this.buttonFreigeben.BackColor = Color.Turquoise; } + buttonFreigeben.Enabled = true; + buttonFreigeben.BackColor = Color.Turquoise; } else { - buttonSpeichern.Enabled = false; - buttonSpeichern.BackColor = Color.Gray; buttonFreigeben.Enabled = false; buttonFreigeben.BackColor = Color.Gray; } @@ -80,12 +77,11 @@ namespace Deckungsbeitrag.UserControls private void UCInventur_Load(object sender, EventArgs e) { - if ((this.user.Rolle == BenutzerRolle.Verwaltung & Tosave) || (this.user.Rolle == BenutzerRolle.Admin & Tosave)) { this.buttonFreigeben.Enabled = true; this.buttonFreigeben.BackColor = Color.Turquoise; } string kundeName = this.kunde.Suchtext ?? this.kunde.KundeName; this.groupBoxInventur.Text = $"Inventur-{this.kunde.KundeNummer} {kundeName}"; if (lines == null || lines.Length == 0) { this.dTPInvDatum.Value = DateTime.Today.Date; } - else { this.dTPInvDatum.Value = DateTime.Parse(lines[4].Split(':')[1]); this.dTPInvDatum.Enabled = true; } + else { this.dTPInvDatum.Value = DateTime.Parse(lines[4].Split(':')[1]); this.dTPInvDatum.Enabled = true; this.buttonAbbrechen.Visible = false; } if (auftrag != null) this.dTPLieferDat.Value = auftrag.Liefertag; Load_DGV(); if (lines != null & Sender is FormMain) PictureBoxClose_Click(sender, e); @@ -205,45 +201,57 @@ namespace Deckungsbeitrag.UserControls Funktionen.GetGroupBoxBoarder(gb, e); } + /// + /// Speichern oder Freigeben der Inventur. Wenn kein Auftrag vorhanden wird davor ButtonSpeichern_Click aufgerufen. + /// Wenn User ist Expedit kann NUR gespeichert werden. + /// Wenn User NICHT Expedit wird abgefragt ob Speichern oder Freigeben. (Speichern wenn noch Zahlen fehlen) + /// + /// + /// private void ButtonFreigeben_Click(object sender, EventArgs e) { - if (this.auftrag == null) return; - this.auftrag.Liefertag = dTPLieferDat.Value; - foreach (DataGridViewRow row in this.dGArtikel.Rows) + if (this.user.Rolle == BenutzerRolle.Expedit) { ButtonSpeichern_Click("Speichern", null); return; } + DialogResult result = MessageBox.Show("Möchtest du die Inventur Speichern oder Freigeben?\n\n[JA] => Speichern (es fehlen noch Zahlen)\n[NEIN] => Freigeben (alle Zahlen vorhanden)", "FRAGE", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); + if (result == DialogResult.Yes) { ButtonSpeichern_Click("Speichern", null); return; } + if (result == DialogResult.Cancel) return; + if (result == DialogResult.No) { - // KundeArtikel updaten. Neuen Stand eintragen, Reklamation & Fehlmenge auf Null setzten und Korrektur als InventruAusgleich speichern. - KundeArtikel art = (KundeArtikel)artikelListe[row.Index]; - - art.Reklamation = 0; - art.Fehlmenge = 0; - art.StandBearbeitet = this.user.BenutzerName + " am " + DateTime.Now; - art.FehlmengeBearbeitet = this.user.BenutzerName + " am " + DateTime.Now; - art.KorrekturBearbeitet = this.user.BenutzerName + " am " + DateTime.Now; - art.Stand = int.Parse(row.Cells[2].Value.ToString()); - art.Korrektur = int.Parse(row.Cells[6].Value.ToString()); - art.Save(); - - // AuftragArtikel erstellen. - if (int.Parse(row.Cells[6].Value.ToString()) != 0) + if (this.auftrag == null) ButtonSpeichern_Click("Speichern", null); + this.auftrag.Liefertag = dTPLieferDat.Value; + foreach (DataGridViewRow row in this.dGArtikel.Rows) { - AuftragArtikel auf = new AuftragArtikel + // KundeArtikel updaten. Neuen Stand eintragen, Reklamation & Fehlmenge auf Null setzten und Korrektur als InventruAusgleich speichern. + KundeArtikel art = (KundeArtikel)artikelListe[row.Index]; + + art.Reklamation = 0; + art.Fehlmenge = 0; + art.StandBearbeitet = this.user.BenutzerName + " am " + DateTime.Now; + art.FehlmengeBearbeitet = this.user.BenutzerName + " am " + DateTime.Now; + art.KorrekturBearbeitet = this.user.BenutzerName + " am " + DateTime.Now; + art.Stand = int.Parse(row.Cells[2].Value.ToString()); + art.Korrektur = int.Parse(row.Cells[6].Value.ToString()); + art.Save(); + + // AuftragArtikel erstellen. + if (int.Parse(row.Cells[6].Value.ToString()) != 0) { - ArtikelID = art.ArtikelID, - AuftragID = auftrag.AuftragID, - Anzahl = art.Korrektur, - ArtikelName = art.ArtikelName, - Gesamt = art.Korrektur - }; - auf.Save(); + AuftragArtikel auf = new AuftragArtikel + { + ArtikelID = art.ArtikelID, + AuftragID = auftrag.AuftragID, + Anzahl = art.Korrektur, + ArtikelName = art.ArtikelName, + Gesamt = art.Korrektur + }; + auf.Save(); + } + } - + auftrag.Status = AuftragStatus.Herrichten; + auftrag.Save(); + GetInventurCSV(sender, auftrag.AuftragID); + UCInventur_Update(); } - auftrag.Status = AuftragStatus.Herrichten; - auftrag.Save(); - - GetInventurCSV(sender, auftrag.AuftragID); - - UCInventur_Update(); } /// @@ -388,12 +396,11 @@ namespace Deckungsbeitrag.UserControls /// private void PictureBoxClose_Click(object sender, EventArgs e) { - if (Tosave) if (MessageBox.Show("Du hast die Zahlen geändert. Möchtest du die Inventur so speichern?", "INVENTUR SPEICHERN", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ButtonSpeichern_Click(this.buttonSpeichern, null); + if (Tosave) if (MessageBox.Show("Du hast die Zahlen geändert. Möchtest du die Inventur so speichern?", "INVENTUR SPEICHERN", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ButtonSpeichern_Click("Speichern", null); if (groupBoxInventur.Visible) { this.buttonFreigeben.Visible = false; - this.buttonSpeichern.Visible = false; this.labelInvText.Text = groupBoxInventur.Text; this.groupBoxInventur.Visible = false; this.labelInvText.Visible = true; @@ -445,7 +452,6 @@ namespace Deckungsbeitrag.UserControls this.dTPInvDatum.Location = new Point(x += labelInvDat.Width, this.pictureBoxPlus.Location.Y); this.labelLieferDat.Location = new Point(x = x + dTPInvDatum.Width + 10, label_y); this.dTPLieferDat.Location = new Point(x + labelLieferDat.Width, this.pictureBoxPlus.Location.Y); - this.buttonSpeichern.Location = new Point(buttonFreigeben.Left - buttonSpeichern.Width - buttonSpeichern.Margin.Left, buttonSpeichern.Top); if (Sender is FormAuftragDetail) SizeChangedForParent?.Invoke(); } @@ -461,7 +467,6 @@ namespace Deckungsbeitrag.UserControls uci_loc = this.Location; DataGridView_GetNewSize(this.dGArtikel); this.buttonFreigeben.Visible = true; - this.buttonSpeichern.Visible = true; groupBoxInventur.Visible = true; this.labelInvText.Visible = false; } @@ -482,15 +487,11 @@ namespace Deckungsbeitrag.UserControls iststand += int.TryParse(row.Cells[j].Value.ToString(), out int r) ? r : 0; } - if (e.ColumnIndex >= 7) + if (e.ColumnIndex >= 7 || e.ColumnIndex == 2) { row.Cells[5].Value = sollstand - fehlmenge - iststand; row.Cells[6].Value = artikelListe[e.RowIndex].Korrektur = sollstand - iststand; } - if (e.ColumnIndex == 2) - { - row.Cells[6].Value = artikelListe[e.RowIndex].Korrektur = sollstand - iststand; - } } else return; dgv.Refresh(); @@ -502,6 +503,11 @@ namespace Deckungsbeitrag.UserControls else Tosave = false; } + /// + /// Wird über den buttonFreigeben aufgerufen. + /// + /// + /// private void ButtonSpeichern_Click(object sender, EventArgs e) { this.dGArtikel.EndEdit(); // beendet aktuelle Zell‑Bearbeitung @@ -543,10 +549,23 @@ namespace Deckungsbeitrag.UserControls } } + /// + /// Wenn lines existieren (CSV-Datei) dann wird das Speichern der Änderungen abgefragt. + /// Wenn lines nicht existieren (Neue Inventur) wird die Inventur verworfen. + /// + /// + /// private void ButtonAbbrechen_Click(object sender, EventArgs e) { - if (Tosave) { if (MessageBox.Show("Möchtest du wirklich Abbrechen und die Inventur verwerfen?", "FRAGE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) UCInventur_Delete(); } - else UCInventur_Delete(); + if (lines == null) + { + if (Tosave) { if (MessageBox.Show("Möchtest du wirklich Abbrechen und die Inventur verwerfen?", "FRAGE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) UCInventur_Delete(); } + else UCInventur_Delete(); + } + else + { + PictureBoxClose_Click(this.pictureBoxClose, null); + } } } } diff --git a/UserControls/UCInventur.resx b/UserControls/UCInventur.resx index 81e7f71..aa4dd3d 100644 --- a/UserControls/UCInventur.resx +++ b/UserControls/UCInventur.resx @@ -173,4 +173,25 @@ True + + True + + + True + + + True + + + True + + + True + + + True + + + True + \ No newline at end of file diff --git a/UserControls/UCTourenplan.cs b/UserControls/UCTourenplan.cs index 0c65828..c7ff42c 100644 --- a/UserControls/UCTourenplan.cs +++ b/UserControls/UCTourenplan.cs @@ -35,7 +35,21 @@ namespace Deckungsbeitrag.UserControls { ReadCSV(); + GetTouren(); + } + private void GetTouren() + { + Saison saison = Saison.GetAktivSaison(); + foreach (string t in touren) + { + Tour tour = Tour.GetTour(saison.SaisonId, t) ?? new Tour + { + SaisonID = saison.SaisonId, + Bezeichnung = t + }; + tour.Save(); + } } /// @@ -47,7 +61,6 @@ namespace Deckungsbeitrag.UserControls string dateiName = "Tourenplan_Aktuell.csv"; string row; string[] rows; - try { diff --git a/Verwaltung_ReadMe.txt b/Verwaltung_ReadMe.txt index e65f760..aaaa4ca 100644 --- a/Verwaltung_ReadMe.txt +++ b/Verwaltung_ReadMe.txt @@ -4,19 +4,17 @@ NEUIGKEITEN - Version 1.0.9.4 Build-Info: - Build-Typ: Release Build -- Erledigte TODOs: 15 -- Offene TODOs: 31 -- Install-Reminders: 2 -- Changes: 16 +- Erledigte TODOs: 14 +- Offene TODOs: 29 +- Install-Reminders: 1 +- Changes: 15 -=== ⚙️ INSTALL-REMINDER (2) === +=== ⚙️ INSTALL-REMINDER (1) === - ⚙️ DB anpassen. (Priority in Auftrag etc.) [Auftrag.cs] -- ⚙️ Tabelle Tour in Datenbank einfügen [Tour.cs] -=== ✨ CHANGES (16) === +=== ✨ CHANGES (15) === - ✨ Artikelliste und Kundenliste werden automatisch importiert wenn vorhanden. [FormMain.cs] -- ✨ Class Tour wurde erstellt. Speichern, Laden und Bearbeiten von Touren sollte möglich sein. [Tour.cs] - ✨ Es kann nach der Kontrolle der Lieferrhythmus geändert werden. Dazu muss auch die Anzahl der Liefertage gewählt werden. [FormTourenplanung.cs] - ✨ Es können nur so viele Clone erstellt werden wie Liefertag im Lieferrhythmus hinterlegt sind. [FormTourenplanung.cs] - ✨ Es wir kontrolliert ob der gewählte Liefertag zum hinterlegten Lieferrhythmus passt. [FormTourenplanung.cs] @@ -33,7 +31,7 @@ Build-Info: - ✨ Wenn ein anderer Fahrer ausgewählt wird, wird auch die Priority laut dem Fahrer geändert. [FormExpedit.cs] -=== ✅ ERLEDIGTE TODOs (15) === +=== ✅ ERLEDIGTE TODOs (14) === - ✅ : Bei Transport wir ein Fach mit Aktuellem Auftrag erstellt. Das Alte wird bei Transport gespeichert. [FormAusschlager.cs] - ✅ : CLick auf Inventur freigeben Dateiname von "Warten" auf "Herrichten" ändern. [UCInventur.cs] - ✅ : ComboBox Fahrer und Priorität implementieren [FormAuftragDetail.cs] @@ -45,15 +43,12 @@ Build-Info: - ✅ : Korrigiere Bestand: Wenn -Zahl dann Stand - Zahl. [FormAuftragDetail.cs] - ✅ : Mit AddFehler können Fehler aus try/chatch in Obsidian eingefügt werden. (Timestamp, PC-Name, Ex-Message) [Program.cs] - ✅ : Speichern etc. durchgehen und adaptieren [FormAuftragDetail.cs] -- ✅ : Wenn Fahrer neuen Auftrag erstellt, wird Tour (BenutzerID & Liefertag) gesucht und gespeichert oder upgedatet. Dabei werden die Containerzahlen schmutzig addiert und die Kundenanzahl um 1 erhöht. [Tour.cs] - ✅ : Wenn Frottee-Expedit auch Reklamation bearbeitet, muss BenutzerRolle abgefragt werden. siehe CHANGES. [FormFehlmengeCount.cs] - ✅ : Wenn NeuerAuftrag gewählt Fach ändern nicht vergessen. [FormAusschlager.cs] - ✅ : Wenn NeuerAuftrag gewählt wie gehts weiter? [FormAusschlager.cs] -=== 🔄 OFFENE TODOs (31) === -- 🔄 !!Ü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. (Beladenscan und Entladescan?) [Tour.cs] +=== 🔄 OFFENE TODOs (29) === - 🔄 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 richtig speichern... mit gedruckt bzw. erledigt bzw. [FormExpedit.cs] @@ -65,24 +60,24 @@ Build-Info: - 🔄 Deaktivieren wenn SPS funktioniert. Transport wird simuliert. [FormWSVerfolgung.cs] - 🔄 Design des Controls anpassen. Eventuell im Designer erstellen. [UCKunde.cs] - 🔄 Einbinden der NachwaescheArtikelData... [FormArtikelVW.cs] -- 🔄 Eingabemöglichkeit von Tour Start und Ende muss erledigt werden. [Tour.cs] - 🔄 Erstellen von SonderAuftrag und Drucken von Etikett testen. [FormAuftragDetail.cs] - 🔄 Eventuell die Zahlen in CSV speichern und von dort für Druck verwenden?! [FormAuftragDetail.cs] - 🔄 Funktioniert mehrere KundenControls auf einmal DragDrop? [FormTourenplanung.cs] - 🔄 Gesamt soll immer 100% sein. [Funktionen.cs] - 🔄 Hier Settings speichern mit UserSettingsManager Klasse. [FormEinstellung.cs] -- 🔄 Kundenanzahl bei Tourenliste erstellen vergleichen und anpassen. [Tour.cs] +- 🔄 Mit Tour statt Fahrer durchgehen. [FormExpedit.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] - 🔄 Non-Hard-Coded-Lösung für Priority finden. [Auftrag.cs] - 🔄 Reg.Aufträge einbauen. Besonderheit: Die Artikel sollen ebenfalls erscheinen. [Funktionen.cs] +- 🔄 Richtige Liste holen, wahrscheinlich mit TourID von ShowTourenplan. [FormMain.cs] - 🔄 Settings hier ändern auf UserSettingsManager Klasse. [FormEinstellung.cs] - 🔄 TourenListe Entwurf muss überarbeitet werden. [FormNeuerAuftrag.cs] - 🔄 UserSetting Properties eintragen und in EinstellungsScreen abrufen. [UserSettingsManager.cs] - 🔄 Warum der falsche Path? Immer mit \\ [UCFeedback.cs] - 🔄 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 Cancel... [FormShowUserControl.cs] - 🔄 Zuweisung zu Fahrer muss geklärt werden. [Funktionen.cs] -Installation: 21.04.2026 14:34 +Installation: 22.04.2026 13:33 =====================================