dakosy, etc.

This commit is contained in:
2026-06-10 08:16:40 +02:00
parent 14fd7c2f69
commit 67965acfea
8 changed files with 245 additions and 17 deletions

View File

@@ -3,6 +3,7 @@ Imports System.Net
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Xml
Imports java.util.function
Imports VERAG_PROG_ALLGEMEIN
Public Class frmMDMNachrichtenVerarbeitung
@@ -355,7 +356,7 @@ Public Class frmMDMNachrichtenVerarbeitung
Exit Sub
End If
For i = 1 To 5
For i = 1 To 6
For Each d In System.IO.Directory.GetFiles(VERARBEITUNGS_PFAD)
Try
@@ -412,7 +413,21 @@ Public Class frmMDMNachrichtenVerarbeitung
End If
If found Then cntDatenEingelesen += 1
End If
Case 4
'Case 4
' '------------------------------------------
' '------- NEW FORMAT - TRANS-FILE ----------
' '------------------------------------------
' If fi.Extension.ToLower = ".csv" Then
' If Not found And cGetMsgType.isPLOSE_NewFormat_TR(d) Then
' If readPLOSE_Detail_NEW_FORMAT(d) <> "" Then found = True
' End If
' If found Then cntDatenEingelesen += 1
' End If
Case 5
'------------------------------------------
'------------------ PDF ------------------
'------------------------------------------
@@ -468,7 +483,10 @@ Public Class frmMDMNachrichtenVerarbeitung
'Eintrag
End If
Case 5
Case 6
frmStartOptions.moveFile_DateBack(d, ERROR_PFAD)
dsNichtErkannt += 1
End Select
@@ -491,6 +509,20 @@ Public Class frmMDMNachrichtenVerarbeitung
End Try
Next
Next
'Dim sql_setMDMEinarbeitung As String = "UPDATE tblMDMEinarbeitung
' SET billingdate =
' CASE
' WHEN DAY(invoicedate) < 15 THEN
' EOMONTH(DATEADD(MONTH, -1, invoicedate))
' ELSE
' DATEFROMPARTS(YEAR(invoicedate), MONTH(invoicedate), 15)
' END
' WHERE supplier = 'PLOSE'
' AND billingdate IS NULL;"
'SQL.doSQL(sql_setMDMEinarbeitung, "FMZOLL")
End Sub
@@ -727,6 +759,191 @@ Public Class frmMDMNachrichtenVerarbeitung
End Try
End Function
Function readPLOSE_Detail_NEW_FORMAT(d As String) As String
Try
readPLOSE_Detail_NEW_FORMAT = ""
Dim KdnR = ""
Dim plose_RechnungsJahr = ""
Dim plose_RechnungsLieferantCode = ""
Dim plose_RechnungsNr = ""
Dim counTrans As Integer = 0
Dim savedTrans As Integer = 0
Dim MDMEinarb As New cMDMEinarbeitung("PLOSE", Now(), Now())
Dim plose_RechnungsDat = Nothing
Dim plose_Lieferant = Nothing
Dim fi As FileInfo = New FileInfo(d)
If fi.Name.Length > 8 Then
plose_RechnungsJahr = fi.Name.Substring(0, 2)
plose_RechnungsLieferantCode = fi.Name.Substring(2, 1)
'--------> auslesen [tblPLOSE_Lieferant]
Select Case plose_RechnungsLieferantCode
Case "0" : plose_Lieferant = "PLOSE Sistem Service"
Case "7" : plose_Lieferant = "Consortio PLOSE"
Case "1" : plose_Lieferant = "Plose Union"
Case "9" : plose_Lieferant = "PLOSE UNION SOCIETA COOPERATIVA"
End Select
End If
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(d, Encoding.UTF8)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(";")
Dim currentRow As String()
Dim cnt = 0
If True Then
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
If True Then 'fi.Name.Length > 8 Then
'Select Case currentRow(0)
' Case "TR1"
'RECHNUGNSDATUM
If currentRow.Length > 1 AndAlso currentRow(11).ToString.Length = 8 Then
Dim datumParse = DateTime.ParseExact(currentRow(11), "yyyyMMdd", Nothing)
plose_RechnungsDat = datumParse
End If
'RECHNUGNSNR
If currentRow.Length > 2 Then 'AndAlso currentRow(1).ToString.Length = 8 Then
plose_RechnungsNr = SQL.isleernothing(currentRow(12)) 'Rechnungsdatum aus TR1 Datensatz, überschreibt den Wert aus der Dateierstellung
End If
'Case "TR5"
If currentRow.Length > 24 AndAlso currentRow(12) <> "839160" Then 'KDNR <> VERAG --> Die Kosten bleiben uns
Dim PLOSE As New MDM_Worker.cPLOSE
PLOSE.plose_Dateiname = fi.Name
PLOSE.plose_RechnungsNr = plose_RechnungsNr
PLOSE.plose_Lieferant = plose_Lieferant
PLOSE.plose_LieferantCode = plose_RechnungsLieferantCode
PLOSE.plose_RechnungsJahr = plose_RechnungsJahr
If plose_RechnungsDat IsNot Nothing Then PLOSE.plose_RechnungsDatum = plose_RechnungsDat
PLOSE.plose_Datensatztyp = SQL.isleernothing(currentRow(0))
PLOSE.plose_KodexMautTankstelle = SQL.isleernothing(currentRow(1))
PLOSE.plose_BeschreibungMautTankstelle = SQL.isleernothing(currentRow(2))
PLOSE.plose_KodexEinfahrt = SQL.isleernothing(currentRow(3))
PLOSE.plose_BeschreibungEinfahrt = SQL.isleernothing(currentRow(4))
PLOSE.plose_KodexAusfahrt = SQL.isleernothing(currentRow(5))
PLOSE.plose_BeschreibungAusfahrt = SQL.isleernothing(currentRow(6))
PLOSE.plose_Kartenkodex = SQL.isleernothing(currentRow(7))
PLOSE.plose_Kontonummer = SQL.isleernothing(currentRow(8))
PLOSE.plose_NummerKarteGeraet = SQL.isleernothing(currentRow(9))
PLOSE.plose_Kennzeichen = SQL.isleernothing(currentRow(10))
PLOSE.plose_InterneNrFahrzeug = SQL.isleernothing(currentRow(11))
PLOSE.plose_POLSEKundennummer = SQL.isleernothing(currentRow(12))
PLOSE.plose_Firmenname = SQL.isleernothing(currentRow(13))
PLOSE.plose_DatumTransaktion = SQL.isleernothingDateFormatstring(currentRow(14))
PLOSE.plose_Produktbeschreibung = SQL.isleernothing(currentRow(15))
PLOSE.plose_Menge = SQL.isNullNothingDbl(currentRow(16))
PLOSE.plose_Preis = SQL.isNullNothingDbl(currentRow(17))
PLOSE.Einheitsrabatt = SQL.isleernothing(currentRow(18))
PLOSE.plose_NettobetragTransaktion = SQL.isNullNothingDbl(currentRow(19))
PLOSE.plose_MWSTBetrag = SQL.isNullNothingDbl(currentRow(20))
PLOSE.plose_BruttobetragTransaktion = SQL.isNullNothingDbl(currentRow(21))
PLOSE.plose_NettobetragWaehrungAbbuchung = SQL.isNullNothingDbl(currentRow(22))
PLOSE.plose_MWSTBetragWaehrungAbbuchung = SQL.isNullNothingDbl(currentRow(23))
PLOSE.plose_BruttobetragWaehrungAbbuchung = SQL.isNullNothingDbl(currentRow(24))
PLOSE.plose_WaehrungLandDiesntleistung = SQL.isleernothing(currentRow(25))
PLOSE.plose_WaehrungAbbuchung = SQL.isleernothing(currentRow(26))
PLOSE.plose_DokumentNrQuittungUhrzeit = SQL.isleernothing(currentRow(27))
PLOSE.plose_ArtTransaktion = SQL.isleernothing(currentRow(28))
PLOSE.plose_Fahrzeugklasse = SQL.isleernothing(currentRow(29))
PLOSE.plose_KlassenidentifikationEURO = SQL.isleernothing(currentRow(30))
PLOSE.plose_ProduktbeschreibungShort = SQL.isleernothing(currentRow(31))
PLOSE.plose_DokumentNrQuittungUhrzeit = SQL.isleernothing(currentRow(32))
PLOSE.plose_Geraetetyp = SQL.isleernothing(currentRow(33))
PLOSE.plose_ProduktCode = SQL.isleernothing(currentRow(34))
PLOSE.plose_ReferenzenBuchungMaut = SQL.isleernothing(currentRow(35))
If currentRow.Length > 36 Then PLOSE.plose_SupplierRechnungsNr = SQL.isleernothing(currentRow(36))
If currentRow.Length > 37 AndAlso currentRow(37).ToString.Length = 8 Then
Dim datumParse = DateTime.ParseExact(currentRow(37), "yyyyMMdd", Nothing)
PLOSE.plose_SupplierRechnungsDatum = datumParse
End If
If If(PLOSE.plose_SupplierRechnungsNr, "").contains("-SFC-") Then ' SOFICO
PLOSE.plose_LieferantCode = "90"
PLOSE.plose_Lieferant = SQL.DLookup("pl_Bezeichnung", "tblPLOSE_Lieferant", " [pl_LieferantCode]='" & PLOSE.plose_LieferantCode & "' ", "FMZOLL", "")
End If
''''''''''''
If PLOSE.SAVE() Then
savedTrans += 1
End If
counTrans += 1
End If
'End Select
cnt += 1
End If
'For Each currentField In currentRow
'Next
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End While
'Label30.Text = (cnt + 1) & " / " & LineCount
'Label31.Visible = True
readPLOSE_Detail_NEW_FORMAT = "Zeilen: " & cnt
Else
' MsgBox("FEHLER beim Löschen der vorhandenen OP-Liste.")
End If
End Using
Try
' System.IO.File.Delete(p)
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
addDGVEinarbeitung("PLOSE: Detail" & KdnR, readPLOSE_Detail_NEW_FORMAT)
MDMEinarb.ds_total = counTrans
MDMEinarb.ds_count = savedTrans
MDMEinarb.importfilename = fi.Name
MDMEinarb.import_date = Now()
If MDMEinarb.ds_total = MDMEinarb.ds_count Then
MDMEinarb.completed = True
MDMEinarb.completed_date = Now()
End If
MDMEinarb.SAVE()
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
readPLOSE_Detail_NEW_FORMAT = ""
End Try
End Function
Function readPLOSE_Header(d As String) As String
Try