TrdInvoice, UstvaAntrag, Auswerungen, Kundenblatt, FaktMail, etc.
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
Imports System
|
Imports System
|
||||||
Imports System.Collections.Generic
|
Imports System.Collections.Generic
|
||||||
Imports Chilkat
|
Imports System.Globalization
|
||||||
Imports System.Web.Script.Serialization
|
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Text
|
Imports System.Text
|
||||||
|
Imports System.Web.Script.Serialization
|
||||||
|
Imports Chilkat
|
||||||
Imports Renci.SshNet
|
Imports Renci.SshNet
|
||||||
|
Imports sun.swing
|
||||||
Public Class cTelotecAPI
|
Public Class cTelotecAPI
|
||||||
|
|
||||||
|
|
||||||
@@ -140,31 +142,31 @@ Public Class cTelotecAPI
|
|||||||
Console.WriteLine("✅ StoreEXDeclarations Antwort: " & resp.BodyStr)
|
Console.WriteLine("✅ StoreEXDeclarations Antwort: " & resp.BodyStr)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Shared Sub GET_ALL_TELO_Messages()
|
Shared Sub GET_ALL_TELO_Messages(AnhEinlesen As Boolean)
|
||||||
|
|
||||||
Dim TELO As New VERAG_PROG_ALLGEMEIN.cTelotecAPI
|
Dim TELO As New VERAG_PROG_ALLGEMEIN.cTelotecAPI
|
||||||
Dim Company = "ATILLA"
|
Dim Company = "ATILLA"
|
||||||
|
|
||||||
For ii As Integer = 0 To 50
|
For ii As Integer = 0 To 50
|
||||||
Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company)
|
Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company, AnhEinlesen)
|
||||||
Threading.Thread.Sleep(1000) '
|
Threading.Thread.Sleep(1000) '
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Company = "IMEX"
|
Company = "IMEX"
|
||||||
For ii As Integer = 0 To 50
|
For ii As Integer = 0 To 50
|
||||||
Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company)
|
Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company, AnhEinlesen)
|
||||||
Threading.Thread.Sleep(1000) '
|
Threading.Thread.Sleep(1000) '
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Company = "DURMAZ"
|
Company = "DURMAZ"
|
||||||
For ii As Integer = 0 To 50
|
For ii As Integer = 0 To 50
|
||||||
Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company)
|
Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company, AnhEinlesen)
|
||||||
Threading.Thread.Sleep(1000) '
|
Threading.Thread.Sleep(1000) '
|
||||||
Next
|
Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Function GetTAMessages(Company) As List(Of TAMessage)
|
Function GetTAMessages(Company, AnhEinlesen) As List(Of TAMessage)
|
||||||
|
|
||||||
Console.WriteLine("-------------LOS-------------")
|
Console.WriteLine("-------------LOS-------------")
|
||||||
|
|
||||||
@@ -214,14 +216,14 @@ Public Class cTelotecAPI
|
|||||||
SaveJsonResponseTo_ATEZFTP(filePath)
|
SaveJsonResponseTo_ATEZFTP(filePath)
|
||||||
|
|
||||||
' Übergabe an Parserfunktion
|
' Übergabe an Parserfunktion
|
||||||
Return ParseTAMessagesJson(jsonText)
|
Return ParseTAMessagesJson(jsonText, AnhEinlesen)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Function ParseTAMessagesFromFile(filePath As String) As List(Of TAMessage)
|
Public Function ParseTAMessagesFromFile(filePath As String, AnhEinlesen As Boolean) As List(Of TAMessage)
|
||||||
Dim messages As New List(Of TAMessage)()
|
Dim messages As New List(Of TAMessage)()
|
||||||
|
|
||||||
If Not File.Exists(filePath) Then
|
If Not File.Exists(filePath) Then
|
||||||
@@ -231,7 +233,7 @@ Public Class cTelotecAPI
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
Dim jsonText As String = File.ReadAllText(filePath, Encoding.UTF8)
|
Dim jsonText As String = File.ReadAllText(filePath, Encoding.UTF8)
|
||||||
Return ParseTAMessagesJson(jsonText)
|
Return ParseTAMessagesJson(jsonText, AnhEinlesen)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Console.WriteLine("❌ Fehler beim Lesen/Verarbeiten der Datei: " & ex.Message)
|
Console.WriteLine("❌ Fehler beim Lesen/Verarbeiten der Datei: " & ex.Message)
|
||||||
End Try
|
End Try
|
||||||
@@ -240,7 +242,7 @@ Public Class cTelotecAPI
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Function ParseTAMessagesJson(jsonText As String) As List(Of TAMessage)
|
Public Function ParseTAMessagesJson(jsonText As String, AnhEinlesen As Boolean) As List(Of TAMessage)
|
||||||
Dim messages As New List(Of TAMessage)()
|
Dim messages As New List(Of TAMessage)()
|
||||||
|
|
||||||
Dim json As New Chilkat.JsonObject()
|
Dim json As New Chilkat.JsonObject()
|
||||||
@@ -260,19 +262,25 @@ Public Class cTelotecAPI
|
|||||||
msg.externalReference = jmsg.StringOf("externalReference")
|
msg.externalReference = jmsg.StringOf("externalReference")
|
||||||
msg.msgType = jmsg.StringOf("msgType")
|
msg.msgType = jmsg.StringOf("msgType")
|
||||||
|
|
||||||
|
Dim filePath As String = ""
|
||||||
|
|
||||||
' 💾 Attachment speichern
|
If AnhEinlesen Then
|
||||||
|
|
||||||
|
' 💾 Attachment speichern
|
||||||
|
|
||||||
|
Dim attachmentB64 As String = jmsg.StringOf("attachment")
|
||||||
|
If Not String.IsNullOrWhiteSpace(attachmentB64) AndAlso attachmentB64.ToString <> "null" Then
|
||||||
|
SaveAttachmentBase64(attachmentB64, TELOTEC_ATTACHMENT_PATH, msg.lrn, filePath)
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
Dim attachmentB64 As String = jmsg.StringOf("attachment")
|
|
||||||
If Not String.IsNullOrWhiteSpace(attachmentB64) AndAlso attachmentB64.ToString <> "null" Then
|
|
||||||
SaveAttachmentBase64(attachmentB64, TELOTEC_ATTACHMENT_PATH, msg.lrn)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Dim contentObj As Chilkat.JsonObject = jmsg.ObjectOf("declarationContent")
|
Dim contentObj As Chilkat.JsonObject = jmsg.ObjectOf("declarationContent")
|
||||||
If Not contentObj Is Nothing Then
|
If Not contentObj Is Nothing Then
|
||||||
Dim decl As New TADeclaration()
|
Dim decl As New TADeclaration()
|
||||||
|
|
||||||
|
decl.filePath = filePath
|
||||||
decl.mandant_ID = contentObj.StringOf("mandant_ID")
|
decl.mandant_ID = contentObj.StringOf("mandant_ID")
|
||||||
decl.interfaceReferenceId = contentObj.StringOf("interfaceReferenceId")
|
decl.interfaceReferenceId = contentObj.StringOf("interfaceReferenceId")
|
||||||
decl.ifcCustomerId = contentObj.StringOf("ifcCustomerId")
|
decl.ifcCustomerId = contentObj.StringOf("ifcCustomerId")
|
||||||
@@ -342,7 +350,7 @@ Public Class cTelotecAPI
|
|||||||
|
|
||||||
|
|
||||||
'PARSE TO cTELANMEUNG
|
'PARSE TO cTELANMEUNG
|
||||||
Dim TC
|
|
||||||
|
|
||||||
'-------------------------------
|
'-------------------------------
|
||||||
Else
|
Else
|
||||||
@@ -355,7 +363,7 @@ Public Class cTelotecAPI
|
|||||||
Return messages
|
Return messages
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Sub SaveAttachmentBase64(base64String As String, ByVal TELOTEC_ATTACHMENT_PATH As String, filePrefix As String)
|
Public Sub SaveAttachmentBase64(base64String As String, ByVal TELOTEC_ATTACHMENT_PATH As String, filePrefix As String, ByRef filePath As String)
|
||||||
Try
|
Try
|
||||||
If String.IsNullOrWhiteSpace(base64String) Then Exit Sub
|
If String.IsNullOrWhiteSpace(base64String) Then Exit Sub
|
||||||
|
|
||||||
@@ -370,11 +378,12 @@ Public Class cTelotecAPI
|
|||||||
Next
|
Next
|
||||||
|
|
||||||
Dim fileName As String = filePrefix & "_" & Date.Now.ToString("HHmmss") & ".pdf"
|
Dim fileName As String = filePrefix & "_" & Date.Now.ToString("HHmmss") & ".pdf"
|
||||||
Dim filePath As String = Path.Combine(dayDir, fileName)
|
filePath = Path.Combine(dayDir, fileName)
|
||||||
|
|
||||||
Dim fileBytes() As Byte = Convert.FromBase64String(base64String)
|
Dim fileBytes() As Byte = Convert.FromBase64String(base64String)
|
||||||
File.WriteAllBytes(filePath, fileBytes)
|
File.WriteAllBytes(filePath, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine("📄 PDF gespeichert unter: " & filePath)
|
Console.WriteLine("📄 PDF gespeichert unter: " & filePath)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Console.WriteLine("❌ Fehler beim Speichern des Attachments: " & ex.Message)
|
Console.WriteLine("❌ Fehler beim Speichern des Attachments: " & ex.Message)
|
||||||
@@ -533,7 +542,14 @@ Public Class cTelotecAPI
|
|||||||
gr.sequenceNumber = grefObj.IntOf("sequenceNumber")
|
gr.sequenceNumber = grefObj.IntOf("sequenceNumber")
|
||||||
gr.grn = grefObj.StringOf("grn")
|
gr.grn = grefObj.StringOf("grn")
|
||||||
gr.accessCode = grefObj.StringOf("accessCode")
|
gr.accessCode = grefObj.StringOf("accessCode")
|
||||||
gr.amountToBeCovered = grefObj.StringOf("amountToBeCovered")
|
' gr.amountToBeCovered = grefObj.StringOf("amountToBeCovered")
|
||||||
|
Dim tmp As String = grefObj.StringOf("amountToBeCovered")
|
||||||
|
If Not String.IsNullOrEmpty(tmp) Then
|
||||||
|
gr.amountToBeCovered = Double.Parse(tmp, CultureInfo.InvariantCulture)
|
||||||
|
Else
|
||||||
|
gr.amountToBeCovered = 0
|
||||||
|
End If
|
||||||
|
|
||||||
gr.currency = grefObj.StringOf("currency")
|
gr.currency = grefObj.StringOf("currency")
|
||||||
g.guaranteeReference.Add(gr)
|
g.guaranteeReference.Add(gr)
|
||||||
Next
|
Next
|
||||||
@@ -554,6 +570,7 @@ Public Class cTelotecAPI
|
|||||||
|
|
||||||
|
|
||||||
Public Class TADeclaration
|
Public Class TADeclaration
|
||||||
|
Public Property filePath As String ' Wenn anhang vorhanden ist, wird der Pfad hier gespeichert
|
||||||
Public Property mandant_ID As String
|
Public Property mandant_ID As String
|
||||||
Public Property interfaceReferenceId As String
|
Public Property interfaceReferenceId As String
|
||||||
Public Property ifcCustomerId As String
|
Public Property ifcCustomerId As String
|
||||||
|
|||||||
Reference in New Issue
Block a user