diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/Digicast/cDigicustAPI.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/Digicast/cDigicustAPI.vb index 32efbade..5d8c078f 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/Digicast/cDigicustAPI.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/Digicast/cDigicustAPI.vb @@ -193,6 +193,22 @@ Public Class cDigicustSendungen Public Property uploadedDocuments As Integer Public Property projectId 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 @@ -212,6 +228,22 @@ Public Class cDigicustSendungen 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("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 End Function @@ -372,7 +404,6 @@ Public Class cDigicustAPI Dim now As DateTime = DateTime.Now() now = now.AddSeconds(jsonResp.IntOf("expires_in")) session = New cDigicustSessions(_token, refresh_token, now.ToString("yyyy-MM-dd HH:mm:ss")) - '"yyyyMMdd HH:mm:ss" Return rest.ResponseStatusCode & " " & rest.ResponseStatusText @@ -454,12 +485,7 @@ Public Class cDigicustAPI rest.SetMultipartBodyString(dig.reference) counter += 1 - rest.PartSelector = counter - rest.AddHeader("Content-Disposition", "form-data; name=""documents""") - rest.SetMultipartBodyString("[{""priority"":""afterNormalization""}]") - 'rest.SetMultipartBodyString("[{""priority"":""afterNormalization"",""annotatedAggregated"":{}}]") - counter += 1 - + ' createUserinput(rest, counter, dig) rest.PartSelector = "0" @@ -520,14 +546,12 @@ Public Class cDigicustAPI Dim getAsLocal As Boolean = False jsonResp.DateOf("result.createdAt", dateTime) dig.createdAt = dateTime.GetAsTimestamp(getAsLocal) - - jsonResp.DateOf("result.status.modifiedAt", dateTime) dig.modifiedAt = dateTime.GetAsTimestamp(getAsLocal) - dig.status = jsonResp.StringOf("result.status.value") dig.digicustId = jsonResp.StringOf("result.id") dig.uploadedDocuments = jsonResp.SizeOfArray("result.uploadedFiles") - + dig.projectId = jsonResp.StringOf("result.projectId") + dig.companyId = jsonResp.StringOf("result.customerId") Return True @@ -581,17 +605,38 @@ Public Class cDigicustAPI Dim jsonResp = New Chilkat.JsonObject() jsonResp.LoadSb(sbResponseBody) - sendung.status = jsonResp.StringOf("status.value") - Dim dateTime As New Chilkat.CkDateTime - Dim getAsLocal As Boolean = False - jsonResp.DateOf("status.modifiedAt", dateTime) - sendung.modifiedAt = dateTime.GetAsTimestamp(getAsLocal) - + 'Dim dateTime As New Chilkat.CkDateTime + 'Dim getAsLocal As Boolean = False + 'jsonResp.DateOf("status.modifiedAt", dateTime) + sendung.modifiedAt = Now() sendung.uploadedDocuments = jsonResp.SizeOfArray("uploadedFiles") sendung.SAVE() 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