Import Excel DY

This commit is contained in:
2025-09-05 08:54:23 +02:00
parent ef62a1dc86
commit 167c250ee8
8 changed files with 1929 additions and 705 deletions

View File

@@ -44,11 +44,10 @@ Public Class cRelayHub
Public Class cRelayHubHeaderData
Public Property agentContact As cRelayHubAgentContact
Public Property declarantIsConsignee As Boolean
Public Property representationRelationshipCode As String
Public Property inputTaxDeduction As String
Public Property representationRelationshipCode As Integer ' <- war String
Public Property inputTaxDeduction As Boolean ' <- war String
Public Property procedureCodeRequested As String
Public Property goodsStatus As String
Public Property costs As List(Of cRelayHubCost)
' Entfernt: goodsStatus, costs (nicht im Schema an dieser Stelle)
Public Property transportMeansArrivalIdentity As String
Public Property transportMeansNationalityCode As String
Public Property previousAdministrativeReferenceType As String
@@ -57,7 +56,7 @@ Public Class cRelayHub
Public Property destinationCountry As String
Public Property departureCountry As String
Public Property addressedCustomsOffice As String
Public Property dv1CostAllocation As cRelayHubDv1CostAllocation ' <--- NEU
Public Property dv1CostAllocation As cRelayHubDv1CostAllocation
End Class
Public Class cRelayHubAddress
@@ -87,9 +86,12 @@ Public Class cRelayHub
Public Property dispatchCountry As String
Public Property destinationCountry As String
Public Property regimeType As String
Public Property customer As String
' Entfernt: customer (vom Schema abgelehnt)
Public Property documents As List(Of cRelayHubDocument)
Public Property additionalData As cRelayHubAdditionalData
' Neu: Pflichtfeld lt. Fehlermeldung
Public Property outputApplication As String ' "test" | "dakosy/sftp/vera" | "evrim/excel" | "sec/import/integration"
End Class
Public Class cRelayHubJobOrderResponse
@@ -117,9 +119,9 @@ Public Class cRelayHub
http.SetRequestHeader("Accept", "application/json")
' *** Token aus der separaten Token-Klasse beziehen ***
Dim token As String = cRelayHubToken.GetValidAccessToken()
Dim token As String = cRelayHubToken.GetAccessToken()
http.AuthToken = token ' -> setzt Authorization: Bearer <token>
Console.WriteLine("Using Token: " & token)
Return http.PostJson2(API_URL & "/job-orders/init", "application/json", jsonPayload)
End Function
@@ -140,29 +142,29 @@ Public Class cRelayHub
}
End If
' 401 → Token-Cache invalidieren und genau 1x erneut probieren
If response.StatusCode = 401 Then
' WICHTIG:
' Diese Methode sollte in cRelayHubToken als Public verfügbar sein:
' Public Shared Sub ResetTokenCache() : ClearToken() : End Sub
' → Falls noch nicht vorhanden, bitte dort ergänzen.
Try
cRelayHubToken.ResetTokenCache()
Catch
' Falls die Methode (noch) nicht existiert, kann man als Fallback
' hier eine kurze Wartezeit einbauen und anschließend erneut GetValidAccessToken() aufrufen.
' Threading.Thread.Sleep(100)
End Try
'' 401 → Token-Cache invalidieren und genau 1x erneut probieren
'If response.StatusCode = 401 Then
' ' WICHTIG:
' ' Diese Methode sollte in cRelayHubToken als Public verfügbar sein:
' ' Public Shared Sub ResetTokenCache() : ClearToken() : End Sub
' ' → Falls noch nicht vorhanden, bitte dort ergänzen.
' Try
' cRelayHubToken.ResetTokenCache()
' Catch
' ' Falls die Methode (noch) nicht existiert, kann man als Fallback
' ' hier eine kurze Wartezeit einbauen und anschließend erneut GetValidAccessToken() aufrufen.
' ' Threading.Thread.Sleep(100)
' End Try
' Retry
response = SendJobOrder(jsonPayload)
If response Is Nothing Then
Return New cRelayHubApiResult With {
.Success = False, .StatusCode = 0, .Message = "Verbindungsfehler (nach Refresh)",
.Details = "Keine Antwort erhalten."
}
End If
End If
' ' Retry
' response = SendJobOrder(jsonPayload)
' If response Is Nothing Then
' Return New cRelayHubApiResult With {
' .Success = False, .StatusCode = 0, .Message = "Verbindungsfehler (nach Refresh)",
' .Details = "Keine Antwort erhalten."
' }
' End If
'End If
' Auswertung
result.StatusCode = response.StatusCode
@@ -208,61 +210,58 @@ Public Class cRelayHub
' Beispielfall
Function CreateSampleJobOrderRequest() As cRelayHubJobOrderRequest
Dim request As New cRelayHubJobOrderRequest With {
.referenceNo = "1001K",
.dispatchCountry = "TR",
.destinationCountry = "EN",
.regimeType = "IM",
.customer = "AVISO",
.documents = New List(Of cRelayHubDocument) From {
New cRelayHubDocument With {.type = "base64", .base64String = "SGVsbG8sIHRoaXMgaXMgYSBzYW1wbGUgYmFzZTY0IHN0cmluZy4=", .filename = "test.txt", .fileType = "invoice"},
New cRelayHubDocument With {.type = "base64", .base64String = "SGVsbG8sIHRoaXMgaXMgYSBzYW1wbGUgYmFzZTY0IHN0cmluZy4=", .filename = "test2.txt", .fileType = "atr"},
New cRelayHubDocument With {.type = "base64", .base64String = "SGVsbG8sIHRoaXMgaXMgYSBzYW1wbGUgYmFzZTY0IHN0cmluZy4=", .filename = "test3.txt", .fileType = "cmr"}
},
.additionalData = New cRelayHubAdditionalData With {
.transaction = New cRelayHubTransaction With {
.ioPartner = "VERA",
.ioDivision3 = "SUB",
.ioReference = "4803/25001763_1301250935SS/samimx"
Dim req As New cRelayHubJobOrderRequest With {
.referenceNo = "1001K",
.dispatchCountry = "TR", ' ISO-2
.destinationCountry = "DE", ' ISO-2 (nicht "EN")
.regimeType = "IMPORT", ' "IMPORT" | "EXPORT"
.outputApplication = "test", ' Pflichtfeld lt. Validator
.documents = New List(Of cRelayHubDocument) From {
New cRelayHubDocument With {.type = "base64", .base64String = "SGVsbG8sIHRoaXMgaXMgYSBzYW1wbGUgYmFzZTY0IHN0cmluZy4=", .filename = "test.txt", .fileType = "invoice"},
New cRelayHubDocument With {.type = "base64", .base64String = "SGVsbG8sIHRoaXMgaXMgYSBzYW1wbGUgYmFzZTY0IHN0cmluZy4=", .filename = "test2.txt", .fileType = "atr"},
New cRelayHubDocument With {.type = "base64", .base64String = "SGVsbG8sIHRoaXMgaXMgYSBzYW1wbGUgYmFzZTY0IHN0cmluZy4=", .filename = "test3.txt", .fileType = "cmr"}
},
.additionalData = New cRelayHubAdditionalData With {
.transaction = New cRelayHubTransaction With {
.ioPartner = "VERA",
.ioDivision3 = "SUB",
.ioReference = "4803/25001763_1301250935SS/samimx"
},
.declaration = New List(Of cRelayHubDeclaration) From {
New cRelayHubDeclaration With {
.objectIdentification = New cRelayHubObjectIdentification With {
.objectName = "4803/25001763",
.objectAlias = "1349846",
.declarationType = "EZA-D"
},
.declaration = New List(Of cRelayHubDeclaration) From {
New cRelayHubDeclaration With {
.objectIdentification = New cRelayHubObjectIdentification With {
.objectName = "4803/25001763",
.objectAlias = "1349846",
.declarationType = "EZA-D"
},
.headerData = New cRelayHubHeaderData With {
.agentContact = New cRelayHubAgentContact With {
.contactPersonName = "AMANN",
.contactPersonPhoneNumber = "+49 123 456 789",
.contactPersonPosition = "Manager"
},
.declarantIsConsignee = True,
.representationRelationshipCode = "1",
.inputTaxDeduction = "true",
.procedureCodeRequested = "42",
.goodsStatus = "EU",
.costs = New List(Of cRelayHubCost) From {
New cRelayHubCost With {.costAmount = "25909.92", .costCurrency = "EUR"}
},
.transportMeansArrivalIdentity = "PB1552EC",
.transportMeansNationalityCode = "BG",
.previousAdministrativeReferenceType = "T1",
.previousAdministrativeReferenceNumber = "25TR160100001472M0",
.destinationFederalState = "07",
.destinationCountry = "DE",
.departureCountry = "TR"
},
.addresses = New List(Of cRelayHubAddress) From {
New cRelayHubAddress With {.addressType = "CZ", .participantEORI = "EORI12345", .participantSubsidiaryNumber = "001", .companyName = "SISECAM DIS TIC.A.S.", .streetAndNumber = "D-100 KARAYOLU CD.YAYLA MH.NO.70/C", .countryCode = "TR", .postalCode = "34949", .city = "TUZLA ISTANBUL"},
New cRelayHubAddress With {.addressType = "CN", .participantEORI = "EORI67890", .participantSubsidiaryNumber = "002", .companyName = "POLYNT COMPOSITES GERMANY GMBH", .streetAndNumber = "KIESELSTRASSE 2", .countryCode = "DE", .postalCode = "56357", .city = "MIEHLEN"}
}
}
.headerData = New cRelayHubHeaderData With {
.agentContact = New cRelayHubAgentContact With {
.contactPersonName = "AMANN",
.contactPersonPhoneNumber = "+49 123 456 789",
.contactPersonPosition = "Manager",
.contactPersonEmail = "a@example.com"
},
.declarantIsConsignee = True,
.representationRelationshipCode = 1, ' Integer
.inputTaxDeduction = True, ' Boolean
.procedureCodeRequested = "42", ' goodsStatus/costs entfernt
.transportMeansArrivalIdentity = "PB1552EC",
.transportMeansNationalityCode = "BG",
.previousAdministrativeReferenceType = "T1",
.previousAdministrativeReferenceNumber = "25TR160100001472M0",
.destinationFederalState = "07",
.destinationCountry = "DE",
.departureCountry = "TR"
},
.addresses = New List(Of cRelayHubAddress) From {
New cRelayHubAddress With {.addressType = "CZ", .participantEORI = "EORI12345", .participantSubsidiaryNumber = "001", .companyName = "SISECAM DIS TIC.A.S.", .streetAndNumber = "D-100 KARAYOLU CD.YAYLA MH.NO.70/C", .countryCode = "TR", .postalCode = "34949", .city = "TUZLA ISTANBUL"},
New cRelayHubAddress With {.addressType = "CN", .participantEORI = "EORI67890", .participantSubsidiaryNumber = "002", .companyName = "POLYNT COMPOSITES GERMANY GMBH", .streetAndNumber = "KIESELSTRASSE 2", .countryCode = "DE", .postalCode = "56357", .city = "MIEHLEN"}
}
}
}
Return request
}
}
Return req
End Function
End Class