ArtikelZahlen-Audit mit Trigger in DB erstellt. Speichern von KundeArtikel Zahlen in FehlmengeCount erst wenn KundeFertig - weniger Datensätze in Audit.

This commit is contained in:
Kilian Wirl 2026-06-08 18:26:48 +02:00
parent 32f6702d8f
commit 06273b8094
3 changed files with 72 additions and 62 deletions

View File

@ -402,6 +402,15 @@ namespace Deckungsbeitrag
/// <param name="e"></param>
private async void ButtonFertig_Click(object sender, EventArgs e)
{
foreach (Button btn in this.tableLayoutPanelArtikel.Controls.OfType<Button>())
{
KundeArtikel kndart = null;
if (btn.Enabled)
{
kndart = (KundeArtikel)btn.Tag;
kndart.Save();
}
}
if (auftrag != null)
{
// Controls werden durchgegangen und ausgeblendet oder der Text entfernt.
@ -577,7 +586,7 @@ namespace Deckungsbeitrag
if ((userid != null && userid.Contains("reklamation")) || (this.benutzer != null && this.benutzer.Rolle == BenutzerRolle.Expedit) || (this.benutzer != null && this.benutzer.Rolle == BenutzerRolle.Frottee))
{
artnw.Reklamation++;
artnw.Reklamation++;
kndart.Reklamation++;
if (auftragDictionary.TryGetValue((int)kndart.KundeArtikelID, out int val))
{
@ -596,7 +605,7 @@ namespace Deckungsbeitrag
btn.Text = AktualisiereButtonText(btn.Text, artZahl[x - 1]);
// Wenn speichern nicht möglich, wird darauf hingewiesen.
if (kndart.Save() != 1 || artnw.Save() != 1) meldung.FehlmengeCount();
if (artnw.Save() != 1) meldung.FehlmengeCount();
}
private string AktualisiereButtonText(string button, int zahl)
{

View File

@ -91,7 +91,7 @@ namespace Deckungsbeitrag
this.labelAnzahlChars.Location = new Point(this.textBoxAnmerkung.Right - this.labelAnzahlChars.Width, this.labelAnzahlChars.Location.Y);
this.tabControlKunde.Location = new Point(this.textBoxAnmerkung.Right + 10, 11);
this.tabControlKunde.TabPages.Remove(tabPageArtikel);
ComboBox_Laden();
@ -156,46 +156,46 @@ namespace Deckungsbeitrag
// Wenn bereits ein Stand gespeichert ist, kommt er aus der DB. Wenn kein Stand gespeichert kommt Liste aus Sortiment.
//if (KundeArtikel.GetList(kundeid).Count > 0)
//{
// this.standListe = KundeArtikel.GetList(kundeid);
// if (this.standListe[0].ArtikelID == null || this.standListe[0].Reihung == 0)
// {
// CompareToSortiment();
// }
// Load_Gridview(this.standListe);
if (KundeArtikel.GetList(kundeid).Count > 0)
{
this.standListe = KundeArtikel.GetList(kundeid);
if (this.standListe[0].ArtikelID == null || this.standListe[0].Reihung == 0)
{
CompareToSortiment();
}
Load_Gridview(this.standListe);
this.dGArtikel.Enabled = false;
}
else
{
//Jedes Innsbrucker Soziale Dienste Sortiment ist gleich.
if (this.kunde.KundeNummer == "010069" | this.kunde.KundeNummer == "010071") sortNr = "010068";
else sortNr = this.kunde.KundeNummer;
//}
//else
//{
// //Jedes Innsbrucker Soziale Dienste Sortiment ist gleich.
// if (this.kunde.KundeNummer == "010069" | this.kunde.KundeNummer == "010071") sortNr = "010068";
// else sortNr = this.kunde.KundeNummer;
//Sortiment holen und Standliste filtern.
standListe = new List<KundeArtikel>();
int reihung = 1;
foreach (Sortiment sort in sortimentListe.FindAll(Sortiment => Sortiment.KundeNummer == sortNr))
{
if (sort.ArtName.Contains("*EK")) continue;
KundeArtikel item = new KundeArtikel
{
ArtikelNR = sort.ArtNr,
ArtikelName = sort.ArtName,
KundeID = Kunde.GetKundeID(sort.KundeNummer, null),
ArtikelID = Artikel.GetArtikelID(sort.ArtNr),
Reihung = reihung
};
standListe.Add(item);
// //Sortiment holen und Standliste filtern.
// standListe = new List<KundeArtikel>();
// int reihung = 1;
// foreach (Sortiment sort in sortimentListe.FindAll(Sortiment => Sortiment.KundeNummer == sortNr))
// {
// if (sort.ArtName.Contains("*EK")) continue;
// KundeArtikel item = new KundeArtikel
// {
// ArtikelNR = sort.ArtNr,
// ArtikelName = sort.ArtName,
// KundeID = Kunde.GetKundeID(sort.KundeNummer, null),
// ArtikelID = Artikel.GetArtikelID(sort.ArtNr),
// Reihung = reihung
// };
// standListe.Add(item);
reihung++;
}
if (standListe.Count == 0) this.tabControlKunde.Controls.Remove(tabPageArtikel);
standListe = standListe.OrderBy(x => x.Reihung).ToList();
// reihung++;
// }
// if (standListe.Count == 0) this.tabControlKunde.Controls.Remove(tabPageArtikel);
// standListe = standListe.OrderBy(x => x.Reihung).ToList();
// //GridView mit der jeweiligen Liste füllen.
// Load_Gridview(standListe);
//}
//GridView mit der jeweiligen Liste füllen.
Load_Gridview(standListe);
}
// QR-Code wird erstellt
BarcodeWriter code = new BarcodeWriter

View File

@ -48,6 +48,7 @@ namespace Deckungsbeitrag
this.tSBWaschstrasse = new System.Windows.Forms.ToolStripButton();
this.toolStripBeenden = new System.Windows.Forms.ToolStripButton();
this.panelMain = new System.Windows.Forms.Panel();
this.buttonTest = new System.Windows.Forms.Button();
this.buttonSonderAuftrag = new System.Windows.Forms.Button();
this.groupBoxAuftrag = new System.Windows.Forms.GroupBox();
this.objectListViewAuftrag = new BrightIdeasSoftware.ObjectListView();
@ -109,7 +110,6 @@ namespace Deckungsbeitrag
this.textBoxScannTest = new System.Windows.Forms.TextBox();
this.buttonScannTest = new System.Windows.Forms.Button();
this.labelScannTest = new System.Windows.Forms.Label();
this.buttonTest = new System.Windows.Forms.Button();
this.toolStripMenu.SuspendLayout();
this.panelMain.SuspendLayout();
this.groupBoxAuftrag.SuspendLayout();
@ -191,6 +191,7 @@ namespace Deckungsbeitrag
this.tSBAuftragVW.Text = "AUFTRAGVERWALTUNG";
this.tSBAuftragVW.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.tSBAuftragVW.ToolTipText = "Auftragkontrolle und -bearbeitung";
this.tSBAuftragVW.Visible = false;
this.tSBAuftragVW.Click += new System.EventHandler(this.TSBAuftragVW_Click);
this.tSBAuftragVW.MouseEnter += new System.EventHandler(this.ToolStrip_MouseEnter);
this.tSBAuftragVW.MouseLeave += new System.EventHandler(this.ToolStrip_MouseLeave);
@ -494,6 +495,27 @@ namespace Deckungsbeitrag
this.panelMain.Paint += new System.Windows.Forms.PaintEventHandler(this.PanelMain_Paint);
this.panelMain.Resize += new System.EventHandler(this.PanelMain_Resize);
//
// buttonTest
//
this.buttonTest.BackColor = System.Drawing.Color.Red;
this.buttonTest.Enabled = false;
this.buttonTest.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.buttonTest.FlatAppearance.BorderSize = 0;
this.buttonTest.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonTest.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonTest.ForeColor = System.Drawing.Color.Black;
this.buttonTest.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.buttonTest.Location = new System.Drawing.Point(376, 15);
this.buttonTest.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.buttonTest.Name = "buttonTest";
this.buttonTest.Size = new System.Drawing.Size(333, 50);
this.buttonTest.TabIndex = 73;
this.buttonTest.Text = "Trello Test";
this.buttonTest.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.buttonTest.UseVisualStyleBackColor = false;
this.buttonTest.Visible = false;
this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click);
//
// buttonSonderAuftrag
//
this.buttonSonderAuftrag.BackColor = System.Drawing.Color.CadetBlue;
@ -1453,27 +1475,6 @@ namespace Deckungsbeitrag
this.labelScannTest.TabIndex = 11;
this.labelScannTest.Text = "label1";
//
// buttonTest
//
this.buttonTest.BackColor = System.Drawing.Color.Red;
this.buttonTest.Enabled = false;
this.buttonTest.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.buttonTest.FlatAppearance.BorderSize = 0;
this.buttonTest.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonTest.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonTest.ForeColor = System.Drawing.Color.Black;
this.buttonTest.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.buttonTest.Location = new System.Drawing.Point(376, 15);
this.buttonTest.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.buttonTest.Name = "buttonTest";
this.buttonTest.Size = new System.Drawing.Size(333, 50);
this.buttonTest.TabIndex = 73;
this.buttonTest.Text = "Trello Test";
this.buttonTest.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.buttonTest.UseVisualStyleBackColor = false;
this.buttonTest.Visible = false;
this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click);
//
// FormMain
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;