Digicust, Timas, Essensbestellungen

This commit is contained in:
2023-11-13 16:07:30 +01:00
parent 530552aaa6
commit e5f1d2ef4a
5 changed files with 92 additions and 32 deletions

View File

@@ -586,7 +586,7 @@ Public Class UsrCntlessensbestellungen
cbxMenu.fillWithSQL("SELECT Distinct Top 50 (REPLACE(MenuTitel,'Wochenkarte ','')) + ' - ' + Convert(varchar, Year(MenuDateVon)), MenuDateVon from tblEBMenu order by MenuDateVon desc", True, "AVISO", True) '/ where MenuDateVon >= GETDATE() cbxMenu.fillWithSQL("SELECT Distinct Top 50 (REPLACE(MenuTitel,'Wochenkarte ','')) + ' - ' + Convert(varchar, Year(MenuDateVon)), MenuDateVon from tblEBMenu order by MenuDateVon desc", True, "AVISO", True) '/ where MenuDateVon >= GETDATE()
cbxMitarbeiter.fillWithSQL("SELECT [mit_id], ([mit_vname] + ' ' + [mit_nname]) as name FROM [tblMitarbeiter] where [mit_ChatBenutzer] = 1 AND [mit_pseudoUser] = 0 AND [mit_gekuendigt] = 0 AND mit_niederlassung = 'SUB' AND ((CAse when mit_firma = 'ALL' Then mit_FirmaHaupt else mit_firma END ) = 'VERAG' Or mit_firma = 'UNISPED' OR mit_firma = 'IMEX' OR mit_firma = 'FRONTOFFICE') order by name ", False, "ADMIN", True) cbxMitarbeiter.fillWithSQL("SELECT [mit_id], ([mit_vname] + ' ' + [mit_nname]) as name FROM [tblMitarbeiter] where [mit_ChatBenutzer] = 1 AND [mit_pseudoUser] = 0 AND [mit_gekuendigt] = 0 AND mit_niederlassung = 'SUB' AND ((CAse when mit_firma = 'ALL' Then mit_FirmaHaupt else mit_firma END ) = 'VERAG' Or mit_firma = 'UNISPED' OR mit_firma = 'IMEX' OR mit_firma = 'FRONTOFFICE') Or mit_id = 144 order by name ", False, "ADMIN", True)
cbxAbteilung.fillWithSQL("SELECT [abt_kuerzel], [abt_bezeichnung] from [tblAbteilungen] ", False, "ADMIN", True,, "") cbxAbteilung.fillWithSQL("SELECT [abt_kuerzel], [abt_bezeichnung] from [tblAbteilungen] ", False, "ADMIN", True,, "")
cbxGebäude.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Frontoffice", "Frontoffice")) cbxGebäude.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Frontoffice", "Frontoffice"))

View File

@@ -143,8 +143,9 @@ Public Class frmMain
Dim timas As New cTimasAPI Dim timas As New cTimasAPI
Dim infoMessage As String = "" Dim infoMessage As String = ""
Dim timeEntryExisting As Boolean = False Dim timeEntryExisting As Boolean = False
timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, Nothing, timeEntryExisting) Dim isEndpointRunning As Boolean
If Not timeEntryExisting Then timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, Nothing, timeEntryExisting,, isEndpointRunning)
If Not timeEntryExisting AndAlso isEndpointRunning Then
Dim a As MsgBoxResult = MsgBox("Für " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME & " wurde heute noch keine Zeit erfasst!" & vbNewLine & Now.ToString() & " als Startzeit erfassen?", vbYesNo) Dim a As MsgBoxResult = MsgBox("Für " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME & " wurde heute noch keine Zeit erfasst!" & vbNewLine & Now.ToString() & " als Startzeit erfassen?", vbYesNo)
If a = vbYes Then If a = vbYes Then
Dim info Dim info

View File

@@ -322,12 +322,11 @@ Public Class frmMitarbeitersuche
Dim timeEntryExisting As Boolean = False Dim timeEntryExisting As Boolean = False
Dim isOnline = timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, Nothing, timeEntryExisting) Dim isOnline = timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, Nothing, timeEntryExisting)
If timeEntryExisting AndAlso isOnline Then timas.setTimeEntry(cAllgemein.MITARBEITER, timestp, info, "out", 0) 'Ende
timestp = timestp.AddMinutes(1) timestp = timestp.AddMinutes(1)
timas.setTimeEntry(cAllgemein.MITARBEITER, timestp, info, "in", 6) 'Start Post 6 Postgang timas.setTimeEntry(cAllgemein.MITARBEITER, timestp, info, "in", 6) 'Start Post 6 Postgang
timestp = timestp.AddHours(1) timestp = timestp.AddHours(1)
timas.setTimeEntry(cAllgemein.MITARBEITER, timestp, info, "out", 6) ' Ende Post 6 Postgang timas.setTimeEntry(cAllgemein.MITARBEITER, timestp, info, "out", 6) ' Ende Post 6 Postgang
If timeEntryExisting AndAlso isOnline Then timas.setTimeEntry(cAllgemein.MITARBEITER, timestp, info, "out", 0) 'Ende
MsgBox(info) MsgBox(info)
Thread.Sleep(2000) 'warten bis Eintrag in Timas-DB Thread.Sleep(2000) 'warten bis Eintrag in Timas-DB
requestDone = False requestDone = False
@@ -367,7 +366,12 @@ Public Class frmMitarbeitersuche
lblTimasSaldo.Text = "" lblTimasSaldo.Text = ""
Dim dtZeiten As New DataTable Dim dtZeiten As New DataTable
If timas IsNot Nothing Then If timas IsNot Nothing Then
timas.getTimeSaldo(MA.mit_timasId, lblTimasSaldo.Text) Dim isServiceRunning As Boolean = True
timas.getTimeSaldo(MA.mit_timasId, lblTimasSaldo.Text, isServiceRunning)
If Not isServiceRunning Then
MsgBox("Abfragefehler!")
Exit Sub
End If
lblStatusZE.Visible = True lblStatusZE.Visible = True
Dim checkEntry As Boolean = timas.getTimeEntries(MA.mit_timasId, dtZeiten,, requestDone) Dim checkEntry As Boolean = timas.getTimeEntries(MA.mit_timasId, dtZeiten,, requestDone)

View File

@@ -1,16 +1,10 @@
Imports System.ComponentModel.Design Imports System.Data.SqlClient
Imports System.Data.SqlClient
Imports System.Net Imports System.Net
Imports System.Reflection Imports System.Reflection
Imports System.ServiceModel.Security
Imports System.Threading Imports System.Threading
Imports System.Windows.Forms Imports System.Windows.Forms
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Imports Chilkat Imports Chilkat
Imports iTextSharp.text Imports iTextSharp.text
Imports Newtonsoft.Json.Linq
Imports Org.BouncyCastle.Bcpg
Imports VERAG_PROG_ALLGEMEIN.cCreditSafeAPI
Public Class cDigicustSessions Public Class cDigicustSessions
@@ -124,6 +118,8 @@ Public Class cDigicustSettings
Public Property valid As Boolean Public Property valid As Boolean
Public Property companyId As Integer Public Property companyId As Integer
Public Property description As String Public Property description As String
Public Property type As String
Public Property companyGroup As String
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL 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("valid", valid))
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("description", description)) 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 Return list
End Function End Function
@@ -209,6 +207,9 @@ Public Class cDigicustSendungen
Public Property prepaper_code As String Public Property prepaper_code As String
Public Property licencePlate As String Public Property licencePlate As String
Public Property lkwCountryId 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 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("prepaper_code", prepaper_code))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("licencePlate", licencePlate)) 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("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 Return list
End Function End Function
@@ -405,7 +409,7 @@ Public Class cDigicustAPI
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"))
Return rest.ResponseStatusCode & " " & rest.ResponseStatusText Return rest.ResponseStatusCode
Catch ex As WebException Catch ex As WebException
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
@@ -421,7 +425,8 @@ Public Class cDigicustAPI
End Function 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 rest As New Chilkat.Rest
Dim success As Boolean Dim success As Boolean
@@ -491,7 +496,7 @@ Public Class cDigicustAPI
rest.SetMultipartBodyString(dig.reference) rest.SetMultipartBodyString(dig.reference)
counter += 1 counter += 1
If withAvisoData Then createUserinput(rest, counter, dig) If withAvisoData Then createUserinput(rest, counter, dig, sender, recipient)
rest.PartSelector = "0" rest.PartSelector = "0"
@@ -559,6 +564,12 @@ Public Class cDigicustAPI
Dim jsonResp = New Chilkat.JsonObject() Dim jsonResp = New Chilkat.JsonObject()
jsonResp.Load(responseBodyStr) jsonResp.Load(responseBodyStr)
If (jsonResp.LastMethodSuccess <> True) Then
MsgBox(rest.LastErrorText)
Return False
End If
Dim dateTime As New Chilkat.CkDateTime Dim dateTime As New Chilkat.CkDateTime
Dim getAsLocal As Boolean = False Dim getAsLocal As Boolean = False
jsonResp.DateOf("result.createdAt", dateTime) jsonResp.DateOf("result.createdAt", dateTime)
@@ -639,7 +650,7 @@ Public Class cDigicustAPI
End Function 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 'zusätzliche Informationen aus dem AVISO
@@ -653,22 +664,59 @@ Public Class cDigicustAPI
json.UpdateString("documentStatus", "finished") json.UpdateString("documentStatus", "finished")
json.UpdateString("documentType", "UserInput") 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)
If sendung.consignee_eori <> "" Then json.UpdateString("annotatedAggregated.consignee.EORI.input", sendung.consignee_eori) json.UpdateString("annotatedAggregated.declarant.name.input", sendung.consignee_name)
json.UpdateString("annotatedAggregated.importer.name.input", sendung.consignee_name)
If sendung.licencePlate <> "" AndAlso sendung.lkwCountryId <> "" Then json.UpdateString("annotatedAggregated.buyer.name.input", sendung.consignee_name)
json.UpdateString("annotatedAggregated.meansOfTransportation[0].type", "Border") End If
json.UpdateString("annotatedAggregated.meansOfTransportation[0].value", "Road") If sendung.consignee_address <> "" Then
json.UpdateString("annotatedAggregated.meansOfTransportation[0].licensePlate", sendung.licencePlate) 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.meansOfTransportation[0].countryCode", sendung.lkwCountryId) 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
End If
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 End If
'json.UpdateString("annotatedAggregated.consignee.email.input", "")
'json.UpdateString("annotatedAggregated.consignee.contactPerson.input", "Herr Berger")
'json.UpdateString("annotatedAggregated.consignee.VAT.input", "")
rest.PartSelector = counter rest.PartSelector = counter

View File

@@ -49,7 +49,7 @@ Public Class cTimasAPI
End Function 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 Try
Dim returnText As String = "" Dim returnText As String = ""
Dim failureText As String = "" Dim failureText As String = ""
@@ -66,10 +66,12 @@ Public Class cTimasAPI
Dim success As Boolean Dim success As Boolean
rest.IdleTimeoutMs = 5000
Dim responseJson As String = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/balance") Dim responseJson As String = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/balance")
If (rest.LastMethodSuccess <> True) Then If (rest.LastMethodSuccess <> True) Then
Debug.WriteLine(rest.LastErrorText) Debug.WriteLine(rest.LastErrorText)
isEndpointRunning = rest.LastMethodSuccess
rest.IdleTimeoutMs = 30000 'defualt
Exit Sub Exit Sub
End If End If
@@ -117,7 +119,7 @@ Public Class cTimasAPI
End Sub 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 Try
Dim isPresent = False Dim isPresent = False
@@ -141,10 +143,15 @@ Public Class cTimasAPI
Dim Response As String Dim Response As String
rest.IdleTimeoutMs = 5000 '5 sec
Response = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/bookings") Response = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/bookings")
If (rest.LastMethodSuccess <> True) Then If (rest.LastMethodSuccess <> True) Then
Debug.WriteLine(rest.LastErrorText) Debug.WriteLine(rest.LastErrorText)
isEndpointRunning = rest.LastMethodSuccess
rest.IdleTimeoutMs = 30000 'defualt
Return isPresent Return isPresent
Else
rest.IdleTimeoutMs = 30000
End If End If
If (rest.ResponseStatusCode <> 200) Then If (rest.ResponseStatusCode <> 200) Then