Digicust, Timas, Essensbestellungen
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
Imports System.ComponentModel.Design
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Net
|
||||
Imports System.Reflection
|
||||
Imports System.ServiceModel.Security
|
||||
Imports System.Threading
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
|
||||
Imports Chilkat
|
||||
Imports iTextSharp.text
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports Org.BouncyCastle.Bcpg
|
||||
Imports VERAG_PROG_ALLGEMEIN.cCreditSafeAPI
|
||||
|
||||
Public Class cDigicustSessions
|
||||
|
||||
@@ -124,6 +118,8 @@ Public Class cDigicustSettings
|
||||
Public Property valid As Boolean
|
||||
Public Property companyId As Integer
|
||||
Public Property description As String
|
||||
Public Property type As String
|
||||
Public Property companyGroup As String
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
@@ -140,6 +136,8 @@ Public Class cDigicustSettings
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("valid", valid))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("companyId", companyId))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("description", description))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("companyGroup", companyGroup))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("type", Type))
|
||||
Return list
|
||||
End Function
|
||||
|
||||
@@ -209,6 +207,9 @@ Public Class cDigicustSendungen
|
||||
Public Property prepaper_code As String
|
||||
Public Property licencePlate As String
|
||||
Public Property lkwCountryId As String
|
||||
Public Property customsOfficeNr As String
|
||||
Public Property settingsId As Integer
|
||||
Public Property type As String
|
||||
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
@@ -244,6 +245,9 @@ Public Class cDigicustSendungen
|
||||
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))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("customsOfficeNr", customsOfficeNr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("settingsId", settingsId))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("type", type))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
@@ -405,7 +409,7 @@ Public Class cDigicustAPI
|
||||
now = now.AddSeconds(jsonResp.IntOf("expires_in"))
|
||||
session = New cDigicustSessions(_token, refresh_token, now.ToString("yyyy-MM-dd HH:mm:ss"))
|
||||
|
||||
Return rest.ResponseStatusCode & " " & rest.ResponseStatusText
|
||||
Return rest.ResponseStatusCode
|
||||
|
||||
Catch ex As WebException
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
@@ -421,7 +425,8 @@ Public Class cDigicustAPI
|
||||
|
||||
End Function
|
||||
|
||||
Shared Function uploadingCase(dig As cDigicustSendungen, settings As cDigicustSettings, dgv As DataGridView, withAvisoData As Boolean) As Boolean
|
||||
Shared Function uploadingCase(dig As cDigicustSendungen, settings As cDigicustSettings, dgv As DataGridView, withAvisoData As Boolean, sender As Boolean, recipient As Boolean) As Boolean
|
||||
|
||||
|
||||
Dim rest As New Chilkat.Rest
|
||||
Dim success As Boolean
|
||||
@@ -491,7 +496,7 @@ Public Class cDigicustAPI
|
||||
rest.SetMultipartBodyString(dig.reference)
|
||||
counter += 1
|
||||
|
||||
If withAvisoData Then createUserinput(rest, counter, dig)
|
||||
If withAvisoData Then createUserinput(rest, counter, dig, sender, recipient)
|
||||
|
||||
rest.PartSelector = "0"
|
||||
|
||||
@@ -559,6 +564,12 @@ Public Class cDigicustAPI
|
||||
Dim jsonResp = New Chilkat.JsonObject()
|
||||
jsonResp.Load(responseBodyStr)
|
||||
|
||||
If (jsonResp.LastMethodSuccess <> True) Then
|
||||
MsgBox(rest.LastErrorText)
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
Dim dateTime As New Chilkat.CkDateTime
|
||||
Dim getAsLocal As Boolean = False
|
||||
jsonResp.DateOf("result.createdAt", dateTime)
|
||||
@@ -639,7 +650,7 @@ Public Class cDigicustAPI
|
||||
|
||||
End Function
|
||||
|
||||
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, ByRef sender As Boolean, ByRef recipient As Boolean)
|
||||
|
||||
'zusätzliche Informationen aus dem AVISO
|
||||
|
||||
@@ -653,22 +664,59 @@ Public Class cDigicustAPI
|
||||
json.UpdateString("documentStatus", "finished")
|
||||
json.UpdateString("documentType", "UserInput")
|
||||
|
||||
If sendung.consignee_name <> "" Then json.UpdateString("annotatedAggregated.consignee.name.input", sendung.consignee_name)
|
||||
If recipient Then 'im DIGICUST werden Stakeholder Buyer, Importeur, Declarant, und Consignee gesetzt!
|
||||
|
||||
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_name <> "" Then
|
||||
json.UpdateString("annotatedAggregated.consignee.name.input", sendung.consignee_name)
|
||||
json.UpdateString("annotatedAggregated.declarant.name.input", sendung.consignee_name)
|
||||
json.UpdateString("annotatedAggregated.importer.name.input", sendung.consignee_name)
|
||||
json.UpdateString("annotatedAggregated.buyer.name.input", sendung.consignee_name)
|
||||
End If
|
||||
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, ""))
|
||||
json.UpdateString("annotatedAggregated.declarant.address.input", sendung.consignee_address & IIf(sendung.consignee_postcode <> "", " / " & sendung.consignee_postcode, "") & IIf(sendung.consignee_city_name <> "", " " & sendung.consignee_city_name, ""))
|
||||
json.UpdateString("annotatedAggregated.importer.address.input", sendung.consignee_address & IIf(sendung.consignee_postcode <> "", " / " & sendung.consignee_postcode, "") & IIf(sendung.consignee_city_name <> "", " " & sendung.consignee_city_name, ""))
|
||||
json.UpdateString("annotatedAggregated.buyer.address.input", sendung.consignee_address & IIf(sendung.consignee_postcode <> "", " / " & sendung.consignee_postcode, "") & IIf(sendung.consignee_city_name <> "", " " & sendung.consignee_city_name, ""))
|
||||
End If
|
||||
If sendung.consignee_eori <> "" Then
|
||||
json.UpdateString("annotatedAggregated.consignee.EORI.input", sendung.consignee_eori)
|
||||
json.UpdateString("annotatedAggregated.declarant.EORI.input", sendung.consignee_eori)
|
||||
json.UpdateString("annotatedAggregated.importer.EORI.input", sendung.consignee_eori)
|
||||
json.UpdateString("annotatedAggregated.buyer.EORI.input", sendung.consignee_eori)
|
||||
End If
|
||||
|
||||
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", "Border")
|
||||
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
|
||||
|
||||
'json.UpdateString("annotatedAggregated.consignee.email.input", "")
|
||||
'json.UpdateString("annotatedAggregated.consignee.contactPerson.input", "Herr Berger")
|
||||
'json.UpdateString("annotatedAggregated.consignee.VAT.input", "")
|
||||
|
||||
If sender Then 'im DIGICUST werden Stakeholder Shipper und Exporter gesetzt!
|
||||
If sendung.consignor_name <> "" Then
|
||||
json.UpdateString("annotatedAggregated.shipper.name.input", sendung.consignor_name)
|
||||
json.UpdateString("annotatedAggregated.exporter.name.input", sendung.consignor_name)
|
||||
End If
|
||||
If sendung.consignor_address <> "" Then
|
||||
json.UpdateString("annotatedAggregated.shipper.address.input", sendung.consignor_address & IIf(sendung.consignor_postcode <> "", " / " & sendung.consignor_postcode, "") & IIf(sendung.consignor_city_name <> "", " " & sendung.consignor_city_name, ""))
|
||||
json.UpdateString("annotatedAggregated.exporter.address.input", sendung.consignor_address & IIf(sendung.consignor_postcode <> "", " / " & sendung.consignor_postcode, "") & IIf(sendung.consignor_city_name <> "", " " & sendung.consignor_city_name, ""))
|
||||
End If
|
||||
If sendung.consignor_eori <> "" Then
|
||||
json.UpdateString("annotatedAggregated.shipper.EORI.input", sendung.consignor_eori)
|
||||
json.UpdateString("annotatedAggregated.exporter.EORI.input", sendung.consignor_eori)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If Not (sendung.licencePlate = "" And sendung.lkwCountryId = "") Then
|
||||
json.UpdateString("annotatedAggregated.meansOfTransportation[0].type", "Border")
|
||||
json.UpdateString("annotatedAggregated.meansOfTransportation[0].value", "Road")
|
||||
If sendung.licencePlate <> "" Then json.UpdateString("annotatedAggregated.meansOfTransportation[0].licensePlate", sendung.licencePlate)
|
||||
If sendung.lkwCountryId <> "" Then json.UpdateString("annotatedAggregated.meansOfTransportation[0].countryCode", sendung.lkwCountryId)
|
||||
End If
|
||||
|
||||
If sendung.customsOfficeNr <> "" AndAlso sendung.type <> "" Then
|
||||
json.UpdateString("annotatedAggregated.customsOffices[0].value", sendung.customsOfficeNr)
|
||||
json.UpdateString("annotatedAggregated.customsOffices[0].officeType", sendung.type)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
rest.PartSelector = counter
|
||||
|
||||
@@ -49,7 +49,7 @@ Public Class cTimasAPI
|
||||
|
||||
End Function
|
||||
|
||||
Public Sub getTimeSaldo(maid As Integer, ByRef info As String, Optional ByRef requestDone As Boolean = False)
|
||||
Public Sub getTimeSaldo(maid As Integer, ByRef info As String, Optional isEndpointRunning As Boolean = True)
|
||||
Try
|
||||
Dim returnText As String = ""
|
||||
Dim failureText As String = ""
|
||||
@@ -66,10 +66,12 @@ Public Class cTimasAPI
|
||||
|
||||
Dim success As Boolean
|
||||
|
||||
|
||||
rest.IdleTimeoutMs = 5000
|
||||
Dim responseJson As String = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/balance")
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
isEndpointRunning = rest.LastMethodSuccess
|
||||
rest.IdleTimeoutMs = 30000 'defualt
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -117,7 +119,7 @@ Public Class cTimasAPI
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function getTimeEntries(ByVal maid As Integer, ByRef dtZeiten As DataTable, Optional ByRef entryExistingToday As Boolean = True, Optional ByRef requestDone As Boolean = False) As Boolean
|
||||
Public Function getTimeEntries(ByVal maid As Integer, ByRef dtZeiten As DataTable, Optional ByRef entryExistingToday As Boolean = True, Optional ByRef requestDone As Boolean = False, Optional isEndpointRunning As Boolean = True) As Boolean
|
||||
Try
|
||||
|
||||
Dim isPresent = False
|
||||
@@ -141,10 +143,15 @@ Public Class cTimasAPI
|
||||
|
||||
|
||||
Dim Response As String
|
||||
rest.IdleTimeoutMs = 5000 '5 sec
|
||||
Response = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/bookings")
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
isEndpointRunning = rest.LastMethodSuccess
|
||||
rest.IdleTimeoutMs = 30000 'defualt
|
||||
Return isPresent
|
||||
Else
|
||||
rest.IdleTimeoutMs = 30000
|
||||
End If
|
||||
|
||||
If (rest.ResponseStatusCode <> 200) Then
|
||||
|
||||
Reference in New Issue
Block a user