Merge branch 'master' of https://verag.visualstudio.com/SDL/_git/SDL
This commit is contained in:
@@ -581,7 +581,6 @@ Public Class cATEZ_NCTS_IN
|
|||||||
Dim rest As New Chilkat.Rest
|
Dim rest As New Chilkat.Rest
|
||||||
Dim success As Boolean
|
Dim success As Boolean
|
||||||
|
|
||||||
|
|
||||||
Dim bTls As Boolean = True
|
Dim bTls As Boolean = True
|
||||||
Dim port As Integer = 443
|
Dim port As Integer = 443
|
||||||
Dim bAutoReconnect As Boolean = True
|
Dim bAutoReconnect As Boolean = True
|
||||||
@@ -606,9 +605,9 @@ Public Class cATEZ_NCTS_IN
|
|||||||
'DEBUG-Mode -> no request will be sent!
|
'DEBUG-Mode -> no request will be sent!
|
||||||
'rest.DebugMode = True
|
'rest.DebugMode = True
|
||||||
|
|
||||||
rest.PercentDoneOnSend = True
|
'rest.PercentDoneOnSend = True
|
||||||
rest.IdleTimeoutMs = 60000
|
rest.IdleTimeoutMs = 5000 * 16
|
||||||
|
rest.VerboseLogging = True
|
||||||
|
|
||||||
success = rest.SendReqSb("POST", "/api/integrations/verag", sbRequestBody)
|
success = rest.SendReqSb("POST", "/api/integrations/verag", sbRequestBody)
|
||||||
|
|
||||||
@@ -617,13 +616,17 @@ Public Class cATEZ_NCTS_IN
|
|||||||
For i = 0 To 15 'Versuche den Header 16x abzufragen (funktioniert ab und zu nicht).
|
For i = 0 To 15 'Versuche den Header 16x abzufragen (funktioniert ab und zu nicht).
|
||||||
responseStatusCode = rest.ReadResponseHeader()
|
responseStatusCode = rest.ReadResponseHeader()
|
||||||
If responseStatusCode > 0 Then Exit For
|
If responseStatusCode > 0 Then Exit For
|
||||||
Thread.Sleep(3000)
|
Thread.Sleep(5000)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If rest.ResponseStatusCode <> 200 Then
|
If rest.ResponseStatusCode <> 200 Then
|
||||||
|
If responseStatusCode = -1 Then
|
||||||
|
Return responseStatusCode
|
||||||
|
End If
|
||||||
MsgBox(rest.LastErrorText)
|
MsgBox(rest.LastErrorText)
|
||||||
Return False
|
failureDesc = responseStatusCode & "-" & rest.ResponseStatusText
|
||||||
|
Return failureDesc
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@@ -642,7 +645,7 @@ Public Class cATEZ_NCTS_IN
|
|||||||
Dim jsonResultFailure As New Chilkat.JsonObject
|
Dim jsonResultFailure As New Chilkat.JsonObject
|
||||||
jsonResultFailure.LoadSb(sbResponseBody)
|
jsonResultFailure.LoadSb(sbResponseBody)
|
||||||
jsonResultFailure.Emit()
|
jsonResultFailure.Emit()
|
||||||
failureDesc = jsonResultFailure.StringOf("code") & "-" & jsonResultFailure.StringOf("message")
|
failureDesc = "ATEZ: " & jsonResultFailure.StringOf("code") & "-" & jsonResultFailure.StringOf("message")
|
||||||
Return failureDesc
|
Return failureDesc
|
||||||
Else
|
Else
|
||||||
|
|
||||||
@@ -692,7 +695,6 @@ Public Class cATEZ_NCTS_IN
|
|||||||
success = jsonData.UpdateString("Guarantee.GRN", ncts.Guarantee_GRN)
|
success = jsonData.UpdateString("Guarantee.GRN", ncts.Guarantee_GRN)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim Route_LIST As New List(Of VERAG_PROG_ALLGEMEIN.cATEZ_NCTS_Routen)
|
Dim Route_LIST As New List(Of VERAG_PROG_ALLGEMEIN.cATEZ_NCTS_Routen)
|
||||||
VERAG_PROG_ALLGEMEIN.cATEZ_NCTS_Routen.LOAD_LIST_ByNCTS(Route_LIST, ncts.Id)
|
VERAG_PROG_ALLGEMEIN.cATEZ_NCTS_Routen.LOAD_LIST_ByNCTS(Route_LIST, ncts.Id)
|
||||||
|
|
||||||
|
|||||||
@@ -439,6 +439,12 @@ Public Class cDigicustAPI
|
|||||||
|
|
||||||
rest.VerboseLogging = True
|
rest.VerboseLogging = True
|
||||||
|
|
||||||
|
|
||||||
|
rest.ClearAllHeaders()
|
||||||
|
rest.ClearAllParts()
|
||||||
|
rest.PartSelector = ""
|
||||||
|
|
||||||
|
|
||||||
Dim counter As Integer = 1
|
Dim counter As Integer = 1
|
||||||
Dim jsonFileArray = New Chilkat.JsonArray()
|
Dim jsonFileArray = New Chilkat.JsonArray()
|
||||||
|
|
||||||
@@ -485,7 +491,7 @@ Public Class cDigicustAPI
|
|||||||
rest.SetMultipartBodyString(dig.reference)
|
rest.SetMultipartBodyString(dig.reference)
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
||||||
' createUserinput(rest, counter, dig)
|
createUserinput(rest, counter, dig)
|
||||||
|
|
||||||
rest.PartSelector = "0"
|
rest.PartSelector = "0"
|
||||||
|
|
||||||
@@ -493,12 +499,18 @@ Public Class cDigicustAPI
|
|||||||
rest.AddHeader("Authorization", "Bearer " & token)
|
rest.AddHeader("Authorization", "Bearer " & token)
|
||||||
rest.AddHeader("Expect", "100-continue")
|
rest.AddHeader("Expect", "100-continue")
|
||||||
|
|
||||||
|
|
||||||
|
Debug.WriteLine(rest)
|
||||||
|
|
||||||
'Debuging
|
'Debuging
|
||||||
'rest.DebugMode = True
|
'rest.DebugMode = True
|
||||||
rest.IdleTimeoutMs = 60000
|
rest.IdleTimeoutMs = 60000
|
||||||
|
|
||||||
rest.SendReqMultipart("POST", "/upload/api/" & settings.customerId & "/" & settings.projectId & "/new")
|
rest.SendReqMultipart("POST", "/upload/api/" & settings.customerId & "/" & settings.projectId & "/new")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim responseStatusCode = rest.ReadResponseHeader()
|
Dim responseStatusCode = rest.ReadResponseHeader()
|
||||||
If (responseStatusCode < 0) Then
|
If (responseStatusCode < 0) Then
|
||||||
For i = 0 To 15 'Versuche den Header 16x abzufragen (funktioniert ab und zu nicht).
|
For i = 0 To 15 'Versuche den Header 16x abzufragen (funktioniert ab und zu nicht).
|
||||||
@@ -508,12 +520,17 @@ Public Class cDigicustAPI
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If rest.ResponseStatusCode <> 200 Then
|
End If
|
||||||
|
|
||||||
|
If Not (rest.ResponseStatusCode = 200 Or rest.ResponseStatusCode = 201) Then
|
||||||
MsgBox(rest.LastErrorText)
|
MsgBox(rest.LastErrorText)
|
||||||
|
If rest.ResponseStatusCode = -1 Then
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
If (rest.LastMethodSuccess <> True) Then
|
If (rest.LastMethodSuccess <> True) Then
|
||||||
MsgBox(rest.LastErrorText)
|
MsgBox(rest.LastErrorText)
|
||||||
@@ -553,6 +570,11 @@ Public Class cDigicustAPI
|
|||||||
dig.projectId = jsonResp.StringOf("result.projectId")
|
dig.projectId = jsonResp.StringOf("result.projectId")
|
||||||
dig.companyId = jsonResp.StringOf("result.customerId")
|
dig.companyId = jsonResp.StringOf("result.customerId")
|
||||||
|
|
||||||
|
rest.ClearAllHeaders()
|
||||||
|
rest.ClearAllParts()
|
||||||
|
rest.PartSelector = ""
|
||||||
|
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
@@ -619,23 +641,40 @@ Public Class cDigicustAPI
|
|||||||
|
|
||||||
Shared Function createUserinput(ByRef rest As Chilkat.Rest, ByRef counter As Integer, ByVal sendung As cDigicustSendungen)
|
Shared Function createUserinput(ByRef rest As Chilkat.Rest, ByRef counter As Integer, ByVal sendung As cDigicustSendungen)
|
||||||
|
|
||||||
|
'zusätzliche Informationen aus dem AVISO
|
||||||
|
|
||||||
|
Dim jarr As New Chilkat.JsonArray
|
||||||
|
|
||||||
|
jarr.AddObjectAt(-1)
|
||||||
|
Dim json As Chilkat.JsonObject = jarr.ObjectAt(jarr.Size - 1)
|
||||||
'beforeNormalization(fallback -> falls Daten nicht gelesen werden können, wird ergänzt)
|
'beforeNormalization(fallback -> falls Daten nicht gelesen werden können, wird ergänzt)
|
||||||
'afterNormalization(overwrite -> werden mit mitgeschickten Infos überschrieben).
|
'afterNormalization(overwrite -> werden mit mitgeschickten Infos überschrieben).
|
||||||
|
json.UpdateString("priority", "afterNormalization")
|
||||||
|
json.UpdateString("documentStatus", "finished")
|
||||||
|
|
||||||
Dim json As New Chilkat.JsonObject
|
If sendung.consignee_name <> "" Then json.UpdateString("annotatedAggregated.consignee.name.input", sendung.consignee_name)
|
||||||
If sendung.licencePlate <> "" Then
|
|
||||||
json.UpdateString("truckLicensePlate", sendung.licencePlate)
|
If sendung.consignee_address <> "" Then json.UpdateString("annotatedAggregated.consignee.address.input", sendung.consignee_address & IIf(sendung.consignee_postcode <> "", " / " & sendung.consignee_postcode, "") & IIf(sendung.consignee_city_name <> "", " " & sendung.consignee_city_name, ""))
|
||||||
|
|
||||||
|
If sendung.consignee_eori <> "" Then json.UpdateString("annotatedAggregated.consignee.EORI.input", sendung.consignee_eori)
|
||||||
|
|
||||||
|
If sendung.licencePlate <> "" AndAlso sendung.lkwCountryId <> "" Then
|
||||||
|
json.UpdateString("annotatedAggregated.meansOfTransportation[0].type", "Inland")
|
||||||
|
json.UpdateString("annotatedAggregated.meansOfTransportation[0].value", "Road")
|
||||||
|
json.UpdateString("annotatedAggregated.meansOfTransportation[0].licensePlate", sendung.licencePlate)
|
||||||
|
json.UpdateString("annotatedAggregated.meansOfTransportation[0].countryCode", sendung.lkwCountryId)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If sendung.lkwCountryId <> "" Then
|
'json.UpdateString("annotatedAggregated.consignee.email.input", "")
|
||||||
json.UpdateString("truckNationality", sendung.lkwCountryId)
|
'json.UpdateString("annotatedAggregated.consignee.contactPerson.input", "Herr Berger")
|
||||||
End If
|
'json.UpdateString("annotatedAggregated.consignee.VAT.input", "")
|
||||||
|
|
||||||
|
|
||||||
rest.PartSelector = counter
|
rest.PartSelector = counter
|
||||||
rest.AddHeader("Content-Disposition", "form-data; name=""documents""")
|
rest.AddHeader("Content-Disposition", "form-data; name=""documents""")
|
||||||
rest.SetMultipartBodyString("[{""priority"":""afterNormalization"",""annotatedAggregated"":{" & json.Emit & "}}]")
|
rest.SetMultipartBodyString(jarr.Emit)
|
||||||
|
|
||||||
|
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
Reference in New Issue
Block a user