|
|
|
|
@@ -81,6 +81,10 @@ Public Class cRelayHub
|
|
|
|
|
Public Property declaration As List(Of cRelayHubDeclaration)
|
|
|
|
|
End Class
|
|
|
|
|
|
|
|
|
|
Public Class cRelayHubAdditionalSettings
|
|
|
|
|
Public Property combineOptions As List(Of String)
|
|
|
|
|
End Class
|
|
|
|
|
|
|
|
|
|
Public Class cRelayHubJobOrderRequest
|
|
|
|
|
Public Property referenceNo As String
|
|
|
|
|
Public Property dispatchCountry As String
|
|
|
|
|
@@ -89,6 +93,7 @@ Public Class cRelayHub
|
|
|
|
|
' Entfernt: customer (vom Schema abgelehnt)
|
|
|
|
|
Public Property documents As List(Of cRelayHubDocument)
|
|
|
|
|
Public Property additionalData As cRelayHubAdditionalData
|
|
|
|
|
Public Property additionalSettings As cRelayHubAdditionalSettings
|
|
|
|
|
|
|
|
|
|
' Neu: Pflichtfeld lt. Fehlermeldung
|
|
|
|
|
Public Property outputApplication As String ' "test" | "dakosy/sftp/vera" | "evrim/excel" | "sec/import/integration"
|
|
|
|
|
@@ -225,15 +230,60 @@ Public Class cRelayHub
|
|
|
|
|
End Try
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
|
'Private Shared Function Sanitize(req As cRelayHub.cRelayHubJobOrderRequest) As cRelayHub.cRelayHubJobOrderRequest
|
|
|
|
|
' req.outputApplication = If(req.outputApplication, "").Trim()
|
|
|
|
|
' req.dispatchCountry = If(req.dispatchCountry, "").Trim().ToUpperInvariant()
|
|
|
|
|
' req.destinationCountry = If(req.destinationCountry, "").Trim().ToUpperInvariant()
|
|
|
|
|
|
|
|
|
|
' ' lokale Fail-fast Checks
|
|
|
|
|
' If req.dispatchCountry.Length <> 2 Then Throw New ApplicationException("dispatchCountry ISO-2 erforderlich.")
|
|
|
|
|
' If req.destinationCountry.Length <> 2 Then Throw New ApplicationException("destinationCountry ISO-2 erforderlich.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' Return req
|
|
|
|
|
'End Function
|
|
|
|
|
Public Shared Function getRelayHub_AnhDesc(anh_Art) As String
|
|
|
|
|
Dim fileType = "other"
|
|
|
|
|
If anh_Art IsNot Nothing AndAlso anh_Art IsNot DBNull.Value Then
|
|
|
|
|
Select Case anh_Art
|
|
|
|
|
Case "eFatura", "INVOICE" : fileType = "invoice"
|
|
|
|
|
Case "Rechnung", "Konsi-Rechnung", "INVOICE" : fileType = "commercial_invoice"
|
|
|
|
|
Case "CMR" : fileType = "cmr"
|
|
|
|
|
Case "Ausfuhr", "EXPORT" : fileType = "tr_export_declaration"
|
|
|
|
|
Case "ATR", "A.TR", "ATR-EUR1", "EUR1" : fileType = "atr"
|
|
|
|
|
Case "Vorpapier", "T1" : fileType = "transit_declaration"
|
|
|
|
|
Case "Ursprungszeugnis", "CoO" : fileType = "origin"
|
|
|
|
|
Case "Lieferschein" : fileType = "delivery_note"
|
|
|
|
|
Case "Packliste" : fileType = "packaging_list"
|
|
|
|
|
Case Else : fileType = "other"
|
|
|
|
|
|
|
|
|
|
End Select
|
|
|
|
|
End If
|
|
|
|
|
Return fileType
|
|
|
|
|
End Function
|
|
|
|
|
Private Shared Function Sanitize(req As cRelayHub.cRelayHubJobOrderRequest) As cRelayHub.cRelayHubJobOrderRequest
|
|
|
|
|
req.outputApplication = If(req.outputApplication, "").Trim()
|
|
|
|
|
req.dispatchCountry = If(req.dispatchCountry, "").Trim().ToUpperInvariant()
|
|
|
|
|
req.destinationCountry = If(req.destinationCountry, "").Trim().ToUpperInvariant()
|
|
|
|
|
|
|
|
|
|
' lokale Fail-fast Checks
|
|
|
|
|
If req.dispatchCountry.Length <> 2 Then Throw New ApplicationException("dispatchCountry ISO-2 erforderlich.")
|
|
|
|
|
If req.destinationCountry.Length <> 2 Then Throw New ApplicationException("destinationCountry ISO-2 erforderlich.")
|
|
|
|
|
|
|
|
|
|
' AdditionalSettings -> combineOptions: nur erlaubte Keys, distinct, lower-case
|
|
|
|
|
Dim allowed As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase) From {
|
|
|
|
|
"description", "commodity_code", "country_of_origin", "unit_type"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
If req.additionalSettings IsNot Nothing AndAlso req.additionalSettings.combineOptions IsNot Nothing Then
|
|
|
|
|
Dim cleaned = req.additionalSettings.combineOptions.
|
|
|
|
|
Where(Function(o) Not String.IsNullOrWhiteSpace(o)).
|
|
|
|
|
Select(Function(o) o.Trim().ToLowerInvariant()).
|
|
|
|
|
Where(Function(o) allowed.Contains(o)).
|
|
|
|
|
Distinct().
|
|
|
|
|
ToList()
|
|
|
|
|
|
|
|
|
|
req.additionalSettings.combineOptions = cleaned
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
Return req
|
|
|
|
|
End Function
|
|
|
|
|
@@ -289,6 +339,14 @@ Public Class cRelayHub
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
.additionalSettings = New cRelayHubAdditionalSettings With {
|
|
|
|
|
.combineOptions = New List(Of String) From {
|
|
|
|
|
"description",
|
|
|
|
|
"commodity_code",
|
|
|
|
|
"country_of_origin",
|
|
|
|
|
"unit_type"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Return req
|
|
|
|
|
|