diff --git a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.Designer.vb b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.Designer.vb index 1b104e81..76de1259 100644 --- a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.Designer.vb +++ b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.Designer.vb @@ -22,8 +22,6 @@ Partial Class usrCntlQualitaetskontrolle 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. Private Sub InitializeComponent() - Dim DataGridViewCellStyle10 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle11 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim DataGridViewCellStyle12 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim DataGridViewCellStyle13 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim DataGridViewCellStyle14 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() @@ -31,6 +29,8 @@ Partial Class usrCntlQualitaetskontrolle Dim DataGridViewCellStyle16 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim DataGridViewCellStyle17 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim DataGridViewCellStyle18 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle10 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle11 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Me.Label46 = New System.Windows.Forms.Label() Me.Button2 = New System.Windows.Forms.Button() Me.Label40 = New System.Windows.Forms.Label() @@ -62,12 +62,6 @@ Partial Class usrCntlQualitaetskontrolle Me.txtFirma = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Label30 = New System.Windows.Forms.Label() Me.dgvPositionen = New System.Windows.Forms.DataGridView() - Me.pos = New System.Windows.Forms.DataGridViewTextBoxColumn() - Me.anZ_pkgstk = New System.Windows.Forms.DataGridViewTextBoxColumn() - Me.art_pkgstk = New System.Windows.Forms.DataGridViewTextBoxColumn() - Me.erzeugnis = New System.Windows.Forms.DataGridViewTextBoxColumn() - Me.gewicht = New System.Windows.Forms.DataGridViewTextBoxColumn() - Me.KNCode = New System.Windows.Forms.DataGridViewTextBoxColumn() Me.txtPackAdresse2 = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtPackAdresse1 = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtPackFirma = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -111,6 +105,13 @@ Partial Class usrCntlQualitaetskontrolle Me.Label18 = New System.Windows.Forms.Label() Me.btnVermarktungsnorman = New System.Windows.Forms.Button() Me.btnPreise = New System.Windows.Forms.Button() + Me.pos = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.anZ_pkgstk = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.art_pkgstk = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.erzeugnis = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.gewicht = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.KNCode = New System.Windows.Forms.DataGridViewTextBoxColumn() + Me.speziell = New System.Windows.Forms.DataGridViewTextBoxColumn() CType(Me.pic, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.dgvPositionen, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.dgvGebuehren, System.ComponentModel.ISupportInitialize).BeginInit() @@ -555,58 +556,14 @@ Partial Class usrCntlQualitaetskontrolle 'dgvPositionen ' Me.dgvPositionen.BackgroundColor = System.Drawing.Color.White - Me.dgvPositionen.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable + Me.dgvPositionen.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText Me.dgvPositionen.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - Me.dgvPositionen.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.pos, Me.anZ_pkgstk, Me.art_pkgstk, Me.erzeugnis, Me.gewicht, Me.KNCode}) + Me.dgvPositionen.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.pos, Me.anZ_pkgstk, Me.art_pkgstk, Me.erzeugnis, Me.gewicht, Me.KNCode, Me.speziell}) Me.dgvPositionen.Location = New System.Drawing.Point(180, 291) Me.dgvPositionen.Name = "dgvPositionen" Me.dgvPositionen.Size = New System.Drawing.Size(791, 345) Me.dgvPositionen.TabIndex = 156 ' - 'pos - ' - DataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - DataGridViewCellStyle10.Format = "N0" - DataGridViewCellStyle10.NullValue = Nothing - Me.pos.DefaultCellStyle = DataGridViewCellStyle10 - Me.pos.Frozen = True - Me.pos.HeaderText = "Position" - Me.pos.MaxInputLength = 3 - Me.pos.Name = "pos" - Me.pos.ReadOnly = True - Me.pos.Width = 50 - ' - 'anZ_pkgstk - ' - Me.anZ_pkgstk.HeaderText = "Anz-Packs." - Me.anZ_pkgstk.Name = "anZ_pkgstk" - ' - 'art_pkgstk - ' - Me.art_pkgstk.HeaderText = "Art-Packs" - Me.art_pkgstk.Name = "art_pkgstk" - ' - 'erzeugnis - ' - Me.erzeugnis.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill - Me.erzeugnis.HeaderText = "Art des Erzeugnisses" - Me.erzeugnis.Name = "erzeugnis" - ' - 'gewicht - ' - DataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - DataGridViewCellStyle11.Format = "N2" - DataGridViewCellStyle11.NullValue = Nothing - Me.gewicht.DefaultCellStyle = DataGridViewCellStyle11 - Me.gewicht.HeaderText = "Gewicht" - Me.gewicht.MaxInputLength = 100 - Me.gewicht.Name = "gewicht" - ' - 'KNCode - ' - Me.KNCode.HeaderText = "KNCode" - Me.KNCode.Name = "KNCode" - ' 'txtPackAdresse2 ' Me.txtPackAdresse2._DateTimeOnly = False @@ -1119,6 +1076,55 @@ Partial Class usrCntlQualitaetskontrolle Me.btnPreise.Text = "Preise" Me.btnPreise.UseVisualStyleBackColor = True ' + 'pos + ' + DataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + DataGridViewCellStyle10.Format = "N0" + DataGridViewCellStyle10.NullValue = Nothing + Me.pos.DefaultCellStyle = DataGridViewCellStyle10 + Me.pos.Frozen = True + Me.pos.HeaderText = "Position" + Me.pos.MaxInputLength = 3 + Me.pos.Name = "pos" + Me.pos.ReadOnly = True + Me.pos.Width = 50 + ' + 'anZ_pkgstk + ' + Me.anZ_pkgstk.HeaderText = "Anz-Packs." + Me.anZ_pkgstk.Name = "anZ_pkgstk" + ' + 'art_pkgstk + ' + Me.art_pkgstk.HeaderText = "Art-Packs" + Me.art_pkgstk.Name = "art_pkgstk" + ' + 'erzeugnis + ' + Me.erzeugnis.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill + Me.erzeugnis.HeaderText = "Art des Erzeugnisses" + Me.erzeugnis.Name = "erzeugnis" + ' + 'gewicht + ' + DataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + DataGridViewCellStyle11.Format = "N2" + DataGridViewCellStyle11.NullValue = Nothing + Me.gewicht.DefaultCellStyle = DataGridViewCellStyle11 + Me.gewicht.HeaderText = "Gewicht" + Me.gewicht.MaxInputLength = 100 + Me.gewicht.Name = "gewicht" + ' + 'KNCode + ' + Me.KNCode.HeaderText = "KNCode" + Me.KNCode.Name = "KNCode" + ' + 'speziell + ' + Me.speziell.HeaderText = "spez/allg" + Me.speziell.Name = "speziell" + ' 'usrCntlQualitaetskontrolle ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -1270,12 +1276,13 @@ Partial Class usrCntlQualitaetskontrolle Friend WithEvents Preis As DataGridViewTextBoxColumn Friend WithEvents Faktor As DataGridViewTextBoxColumn Friend WithEvents Betrag As DataGridViewTextBoxColumn + Friend WithEvents btnVermarktungsnorman As Button + Friend WithEvents btnPreise As Button Friend WithEvents pos As DataGridViewTextBoxColumn Friend WithEvents anZ_pkgstk As DataGridViewTextBoxColumn Friend WithEvents art_pkgstk As DataGridViewTextBoxColumn Friend WithEvents erzeugnis As DataGridViewTextBoxColumn Friend WithEvents gewicht As DataGridViewTextBoxColumn Friend WithEvents KNCode As DataGridViewTextBoxColumn - Friend WithEvents btnVermarktungsnorman As Button - Friend WithEvents btnPreise As Button + Friend WithEvents speziell As DataGridViewTextBoxColumn End Class diff --git a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.resx b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.resx index f5f4cc74..36a7fd63 100644 --- a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.resx +++ b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.resx @@ -135,22 +135,7 @@ True - - True - - - True - - - True - - - True - - - True - - + True diff --git a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.vb b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.vb index a856e0d9..02387134 100644 --- a/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.vb +++ b/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlQualitaetskontrolle.vb @@ -218,15 +218,19 @@ Public Class usrCntlQualitaetskontrolle Dim couter As Integer = 1 Dim checkKNCode As Boolean = False + Dim speziellOderAllg As String = "" For Each row As DataRow In dt.Rows - dgvPositionen.Rows.Add(row("ItNr"), row("Nr"), row("Kind"), row("GdsDes"), row("Net"), row("ComCd")) - If row("ComCd") <> "" Then checkKNCode = True - couter = +1 + If row("ComCd") <> "" Then + checkKNCode = True + checkifAllgemeinOderSpeziell(row("ComCd"), speziellOderAllg) + End If + couter = +1 + dgvPositionen.Rows.Add(row("ItNr"), row("Nr"), row("Kind"), row("GdsDes"), row("Net"), row("ComCd"), speziellOderAllg) Next - If checkKNCode Then initdgvGebuehren() + If checkKNCode Then initdgvGebuehren(True) End Sub @@ -390,6 +394,7 @@ Public Class usrCntlQualitaetskontrolle If r IsNot Nothing And r.Cells(5).Value <> "" Then checkKNCode = True + checkifAllgemeinOderSpeziell(r.Cells(5).Value, r.Cells(6).Value) End If Next @@ -397,7 +402,7 @@ Public Class usrCntlQualitaetskontrolle txtGewicht.Text = gewicht & " kg" txtAnzVerp.Text = colli - If checkKNCode Then initdgvGebuehren() + If checkKNCode Then initdgvGebuehren(True) End Sub @@ -411,12 +416,12 @@ Public Class usrCntlQualitaetskontrolle Private Sub dgvPositionen_RowsAdded(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles dgvPositionen.RowsAdded berechneDGVSum() - initdgvGebuehren() + initdgvGebuehren(True) End Sub Private Sub dgvPositionen_RowsRemoved(sender As Object, e As DataGridViewRowsRemovedEventArgs) Handles dgvPositionen.RowsRemoved berechneDGVSum() - initdgvGebuehren() + initdgvGebuehren(True) End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click @@ -502,19 +507,112 @@ Public Class usrCntlQualitaetskontrolle End Sub - Private Sub initdgvGebuehren() + + Private Sub checkifAllgemeinOderSpeziell(ByRef codeKND As String, ByRef speziell As String) + + Dim found As Boolean = False + + If codeKND <> "" Then + + For Each row As DataRow In normenSpeziell.Rows + Dim code = row("kncode").ToString.Trim().Replace(" ", "") + Dim searchedCode = codeKND + If code.Length < searchedCode.Length Then + searchedCode = searchedCode.ToString.Substring(0, code.Length) + End If + + If code = searchedCode Then + If speziell <> "spez." Then speziell = "spez." + + found = True + Exit For + End If + + Next + + If Not found Then + + For Each row As DataRow In normenAllg.Rows + Dim code = row("kncode").ToString.Trim().Replace(" ", "") + Dim searchedCode = codeKND + If code.Length < searchedCode.Length Then + searchedCode = searchedCode.ToString.Substring(0, code.Length) + End If + If code = searchedCode Then + If speziell <> "allg" Then speziell = "allg" + found = True + Exit For + End If + + Next + + + End If + + If Not found Then + If speziell <> "allg-NIL" Then speziell = "allg-NIL" + End If + End If + + + End Sub + + Private Sub initdgvGebuehren(initDatatable As Boolean) Try - - If dgvGebuehren.Rows.Count > 0 Then dgvGebuehren.Rows.Clear() + If dgvGebuehren IsNot Nothing AndAlso dgvGebuehren.Rows.Count > 0 Then dgvGebuehren.Rows.Clear() Dim posVorhanden As Boolean = False - If dgvPositionen.Rows.Count < 1 Then Exit Sub + If dgvPositionen.Rows.Count <1 Then Exit Sub + If normenSpeziell.Rows.Count < 1 Or normenSpeziell.Rows.Count < 1 Then Exit Sub + Dim tableResultGroup As New DataTable + If initDatatable Then + + + Dim tableResult As New DataTable + For Each column As DataGridViewColumn In dgvPositionen.Columns + If column.HeaderText.ToLower().Contains("spez/allg") Then tableResult.Columns.Add(column.HeaderText, GetType(String)) + If column.HeaderText.ToLower().Contains("kncode") Then tableResult.Columns.Add(column.HeaderText, GetType(String)) + If column.HeaderText.ToLower().Contains("gewicht") Then tableResult.Columns.Add(column.HeaderText, GetType(Double)) + Next + + For Each row As DataGridViewRow In dgvPositionen.Rows + tableResult.Rows.Add() + For Each cell As DataGridViewCell In row.Cells + If cell.Value IsNot Nothing AndAlso cell.Value.ToString() <> "" Then + If cell.ColumnIndex() = 4 Then tableResult.Rows(tableResult.Rows.Count - 1)(0) = cell.Value.ToString() + If cell.ColumnIndex() = 5 Then tableResult.Rows(tableResult.Rows.Count - 1)(1) = cell.Value.ToString() + If cell.ColumnIndex() = 6 Then tableResult.Rows(tableResult.Rows.Count - 1)(2) = cell.Value.ToString() + End If + + Next + Next + + Dim groups = tableResult.AsEnumerable(). + GroupBy(Function(row) New With { + Key .Id = row.Field(Of String)("spez/allg"), + Key .Multi = row.Field(Of String)("kncode") + }) + + tableResultGroup = tableResult.Clone() + + For Each grp In groups + + tableResultGroup.Rows.Add( + grp.Sum(Function(row) + Dim value = 0 + If Not IsDBNull(row.Item("gewicht")) Then value = row.Item("gewicht") + Return value + End Function), grp.Key.Multi, grp.Key.Id) + Next + + + End If Dim sumNormenAllg As Double = 0 Dim sumNormenSpez As Double = 0 @@ -524,48 +622,19 @@ Public Class usrCntlQualitaetskontrolle idk = 39.4 - For Each r As DataGridViewRow In dgvPositionen.Rows + 'If Not posVorhanden Then Exit Sub - Dim found As Boolean = False - - If r IsNot Nothing And IsNumeric(r.Cells(4).Value) AndAlso r.Cells(4).Value >= 1000 Then - posVorhanden = True - - If r.Cells(5).Value <> "" Then - For Each row As DataRow In normenSpeziell.Rows - Dim code = row("kncode").ToString.Trim().Replace(" ", "") - Dim searchedCode = r.Cells(5).Value - searchedCode = searchedCode.ToString.Substring(0, code.Length) - If code = searchedCode Then - sumNormenSpez += r.Cells(4).Value - found = True - Exit For - End If - - Next - If Not found Then - - For Each row As DataRow In normenAllg.Rows - Dim code = row("kncode").ToString.Trim().Replace(" ", "") - Dim searchedCode = r.Cells(5).Value - searchedCode = searchedCode.ToString.Substring(0, code.Length) - If code = searchedCode Then - sumNormenAllg += r.Cells(4).Value - found = True - Exit For - End If - - Next - - End If + For Each r In tableResultGroup.Rows + If Not IsDBNull(r("gewicht")) AndAlso IsNumeric(r("gewicht")) AndAlso Not IsDBNull(r("spez/allg")) Then + If r("spez/allg") = "spez." Then + sumNormenSpez += CDbl(r("gewicht")) + ElseIf r("spez/allg").ToString.Contains("allg") Then + sumNormenAllg += CDbl(r("gewicht")) End If - End If Next - If Not posVorhanden Then Exit Sub - If sumNormenAllg > 0 Then Dim anzAllg As Integer anzAllg = Math.Ceiling(sumNormenAllg / 1000) @@ -607,7 +676,7 @@ Public Class usrCntlQualitaetskontrolle Private Sub cbxVerzicht_CheckedChanged(sender As Object, e As EventArgs) Handles cbxVerzicht.CheckedChanged - initdgvGebuehren() + initdgvGebuehren(True) End Sub End Class diff --git a/SDL/mdm/frmMDMDatenverarbetiung.vb b/SDL/mdm/frmMDMDatenverarbetiung.vb index cd9bed18..c695ec9b 100644 --- a/SDL/mdm/frmMDMDatenverarbetiung.vb +++ b/SDL/mdm/frmMDMDatenverarbetiung.vb @@ -1168,7 +1168,7 @@ Public Class frmMDMDatenverarbetiung dt_CSV_selected.Constraints.Clear() - Dim fn As String = dir & "\" & csv.Item("Customer ID") & "_Maut_MSE.csv" + Dim fn As String = dir & "\" & csv.Item("Customer Nr") & "_Maut_MSE.csv" Dim outFile As System.IO.StreamWriter = My.Computer.FileSystem.OpenTextFileWriter(fn, False) Dim clmns As String = "" For i = 0 To dt_CSV_selected.Columns.Count - 1