From faebd68d0fbf962d0bad9f003208b6cbeb80b15e Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Mon, 13 Nov 2023 16:07:02 +0100 Subject: [PATCH] Digicust API --- Aviso/My Project/AssemblyInfo.vb | 4 +- Aviso/frmDigicust.Designer.vb | 61 +++++++++++++++++++++++++------ Aviso/frmDigicust.vb | 63 ++++++++++++++++++++++++++------ Aviso/frmHauptfenster.vb | 35 ++++++++++-------- Aviso/frmSendungsdetailsNEU.vb | 13 ++++--- 5 files changed, 132 insertions(+), 44 deletions(-) diff --git a/Aviso/My Project/AssemblyInfo.vb b/Aviso/My Project/AssemblyInfo.vb index c9b20da..fec7384 100644 --- a/Aviso/My Project/AssemblyInfo.vb +++ b/Aviso/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Aviso/frmDigicust.Designer.vb b/Aviso/frmDigicust.Designer.vb index 89d603f..329c02d 100644 --- a/Aviso/frmDigicust.Designer.vb +++ b/Aviso/frmDigicust.Designer.vb @@ -26,6 +26,7 @@ Partial Class frmDigicust Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmDigicust)) Me.Button1 = New System.Windows.Forms.Button() Me.pnlHead = New System.Windows.Forms.Panel() + Me.cbxAviso = New System.Windows.Forms.CheckBox() Me.txtVorpapierT = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtLWKLand = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.UsrCntl_Consignee = New SDL.usrCntlAdresse() @@ -46,7 +47,9 @@ Partial Class frmDigicust Me.Label1 = New System.Windows.Forms.Label() Me.txtDyNiederlassung = New System.Windows.Forms.Label() Me.lblBezugsnummer = New System.Windows.Forms.Label() - Me.cbxAviso = New System.Windows.Forms.CheckBox() + Me.lblAnh = New System.Windows.Forms.Label() + Me.cbxAbsender = New System.Windows.Forms.CheckBox() + Me.cbxEmpfänger = New System.Windows.Forms.CheckBox() Me.pnlHead.SuspendLayout() CType(Me.dgvAnhaenge, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() @@ -71,6 +74,8 @@ Partial Class frmDigicust ' Me.pnlHead.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.pnlHead.BackColor = System.Drawing.Color.White + Me.pnlHead.Controls.Add(Me.cbxEmpfänger) + Me.pnlHead.Controls.Add(Me.cbxAbsender) Me.pnlHead.Controls.Add(Me.cbxAviso) Me.pnlHead.Controls.Add(Me.txtVorpapierT) Me.pnlHead.Controls.Add(Me.txtLWKLand) @@ -96,6 +101,18 @@ Partial Class frmDigicust Me.pnlHead.Size = New System.Drawing.Size(606, 706) Me.pnlHead.TabIndex = 112 ' + 'cbxAviso + ' + Me.cbxAviso.AutoSize = True + Me.cbxAviso.Checked = True + Me.cbxAviso.CheckState = System.Windows.Forms.CheckState.Checked + Me.cbxAviso.Location = New System.Drawing.Point(409, 35) + Me.cbxAviso.Name = "cbxAviso" + Me.cbxAviso.Size = New System.Drawing.Size(150, 17) + Me.cbxAviso.TabIndex = 156 + Me.cbxAviso.Text = "Daten aus Aviso schicken" + Me.cbxAviso.UseVisualStyleBackColor = True + ' 'txtVorpapierT ' Me.txtVorpapierT._DateTimeOnly = False @@ -364,17 +381,35 @@ Partial Class frmDigicust Me.lblBezugsnummer.Text = "4800/000000/17 AAA" Me.lblBezugsnummer.TextAlign = System.Drawing.ContentAlignment.MiddleRight ' - 'cbxAviso + 'lblAnh ' - Me.cbxAviso.AutoSize = True - Me.cbxAviso.Checked = True - Me.cbxAviso.CheckState = System.Windows.Forms.CheckState.Checked - Me.cbxAviso.Location = New System.Drawing.Point(409, 35) - Me.cbxAviso.Name = "cbxAviso" - Me.cbxAviso.Size = New System.Drawing.Size(150, 17) - Me.cbxAviso.TabIndex = 156 - Me.cbxAviso.Text = "Daten aus Aviso schicken" - Me.cbxAviso.UseVisualStyleBackColor = True + Me.lblAnh.Location = New System.Drawing.Point(474, 713) + Me.lblAnh.Name = "lblAnh" + Me.lblAnh.Size = New System.Drawing.Size(135, 13) + Me.lblAnh.TabIndex = 152 + Me.lblAnh.Visible = False + ' + 'cbxAbsender + ' + Me.cbxAbsender.AutoSize = True + Me.cbxAbsender.Location = New System.Drawing.Point(9, 135) + Me.cbxAbsender.Name = "cbxAbsender" + Me.cbxAbsender.Size = New System.Drawing.Size(133, 17) + Me.cbxAbsender.TabIndex = 157 + Me.cbxAbsender.Text = "Absender übernehmen" + Me.cbxAbsender.UseVisualStyleBackColor = True + ' + 'cbxEmpfänger + ' + Me.cbxEmpfänger.AutoSize = True + Me.cbxEmpfänger.Checked = True + Me.cbxEmpfänger.CheckState = System.Windows.Forms.CheckState.Checked + Me.cbxEmpfänger.Location = New System.Drawing.Point(303, 135) + Me.cbxEmpfänger.Name = "cbxEmpfänger" + Me.cbxEmpfänger.Size = New System.Drawing.Size(139, 17) + Me.cbxEmpfänger.TabIndex = 158 + Me.cbxEmpfänger.Text = "Empfänger übernehmen" + Me.cbxEmpfänger.UseVisualStyleBackColor = True ' 'frmDigicust ' @@ -382,6 +417,7 @@ Partial Class frmDigicust Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ClientSize = New System.Drawing.Size(621, 769) + Me.Controls.Add(Me.lblAnh) Me.Controls.Add(Me.pnlHead) Me.Controls.Add(Me.Button1) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) @@ -417,4 +453,7 @@ Partial Class frmDigicust Friend WithEvents txtVorpapierT As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents txtLWKLand As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents cbxAviso As CheckBox + Friend WithEvents lblAnh As Label + Friend WithEvents cbxEmpfänger As CheckBox + Friend WithEvents cbxAbsender As CheckBox End Class diff --git a/Aviso/frmDigicust.vb b/Aviso/frmDigicust.vb index ce42fb6..56cffbd 100644 --- a/Aviso/frmDigicust.vb +++ b/Aviso/frmDigicust.vb @@ -96,7 +96,8 @@ Public Class frmDigicust lblInfo.Text = "" With dig_sendung - + .settingsId = settings.Id + .type = settings.type .avisoId = AVISO.AvisoID .reference = lblBezugsnummer.Text .consignor_eori = usrCntl_consignor.txtEORI.Text @@ -115,7 +116,7 @@ Public Class frmDigicust .prepaper_code = txtVorpapierT.Text .licencePlate = txtLKWId.Text .lkwCountryId = txtLWKLand.Text - + .customsOfficeNr = sbBestimmungsZollstelle._value '.SAVE() @@ -146,7 +147,7 @@ Public Class frmDigicust Exit Sub End If - If api.uploadingCase(dig, settings, dgvAnhaenge, withAvisoData) Then + If api.uploadingCase(dig, settings, dgvAnhaenge, withAvisoData, cbxAbsender.Checked, cbxEmpfänger.Checked) Then dig.SAVE() Me.Close() End If @@ -296,6 +297,7 @@ Public Class frmDigicust Else + 'lblAnh.Visible = True getBezugsnr(BezugsNr) @@ -324,14 +326,15 @@ Public Class frmDigicust usrCntl_consignor.kdFirma.KdNr = SENDUNG.tblSnd_AbsenderKdNr End If - End If + + End If End Sub Sub initAttachment() Dim hSQL As String = " SELECT [anh_id],anh_Datum,[anh_Name],[anh_docId], - + case WHEN [anh_size] > 0 Then ROUND([anh_size] / 1000000,2) End as anh_size, CASE WHEN [anh_Art] = 'ATR-EUR1' then 'EUR1' when [anh_Art] = 'Rechnung' then 'invoice' when [anh_Art] = 'eFatura' then 'invoice' @@ -386,6 +389,11 @@ Public Class frmDigicust .Columns("anh_Datum").HeaderText = "Datum" .Columns("anh_Datum").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter + .Columns("anh_size").MinimumWidth = 50 + .Columns("anh_size").HeaderText = "Größe in MB" + .Columns("anh_size").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter + + .Columns("anh_Art").MinimumWidth = 50 .Columns("anh_Art").HeaderText = "Art" .Columns("anh_Art").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter @@ -394,8 +402,24 @@ Public Class frmDigicust .Columns("anh_Typ").HeaderText = "Typ" .Columns("anh_Typ").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter + End With + For Each doc As DataGridViewRow In dgvAnhaenge.Rows + + If Not IsDBNull(doc.Cells("anh_size").Value) AndAlso doc.Cells("anh_size").Value > 0 Then + Dim size = (doc.Cells("anh_size").Value) + If size < 1 Then + doc.DefaultCellStyle.BackColor = Color.LightGreen + ElseIf size > 1 AndAlso size < 5 Then + doc.DefaultCellStyle.BackColor = Color.LightYellow + Else + doc.DefaultCellStyle.BackColor = Color.IndianRed + End If + End If + + Next + End Sub @@ -459,15 +483,32 @@ Public Class frmDigicust sbBestimmungsZollstelle.initSearchBox(Me.FindForm, "[Code] ,[Code] as Nr,Description as Dienststelle,left(Code,2) as Land,[Description] +' (' +left(Code,2)+')' as display FROM [tbl_DY_ZollDE_C0141_Zollstellen]", {" [Code]", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", " left(Code,2),[Description]", "Code", "display", "FMZOLL", , 400, 200, {"display", "Code"}) End Sub + 'Private Sub dgvAnhaenge_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles dgvAnhaenge.CellLeave - 'Private Sub btnCreateToken_Click(sender As Object, e As EventArgs) - ' Label2.Text = "Status: " & api.authenticate(rtfToken.Text) - ' If rtfToken.Text <> "" Then - ' Label1.Text = "Token (valid 1h) until: " & Now().AddHours(1) - ' Else - ' Label1.Text = "Token (valid 1h)" + ' Dim countAnh As Double = 0 + ' If dgvAnhaenge.RowCount > 0 Then + + ' If dgvAnhaenge.Columns(e.ColumnIndex).Name = "anh_selekt" Then + + ' If Not IsDBNull(dgvAnhaenge.CurrentRow.Cells("anh_selekt").Value) AndAlso dgvAnhaenge.CurrentRow.Cells("anh_selekt").Value = True Then + ' countAnh += IIf(dgvAnhaenge.CurrentRow.Cells("anh_size").Value IsNot DBNull.Value, dgvAnhaenge.CurrentRow.Cells("anh_size").Value, 0) + ' End If + + ' For Each Row As DataGridViewRow In dgvAnhaenge.Rows + ' If Row.Cells("anh_selekt").Value IsNot DBNull.Value AndAlso Row.Cells("anh_selekt").Value = True AndAlso Row.Cells("anh_size").Value IsNot DBNull.Value Then + ' countAnh += IIf(Row.Cells("anh_size").Value IsNot DBNull.Value, Row.Cells("anh_size").Value, 0) + ' End If + ' Next + + ' lblAnh.Text = "Anhang in MB: " & countAnh.ToString + + ' End If + ' End If + + 'End Sub + End Class \ No newline at end of file diff --git a/Aviso/frmHauptfenster.vb b/Aviso/frmHauptfenster.vb index dda8c8f..8d5a1cf 100644 --- a/Aviso/frmHauptfenster.vb +++ b/Aviso/frmHauptfenster.vb @@ -593,27 +593,32 @@ Public Class frmHauptfenster End If + Try + If VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_timasId IsNot Nothing Then + Dim timas As New cTimasAPI + Dim infoMessage As New DataTable + Dim timeEntryExisting As Boolean = False + Dim isEndpointRunning As Boolean + timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, infoMessage, 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) + If a = vbYes Then + Dim info + timas.setTimeEntry(cAllgemein.MITARBEITER, Now, info, "in") + MsgBox(info) + Else - - If VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_timasId IsNot Nothing Then - Dim timas As New cTimasAPI - Dim infoMessage As New DataTable - Dim timeEntryExisting As Boolean = False - timas.getTimeEntries(cAllgemein.MITARBEITER.mit_timasId, infoMessage, timeEntryExisting) - If Not timeEntryExisting 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) - If a = vbYes Then - Dim info - timas.setTimeEntry(cAllgemein.MITARBEITER, Now, info, "in") - MsgBox(info) - Else + End If End If - End If - End If + End If + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try diff --git a/Aviso/frmSendungsdetailsNEU.vb b/Aviso/frmSendungsdetailsNEU.vb index a575973..0ed5834 100644 --- a/Aviso/frmSendungsdetailsNEU.vb +++ b/Aviso/frmSendungsdetailsNEU.vb @@ -3107,7 +3107,7 @@ Public Class frmSendungsdetailsNEU ElseIf TabControl1.SelectedTab Is tbKundenInfo Then initdgvATEZ() ElseIf TabControl1.SelectedTab Is tbDigicust Then - initdgvDigicust() + initdgvDigicust(SENDUNG_LIST(CURRENT_INDEX)) ElseIf TabControl1.SelectedTab Is tbKundenInfo Then Dim kdSrc As VERAG_PROG_ALLGEMEIN.KdSearchBox = txtAuftraggeber If kdSrc.KdNr_value <= 0 Then kdSrc = txtEmpfaenger @@ -6483,7 +6483,7 @@ Public Class frmSendungsdetailsNEU Dim SND As VERAG_PROG_ALLGEMEIN.cSendungen = SENDUNG_LIST(CURRENT_INDEX) Dim frm = New frmDigicust(AVISO, SND, Now.ToString("yy"), dgvDigicust) frm.Show(Me) - initdgvDigicust() + initdgvDigicust(SND) End If Catch ex As Exception @@ -6493,11 +6493,14 @@ Public Class frmSendungsdetailsNEU End Sub - Sub initdgvDigicust() + Sub initdgvDigicust(SND As VERAG_PROG_ALLGEMEIN.cSendungen) + + Dim refLength = SND.FilialenNr.ToString.Length + SND.AbfertigungsNr.ToString.Length + 1 + With dgvDigicust .Columns.Clear() .ReadOnly = False - .DataSource = SQL.loadDgvBySql("select Id, AvisoId, reference, digicustId, status, createdAt, modifiedAt, uploadedDocuments, companyId, projectId FROM [tblDigicust_Sendungen] WHERE AvisoId='" & AvisoId & "'", "FMZOLL") + .DataSource = SQL.loadDgvBySql("select Id, AvisoId, reference, digicustId, status, createdAt, modifiedAt, uploadedDocuments, companyId, projectId FROM [tblDigicust_Sendungen] WHERE AvisoId='" & AvisoId & "' AND left(reference," & refLength & ") = '" & SND.FilialenNr & "/" & SND.AbfertigungsNr & "'", "FMZOLL") If .Columns.Count <= 0 Then Exit Sub 'Ä.Columns("txtStatus").ReadOnly = False .Columns("Id").Visible = False @@ -6550,7 +6553,7 @@ Public Class frmSendungsdetailsNEU Dim API = New cDigicustAPI() API.fetchingCase(digiSendung) - initdgvDigicust() + initdgvDigicust(SENDUNG_LIST(CURRENT_INDEX)) End Sub