Digicust-ergänzende Daten werden mitgeschickt.
This commit is contained in:
@@ -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,24 +491,25 @@ 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.AddHeader("Content-Type", "multipart/form-data")
|
rest.AddHeader("Content-Type", "multipart/form-data")
|
||||||
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")
|
||||||
|
|
||||||
rest.PartSelector = "0"
|
|
||||||
rest.ClearAllHeaders()
|
|
||||||
rest.ClearAllParts()
|
|
||||||
rest.PartSelector = ""
|
|
||||||
|
|
||||||
Dim responseStatusCode = rest.ReadResponseHeader()
|
Dim responseStatusCode = rest.ReadResponseHeader()
|
||||||
If (responseStatusCode < 0) Then
|
If (responseStatusCode < 0) Then
|
||||||
@@ -513,13 +520,18 @@ Public Class cDigicustAPI
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If rest.ResponseStatusCode <> 200 Then
|
|
||||||
MsgBox(rest.LastErrorText)
|
|
||||||
Return False
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Not (rest.ResponseStatusCode = 200 Or rest.ResponseStatusCode = 201) Then
|
||||||
|
MsgBox(rest.LastErrorText)
|
||||||
|
If rest.ResponseStatusCode = -1 Then
|
||||||
|
Return True
|
||||||
|
End If
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If (rest.LastMethodSuccess <> True) Then
|
If (rest.LastMethodSuccess <> True) Then
|
||||||
MsgBox(rest.LastErrorText)
|
MsgBox(rest.LastErrorText)
|
||||||
Return False
|
Return False
|
||||||
@@ -558,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
|
||||||
@@ -626,26 +643,38 @@ Public Class cDigicustAPI
|
|||||||
|
|
||||||
'zusätzliche Informationen aus dem AVISO
|
'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 jsonArray As New Chilkat.JsonArray()
|
If sendung.consignee_name <> "" Then json.UpdateString("annotatedAggregated.consignee.name.input", sendung.consignee_name)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
Dim json As New Chilkat.JsonObject
|
If sendung.licencePlate <> "" AndAlso sendung.lkwCountryId <> "" Then
|
||||||
If sendung.licencePlate <> "" Then
|
json.UpdateString("annotatedAggregated.meansOfTransportation[0].type", "Inland")
|
||||||
json.UpdateString("truckLicensePlate", sendung.licencePlate)
|
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