Nachrichtenverarbeitung RMC

This commit is contained in:
2024-05-22 10:29:59 +02:00
parent a7ca09e6f4
commit 0621ad34d0
15 changed files with 1391 additions and 790 deletions

View File

@@ -636,9 +636,9 @@ Public Class frmMDMNachrichtenVerarbeitung
''''''''''''
If PLOSE.SAVE() Then
End If
End If
End If
End Select
cnt += 1

View File

@@ -23,11 +23,15 @@ Partial Class frmRMCNachrichtenVerarbeitung
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmAsfinag_NachrichtenVerabeitung))
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmRMCNachrichtenVerarbeitung))
Me.btn = New System.Windows.Forms.Button()
Me.pnl = New System.Windows.Forms.Panel()
Me.lblFTP = New System.Windows.Forms.Label()
Me.lblTestsystem = New System.Windows.Forms.Label()
Me.lblDatenCnt = New System.Windows.Forms.Label()
Me.dgvEinarbeitung = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.clmnArt = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Label9 = New System.Windows.Forms.Label()
Me.Button2 = New System.Windows.Forms.Button()
Me.Label7 = New System.Windows.Forms.Label()
@@ -38,10 +42,6 @@ Partial Class frmRMCNachrichtenVerarbeitung
Me.btnOK = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.dgvEinarbeitung = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.clmnArt = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.Column1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.lblFTP = New System.Windows.Forms.Label()
Me.pnl.SuspendLayout()
CType(Me.dgvEinarbeitung, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
@@ -87,6 +87,16 @@ Partial Class frmRMCNachrichtenVerarbeitung
Me.pnl.Size = New System.Drawing.Size(456, 319)
Me.pnl.TabIndex = 1
'
'lblFTP
'
Me.lblFTP.AutoSize = True
Me.lblFTP.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblFTP.ForeColor = System.Drawing.Color.Red
Me.lblFTP.Location = New System.Drawing.Point(121, 34)
Me.lblFTP.Name = "lblFTP"
Me.lblFTP.Size = New System.Drawing.Size(0, 13)
Me.lblFTP.TabIndex = 21
'
'lblTestsystem
'
Me.lblTestsystem.AutoSize = True
@@ -110,6 +120,35 @@ Partial Class frmRMCNachrichtenVerarbeitung
Me.lblDatenCnt.Text = "0"
Me.lblDatenCnt.Visible = False
'
'dgvEinarbeitung
'
Me.dgvEinarbeitung.AKTUALISIERUNGS_INTERVALL = -1
Me.dgvEinarbeitung.AllowUserToAddRows = False
Me.dgvEinarbeitung.AllowUserToDeleteRows = False
Me.dgvEinarbeitung.AllowUserToOrderColumns = True
Me.dgvEinarbeitung.AllowUserToResizeColumns = False
Me.dgvEinarbeitung.AllowUserToResizeRows = False
Me.dgvEinarbeitung.BackgroundColor = System.Drawing.Color.White
Me.dgvEinarbeitung.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgvEinarbeitung.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.clmnArt, Me.Column1})
Me.dgvEinarbeitung.Location = New System.Drawing.Point(12, 164)
Me.dgvEinarbeitung.Name = "dgvEinarbeitung"
Me.dgvEinarbeitung.RowHeadersVisible = False
Me.dgvEinarbeitung.Size = New System.Drawing.Size(291, 145)
Me.dgvEinarbeitung.TabIndex = 18
'
'clmnArt
'
Me.clmnArt.HeaderText = "Dateiname"
Me.clmnArt.Name = "clmnArt"
Me.clmnArt.Width = 150
'
'Column1
'
Me.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column1.HeaderText = "Status"
Me.Column1.Name = "Column1"
'
'Label9
'
Me.Label9.AutoSize = True
@@ -197,9 +236,9 @@ Partial Class frmRMCNachrichtenVerarbeitung
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(8, 8)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(231, 13)
Me.Label2.Size = New System.Drawing.Size(220, 13)
Me.Label2.TabIndex = 8
Me.Label2.Text = "Einarbeitung der Nachrichtendaten von Asfinag"
Me.Label2.Text = "Einarbeitung der Nachrichtendaten von RMC"
'
'Label1
'
@@ -211,46 +250,7 @@ Partial Class frmRMCNachrichtenVerarbeitung
Me.Label1.TabIndex = 8
Me.Label1.Text = "Einarbeitung:"
'
'dgvEinarbeitung
'
Me.dgvEinarbeitung.AKTUALISIERUNGS_INTERVALL = -1
Me.dgvEinarbeitung.AllowUserToAddRows = False
Me.dgvEinarbeitung.AllowUserToDeleteRows = False
Me.dgvEinarbeitung.AllowUserToOrderColumns = True
Me.dgvEinarbeitung.AllowUserToResizeColumns = False
Me.dgvEinarbeitung.AllowUserToResizeRows = False
Me.dgvEinarbeitung.BackgroundColor = System.Drawing.Color.White
Me.dgvEinarbeitung.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgvEinarbeitung.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.clmnArt, Me.Column1})
Me.dgvEinarbeitung.Location = New System.Drawing.Point(12, 164)
Me.dgvEinarbeitung.Name = "dgvEinarbeitung"
Me.dgvEinarbeitung.RowHeadersVisible = False
Me.dgvEinarbeitung.Size = New System.Drawing.Size(291, 145)
Me.dgvEinarbeitung.TabIndex = 18
'
'clmnArt
'
Me.clmnArt.HeaderText = "Dateiname"
Me.clmnArt.Name = "clmnArt"
Me.clmnArt.Width = 150
'
'Column1
'
Me.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill
Me.Column1.HeaderText = "Status"
Me.Column1.Name = "Column1"
'
'lblFTP
'
Me.lblFTP.AutoSize = True
Me.lblFTP.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblFTP.ForeColor = System.Drawing.Color.Red
Me.lblFTP.Location = New System.Drawing.Point(121, 34)
Me.lblFTP.Name = "lblFTP"
Me.lblFTP.Size = New System.Drawing.Size(0, 13)
Me.lblFTP.TabIndex = 21
'
'frmAsfinag_NachrichtenVerabeitung
'frmRMCNachrichtenVerarbeitung
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
@@ -258,7 +258,7 @@ Partial Class frmRMCNachrichtenVerarbeitung
Me.Controls.Add(Me.pnl)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmAsfinag_NachrichtenVerabeitung"
Me.Name = "frmRMCNachrichtenVerarbeitung"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "DY NachrichtenVerarbeitung"
Me.pnl.ResumeLayout(False)

View File

@@ -1,7 +1,10 @@
Imports System.IO
Imports System.Net
Imports System.Runtime.Remoting
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Xml
Imports DocumentFormat.OpenXml.Office2010.Excel
Imports VERAG_PROG_ALLGEMEIN
Public Class frmRMCNachrichtenVerarbeitung
@@ -10,28 +13,32 @@ Public Class frmRMCNachrichtenVerarbeitung
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim allowClose = False
Dim rmc As New cRMC
Dim programName As String
Dim Dateiname = ""
Sub New()
Sub New(programName As String)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
Me.programName = programName
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
End Sub
Sub New(allowClose) 'autostart
Sub New(programName As String, allowClose As Boolean) 'autostart
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
Me.programName = programName
Me.allowClose = allowClose
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
End Sub
Private Sub frmDYNachrichtenVerarbeitung_Load(sender As Object, e As EventArgs) Handles Me.Load
rmc.initImportPfade()
rmc.initImportPfade(programName)
lblFTP.Text = programName
For Each d In System.IO.Directory.GetFiles(rmc.VERARBEITUNG_PFAD)
ListBox3.Items.Add(frmStartOptions.cut_file(d))
Me.Refresh()
@@ -74,7 +81,7 @@ Public Class frmRMCNachrichtenVerarbeitung
Dim cnt = 0
Try
DownloadFtpDirectory(rmc.API_STRING & "/"c & "out/", New NetworkCredential(rmc.API.Rows(0).Item("api_user").ToString, rmc.API.Rows(0).Item("api_pw").ToString), "", cnt, False)
DownloadFtpDirectory(rmc.API_STRING & "/", New NetworkCredential(rmc.API.Rows(0).Item("api_user").ToString, rmc.API.Rows(0).Item("api_password").ToString), "", cnt, False)
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
@@ -95,6 +102,7 @@ Public Class frmRMCNachrichtenVerarbeitung
Using listResponse As FtpWebResponse = listRequest.GetResponse(),
listStream As Stream = listResponse.GetResponseStream(),
listReader As StreamReader = New StreamReader(listStream)
While Not listReader.EndOfStream
lines.Add(listReader.ReadLine())
End While
@@ -109,65 +117,57 @@ Public Class frmRMCNachrichtenVerarbeitung
Dim localFilePath As String = Path.Combine(localPath, name)
Dim fileUrl As String = url + name
If permissions(0) = "d" Then 'Ordner
If Not Directory.Exists(localFilePath) Then
Directory.CreateDirectory(localFilePath)
End If
DownloadFtpDirectory(fileUrl + "/", credentials, localFilePath, cnt, deleteAfterDownload)
If permissions(0) <> "d" Then 'in keine Unterorder suchen, nur die erste Ebene
Else
Dim downloadRequest As FtpWebRequest = WebRequest.Create(fileUrl)
downloadRequest.Method = WebRequestMethods.Ftp.DownloadFile
downloadRequest.Credentials = credentials
If True Then
Dim fileDateTmp As Date = ServerDateFile(credentials, fileUrl)
Dim downloadRequest As FtpWebRequest = WebRequest.Create(fileUrl)
downloadRequest.Method = WebRequestMethods.Ftp.DownloadFile
downloadRequest.Credentials = credentials
name = name.Replace(".csv", "_RGDAT_" & fileDateTmp.ToShortDateString & ".csv")
Dim fileDateTmp As Date = ServerDateFile(credentials, fileUrl)
Dim destFilenameTMP = rmc.VERARBEITUNG_PFAD & "." & If(IO.File.Exists(rmc.VERARBEITUNG_PFAD & "." & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
name = name.Replace(".csv", "_RGDAT_" & fileDateTmp.ToShortDateString & ".csv")
Dim destFilenameTMP = rmc.VERARBEITUNG_PFAD & "." & If(io.File.Exists(rmc.VERARBEITUNG_PFAD & "." & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
Using downloadResponse As FtpWebResponse = downloadRequest.GetResponse(),
Using downloadResponse As FtpWebResponse = downloadRequest.GetResponse(),
sourceStream As Stream = downloadResponse.GetResponseStream(),
targetStream As Stream = File.OpenWrite(destFilenameTMP)
Dim buffer As Byte() = New Byte(10240 - 1) {}
Dim read As Integer
Do
read = sourceStream.Read(buffer, 0, buffer.Length)
If read > 0 Then
targetStream.Write(buffer, 0, read)
End If
Loop While read > 0
sourceStream.Dispose()
targetStream.Dispose()
downloadResponse.Dispose()
Dim destFilename = rmc.VERARBEITUNG_PFAD & If(io.File.Exists(rmc.VERARBEITUNG_PFAD & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
io.File.Move(destFilenameTMP, destFilename) 'Datei umbenennen
Dim fi As FileInfo = New FileInfo(destFilename)
ListBox3.Items.Add(frmStartOptions.cut_file(fi.Name)) 'zur Liste hinzufügen
cnt += 1
'Datei nach download löschen
If deleteAfterDownload Then
Dim ftpReq As FtpWebRequest = WebRequest.Create(fileUrl)
ftpReq.Method = WebRequestMethods.Ftp.DeleteFile
ftpReq.Credentials = credentials
Dim ftpResp As FtpWebResponse = ftpReq.GetResponse
ftpResp.Close()
Dim buffer As Byte() = New Byte(10240 - 1) {}
Dim read As Integer
Do
read = sourceStream.Read(buffer, 0, buffer.Length)
If read > 0 Then
targetStream.Write(buffer, 0, read)
End If
Loop While read > 0
End Using
End If
sourceStream.Dispose()
targetStream.Dispose()
downloadResponse.Dispose()
Dim destFilename = rmc.VERARBEITUNG_PFAD & If(IO.File.Exists(rmc.VERARBEITUNG_PFAD & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
IO.File.Move(destFilenameTMP, destFilename) 'Datei umbenennen
Dim fi As FileInfo = New FileInfo(destFilename)
ListBox3.Items.Add(frmStartOptions.cut_file(fi.Name)) 'zur Liste hinzufügen
cnt += 1
'Datei nach download löschen
If deleteAfterDownload Then
Dim ftpReq As FtpWebRequest = WebRequest.Create(fileUrl)
ftpReq.Method = WebRequestMethods.Ftp.DeleteFile
ftpReq.Credentials = credentials
Dim ftpResp As FtpWebResponse = ftpReq.GetResponse
ftpResp.Close()
End If
End Using
End If
'End If
Next
End Sub
@@ -186,7 +186,7 @@ Public Class frmRMCNachrichtenVerarbeitung
Return ServerDate
Catch ex As WebException
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "PLOSE GET DATE FILE: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "RMC GET DATE FILE: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ServerDate
@@ -194,8 +194,6 @@ Public Class frmRMCNachrichtenVerarbeitung
Sub DatenEinlesen()
Exit Sub 'under development
VERAG_PROG_ALLGEMEIN.cAllgemein.ERR_OP_GLOBAL = VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL
If ListBox3.Items.Count = 0 Then
@@ -216,8 +214,6 @@ Public Class frmRMCNachrichtenVerarbeitung
Dim alreadyMoved = False
Select Case i
Case 1
'------------------------------------------
@@ -236,6 +232,7 @@ Public Class frmRMCNachrichtenVerarbeitung
'------------------ PDF ------------------
'------------------------------------------
If fi.Extension.ToLower = ".pdf" Then
found = False
If Not IO.Directory.Exists(rmc.ZIEL_PFAD & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\") Then IO.Directory.CreateDirectory(rmc.ZIEL_PFAD & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
@@ -243,10 +240,10 @@ Public Class frmRMCNachrichtenVerarbeitung
'File in Datenarchiv sichern:
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "RMC", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
DS.uploadDataToDATENSERVER(d)
'DatenArchiv-Id in tblPLOSE_Inv_Data Tabelle eintragen (über PDF-Name) :
SQL.doSQL("Update [tblPLOSE_Inv_Data] SET [plInv_daId]='" & DS.da_id & "' where [plInv_PdfFileName] = '" & DS.da_name & "' and [plInv_Einlesedatum] > DATEADD(DAY,-4,getdate()) ", "FMZOLL")
DS.uploadDataToDATENSERVER(d,,,,,, True)
If fi.Name.ToString.StartsWith("invoice_") Then
SQL.doSQL("Update [tblRMCImport] SET [rmc_daId]='" & DS.da_id & "' where [rmc_pdfFileName] = '" & DS.da_name & "' and [rmc_importDatum] > DATEADD(DAY,-4,getdate()) ", "FMZOLL")
End If
frmStartOptions.moveFile_DateBack(d, rmc.ZIEL_PFAD & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
@@ -256,9 +253,7 @@ Public Class frmRMCNachrichtenVerarbeitung
'Eintrag
End If
Case 5
frmStartOptions.moveFile_DateBack(d, rmc.ERROR_PFAD)
dsNichtErkannt += 1
End Select
If True Then
@@ -305,145 +300,64 @@ Public Class frmRMCNachrichtenVerarbeitung
Function readRMC(d As String) As String
Try
Dim KdnR = ""
Dim plose_RechnungsJahr = ""
Dim plose_RechnungsLieferantCode = ""
Dim plose_RechnungsNr = ""
Dim plose_RechnungsDat = Nothing
Dim plose_Lieferant = Nothing
Dim fi As FileInfo = New FileInfo(d)
If fi.Name.Length > 8 Then
''Dim plose_RechnungsNr = fi.Name.Substring(0, 8)
Dim kdNr = ""
'plose_RechnungsJahr = fi.Name.Substring(0, 2)
'plose_RechnungsLieferantCode = fi.Name.Substring(2, 1)
'' plose_RechnungsNr = fi.Name.Substring(3, 5)
Dim filetimestamp = Regex.Replace(fi.Name, "[^\d]", "") 'entferne alle nicht numerischen Werte!
Dim fileNr = filetimestamp.Substring(0, IIf(filetimestamp.Length > 8, filetimestamp.Length - 8, filetimestamp.Length))
Dim fileType = IIf(fi.Name.ToLower.Contains("nto"), "netto", "brutto")
Dim dt As New DataTable
dt.Columns.Add("KundenNr", GetType(String))
dt.Columns.Add("Kunde", GetType(String))
dt.Columns.Add("UID", GetType(String))
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(d, Encoding.GetEncoding(1252))
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
Dim firstLine = True
While Not MyReader.EndOfData
Try
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(1).ToString.Length = 8 Then
Dim datumParse = DateTime.ParseExact(currentRow(1), "yyyyMMdd", Nothing)
plose_RechnungsDat = datumParse 'Rechnungsdatum aus TR1 Datensatz, überschreibt den Wert aus der Dateierstellung
End If
'RECHNUGNSNR
If currentRow.Length > 2 Then 'AndAlso currentRow(1).ToString.Length = 8 Then
plose_RechnungsNr = SQL.isleernothing(currentRow(2)) '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 RMC As New VERAG_PROG_ALLGEMEIN.cRMC
'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 RMC.SAVE() Then
End If
End If
End Select
cnt += 1
currentRow = MyReader.ReadFields()
If firstLine Then
If SQL.isleernothing(currentRow(0)) = "KundenNr" Then
firstLine = False
Else
createRMC(fi, fileNr, filetimestamp, currentRow, fileType, kdNr, cnt, dt)
End If
Else
createRMC(fi, fileNr, filetimestamp, currentRow, fileType, kdNr, cnt, dt)
'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
End If
'Label30.Text = (cnt + 1) & " / " & LineCount
'Label31.Visible = True
readRMC = "Zeilen: " & cnt
Else
MsgBox("FEHLER beim Löschen der vorhandenen OP-Liste.")
End If
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
readRMC = "Zeilen: " & cnt
End Using
addDGVEinarbeitung("RMC: Detail" & kdNr, readRMC)
If dt.Rows.Count > 0 Then
Dim filepath = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt,,,,, False,)
If filepath <> "" Then
Dim anhenge As New List(Of String)
anhenge.Add(filepath)
VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail("juricevic@verag.ag", "Wölfl-UIDNr", "Im Anhang die zu prüfenden Kunden von WÖLFL " & vbNewLine & vbNewLine & "*Automatic generated e-mail*",,,,, "d.breimaier@verag.ag", anhenge)
End If
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, readRMC)
' End Using
'End If
End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
@@ -452,108 +366,6 @@ Public Class frmRMCNachrichtenVerarbeitung
End Try
End Function
'Function readPLOSE_INVData(d As String) As String
' Try
' Dim cnt = 0
' readPLOSE_INVData = ""
' Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(d, Encoding.UTF8)
' MyReader.TextFieldType = FileIO.FieldType.Delimited
' MyReader.SetDelimiters(";")
' Dim currentRow As String()
' Dim fi As FileInfo = New FileInfo(d)
' While Not MyReader.EndOfData
' Try
' currentRow = MyReader.ReadFields()
' If currentRow(0) <> "PloseCode" Then ' Header
' If currentRow.Length >= 15 Then
' Dim PLOSE_INV As New MDM_Worker.cPLOSE_Inv_Data
' ' MsgBox(SQL.isleernothingDateFormatstring(currentRow(7)))
' ' MsgBox(currentRow(7))
' PLOSE_INV.plInv_SupplierRechnungsDatum = SQL.isleernothingDateFormatstring(currentRow(7))
' ' MsgBox(PLOSE_INV.plInv_SupplierRechnungsDatum)
' PLOSE_INV.plInv_SupplierRechnungsNr = SQL.isleernothing(currentRow(8))
' PLOSE_INV.plInv_SupplierCountry = SQL.isleernothing(currentRow(6))
' PLOSE_INV.plInv_Lieferant = SQL.isleernothing(currentRow(4))
' PLOSE_INV.plInv_LieferantCode = SQL.isleernothing(currentRow(3))
' PLOSE_INV.plInv_LieferantUID = SQL.isleernothing(currentRow(5))
' 'PLOSE_INV.plInv_RechnungsJahr = SQL.isleernothing(currentRow(7)) --> JAHR
' PLOSE_INV.plInv_PdfFileName = SQL.isleernothing(currentRow(14))
' If If(PLOSE_INV.plInv_PdfFileName, "") <> "" Then
' If Not PLOSE_INV.plInv_PdfFileName.ToString.ToLower.EndsWith(".pdf") Then PLOSE_INV.plInv_PdfFileName += ".pdf" ' Falls Endung nciht .pdf --> anfügen
' End If
' PLOSE_INV.plInv_Einlesedatum = Now.ToShortDateString
' PLOSE_INV.plInv_Datensatztyp = "PDF"
' PLOSE_INV.plInv_PLOSEKundennummer = SQL.isleernothing(currentRow(0))
' PLOSE_INV.plInv_Firmenname = SQL.isleernothing(currentRow(1))
' ' PLOSE_INV.plInv_DatumTransaktion = SQL.isleernothing(currentRow(0))
' ' PLOSE_INV.plInv_Produktbeschreibung = SQL.isleernothing(currentRow(0))
' PLOSE_INV.plInv_Services = SQL.isleernothing(currentRow(13))
' PLOSE_INV.plInv_Nettobetrag = CDbl(CDbl(SQL.isNullReturnValue(currentRow(9), 0).replace(".", ",")) + CDbl(SQL.isNullReturnValue(currentRow(11), 0).replace(".", ",")))
' PLOSE_INV.plInv_MWSTBetrag = CDbl(SQL.isNullReturnValue(currentRow(10), 0).replace(".", ","))
' PLOSE_INV.plInv_Bruttobetrag = CDbl(SQL.isNullReturnValue(currentRow(12), 0).replace(".", ","))
' ' [plInv_daId]
' 'If If(PLOSE_INV.plInv_PdfFileName, "") <> "" Then 'And PLOSE_INV.plInv_daId Is Nothing Then
' ' PLOSE_INV.plInv_daId = SQL.getValueTxtBySql("SELECT TOP (1) [da_id] FROM [tblDatenarchiv] where da_kategorie = 'MDM' AND da_ordner='MDM_DATEN' and da_name='" & PLOSE_INV.plInv_PdfFileName & "' order by da_id desc", "FMZOLL",,, Nothing)
' 'End If
' PLOSE_INV.plInv_Dateiname = fi.Name
' ''''''''''''
' If PLOSE_INV.SAVE() Then
' ' UPDATE tblPLOSE_Details:
' SQL.doSQL("UPDATE [tblPLOSE_Details] SET [plose_plInvId] ='" & PLOSE_INV.plInv_Id & "' where plose_SupplierRechnungsNr='" & PLOSE_INV.plInv_SupplierRechnungsNr & "' AND plose_SupplierRechnungsDatum='" & PLOSE_INV.plInv_SupplierRechnungsDatum & "'", "FMZOLL")
' End If
' End If
' End If
' cnt += 1
' 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
' readPLOSE_INVData = "Zeilen: " & cnt
' 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: INV_DATA (" & cnt & ")", readPLOSE_INVData)
' ' End Using
' 'End If
' Catch ex As Exception
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
' MsgBox(ex.StackTrace & ex.Message)
' readPLOSE_INVData = ""
' End Try
'End Function
Private Sub dgvEinarbeitung_SelectionChanged(sender As Object, e As EventArgs) Handles dgvEinarbeitung.SelectionChanged
dgvEinarbeitung.ClearSelection()
@@ -573,5 +385,46 @@ Public Class frmRMCNachrichtenVerarbeitung
End If
End Sub
Private Sub createRMC(fi As FileInfo, filenr As Integer, filetimestamp As String, currentRow As String(), fileType As String, ByRef kdNr As String, cnt As Integer, dt As DataTable)
Dim RMC As New VERAG_PROG_ALLGEMEIN.cRMC
RMC.rmc_file = fi.Name
RMC.rmc_version = filetimestamp
RMC.rmc_fileNr = filenr
RMC.rmc_kdNr = SQL.isleernothing(currentRow(0))
RMC.rmc_kdName = SQL.isleernothing(currentRow(1))
RMC.rmc_fibuNr = SQL.isleernothing(currentRow(2))
RMC.rmc_UID = SQL.isleernothing(currentRow(3))
RMC.rmc_landKZ = SQL.isleernothing(currentRow(4))
RMC.rmc_landBezeichnung = SQL.isleernothing(currentRow(5))
RMC.rmc_reDatum = SQL.isleernothing(currentRow(6))
RMC.rmc_sammelReNr = SQL.isleernothing(currentRow(7))
RMC.rmc_reNr = SQL.isleernothing(currentRow(8))
RMC.rmc_betragNetto = SQL.isleernothing(currentRow(9))
RMC.rmc_betragMWST = SQL.isleernothing(currentRow(10))
RMC.rmc_betragBrutto = SQL.isleernothing(currentRow(11))
RMC.rmc_waehrung = SQL.isleernothing(currentRow(12))
RMC.rmc_euroBrutto = SQL.isleernothing(currentRow(13))
RMC.rmc_pdfFileName = "invoice_" & RMC.rmc_kdNr & "_" & filenr & "_" & RMC.rmc_sammelReNr & IIf(fileType = "netto", "_nto_e_verag.pdf", "_bto_e_verag.pdf")
If RMC.SAVE() Then
If kdNr <> RMC.rmc_kdNr Then
Dim adress As New VERAG_PROG_ALLGEMEIN.cAdressen(RMC.rmc_UID, RMC.rmc_kdNr)
If Not adress.hasEntry Then
Dim R As DataRow = dt.NewRow
R("KundenNr") = RMC.rmc_kdNr
R("Kunde") = RMC.rmc_kdName
R("UID") = RMC.rmc_UID
dt.Rows.Add(R)
End If
'If adress IsNot Nothing Then adress.UpdateSpecialField("WölflKundenNr", RMC.rmc_kdNr) -> nicht updaten, sondern nur info ausgeben!
End If
kdNr = RMC.rmc_kdNr
cnt += 1
End If
End Sub
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -80,6 +80,11 @@ Public Class frmStartOptions
cboSYSKAFirma.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("VERAG 360 GmbH", "19"))
cboSYSKAFirma.changeItem("")
cbxRMC.Items.Clear()
cbxRMC.fillWithSQL("SELECT api_program FROM tblAPIEinstellungen WHERE api_program like 'RMC%'", False, "ADMIN", True)
cbxRMC.changeItem("")
txtGJ_UNISPED.Text = Now.Year
txtEZOLLAnhDat._value = Now.ToShortDateString
@@ -3703,6 +3708,7 @@ Public Class frmStartOptions
End If
Case "buchungenAMBAR"
VERAG_PROG_ALLGEMEIN.cSyska_Interface.genDatensatz_Buchungen(24, CheckBox7.Checked, If(cbxSyskaWdh.Checked, txtSyskaWdhDateiname.Text, ""), True)
End Select
@@ -4360,5 +4366,11 @@ Public Class frmStartOptions
Private Sub LinkLabel52_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel52.LinkClicked
Me.Visible = False
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = cbxTestsystem.Checked
If cbxRMC._value = "" Then Exit Sub
Dim f As New frmRMCNachrichtenVerarbeitung(cbxRMC._value)
f.ShowDialog()
Me.Visible = True
End Sub
End Class