This commit is contained in:
2023-09-12 16:53:42 +02:00
parent b8889719bd
commit d4e6afc021

View File

@@ -193,6 +193,22 @@ Public Class cDigicustSendungen
Public Property uploadedDocuments As Integer Public Property uploadedDocuments As Integer
Public Property projectId As String Public Property projectId As String
Public Property companyId As String Public Property companyId As String
Public Property consignor_eori As String
Public Property consignor_name As String
Public Property consignor_address As String
Public Property consignor_city_name As String
Public Property consignor_country_id As String
Public Property consignor_postcode As String
Public Property consignee_eori As String
Public Property consignee_name As String
Public Property consignee_address As String
Public Property consignee_city_name As String
Public Property consignee_country_id As String
Public Property consignee_postcode As String
Public Property prepaper As String
Public Property prepaper_code As String
Public Property licencePlate As String
Public Property lkwCountryId As String
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
@@ -212,6 +228,22 @@ Public Class cDigicustSendungen
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("uploadedDocuments", uploadedDocuments)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("uploadedDocuments", uploadedDocuments))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("projectId", projectId)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("projectId", projectId))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("companyId", companyId)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("companyId", companyId))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_eori", consignee_eori))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_name", consignee_name))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_address", consignee_address))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_city_name", consignee_city_name))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_country_id", consignee_country_id))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignee_postcode", consignee_postcode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_eori", consignor_eori))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_name", consignor_name))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_address", consignor_address))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_city_name", consignor_city_name))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_country_id", consignor_country_id))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("consignor_postcode", consignor_postcode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("prepaper", prepaper))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("prepaper_code", prepaper_code))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("licencePlate", licencePlate))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("lkwCountryId", lkwCountryId))
Return list Return list
End Function End Function
@@ -372,7 +404,6 @@ Public Class cDigicustAPI
Dim now As DateTime = DateTime.Now() Dim now As DateTime = DateTime.Now()
now = now.AddSeconds(jsonResp.IntOf("expires_in")) now = now.AddSeconds(jsonResp.IntOf("expires_in"))
session = New cDigicustSessions(_token, refresh_token, now.ToString("yyyy-MM-dd HH:mm:ss")) session = New cDigicustSessions(_token, refresh_token, now.ToString("yyyy-MM-dd HH:mm:ss"))
'"yyyyMMdd HH:mm:ss"
Return rest.ResponseStatusCode & " " & rest.ResponseStatusText Return rest.ResponseStatusCode & " " & rest.ResponseStatusText
@@ -454,12 +485,7 @@ Public Class cDigicustAPI
rest.SetMultipartBodyString(dig.reference) rest.SetMultipartBodyString(dig.reference)
counter += 1 counter += 1
rest.PartSelector = counter ' createUserinput(rest, counter, dig)
rest.AddHeader("Content-Disposition", "form-data; name=""documents""")
rest.SetMultipartBodyString("[{""priority"":""afterNormalization""}]")
'rest.SetMultipartBodyString("[{""priority"":""afterNormalization"",""annotatedAggregated"":{}}]")
counter += 1
rest.PartSelector = "0" rest.PartSelector = "0"
@@ -520,14 +546,12 @@ Public Class cDigicustAPI
Dim getAsLocal As Boolean = False Dim getAsLocal As Boolean = False
jsonResp.DateOf("result.createdAt", dateTime) jsonResp.DateOf("result.createdAt", dateTime)
dig.createdAt = dateTime.GetAsTimestamp(getAsLocal) dig.createdAt = dateTime.GetAsTimestamp(getAsLocal)
jsonResp.DateOf("result.status.modifiedAt", dateTime)
dig.modifiedAt = dateTime.GetAsTimestamp(getAsLocal) dig.modifiedAt = dateTime.GetAsTimestamp(getAsLocal)
dig.status = jsonResp.StringOf("result.status.value") dig.status = jsonResp.StringOf("result.status.value")
dig.digicustId = jsonResp.StringOf("result.id") dig.digicustId = jsonResp.StringOf("result.id")
dig.uploadedDocuments = jsonResp.SizeOfArray("result.uploadedFiles") dig.uploadedDocuments = jsonResp.SizeOfArray("result.uploadedFiles")
dig.projectId = jsonResp.StringOf("result.projectId")
dig.companyId = jsonResp.StringOf("result.customerId")
Return True Return True
@@ -581,17 +605,38 @@ Public Class cDigicustAPI
Dim jsonResp = New Chilkat.JsonObject() Dim jsonResp = New Chilkat.JsonObject()
jsonResp.LoadSb(sbResponseBody) jsonResp.LoadSb(sbResponseBody)
sendung.status = jsonResp.StringOf("status.value") sendung.status = jsonResp.StringOf("status.value")
Dim dateTime As New Chilkat.CkDateTime 'Dim dateTime As New Chilkat.CkDateTime
Dim getAsLocal As Boolean = False 'Dim getAsLocal As Boolean = False
jsonResp.DateOf("status.modifiedAt", dateTime) 'jsonResp.DateOf("status.modifiedAt", dateTime)
sendung.modifiedAt = dateTime.GetAsTimestamp(getAsLocal) sendung.modifiedAt = Now()
sendung.uploadedDocuments = jsonResp.SizeOfArray("uploadedFiles") sendung.uploadedDocuments = jsonResp.SizeOfArray("uploadedFiles")
sendung.SAVE() sendung.SAVE()
End Function End Function
Shared Function createUserinput(ByRef rest As Chilkat.Rest, ByRef counter As Integer, ByVal sendung As cDigicustSendungen)
'beforeNormalization(fallback -> falls Daten nicht gelesen werden können, wird ergänzt)
'afterNormalization(overwrite -> werden mit mitgeschickten Infos überschrieben).
Dim json As New Chilkat.JsonObject
If sendung.licencePlate <> "" Then
json.UpdateString("truckLicensePlate", sendung.licencePlate)
End If
If sendung.lkwCountryId <> "" Then
json.UpdateString("truckNationality", sendung.lkwCountryId)
End If
rest.PartSelector = counter
rest.AddHeader("Content-Disposition", "form-data; name=""documents""")
rest.SetMultipartBodyString("[{""priority"":""afterNormalization"",""annotatedAggregated"":{" & json.Emit & "}}]")
counter += 1
End Function
End Class End Class