neu
This commit is contained in:
@@ -269,12 +269,19 @@ Public Class frmMDMNachrichtenVerarbeitung
|
||||
|
||||
If True Then
|
||||
' Temp.DownloadPfad
|
||||
Dim destFilenameTMP = VERARBEITUNGS_PFAD & "." & If(IO.File.Exists(VERARBEITUNGS_PFAD & "." & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
|
||||
|
||||
Dim downloadRequest As FtpWebRequest = WebRequest.Create(fileUrl)
|
||||
downloadRequest.Method = WebRequestMethods.Ftp.DownloadFile
|
||||
downloadRequest.Credentials = credentials
|
||||
|
||||
Dim fileDateTmp As Date = ServerDateFile(credentials, fileUrl)
|
||||
|
||||
'Dim destFilenameTMP = VERARBEITUNGS_PFAD & "." & If(IO.File.Exists(VERARBEITUNGS_PFAD & "." & name), name.Replace(".csv", "_") & " RGDAT_" & fileDateTmp.ToShortDateString & "_" & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
|
||||
' Dim FimeNameTmp = If(IO.File.Exists(VERARBEITUNGS_PFAD & "." & name), name.Replace(".csv", "_") & " RGDAT_" & fileDateTmp.ToShortDateString & "_" & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
|
||||
name = name.Replace(".csv", "_RGDAT_" & fileDateTmp.ToShortDateString & ".csv")
|
||||
|
||||
Dim destFilenameTMP = VERARBEITUNGS_PFAD & "." & If(IO.File.Exists(VERARBEITUNGS_PFAD & "." & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
|
||||
|
||||
Using downloadResponse As FtpWebResponse = downloadRequest.GetResponse(),
|
||||
sourceStream As Stream = downloadResponse.GetResponseStream(),
|
||||
targetStream As Stream = File.OpenWrite(destFilenameTMP)
|
||||
@@ -291,7 +298,8 @@ Public Class frmMDMNachrichtenVerarbeitung
|
||||
targetStream.Dispose()
|
||||
downloadResponse.Dispose()
|
||||
|
||||
Dim destFilename = VERARBEITUNGS_PFAD & "." & If(IO.File.Exists(VERARBEITUNGS_PFAD & "." & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
|
||||
Dim destFilename = VERARBEITUNGS_PFAD & If(IO.File.Exists(VERARBEITUNGS_PFAD & name), name.Replace(".csv", "_") & Now.ToString("yyMMdd_HHmmss.fff") & ".csv", name)
|
||||
|
||||
IO.File.Move(destFilenameTMP, destFilename) 'Datei umbenennen
|
||||
|
||||
|
||||
@@ -316,6 +324,28 @@ Public Class frmMDMNachrichtenVerarbeitung
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Function ServerDateFile(credentials As NetworkCredential, fileUrl As String) As Date
|
||||
Dim ServerDate As DateTime
|
||||
Try
|
||||
Dim request As FtpWebRequest = WebRequest.Create(fileUrl)
|
||||
request.Method = WebRequestMethods.Ftp.GetDateTimestamp
|
||||
request.Credentials = credentials
|
||||
|
||||
Using response = CType(request.GetResponse(), Net.FtpWebResponse)
|
||||
ServerDate = response.LastModified.ToShortDateString
|
||||
End Using
|
||||
|
||||
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)
|
||||
End Try
|
||||
|
||||
Return ServerDate
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Function getNachrichtenDatenFromMDMServices_ALTERNATIV() As Integer
|
||||
Dim cnt = 0
|
||||
Try
|
||||
@@ -567,14 +597,36 @@ Public Class frmMDMNachrichtenVerarbeitung
|
||||
|
||||
Dim fi As FileInfo = New FileInfo(d)
|
||||
If fi.Name.Length > 8 Then
|
||||
Dim plose_RechnungsNr = fi.Name.Substring(0, 8)
|
||||
'Dim plose_RechnungsNr = fi.Name.Substring(0, 8)
|
||||
|
||||
Dim plose_RechnungsJahr = fi.Name.Substring(0, 2)
|
||||
Dim plose_RechnungsLieferantCode = fi.Name.Substring(2, 1)
|
||||
Dim plose_RechnungsNr = fi.Name.Substring(3, 5)
|
||||
|
||||
Dim plose_RechnungsDat = Nothing
|
||||
|
||||
Dim plose_Lieferant = Nothing
|
||||
Select Case plose_RechnungsLieferantCode
|
||||
Case "0" : plose_Lieferant = "PLOSE Sistem Service"
|
||||
Case "7" : plose_Lieferant = "Consortio PLOSE"
|
||||
End Select
|
||||
|
||||
If fi.FullName.Contains("_RGDAT_") Then
|
||||
Try
|
||||
plose_RechnungsDat = CDate(fi.FullName.Substring(fi.FullName.IndexOf("_RGDAT_") + 7, 10))
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "PLOSE RG DATUM, FILE: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
End If
|
||||
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))
|
||||
@@ -663,6 +715,11 @@ Public Class frmMDMNachrichtenVerarbeitung
|
||||
|
||||
Function readPLOSE_Header(d As String) As String
|
||||
Try
|
||||
Return "" ' Keine Übernahme der Daten (RgDatum) --> Falsches Format!!!
|
||||
|
||||
|
||||
|
||||
|
||||
readPLOSE_Header = ""
|
||||
Dim KdnR = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user