742 lines
33 KiB
VB.net
742 lines
33 KiB
VB.net
Imports System
|
|
Imports System.Collections.Generic
|
|
Imports Chilkat
|
|
Imports System.Web.Script.Serialization
|
|
Imports System.IO
|
|
Imports System.Text
|
|
Public Class cTelotecAPI
|
|
|
|
Public API_KEY = "YlcbZryXuKPSzQTzkGIJK9UdScGuSnhBBji94Z7A8UMoWPR0qDvVOvmlWNuUCMrQ" 'VERAG
|
|
Public BASE_URL = "https://accscustomsapi.teloweb.at/accscustomsapi120"
|
|
Dim TELOTEC_JSON As String = "\\datenarchiv\Datenarchiv\TELOTEC\ECHTSYSTEM\Nachrichtendaten_Ablage_JSON" ' <-- Deinen Pfad hier setzen
|
|
|
|
Sub Main()
|
|
Console.WriteLine("ACCS Customs API Demo")
|
|
Dim taRequest As StoreTADeclarationsRequest = CreateSampleTARequest()
|
|
PostStoreTADeclarations(taRequest)
|
|
Dim messages As List(Of TAMessage) = GetTAMessages()
|
|
Console.WriteLine("Nachrichten: " & messages.Count)
|
|
End Sub
|
|
|
|
Function getAPIKEY(Firma) As String
|
|
Select Case Firma
|
|
Case "DURMAZ" : Return "Kh8FqcBXx26fK65f4KQMQ3ExW2QbkPEPZpT9ZWS3spn6YjpZERd3SmZAY7Vda2SG" ' Durmaz
|
|
Case "IMEX" : Return "A8V4zAhNHygwApz3b9UPR2dzzdHvsBTGkV4zm8KKewCh7VYbXeKkXmeRBJaFKGcc" 'IMEX
|
|
Case Else : Return "YlcbZryXuKPSzQTzkGIJK9UdScGuSnhBBji94Z7A8UMoWPR0qDvVOvmlWNuUCMrQ" 'VERAG / ATILLA
|
|
End Select
|
|
End Function
|
|
|
|
|
|
Function CreateSampleTARequest() As StoreTADeclarationsRequest
|
|
Dim decl As New TADeclaration() With {
|
|
.mandant_ID = "DemoMandant",
|
|
.interfaceReferenceId = "REF123",
|
|
.ifcCustomerId = "CUST001",
|
|
.anmeldedatum = DateTime.Now,
|
|
.lrn = "LRN001",
|
|
.totNet = 1000D,
|
|
.totNetSplit_IND = True,
|
|
.frankatur = "FOB",
|
|
.flugInfo = "LH123",
|
|
.fillPackList_IND = True,
|
|
.memo = "Test",
|
|
.erstellDatum = DateTime.Now,
|
|
.erstellPersonalID = "USER001",
|
|
.declarationType = "T1",
|
|
.additionalDeclarationType = "A",
|
|
.presentationOfTheGoodsDateAndTime = DateTime.Now.AddHours(1),
|
|
.security = 0,
|
|
.specificCircumstanceIndicator = "S1",
|
|
.containerIndicator = False,
|
|
.grossMass = 1500D,
|
|
.inlandModeOfTransport = 1,
|
|
.modeOfTransportAtTheBorder = 4,
|
|
.referenceNumberUCR = "UCR001",
|
|
.methodOfPayment = "CASH",
|
|
.customsOfficeOfDeparture = "AT000001",
|
|
.customsOfficeOfPresentation = "AT000002",
|
|
.customsOfficeOfDestinationDeclared = "DE000003"
|
|
}
|
|
|
|
Return New StoreTADeclarationsRequest With {
|
|
.allowExistingReferenceId = False,
|
|
.enableGrouping = False,
|
|
.declarations = New List(Of TADeclaration) From {decl}
|
|
}
|
|
End Function
|
|
|
|
Sub PostStoreTADeclarations(request As StoreTADeclarationsRequest)
|
|
Dim http As New Http()
|
|
http.SetRequestHeader("X-API-KEY", API_KEY)
|
|
http.Accept = "application/json"
|
|
|
|
Dim jsonObj As New JsonObject()
|
|
jsonObj.UpdateBool("allowExistingReferenceId", request.allowExistingReferenceId)
|
|
jsonObj.UpdateBool("enableGrouping", request.enableGrouping)
|
|
|
|
Dim declArray As JsonArray = jsonObj.AppendArray("declarations")
|
|
|
|
For Each decl In request.declarations
|
|
Dim serializer As New JavaScriptSerializer()
|
|
Dim jsonString As String = serializer.Serialize(decl)
|
|
|
|
Dim declJson As New JsonObject()
|
|
declJson.Load(jsonString)
|
|
declArray.AddObjectAt(-1)
|
|
declArray.ObjectAt(declArray.Size - 1).Load(declJson.Emit())
|
|
Next
|
|
|
|
Dim url As String = "https://accscustomsapi.teloweb.at/accscustomsapi120/api/Interface/StoreTADeclarations"
|
|
Dim resp As HttpResponse = http.PostJson3(url, "application/json", jsonObj)
|
|
|
|
If http.LastMethodSuccess = False Then
|
|
Console.WriteLine("❌ Fehler beim Senden: " & http.LastErrorText)
|
|
Exit Sub
|
|
End If
|
|
|
|
Console.WriteLine("✅ StoreTADeclarations Antwort: " & resp.BodyStr)
|
|
End Sub
|
|
|
|
Sub PostStoreEXDeclarations(request As StoreTADeclarationsRequest)
|
|
Dim http As New Http()
|
|
http.SetRequestHeader("X-API-KEY", API_KEY)
|
|
http.Accept = "application/json"
|
|
|
|
Dim jsonObj As New JsonObject()
|
|
jsonObj.UpdateBool("allowExistingReferenceId", request.allowExistingReferenceId)
|
|
jsonObj.UpdateBool("enableGrouping", request.enableGrouping)
|
|
|
|
Dim declArray As JsonArray = jsonObj.AppendArray("declarations")
|
|
|
|
For Each decl In request.declarations
|
|
Dim serializer As New JavaScriptSerializer()
|
|
Dim jsonString As String = serializer.Serialize(decl)
|
|
|
|
Dim declJson As New JsonObject()
|
|
declJson.Load(jsonString)
|
|
declArray.AddObjectAt(-1)
|
|
declArray.ObjectAt(declArray.Size - 1).Load(declJson.Emit())
|
|
Next
|
|
|
|
Dim url As String = "https://accscustomsapi.teloweb.at/accscustomsapi120/api/Interface/StoreEXDeclarations"
|
|
Dim resp As HttpResponse = http.PostJson3(url, "application/json", jsonObj)
|
|
|
|
If http.LastMethodSuccess = False Then
|
|
Console.WriteLine("❌ Fehler beim Senden: " & http.LastErrorText)
|
|
Exit Sub
|
|
End If
|
|
|
|
Console.WriteLine("✅ StoreEXDeclarations Antwort: " & resp.BodyStr)
|
|
End Sub
|
|
|
|
Function GetTAMessages() As List(Of TAMessage)
|
|
Dim messages As New List(Of TAMessage)()
|
|
|
|
Dim http As New Http()
|
|
http.SetRequestHeader("X-API-KEY", getAPIKEY("ATILLA"))
|
|
' http.SetRequestHeader("X-API-KEY", http.AuthToken = getAPIKEY("ATILLA"))
|
|
http.Accept = "application/json"
|
|
|
|
Dim url As String = BASE_URL & "/api/Interface/GetTAMessages"
|
|
Dim resp As HttpResponse = http.QuickGetObj(url)
|
|
|
|
If http.LastMethodSuccess = False Then
|
|
Console.WriteLine("❌ HTTP-Anfrage fehlgeschlagen:")
|
|
Console.WriteLine(http.LastErrorText)
|
|
Return messages
|
|
End If
|
|
|
|
Console.WriteLine("📡 HTTP-Statuscode: " & resp.StatusCode)
|
|
If resp.StatusCode <> 200 Then
|
|
Console.WriteLine("❌ Fehler: Erwartet wurde Statuscode 200, erhalten: " & resp.StatusCode)
|
|
Console.WriteLine("Antworttext:")
|
|
Console.WriteLine(resp.BodyStr)
|
|
Return messages
|
|
End If
|
|
|
|
Dim json As New JsonObject()
|
|
Dim success As Boolean = json.Load(resp.BodyStr)
|
|
|
|
If Not success Then
|
|
Console.WriteLine("❌ Fehler beim Parsen der JSON-Antwort:")
|
|
Console.WriteLine(json.LastErrorText)
|
|
Return messages
|
|
End If
|
|
|
|
Dim msgArray As JsonArray = json.ArrayOf("messages")
|
|
If msgArray Is Nothing Then
|
|
Console.WriteLine("⚠️ 'messages' war null oder nicht vorhanden.")
|
|
Return messages
|
|
End If
|
|
|
|
Dim jsonText As String = resp.BodyStr
|
|
SaveJsonResponseToFile(jsonText, TELOTEC_JSON)
|
|
|
|
|
|
Dim serializer As New JavaScriptSerializer()
|
|
Console.WriteLine("✅ Empfangene Nachrichten: " & msgArray.Size)
|
|
For i As Integer = 0 To msgArray.Size - 1
|
|
Dim jmsg As Chilkat.JsonObject = msgArray.ObjectAt(i)
|
|
Dim msg As New TAMessage()
|
|
msg.mrn = jmsg.StringOf("mrn")
|
|
msg.lrn = jmsg.StringOf("lrn")
|
|
msg.externalReference = jmsg.StringOf("externalReference")
|
|
msg.msgType = jmsg.StringOf("msgType")
|
|
|
|
Dim contentObj As Chilkat.JsonObject = jmsg.ObjectOf("declarationContent")
|
|
If Not contentObj Is Nothing Then
|
|
Dim decl As New TADeclaration()
|
|
|
|
decl.mandant_ID = contentObj.StringOf("mandant_ID")
|
|
decl.interfaceReferenceId = contentObj.StringOf("interfaceReferenceId")
|
|
decl.ifcCustomerId = contentObj.StringOf("ifcCustomerId")
|
|
decl.dec2_ID = SafeParseInt(contentObj.StringOf("dec2_ID"))
|
|
decl.anmeldedatum = SafeParseDate(contentObj.StringOf("anmeldedatum"))
|
|
decl.lrn = contentObj.StringOf("lrn")
|
|
decl.mrn = contentObj.StringOf("mrn")
|
|
decl.totNet = SafeParseDecimal(contentObj.StringOf("totNet"))
|
|
decl.totNetSplit_IND = contentObj.BoolOf("totNetSplit_IND")
|
|
decl.frankatur = contentObj.StringOf("frankatur")
|
|
decl.flugInfo = contentObj.StringOf("flugInfo")
|
|
decl.fillPackList_IND = contentObj.BoolOf("fillPackList_IND")
|
|
decl.memo = contentObj.StringOf("memo")
|
|
decl.erstellDatum = SafeParseDate(contentObj.StringOf("erstellDatum"))
|
|
decl.erstellPersonalID = contentObj.StringOf("erstellPersonalID")
|
|
decl.declarationType = contentObj.StringOf("declarationType")
|
|
decl.additionalDeclarationType = contentObj.StringOf("additionalDeclarationType")
|
|
decl.tirCarnetNumber = contentObj.StringOf("tirCarnetNumber")
|
|
decl.presentationOfTheGoodsDateAndTime = SafeParseDate(contentObj.StringOf("presentationOfTheGoodsDateAndTime"))
|
|
decl.security = SafeParseInt(contentObj.StringOf("security"))
|
|
decl.reducedDatasetIndicator = contentObj.BoolOf("reducedDatasetIndicator")
|
|
decl.specificCircumstanceIndicator = contentObj.StringOf("specificCircumstanceIndicator")
|
|
decl.communicationLanguageAtDeparture = contentObj.StringOf("communicationLanguageAtDeparture")
|
|
decl.bindingItinerary = contentObj.BoolOf("bindingItinerary")
|
|
decl.limitDate = SafeParseDate(contentObj.StringOf("limitDate"))
|
|
decl.declarationAcceptanceDate = SafeParseDate(contentObj.StringOf("declarationAcceptanceDate"))
|
|
decl.releaseDate = SafeParseDate(contentObj.StringOf("releaseDate"))
|
|
decl.writeOffDate = SafeParseDate(contentObj.StringOf("writeOffDate"))
|
|
decl.countryOfDispatch = contentObj.StringOf("countryOfDispatch")
|
|
decl.countryOfDestination = contentObj.StringOf("countryOfDestination")
|
|
decl.containerIndicator = contentObj.BoolOf("containerIndicator")
|
|
decl.inlandModeOfTransport = SafeParseInt(contentObj.StringOf("inlandModeOfTransport"))
|
|
decl.modeOfTransportAtTheBorder = SafeParseInt(contentObj.StringOf("modeOfTransportAtTheBorder"))
|
|
decl.grossMass = SafeParseDecimal(contentObj.StringOf("grossMass"))
|
|
decl.methodOfPayment = contentObj.StringOf("methodOfPayment")
|
|
decl.referenceNumberUCR = contentObj.StringOf("referenceNumberUCR")
|
|
decl.locationOfGoods_CustomsOffice = contentObj.StringOf("locationOfGoods_CustomsOffice")
|
|
decl.locationOfGoods_PlaceOfGoods = contentObj.StringOf("locationOfGoods_PlaceOfGoods")
|
|
decl.placeOfLoading_UNLocode = contentObj.StringOf("placeOfLoading_UNLocode")
|
|
decl.placeOfLoading_Country = contentObj.StringOf("placeOfLoading_Country")
|
|
decl.placeOfLoading_Location = contentObj.StringOf("placeOfLoading_Location")
|
|
decl.placeOfUnloading_UNLocode = contentObj.StringOf("placeOfUnloading_UNLocode")
|
|
decl.placeOfUnloading_Country = contentObj.StringOf("placeOfUnloading_Country")
|
|
decl.placeOfUnloading_Location = contentObj.StringOf("placeOfUnloading_Location")
|
|
decl.customsOfficeOfDeparture = contentObj.StringOf("customsOfficeOfDeparture")
|
|
decl.customsOfficeOfDestinationDeclared = contentObj.StringOf("customsOfficeOfDestinationDeclared")
|
|
decl.customsOfficeOfPresentation = contentObj.StringOf("customsOfficeOfPresentation")
|
|
decl.controlResult_Date = SafeParseDate(contentObj.StringOf("controlResult_Date"))
|
|
decl.controlResult_ControlledBy = contentObj.StringOf("controlResult_ControlledBy")
|
|
decl.controlResult_Text = contentObj.StringOf("controlResult_Text")
|
|
decl.controlResult_Code = contentObj.StringOf("controlResult_Code")
|
|
decl.groupId = contentObj.StringOf("groupId")
|
|
decl.template_ID = SafeParseInt(contentObj.StringOf("template_ID"))
|
|
|
|
' Parsen von komplexen Objekten
|
|
Dim arr1 = contentObj.ArrayOf("activeBorderTransportMeans")
|
|
If arr1 IsNot Nothing Then decl.activeBorderTransportMeans = ParseActiveBorderTransportMeans(arr1)
|
|
|
|
Dim c = contentObj.ObjectOf("carrier")
|
|
If c IsNot Nothing Then decl.carrier = ParseCarrier(c)
|
|
|
|
Dim arr2 = contentObj.ArrayOf("guarantee")
|
|
If arr2 IsNot Nothing Then decl.guarantee = ParseGuarantee(arr2)
|
|
|
|
msg.declarationContent = decl
|
|
Else
|
|
Console.WriteLine("⚠️ Keine declarationContent für Nachricht: " & msg.lrn)
|
|
End If
|
|
|
|
messages.Add(msg)
|
|
Next
|
|
|
|
Return messages
|
|
End Function
|
|
|
|
|
|
|
|
|
|
Public Sub SaveJsonResponseToFile(jsonText As String, ByVal TELOTEC_JSON As String)
|
|
Try
|
|
Dim yearDir As String = Path.Combine(TELOTEC_JSON, Date.Now.Year.ToString())
|
|
Dim dayDir As String = Path.Combine(yearDir, Date.Now.ToString("dd.MM.yyyy"))
|
|
|
|
Directory.CreateDirectory(dayDir)
|
|
|
|
Dim fileName As String = "GetTAMessages_" & Date.Now.ToString("HHmmss") & ".json"
|
|
Dim filePath As String = Path.Combine(dayDir, fileName)
|
|
|
|
File.WriteAllText(filePath, jsonText, Encoding.UTF8)
|
|
Console.WriteLine("📁 JSON gespeichert unter: " & filePath)
|
|
Catch ex As Exception
|
|
Console.WriteLine("❌ Fehler beim Speichern des JSON: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Function SafeParseDate(value As String) As Date?
|
|
If String.IsNullOrWhiteSpace(value) Then
|
|
Return Nothing
|
|
End If
|
|
Return Date.Parse(value)
|
|
End Function
|
|
|
|
Function SafeParseDecimal(value As String) As Decimal
|
|
Dim result As Decimal
|
|
If Decimal.TryParse(value, result) Then
|
|
Return result
|
|
Else
|
|
Return 0D
|
|
End If
|
|
End Function
|
|
|
|
Function SafeParseInt(value As String) As Integer
|
|
Dim result As Integer
|
|
If Integer.TryParse(value, result) Then
|
|
Return result
|
|
Else
|
|
Return 0
|
|
End If
|
|
End Function
|
|
|
|
|
|
' Parser für Liste: activeBorderTransportMeans
|
|
Function ParseActiveBorderTransportMeans(arr As JsonArray) As List(Of BorderTransportMeans)
|
|
Dim result As New List(Of BorderTransportMeans)()
|
|
For i As Integer = 0 To arr.Size - 1
|
|
Dim item As JsonObject = arr.ObjectAt(i)
|
|
Dim obj As New BorderTransportMeans()
|
|
obj.sequenceNumber = item.IntOf("sequenceNumber")
|
|
obj.customsOfficeAtBorderReferenceNumber = item.StringOf("customsOfficeAtBorderReferenceNumber")
|
|
obj.typeOfIdentification = item.IntOf("typeOfIdentification")
|
|
obj.identificationNumber = item.StringOf("identificationNumber")
|
|
obj.nationality = item.StringOf("nationality")
|
|
obj.conveyanceReferenceNumber = item.StringOf("conveyanceReferenceNumber")
|
|
result.Add(obj)
|
|
Next
|
|
Return result
|
|
End Function
|
|
|
|
' Parser für carrier (PartyWithContact)
|
|
Function ParseCarrier(obj As JsonObject) As PartyWithContact
|
|
If obj Is Nothing Then Return Nothing
|
|
Dim party As New PartyWithContact()
|
|
party.identificationNumber = obj.StringOf("identificationNumber")
|
|
party.contactPersonName = obj.StringOf("contactPersonName")
|
|
party.phoneNumber = obj.StringOf("phoneNumber")
|
|
party.eMailAddress = obj.StringOf("eMailAddress")
|
|
party.customerAddressReference = obj.StringOf("customerAddressReference")
|
|
party.adressID = obj.IntOf("adressID")
|
|
Return party
|
|
End Function
|
|
|
|
' Parser für guarantee
|
|
Function ParseGuarantee(arr As JsonArray) As List(Of Guarantee)
|
|
Dim list As New List(Of Guarantee)()
|
|
For i As Integer = 0 To arr.Size - 1
|
|
Dim obj As JsonObject = arr.ObjectAt(i)
|
|
Dim g As New Guarantee()
|
|
g.sequenceNumber = obj.IntOf("sequenceNumber")
|
|
g.guaranteeType = obj.StringOf("guaranteeType")
|
|
g.otherGuaranteeReference = obj.StringOf("otherGuaranteeReference")
|
|
|
|
Dim gRefArray As JsonArray = obj.ArrayOf("guaranteeReference")
|
|
If Not gRefArray Is Nothing Then
|
|
g.guaranteeReference = New List(Of GuaranteeReference)()
|
|
For j As Integer = 0 To gRefArray.Size - 1
|
|
Dim grefObj As JsonObject = gRefArray.ObjectAt(j)
|
|
Dim gr As New GuaranteeReference()
|
|
gr.sequenceNumber = grefObj.IntOf("sequenceNumber")
|
|
gr.grn = grefObj.StringOf("grn")
|
|
gr.accessCode = grefObj.StringOf("accessCode")
|
|
gr.amountToBeCovered = grefObj.StringOf("amountToBeCovered")
|
|
gr.currency = grefObj.StringOf("currency")
|
|
g.guaranteeReference.Add(gr)
|
|
Next
|
|
End If
|
|
|
|
list.Add(g)
|
|
Next
|
|
Return list
|
|
End Function
|
|
|
|
|
|
|
|
Public Class StoreTADeclarationsRequest
|
|
Public Property allowExistingReferenceId As Boolean
|
|
Public Property enableGrouping As Boolean
|
|
Public Property declarations As List(Of TADeclaration)
|
|
End Class
|
|
|
|
|
|
Public Class TADeclaration
|
|
Public Property mandant_ID As String
|
|
Public Property interfaceReferenceId As String
|
|
Public Property ifcCustomerId As String
|
|
Public Property dec2_ID As Integer
|
|
Public Property anmeldedatum As Date
|
|
Public Property lrn As String
|
|
Public Property mrn As String
|
|
Public Property totNet As Decimal
|
|
Public Property totNetSplit_IND As Boolean
|
|
Public Property frankatur As String
|
|
Public Property flugInfo As String
|
|
Public Property fillPackList_IND As Boolean
|
|
Public Property memo As String
|
|
Public Property erstellDatum As Date
|
|
Public Property erstellPersonalID As String
|
|
Public Property declarationType As String
|
|
Public Property additionalDeclarationType As String
|
|
Public Property tirCarnetNumber As String
|
|
Public Property presentationOfTheGoodsDateAndTime As Date
|
|
Public Property security As Integer
|
|
Public Property reducedDatasetIndicator As Boolean
|
|
Public Property specificCircumstanceIndicator As String
|
|
Public Property communicationLanguageAtDeparture As String
|
|
Public Property bindingItinerary As Boolean
|
|
Public Property limitDate As Date
|
|
Public Property declarationAcceptanceDate As Date
|
|
Public Property releaseDate As Date
|
|
Public Property writeOffDate As Date
|
|
Public Property countryOfDispatch As String
|
|
Public Property countryOfDestination As String
|
|
Public Property containerIndicator As Boolean
|
|
Public Property inlandModeOfTransport As Integer
|
|
Public Property modeOfTransportAtTheBorder As Integer
|
|
Public Property grossMass As Decimal
|
|
Public Property methodOfPayment As String
|
|
Public Property referenceNumberUCR As String
|
|
Public Property locationOfGoods_CustomsOffice As String
|
|
Public Property locationOfGoods_PlaceOfGoods As String
|
|
Public Property placeOfLoading_UNLocode As String
|
|
Public Property placeOfLoading_Country As String
|
|
Public Property placeOfLoading_Location As String
|
|
Public Property placeOfUnloading_UNLocode As String
|
|
Public Property placeOfUnloading_Country As String
|
|
Public Property placeOfUnloading_Location As String
|
|
Public Property customsOfficeOfDeparture As String
|
|
Public Property customsOfficeOfDestinationDeclared As String
|
|
Public Property customsOfficeOfPresentation As String
|
|
Public Property controlResult_Date As Date
|
|
Public Property controlResult_ControlledBy As String
|
|
Public Property controlResult_Text As String
|
|
Public Property controlResult_Code As String
|
|
Public Property groupId As String
|
|
Public Property template_ID As Integer
|
|
|
|
' Nested/Complex Properties
|
|
Public Property activeBorderTransportMeans As List(Of BorderTransportMeans)
|
|
Public Property additionalInformation As List(Of AdditionalInformation)
|
|
Public Property additionalReference As List(Of AdditionalReference)
|
|
Public Property additionalSupplyChainActor As List(Of SupplyChainActor)
|
|
Public Property authorisation As List(Of Authorisation)
|
|
Public Property carrier As PartyWithContact
|
|
Public Property consignee As PartyWithAddress
|
|
Public Property consignor As PartyWithContact
|
|
Public Property countryOfRoutingOfConsignment As List(Of RoutingCountry)
|
|
Public Property customsOfficeOfExitForTransitDeclared As List(Of SimpleReference)
|
|
Public Property customsOfficeOfTransitDeclared As List(Of TransitOffice)
|
|
Public Property departureTransportMeans As List(Of DepartureTransportMeans)
|
|
Public Property guarantee As List(Of Guarantee)
|
|
Public Property guarantor As PartyWithAddress
|
|
Public Property holderOfTheTransitProcedure As PartyWithContact
|
|
Public Property houseConsignment As List(Of HouseConsignment)
|
|
Public Property previousDocument As List(Of PreviousDocument)
|
|
Public Property representative As PartyWithContact
|
|
Public Property supportingDocument As List(Of SupportingDocument)
|
|
Public Property transportDocument As List(Of TransportDocument)
|
|
Public Property transportEquipment As List(Of TransportEquipment)
|
|
End Class
|
|
|
|
Public Class BorderTransportMeans
|
|
Public Property sequenceNumber As Integer
|
|
Public Property customsOfficeAtBorderReferenceNumber As String
|
|
Public Property typeOfIdentification As Integer
|
|
Public Property identificationNumber As String
|
|
Public Property nationality As String
|
|
Public Property conveyanceReferenceNumber As String
|
|
End Class
|
|
|
|
Public Class AdditionalInformation
|
|
Public Property sequenceNumber As Integer
|
|
Public Property code As String
|
|
Public Property text As String
|
|
End Class
|
|
|
|
Public Class AdditionalReference
|
|
Public Property sequenceNumber As Integer
|
|
Public Property type As String
|
|
Public Property referenceNumber As String
|
|
End Class
|
|
|
|
Public Class SupplyChainActor
|
|
Public Property sequenceNumber As Integer
|
|
Public Property role As String
|
|
Public Property identificationNumber As String
|
|
Public Property customerAddressReference As String
|
|
Public Property adressID As Integer
|
|
End Class
|
|
|
|
Public Class Authorisation
|
|
Public Property sequenceNumber As Integer
|
|
Public Property type As String
|
|
Public Property referenceNumber As String
|
|
End Class
|
|
|
|
Public Class PartyWithContact
|
|
Public Property identificationNumber As String
|
|
Public Property contactPersonName As String
|
|
Public Property phoneNumber As String
|
|
Public Property eMailAddress As String
|
|
Public Property customerAddressReference As String
|
|
Public Property adressID As Integer
|
|
End Class
|
|
|
|
Public Class PartyWithAddress
|
|
Public Property identificationNumber As String
|
|
Public Property consigneeName As String
|
|
Public Property streetAndNumber As String
|
|
Public Property postcode As String
|
|
Public Property city As String
|
|
Public Property country As String
|
|
Public Property customerAddressReference As String
|
|
Public Property adressID As Integer
|
|
End Class
|
|
|
|
Public Class RoutingCountry
|
|
Public Property sequenceNumber As Integer
|
|
Public Property country As String
|
|
End Class
|
|
|
|
Public Class SimpleReference
|
|
Public Property sequenceNumber As Integer
|
|
Public Property referenceNumber As String
|
|
End Class
|
|
|
|
Public Class TransitOffice
|
|
Public Property sequenceNumber As Integer
|
|
Public Property referenceNumber As String
|
|
Public Property arrivalDateAndTimeEstimated As Date
|
|
End Class
|
|
|
|
Public Class DepartureTransportMeans
|
|
Public Property sequenceNumber As Integer
|
|
Public Property typeOfIdentification As Integer
|
|
Public Property identificationNumber As String
|
|
Public Property nationality As String
|
|
End Class
|
|
|
|
Public Class Guarantee
|
|
Public Property sequenceNumber As Integer
|
|
Public Property guaranteeType As String
|
|
Public Property otherGuaranteeReference As String
|
|
Public Property guaranteeReference As List(Of GuaranteeReference)
|
|
End Class
|
|
|
|
Public Class GuaranteeReference
|
|
Public Property sequenceNumber As Integer
|
|
Public Property grn As String
|
|
Public Property accessCode As String
|
|
Public Property amountToBeCovered As Decimal
|
|
Public Property currency As String
|
|
End Class
|
|
|
|
Public Class HouseConsignment
|
|
' This would also need to include full nested structure like consignor, consignee, etc.
|
|
End Class
|
|
|
|
Public Class PreviousDocument
|
|
Public Property sequenceNumber As Integer
|
|
Public Property type As String
|
|
Public Property referenceNumber As String
|
|
Public Property complementOfInformation As String
|
|
End Class
|
|
|
|
Public Class SupportingDocument
|
|
Public Property sequenceNumber As Integer
|
|
Public Property type As String
|
|
Public Property referenceNumber As String
|
|
Public Property documentLineItemNumber As Integer
|
|
Public Property complementOfInformation As String
|
|
End Class
|
|
|
|
Public Class TransportDocument
|
|
Public Property sequenceNumber As Integer
|
|
Public Property type As String
|
|
Public Property referenceNumber As String
|
|
End Class
|
|
|
|
Public Class TransportEquipment
|
|
Public Property sequenceNumber As Integer
|
|
Public Property containerIdentificationNumber As String
|
|
Public Property numberOfSeals As Integer
|
|
Public Property goodsReference As List(Of GoodsReference)
|
|
Public Property seal As List(Of Seal)
|
|
End Class
|
|
|
|
Public Class GoodsReference
|
|
Public Property sequenceNumber As Integer
|
|
Public Property declarationGoodsItemNumber As Integer
|
|
End Class
|
|
|
|
Public Class Seal
|
|
Public Property sequenceNumber As Integer
|
|
Public Property identifier As String
|
|
End Class
|
|
|
|
Public Class TAMessage
|
|
Public Property mrn As String
|
|
Public Property lrn As String
|
|
Public Property externalReference As String
|
|
Public Property msgType As String
|
|
Public Property declarationContent As TADeclaration
|
|
End Class
|
|
|
|
|
|
|
|
|
|
'Public Function ConvertTAMessageToTelotec(msg As TAMessage) As cTelotec_Anmeldung
|
|
' Dim telotec As New cTelotec_Anmeldung()
|
|
|
|
' With msg
|
|
' If .declarationContent IsNot Nothing Then
|
|
' Dim decl = .declarationContent
|
|
|
|
' telotec.telanm_ART = "TA"
|
|
' telotec.telanm_BezugsNr = .lrn
|
|
' telotec.telanm_CRN = .mrn
|
|
' telotec.MsgType = .msgType
|
|
' telotec.Refs_LRN = .lrn
|
|
' telotec.Refs_CRN = .mrn
|
|
|
|
' telotec.Mandant_ID = decl.mandant_ID
|
|
' telotec.Referenz_ID = decl.interfaceReferenceId
|
|
' telotec.dec_CreatePersonalID = decl.erstellPersonalID
|
|
' telotec.dec_CreateDate = decl.erstellDatum
|
|
' telotec.dec_Template_ID = decl.template_ID
|
|
' telotec.dec_TotNet = decl.totNet
|
|
' telotec.dec_TotNetSplit_IND = decl.totNetSplit_IND
|
|
' telotec.dec_FillPackList_IND = decl.fillPackList_IND
|
|
' telotec.dec_Memo = decl.memo
|
|
|
|
' telotec.Hea_DecTy = decl.declarationType
|
|
' telotec.Hea_Simp = decl.reducedDatasetIndicator
|
|
' telotec.Hea_DecDT = decl.declarationAcceptanceDate
|
|
' telotec.Hea_WoffD = decl.writeOffDate
|
|
' telotec.Hea_AccDT = decl.declarationAcceptanceDate
|
|
' telotec.Hea_ProArrDT = decl.presentationOfTheGoodsDateAndTime
|
|
' telotec.Hea_PlaDepDT = decl.presentationOfTheGoodsDateAndTime
|
|
' telotec.Hea_TotGross = decl.grossMass
|
|
' telotec.Hea_PayMet = decl.methodOfPayment
|
|
' telotec.Hea_SecInd = decl.security
|
|
' telotec.Hea_DestLNG = decl.countryOfDestination
|
|
' telotec.Hea_DepLNG = decl.countryOfDispatch
|
|
' telotec.Transp_InMo = decl.inlandModeOfTransport
|
|
' telotec.Transp_BordMo = decl.modeOfTransportAtTheBorder
|
|
' telotec.Transp_ContInd = decl.containerIndicator
|
|
' telotec.Transp_DepIdnt = SafeFirst(decl.departureTransportMeans, Function(dt) dt.identificationNumber)
|
|
' telotec.Transp_DepNat = SafeFirst(decl.departureTransportMeans, Function(dt) dt.nationality)
|
|
|
|
' ' Consignor/Consignee
|
|
' telotec.ConorTra_Na = SafeGetName(decl.consignor)
|
|
' telotec.ConorTra_Strt = decl.consignor?.streetAndNumber
|
|
' telotec.ConorTra_Pst = decl.consignor?.postcode
|
|
' telotec.ConorTra_Cty = decl.consignor?.city
|
|
' telotec.ConorTra_Ctry = decl.consignor?.country
|
|
' telotec.ConorTra_TIN = decl.consignor?.identificationNumber
|
|
|
|
' telotec.ConeeTra_Na = SafeGetName(decl.consignee)
|
|
' telotec.ConeeTra_Strt = decl.consignee?.streetAndNumber
|
|
' telotec.ConeeTra_Pst = decl.consignee?.postcode
|
|
' telotec.ConeeTra_Cty = decl.consignee?.city
|
|
' telotec.ConeeTra_Ctry = decl.consignee?.country
|
|
' telotec.ConeeTra_TIN = decl.consignee?.identificationNumber
|
|
|
|
' telotec.Represent_Na = decl.representative?.contactPersonName
|
|
' telotec.Represent_RIN = decl.representative?.identificationNumber
|
|
|
|
' telotec.Locs_Disp = decl.countryOfDispatch
|
|
' telotec.Locs_Dest = decl.countryOfDestination
|
|
' telotec.Locs_GdsLoc = decl.locationOfGoods_PlaceOfGoods
|
|
' telotec.Locs_GdsLocCd = decl.locationOfGoods_CustomsOffice
|
|
|
|
' ' HouseConsignments inkl. ConsignmentItems und Packaging
|
|
' If decl.houseConsignment IsNot Nothing Then
|
|
' telotec.HouseConsignments = New List(Of cTelotec_HouseConsignment)()
|
|
' For Each hc In decl.houseConsignment
|
|
' Dim newHc As New cTelotec_HouseConsignment()
|
|
' newHc.CountryOfDispatch = hc.countryOfDispatch
|
|
' newHc.CountryOfDestination = hc.countryOfDestination
|
|
' newHc.GrossMass = hc.grossMass
|
|
' newHc.ReferenceNumberUCR = hc.referenceNumberUCR
|
|
' newHc.MethodOfPayment = hc.methodOfPayment
|
|
|
|
' If hc.consignmentItem IsNot Nothing Then
|
|
' newHc.ConsignmentItems = New List(Of cTelotec_ConsignmentItem)()
|
|
' For Each item In hc.consignmentItem
|
|
' Dim newItem As New cTelotec_ConsignmentItem()
|
|
' newItem.GoodsItemNumber = item.goodsItemNumber
|
|
' newItem.DeclarationGoodsItemNumber = item.declarationGoodsItemNumber
|
|
' newItem.DeclarationType = item.declarationType
|
|
' newItem.CountryOfDispatch = item.countryOfDispatch
|
|
' newItem.CountryOfDestination = item.countryOfDestination
|
|
' newItem.DescriptionOfGoods = item.descriptionOfGoods
|
|
' newItem.GrossMass = item.grossMass
|
|
' newItem.NetMass = item.netMass
|
|
' newItem.MethodOfPayment = item.methodOfPayment
|
|
' newItem.ReferenceNumberUCR = item.referenceNumberUCR
|
|
|
|
' If item.packaging IsNot Nothing Then
|
|
' newItem.Packaging = New List(Of cTelotec_Packaging)()
|
|
' For Each pack In item.packaging
|
|
' Dim newPack As New cTelotec_Packaging()
|
|
' newPack.TypeOfPackages = pack.typeOfPackages
|
|
' newPack.NumberOfPackages = pack.numberOfPackages
|
|
' newPack.ShippingMarks = pack.shippingMarks
|
|
' newItem.Packaging.Add(newPack)
|
|
' Next
|
|
' End If
|
|
|
|
' newHc.ConsignmentItems.Add(newItem)
|
|
' Next
|
|
' End If
|
|
|
|
' telotec.HouseConsignments.Add(newHc)
|
|
' Next
|
|
' End If
|
|
' End If
|
|
' End With
|
|
|
|
' telotec.telanm_LetzteBearbeitung = Now
|
|
' telotec.telanm_Erstellung = Now
|
|
' telotec.telanm_Erstellung_SB = VERAG_PROG_ALLGEMEIN.cAllgemein.USRID
|
|
' telotec.telanm_LetzteBearbeitung_SB = VERAG_PROG_ALLGEMEIN.cAllgemein.USRID
|
|
' telotec.ComIndicator = True
|
|
' telotec.initData()
|
|
|
|
' Return telotec
|
|
'End Function
|
|
|
|
'Private Function SafeFirst(Of T, R)(list As List(Of T), selector As Func(Of T, R)) As R
|
|
' If list Is Nothing OrElse list.Count = 0 Then Return Nothing
|
|
' Return selector(list(0))
|
|
'End Function
|
|
|
|
'Private Function SafeGetName(party As Object) As String
|
|
' If party Is Nothing Then Return Nothing
|
|
' Return If(party?.consignorName, party?.consigneeName, "")
|
|
'End Function
|
|
|
|
|
|
End Class
|
|
|
|
|