208 lines
13 KiB
VB.net
208 lines
13 KiB
VB.net
Imports DocumentFormat.OpenXml.Drawing.Charts
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
Imports VERAG_PROG_ALLGEMEIN.TESTJSON
|
|
|
|
Public Class frmATEZNCTS
|
|
|
|
Dim ART As String = ""
|
|
Dim FilialenNr As Integer
|
|
Dim AbfertigungsNr As Integer
|
|
Dim JAHR As Integer = Now.ToString("yy")
|
|
Public isSTAMMREF As Boolean = False
|
|
Public STAMMREF As String = ""
|
|
Public CopyFromZA_Id As Integer = -1
|
|
Dim FIRMA_DY = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
|
|
Dim ZOLL_SYSTEM = "DAKOSY"
|
|
Dim DY As DAKOSY_Worker.cDakosy_Zollanmeldungen = Nothing
|
|
Public ATT As List(Of String)
|
|
Dim AVISO As New cAviso
|
|
Dim zusatz As String
|
|
Dim cDy_ART As String = If(FIRMA_DY = "ATILLA", "T2", "T1")
|
|
Property BezugsNr As String = ""
|
|
Property SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen
|
|
|
|
|
|
|
|
|
|
Sub New(ART As String, DY As DAKOSY_Worker.cDakosy_Zollanmeldungen, AVISO As VERAG_PROG_ALLGEMEIN.cAviso, SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen, JAHR As Integer, Optional ZOLL_SYSTEM As String = "DAKOSY")
|
|
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
Me.DY = DY
|
|
Me.AVISO = AVISO
|
|
Me.ART = ART
|
|
Me.SENDUNG = SENDUNG
|
|
Me.JAHR = JAHR
|
|
Me.ZOLL_SYSTEM = ZOLL_SYSTEM
|
|
|
|
If SENDUNG IsNot Nothing Then
|
|
Me.FilialenNr = SENDUNG.FilialenNr
|
|
Me.AbfertigungsNr = SENDUNG.AbfertigungsNr
|
|
End If
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
|
|
End Sub
|
|
|
|
Sub New(AVISO As VERAG_PROG_ALLGEMEIN.cAviso, SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen, JAHR As Integer)
|
|
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
Me.AVISO = AVISO
|
|
Me.SENDUNG = SENDUNG
|
|
Me.JAHR = JAHR
|
|
|
|
If SENDUNG IsNot Nothing Then
|
|
Me.FilialenNr = SENDUNG.FilialenNr
|
|
Me.AbfertigungsNr = SENDUNG.AbfertigungsNr
|
|
End If
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Dim failreDesc As String
|
|
|
|
Dim atezData As New cATEZ_NCTS_DATA
|
|
Dim atez As New cATEZ_NCTS_IN
|
|
|
|
With atezData
|
|
|
|
.VERAG_LRN = lblBezugsnummer.Text
|
|
.LicensePlateContainerNo = txtLKWId.Text
|
|
.DAKOSY_IOPartner = txtDyNiederlassung.Text & txtDyNiederlassung.Text
|
|
.DAKOSY_Division1 = ""
|
|
.DepartureCustomsOffice = ""
|
|
.DatDeterminationLimit = txtDat.Text
|
|
.CoolingTemperature = IIf(cbxTemperatur.Checked, txtTransporttemp.Text, "")
|
|
|
|
.Carrier_Name = ""
|
|
.Carrier_Adress_City = ""
|
|
.Carrier_Adress_Country = ""
|
|
.Carrier_Adress_Postcode = ""
|
|
.Carrier_Adress_Street = ""
|
|
.Carrier_EORI = ""
|
|
|
|
.Guarantee_GRN = "" 'leer lassen
|
|
|
|
|
|
|
|
'Datenzuweisung machen!
|
|
.SAVE()
|
|
|
|
End With
|
|
|
|
Dim test = atez.authenticate()
|
|
If test <> "200" Then
|
|
failreDesc = "Authentifizierung fehlgeschlagen" & vbNewLine & "Vorgang abgebrochen!"
|
|
MsgBox(failreDesc)
|
|
Exit Sub
|
|
End If
|
|
|
|
|
|
If Not atez.setJson(atezData, dgvAnhaenge) Then MsgBox("Fehler beim Erstellen der Daten")
|
|
|
|
atez.SendRequestWithAuthHeader("application/json", failreDesc)
|
|
|
|
If failreDesc <> "" Then
|
|
atezData.status = failreDesc
|
|
atezData.SAVE()
|
|
MsgBox(failreDesc)
|
|
Else
|
|
atezData.status = "Sent"
|
|
atezData.SAVE()
|
|
End If
|
|
End Sub
|
|
|
|
Function getBezugsnr(ByRef BezugsNr)
|
|
Dim BezugsNrTmp = ""
|
|
BezugsNrTmp = SENDUNG.FilialenNr & "/" & SENDUNG.AbfertigungsNr '& If(zusatz <> "", "/" & zusatz, "") 'zusatz ' & "/" & Jahr2Stellig
|
|
BezugsNr = BezugsNrTmp
|
|
zusatz = "A"
|
|
'Soloagne bis die Bezugsnummer noch nicht existiert
|
|
While DAKOSY_Worker.cDakosy_Zollanmeldungen.ExistsBezugsNr(BezugsNr) 'IsNot Nothing
|
|
BezugsNr = BezugsNrTmp & "/" & zusatz
|
|
|
|
If zusatz.Length = 1 Then
|
|
zusatz = Chr(Asc(zusatz.ToString) + 1)
|
|
Else
|
|
zusatz = zusatz.Substring(0, 1) & Chr(Asc(zusatz.Substring(0, 2).ToString) + 1)
|
|
End If
|
|
|
|
If zusatz = "Z" Then zusatz = "AA"
|
|
End While
|
|
lblBezugsnummer.Text = BezugsNr
|
|
Return BezugsNr
|
|
End Function
|
|
|
|
Private Sub frmATEZNCTS_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
Select Case FIRMA_DY
|
|
Case "VERAG" : txtDyMandant.Text = "VERG"
|
|
txtDyNiederlassung.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
|
|
Case "ATILLA" : txtDyMandant.Text = "ATIL" : txtDyNiederlassung.Text = "SUW"
|
|
Case "UNISPED" : txtDyMandant.Text = "UNAT" : txtDyNiederlassung.Text = "ATSPED"
|
|
Case "IMEX" : txtDyMandant.Text = "IMEX" : txtDyNiederlassung.Text = "IME"
|
|
Case "AMBAR" : txtDyMandant.Text = "ATIL" : txtDyNiederlassung.Text = "AMBWO"
|
|
End Select
|
|
|
|
initSeachboxes()
|
|
initAttachment()
|
|
|
|
cboStammreferenz.fillWithSQL("SELECT [dySr_Stammreferenz],[dySr_Bezeichnung] FROM [tblDakosy_Stammreferenzen] WHERE dySr_Land='DE' AND dySr_Verfahren='NCTS' and dySr_dy_Mandant='" & txtDyMandant.Text & "' and dySr_dy_Niederlassung IN ('','" & txtDyNiederlassung.Text & "') and dySr_visible=1", False, "FMZOLL", True)
|
|
cboStammreferenz.changeItem("")
|
|
|
|
getBezugsnr(BezugsNr)
|
|
txtLKWId.Text = AVISO.LKW_Nr
|
|
|
|
sbAbgangZollstelle._value = SENDUNG.NCTS_Bestimmungszollstelle
|
|
sbBestimmungsZollstelle._value = SENDUNG.NCTS_Bestimmungszollstelle
|
|
|
|
usrCntl_Carrier.KundenNr = SENDUNG.tblSnd_FrachtfuehrerKdNr
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Sub initAttachment()
|
|
dgvAnhaenge.Rows.Clear()
|
|
|
|
If ATT Is Nothing Then
|
|
Exit Sub
|
|
End If
|
|
|
|
dgvAnhaenge.ClearSelection()
|
|
End Sub
|
|
|
|
|
|
Sub initSeachboxes()
|
|
|
|
sbAbgangZollstelle.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"})
|
|
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"})
|
|
|
|
sbDurchgangszollstelle1.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"})
|
|
sbDurchgangszollstelle2.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"})
|
|
sbDurchgangszollstelle3.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"})
|
|
sbDurchgangszollstelle4.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"})
|
|
sbDurchgangszollstelle5.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"})
|
|
sbDurchgangszollstelle6.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"})
|
|
sbDurchgangszollstelle7.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"})
|
|
sbDurchgangszollstelle8.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"})
|
|
sbDurchgangszollstelle9.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"})
|
|
|
|
|
|
sbRoute1.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute2.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute3.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute4.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute5.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute6.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute7.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute8.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
sbRoute9.initSearchBox(Me.FindForm, " [Code] ,[Description] as Land,[Code]+' - ' +[Description] as display FROM tbl_DY_ZollDE_C0008_LaenderFull", {"Code", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", "Code", "Code", "display", "FMZOLL", , 400, 200)
|
|
End Sub
|
|
End Class |