ustva, etc.
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
Imports System.Data.OleDb
|
||||
Imports System.IO
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports itextsharp.text.pdf
|
||||
Imports MDM_Worker
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
|
||||
Public Class frmMDMDatenverarbetiung
|
||||
|
||||
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (
|
||||
ByVal hwnd As IntPtr,
|
||||
ByVal wMsg As Integer,
|
||||
ByVal wParam As Boolean,
|
||||
ByVal lParam As Integer) As Integer
|
||||
|
||||
Const WM_SETREDRAW As Integer = 11
|
||||
|
||||
Public LIEFERANT = ""
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
' Dim ProduktCode_NOT_IN = "SELECT plp_ProductCode FROM [tblPLOSE_Produktbeschreibung] WHERE [plp_einarbeiten]=0 "
|
||||
@@ -3729,7 +3738,6 @@ Public Class frmMDMDatenverarbetiung
|
||||
Panel2.Enabled = cbx.Checked
|
||||
End Sub
|
||||
|
||||
|
||||
Function pruefData_PLOSE() As Boolean
|
||||
|
||||
pruefData_PLOSE = True
|
||||
@@ -3750,85 +3758,207 @@ Public Class frmMDMDatenverarbetiung
|
||||
|
||||
checkFixeTaxeImOffert("PLOSE", VERAGKdNr_DT)
|
||||
|
||||
'------------------------------------------ALT--------------------------------------------------
|
||||
'------------------------------------------ALT--------------------------------------------------
|
||||
'------------------------------------------ALT--------------------------------------------------
|
||||
|
||||
'For Each r As DataGridViewRow In MyDatagridview1.Rows
|
||||
' 'KUNDEN-NR / PLOSE KD-NR
|
||||
' results = VERAGKdNr_DT.Select("PLOSEKundenNr = '" & r.Cells("plose_POLSEKundennummer").Value & "'")
|
||||
' If results.Length > 0 Then
|
||||
' 'Gefunden!
|
||||
' r.Cells("VERAGKdNr").Value = results(0)("PLOSEKundenNr")
|
||||
' r.Cells("VERAGKdNr").Style.BackColor = Color.MintCream
|
||||
' VERAGKdNr = results(0)("AdressenNr")
|
||||
' found = True
|
||||
' Else
|
||||
' r.Cells("VERAGKdNr").Style.BackColor = Color.PapayaWhip
|
||||
' pruefData_PLOSE = False
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
' 'VERAG/PLOSE LEISTUNG
|
||||
' results = VERAGLeistungsNr_DT.Select("plp_ProductCode = '" & r.Cells("plose_ProduktCode").Value & "' AND plp_LeistungsNr is not null")
|
||||
' If results.Length > 0 Then
|
||||
' 'Gefunden!
|
||||
' VERAGLeistungsNr = results(0)("plp_LeistungsNr")
|
||||
' r.Cells("VERAGLeistungsNr").Value = results(0)("plp_LeistungsNr")
|
||||
' r.Cells("VERAGLeistungsNr").Style.BackColor = Color.MintCream
|
||||
' found = True
|
||||
' Else
|
||||
' r.Cells("VERAGLeistungsNr").Style.BackColor = Color.PapayaWhip
|
||||
' pruefData_PLOSE = False
|
||||
' End If
|
||||
|
||||
|
||||
' 'VERAG OFFERT 80
|
||||
' 'Default -> Nicht gefunden
|
||||
' 'Dim OffertenNr_DT = SQL.loadDgvBySql("SELECT KundenNr,OffertenNr FROM [Offerten] where OffertenNr = 80 AND KundenNr = '" & VERAGKdNr & "'", "FMZOLL")
|
||||
' results = OffertenNr_DT.Select("KundenNr = '" & VERAGKdNr & "'")
|
||||
' If results.Length > 0 Then
|
||||
' 'Gefunden!
|
||||
' r.Cells("KundeOffertenNr").Value = results(0)("OffertenNr")
|
||||
' r.Cells("KundeOffertenNr").Style.BackColor = Color.MintCream
|
||||
' Else
|
||||
' pruefData_PLOSE = False
|
||||
' r.Cells("KundeOffertenNr").Style.BackColor = Color.PapayaWhip
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
' 'VERAG LEISTUNGS-NR
|
||||
' 'Default -> Nicht gefunden
|
||||
' 'Dim KundeLeistungsNr_DT = SQL.loadDgvBySql("SELECT [LeistungsNr],KundenNr FROM [Offertenpositionen] where OffertenNr = 80 AND KundenNr = '" & VERAGKdNr & "' AND LeistungsNr = '" & VERAGLeistungsNr & "'", "FMZOLL")
|
||||
' results = KundeLeistungsNr_DT.Select("KundenNr = '" & VERAGKdNr & "' AND LeistungsNr = '" & VERAGLeistungsNr & "'")
|
||||
' If results.Length > 0 Then
|
||||
' 'Gefunden!
|
||||
' r.Cells("KundeLeistungsNr").Value = VERAGLeistungsNr
|
||||
' r.Cells("KundeLeistungsNr").Style.BackColor = Color.MintCream
|
||||
' Else
|
||||
' r.Cells("KundeLeistungsNr").Style.BackColor = Color.PapayaWhip
|
||||
' pruefData_PLOSE = False
|
||||
' End If
|
||||
|
||||
' If cnt Mod 5 = 0 Then
|
||||
' lblProzPruef.Text = CInt(cnt / cntTotal * 100) & " %"
|
||||
' lblProzPruef.Refresh()
|
||||
' 'Me.Refresh()
|
||||
' End If
|
||||
|
||||
' cnt += 1
|
||||
|
||||
'Next
|
||||
|
||||
''lblProzPruef.Text = CInt(cnt / MyDatagridview1.Rows.Count() * 100) & " %" '100
|
||||
''lblProzPruef.Refresh()
|
||||
'Me.Refresh()
|
||||
|
||||
|
||||
|
||||
|
||||
'------------------------------------------NEU--------------------------------------------------
|
||||
'------------------------------------------NEU--------------------------------------------------
|
||||
'------------------------------------------NEU--------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
'MyDatagridview1.SuspendLayout()
|
||||
|
||||
Dim dictPloseKunden = VERAGKdNr_DT.AsEnumerable().
|
||||
GroupBy(Function(x) x("PLOSEKundenNr").ToString()).
|
||||
ToDictionary(Function(g) g.Key, Function(g) g.First())
|
||||
|
||||
Dim dictProdukt = VERAGLeistungsNr_DT.AsEnumerable().
|
||||
GroupBy(Function(x) x("plp_ProductCode").ToString()).
|
||||
ToDictionary(Function(g) g.Key,
|
||||
Function(g) g.First())
|
||||
|
||||
|
||||
Dim dictOfferte =
|
||||
OffertenNr_DT.AsEnumerable().
|
||||
GroupBy(Function(x) x("KundenNr").ToString()).
|
||||
ToDictionary(Function(g) g.Key,
|
||||
Function(g) g.First()("OffertenNr"))
|
||||
|
||||
Dim dictLeistung =
|
||||
KundeLeistungsNr_DT.AsEnumerable().
|
||||
GroupBy(Function(x) x("KundenNr").ToString()).
|
||||
ToDictionary(Function(g) g.Key,
|
||||
Function(g) g.Select(Function(r) r("LeistungsNr").ToString()).
|
||||
ToHashSet())
|
||||
|
||||
|
||||
SendMessage(MyDatagridview1.Handle, WM_SETREDRAW, False, 0)
|
||||
SuspendPainting(MyDatagridview1)
|
||||
|
||||
|
||||
For Each r As DataGridViewRow In MyDatagridview1.Rows
|
||||
'KUNDEN-NR / PLOSE KD-NR
|
||||
results = VERAGKdNr_DT.Select("PLOSEKundenNr = '" & r.Cells("plose_POLSEKundennummer").Value & "'")
|
||||
If results.Length > 0 Then
|
||||
'Gefunden!
|
||||
r.Cells("VERAGKdNr").Value = results(0)("PLOSEKundenNr")
|
||||
|
||||
Dim ploseKunde = r.Cells("plose_POLSEKundennummer").Value?.ToString()
|
||||
Dim produktCode = r.Cells("plose_ProduktCode").Value?.ToString()
|
||||
|
||||
'KD lookup
|
||||
Dim rowKd As DataRow = Nothing
|
||||
If dictPloseKunden.TryGetValue(ploseKunde, rowKd) Then
|
||||
r.Cells("VERAGKdNr").Value = rowKd("PLOSEKundenNr")
|
||||
VERAGKdNr = CInt(rowKd("AdressenNr"))
|
||||
r.Cells("VERAGKdNr").Style.BackColor = Color.MintCream
|
||||
VERAGKdNr = results(0)("AdressenNr")
|
||||
found = True
|
||||
Else
|
||||
pruefData_PLOSE = False
|
||||
r.Cells("VERAGKdNr").Style.BackColor = Color.PapayaWhip
|
||||
pruefData_PLOSE = False
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'VERAG/PLOSE LEISTUNG
|
||||
results = VERAGLeistungsNr_DT.Select("plp_ProductCode = '" & r.Cells("plose_ProduktCode").Value & "' AND plp_LeistungsNr is not null")
|
||||
If results.Length > 0 Then
|
||||
'Gefunden!
|
||||
VERAGLeistungsNr = results(0)("plp_LeistungsNr")
|
||||
r.Cells("VERAGLeistungsNr").Value = results(0)("plp_LeistungsNr")
|
||||
'Produkt lookup
|
||||
Dim rowProdukt As DataRow = Nothing
|
||||
If dictProdukt.TryGetValue(produktCode, rowProdukt) Then
|
||||
VERAGLeistungsNr = CInt(rowProdukt("plp_LeistungsNr"))
|
||||
r.Cells("VERAGLeistungsNr").Value = VERAGLeistungsNr
|
||||
r.Cells("VERAGLeistungsNr").Style.BackColor = Color.MintCream
|
||||
found = True
|
||||
Else
|
||||
r.Cells("VERAGLeistungsNr").Style.BackColor = Color.PapayaWhip
|
||||
pruefData_PLOSE = False
|
||||
r.Cells("VERAGLeistungsNr").Style.BackColor = Color.PapayaWhip
|
||||
End If
|
||||
|
||||
|
||||
'VERAG OFFERT 80
|
||||
'Default -> Nicht gefunden
|
||||
'Dim OffertenNr_DT = SQL.loadDgvBySql("SELECT KundenNr,OffertenNr FROM [Offerten] where OffertenNr = 80 AND KundenNr = '" & VERAGKdNr & "'", "FMZOLL")
|
||||
results = OffertenNr_DT.Select("KundenNr = '" & VERAGKdNr & "'")
|
||||
If results.Length > 0 Then
|
||||
'Gefunden!
|
||||
r.Cells("KundeOffertenNr").Value = results(0)("OffertenNr")
|
||||
'Offerte 80 lookup
|
||||
Dim offered80 As Object = Nothing
|
||||
If dictOfferte.TryGetValue(VERAGKdNr.ToString(), offered80) Then
|
||||
r.Cells("KundeOffertenNr").Value = offered80
|
||||
r.Cells("KundeOffertenNr").Style.BackColor = Color.MintCream
|
||||
Else
|
||||
pruefData_PLOSE = False
|
||||
r.Cells("KundeOffertenNr").Style.BackColor = Color.PapayaWhip
|
||||
End If
|
||||
|
||||
'Leistung lookup
|
||||
Dim setLeist As HashSet(Of String) = Nothing
|
||||
If dictLeistung.TryGetValue(VERAGKdNr.ToString(), setLeist) AndAlso
|
||||
setLeist.Contains(VERAGLeistungsNr.ToString()) Then
|
||||
|
||||
|
||||
'VERAG LEISTUNGS-NR
|
||||
'Default -> Nicht gefunden
|
||||
'Dim KundeLeistungsNr_DT = SQL.loadDgvBySql("SELECT [LeistungsNr],KundenNr FROM [Offertenpositionen] where OffertenNr = 80 AND KundenNr = '" & VERAGKdNr & "' AND LeistungsNr = '" & VERAGLeistungsNr & "'", "FMZOLL")
|
||||
results = KundeLeistungsNr_DT.Select("KundenNr = '" & VERAGKdNr & "' AND LeistungsNr = '" & VERAGLeistungsNr & "'")
|
||||
If results.Length > 0 Then
|
||||
'Gefunden!
|
||||
r.Cells("KundeLeistungsNr").Value = VERAGLeistungsNr
|
||||
r.Cells("KundeLeistungsNr").Style.BackColor = Color.MintCream
|
||||
Else
|
||||
r.Cells("KundeLeistungsNr").Style.BackColor = Color.PapayaWhip
|
||||
pruefData_PLOSE = False
|
||||
r.Cells("KundeLeistungsNr").Style.BackColor = Color.PapayaWhip
|
||||
End If
|
||||
|
||||
If cnt Mod 5 = 0 Then
|
||||
'UI update alle 100 Zeilen statt 5
|
||||
If cnt Mod 100 = 0 Then
|
||||
lblProzPruef.Text = CInt(cnt / cntTotal * 100) & " %"
|
||||
lblProzPruef.Refresh()
|
||||
'Me.Refresh()
|
||||
End If
|
||||
|
||||
cnt += 1
|
||||
|
||||
Next
|
||||
ResumePainting(MyDatagridview1)
|
||||
SendMessage(MyDatagridview1.Handle, WM_SETREDRAW, True, 0)
|
||||
MyDatagridview1.Refresh()
|
||||
|
||||
'lblProzPruef.Text = CInt(cnt / MyDatagridview1.Rows.Count() * 100) & " %" '100
|
||||
'lblProzPruef.Refresh()
|
||||
lblProzPruef.Text = CInt(cnt / MyDatagridview1.Rows.Count() * 100) & " %" '100
|
||||
lblProzPruef.Refresh()
|
||||
Me.Refresh()
|
||||
|
||||
|
||||
MyDatagridview1.SuspendLayout()
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
pruefData_PLOSE = False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Sub SuspendPainting(ByVal parent As Control)
|
||||
SendMessage(parent.Handle, WM_SETREDRAW, False, 0)
|
||||
End Sub
|
||||
|
||||
Public Sub ResumePainting(ByVal parent As Control)
|
||||
SendMessage(parent.Handle, WM_SETREDRAW, True, 0)
|
||||
parent.Refresh()
|
||||
End Sub
|
||||
|
||||
Function pruefData_ASFINAG() As Boolean
|
||||
pruefData_ASFINAG = True
|
||||
Try
|
||||
@@ -4911,4 +5041,6 @@ RabattBerechnen:
|
||||
initDgv_IDS()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user