617 lines
26 KiB
VB.net
617 lines
26 KiB
VB.net
Imports DAKOSY_Worker
|
|
|
|
Imports Tamir
|
|
Imports Tamir.SharpSsh
|
|
|
|
Public Class usrCntlSGS_NCTS
|
|
|
|
Property ALLG As usrCntlATLAS_NCTS_Allg
|
|
Property ADRESSEN As usrCntlATLAS_ncts_Adressen
|
|
Property SICHERHEIT As usrCntlATLAS_NCTS_Sicherheit
|
|
Property POSITIONEN As usrCntlATLAS_NCTS_Positionen
|
|
Property VERSCHLUESSE As usrCntlATLAS_NCTS_Verschluesse
|
|
'Property FilialeNr As Integer
|
|
' Property AbfertigungsNr As Integer
|
|
Property Jahr2Stellig As Integer
|
|
Property zusatz As String
|
|
Property BezugsNr As String = ""
|
|
' Property AvisoId As Integer
|
|
'Property SENDUNGS_ID As Integer
|
|
Property AVISO As VERAG_PROG_ALLGEMEIN.cAviso
|
|
Property SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen
|
|
Dim sentToDakosy = False
|
|
|
|
Property isSTAMMREF As Boolean = False ' Wenn das Formular als Stammreferenz bearbeitet wird
|
|
Property STAMMREF As String = "" ' Wenn eine Stammrefereenz als Grundlage dient
|
|
|
|
Dim FIRMA_DY = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
|
|
|
|
Dim cDy_ART As String = If(FIRMA_DY = "ATILLA", "T2", "T1")
|
|
|
|
Dim ncts_OUT As VERAG_PROG_ALLGEMEIN.cNCTS_TR = Nothing
|
|
Dim DY_ANM As cDakosy_Zollanmeldungen = Nothing
|
|
|
|
Sub New(ncts_OUT As VERAG_PROG_ALLGEMEIN.cNCTS_TR, Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "")
|
|
InitializeComponent()
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
Me.ncts_OUT = ncts_OUT
|
|
DY_ANM = New cDakosy_Zollanmeldungen(ncts_OUT.ncts_dyaAnmID)
|
|
|
|
If DY_ANM.dy_AvisoId > 0 Then
|
|
Dim AV As New VERAG_PROG_ALLGEMEIN.cAvisoDAL
|
|
AVISO = AV.LesenAviso(DY_ANM.dy_AvisoId, "")
|
|
End If
|
|
If DY_ANM.dy_SendungsId > 0 Then
|
|
SENDUNG = New VERAG_PROG_ALLGEMEIN.cSendungen(DY_ANM.dy_SendungsId)
|
|
End If
|
|
End Sub
|
|
|
|
Sub New(DY_ANM As cDakosy_Zollanmeldungen, AVISO As VERAG_PROG_ALLGEMEIN.cAviso, SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen, Jahr2Stellig As Integer, Optional zusatz As String = "", Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "")
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
|
|
Me.Jahr2Stellig = Jahr2Stellig
|
|
Me.zusatz = zusatz
|
|
|
|
Me.AVISO = AVISO
|
|
Me.SENDUNG = SENDUNG
|
|
Me.DY_ANM = DY_ANM
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
|
|
|
|
If DY_ANM IsNot Nothing Then
|
|
Me.ncts_OUT = VERAG_PROG_ALLGEMEIN.cNCTS_TR.LOADByAnmIDFull(DY_ANM.dy_Id, True)
|
|
Me.cDy_ART = If(DY_ANM.dy_ART, "")
|
|
If Me.cDy_ART = "" And Me.ncts_OUT IsNot Nothing Then Me.cDy_ART = If(Me.ncts_OUT.ncts_ArtAnmeldung, "")
|
|
If Me.cDy_ART = "" Then Me.cDy_ART = "T1"
|
|
If ncts_OUT IsNot Nothing Then
|
|
Me.FIRMA_DY = If(Me.ncts_OUT.ncts_firma, "")
|
|
End If
|
|
|
|
End If
|
|
'DY_ANM = New cDakosy_Zollanmeldungen(ncts_OUT.ncts_dyaAnmID)
|
|
|
|
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
End Sub
|
|
|
|
Sub New(ART As String, AvisoId As Integer, SENDUNGS_ID As Integer, Jahr2Stellig As Integer, Optional zusatz As String = "", Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "")
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
Me.cDy_ART = If(ART = "NCTS", "T1", ART)
|
|
|
|
If AvisoId > 0 Then
|
|
Dim AV As New VERAG_PROG_ALLGEMEIN.cAvisoDAL
|
|
AVISO = AV.LesenAviso(AvisoId, "")
|
|
End If
|
|
If SENDUNGS_ID > 0 Then
|
|
SENDUNG = New VERAG_PROG_ALLGEMEIN.cSendungen(SENDUNGS_ID)
|
|
End If
|
|
|
|
Me.Jahr2Stellig = Jahr2Stellig
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
Me.zusatz = zusatz
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
End Sub
|
|
|
|
Sub New(ART As String, Aviso As VERAG_PROG_ALLGEMEIN.cAviso, SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen, Jahr2Stellig As Integer, Optional zusatz As String = "", Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "", Optional FIRMA_DY As String = "")
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
Me.cDy_ART = If(ART = "NCTS", "T1", ART)
|
|
|
|
Me.AVISO = Aviso
|
|
Me.SENDUNG = SENDUNG
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
|
|
Me.Jahr2Stellig = Jahr2Stellig
|
|
Me.zusatz = zusatz
|
|
If FIRMA_DY <> "" Then Me.FIRMA_DY = FIRMA_DY
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
End Sub
|
|
|
|
Function getBezugsnr(ByRef BezugsNr)
|
|
Dim BezugsNrTmp = ""
|
|
Select Case FIRMA_DY
|
|
Case "UNISPED"
|
|
If If(SENDUNG.tblSnd_DakosyRef, "") <> "" Then
|
|
BezugsNrTmp = SENDUNG.tblSnd_DakosyRef
|
|
Else
|
|
BezugsNrTmp = SENDUNG.FilialenNr & "/" & SENDUNG.AbfertigungsNr
|
|
End If
|
|
Case Else
|
|
BezugsNrTmp = SENDUNG.FilialenNr & "/" & SENDUNG.AbfertigungsNr '& If(zusatz <> "", "/" & zusatz, "") 'zusatz ' & "/" & Jahr2Stellig
|
|
End Select
|
|
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 usrCntlATLAS_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
'MsgBox("LOAD")
|
|
|
|
cboDakosyAction.Items.Clear()
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Neuen Datensatz erstellen", DY_ObjektAktion.OBJ_CREATE))
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Vohr. DS ändern", DY_ObjektAktion.OBJ_CHANGE))
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Vorh. DS stornieren", DY_ObjektAktion.OBJ_CANCEL))
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Datensatz an ZOLL senden", DY_ObjektAktion.OBJ_SEND))
|
|
cboDakosyAction.changeItem(DY_ObjektAktion.OBJ_CREATE)
|
|
|
|
Select Case FIRMA_DY
|
|
Case "VERAG" : txtDyMandant.Text = "VERG"
|
|
txtDyNiederlassung.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
|
|
' Select Case VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
|
|
'Case "SUB" : txtDyNiederlassung.Text = "VERG"
|
|
'Case "SUW" : txtDyNiederlassung.Text = "ATIL"
|
|
''Case "SBG" : txtDyNiederlassung.Text = "IMEX"
|
|
'Case "NEU" : txtDyNiederlassung.Text = "IMEX"
|
|
'Case "NKD" : txtDyNiederlassung.Text = "IMEX"
|
|
'End Select
|
|
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
|
|
|
|
|
|
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("")
|
|
|
|
SICHERHEIT = New usrCntlATLAS_NCTS_Sicherheit(ncts_OUT, FIRMA_DY)
|
|
VERSCHLUESSE = New usrCntlATLAS_NCTS_Verschluesse() 'ncts_OUT)
|
|
ADRESSEN = New usrCntlATLAS_ncts_Adressen(ncts_OUT, FIRMA_DY) ')
|
|
ALLG = New usrCntlATLAS_NCTS_Allg(ncts_OUT)
|
|
POSITIONEN = New usrCntlATLAS_NCTS_Positionen(ncts_OUT)
|
|
|
|
If isSTAMMREF Then
|
|
Me.BezugsNr = "STAMMREFERENZ"
|
|
If ncts_OUT Is Nothing Then ncts_OUT = New VERAG_PROG_ALLGEMEIN.cNCTS_TR()
|
|
ncts_OUT.ncts_ObjectName = BezugsNr
|
|
Else
|
|
If ncts_OUT Is Nothing Then ' NEUE ZOLLANMELDUNG
|
|
Dim f As New frmDakosyStammreferenz("DE", "NCTS", False,,, FIRMA_DY)
|
|
Dim Stammreferenz = Nothing
|
|
If f.ShowDialog(Me) Then
|
|
Stammreferenz = f.STAMMREF
|
|
sentToDakosy = f.sentToDakosy
|
|
End If
|
|
Try
|
|
|
|
BezugsNr = getBezugsnr(BezugsNr)
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message & ex.StackTrace)
|
|
End Try
|
|
ncts_OUT = VERAG_PROG_ALLGEMEIN.cNCTS_TR.LOADByBezugsNr(BezugsNr, True)
|
|
If ncts_OUT Is Nothing Then
|
|
'Falls zur BezugsNr schon ein Eintrag in der DB vorhanden ist
|
|
ncts_OUT = VERAG_PROG_ALLGEMEIN.cNCTS_TR.LOADByAnmIDFull(f.STAMMREF_DYID, True) ' DyID --> Falls bei der Stammreferenz eine Vorlage hinterlegt ist!
|
|
|
|
|
|
If ncts_OUT IsNot Nothing Then
|
|
'Stmmreferenz - Werte zurücksetzen, damit nicht falsch übergeben
|
|
ncts_OUT.ncts_dyaAnmID = -1
|
|
ncts_OUT.ncts_Id = -1
|
|
Else
|
|
ncts_OUT = New VERAG_PROG_ALLGEMEIN.cNCTS_TR()
|
|
End If
|
|
|
|
|
|
loaddataFromAVISO(ncts_OUT)
|
|
cboStammreferenz.changeItem(Stammreferenz)
|
|
|
|
|
|
End If
|
|
'ncts_OUT
|
|
|
|
Else
|
|
' ncts_OUT is ot nothing
|
|
Me.BezugsNr = ncts_OUT.ncts_ObjectName
|
|
'MsgBox(ncts_OUT.ncts_Hauptverpflichteter_Name)
|
|
|
|
End If
|
|
End If
|
|
If If(ncts_OUT.ncts_firma, "") = "" Then If FIRMA_DY <> "" Then ncts_OUT.ncts_firma = FIRMA_DY
|
|
|
|
If If(Me.cDy_ART, "") <> "" Then
|
|
'Muss noch überschrieben werdne, da sonst Art von Stammref hergenommen wird...
|
|
ncts_OUT.ncts_ArtAnmeldung = Me.cDy_ART
|
|
Else
|
|
'Wenn keine Art --> T1
|
|
If ncts_OUT.ncts_ArtAnmeldung Is Nothing Or ncts_OUT.ncts_ArtAnmeldung = "" Then
|
|
ncts_OUT.ncts_ArtAnmeldung = "T1"
|
|
End If
|
|
End If
|
|
|
|
|
|
'hinzufügen, damit alle Controls richtig geladen und initialisiert werden:s
|
|
Me.SplitContainer.Panel2.Controls.Add(SICHERHEIT)
|
|
Me.SplitContainer.Panel2.Controls.Add(VERSCHLUESSE)
|
|
Me.SplitContainer.Panel2.Controls.Add(ALLG)
|
|
Me.SplitContainer.Panel2.Controls.Add(POSITIONEN)
|
|
Me.SplitContainer.Panel2.Controls.Add(ADRESSEN)
|
|
|
|
' MsgBox(ncts_OUT.ncts_Hauptverpflichteter_Name)
|
|
'Werte setzen:
|
|
SICHERHEIT.setValues_TR(ncts_OUT.ncts_SICHERHEITSANGABEN)
|
|
'VERSCHLUESSE.setValues_TR(ncts_OUT)
|
|
ADRESSEN.setValues_TR(ncts_OUT)
|
|
ALLG.setValues(ncts_OUT)
|
|
POSITIONEN.setValues_TR(ncts_OUT)
|
|
|
|
If If(ncts_OUT.ncts_Stammreferenz, "") <> "" Then cboStammreferenz.changeItem(ncts_OUT.ncts_Stammreferenz)
|
|
|
|
'Controls wieder entfernen:
|
|
Me.SplitContainer.Panel2.Controls.Clear()
|
|
|
|
|
|
' If ALLG.txtKennnummer.Text = "" Then ALLG.txtKennnummer.Text = BezugsNr
|
|
|
|
|
|
|
|
' ADRESSEN.CreateControl()
|
|
For Each c In MyFlowLayoutPanel1.Controls
|
|
If c.GetType.ToString = GetType(System.Windows.Forms.Button).ToString Then
|
|
AddHandler DirectCast(c, System.Windows.Forms.Button).Click, AddressOf buttonClick
|
|
End If
|
|
Next
|
|
|
|
SplitContainer.Panel2.Controls.Add(ALLG)
|
|
lblBezugsnummer.Text = BezugsNr
|
|
|
|
|
|
|
|
|
|
ALLG.Dock = DockStyle.Fill
|
|
ADRESSEN.Dock = DockStyle.Fill
|
|
POSITIONEN.Dock = DockStyle.Fill
|
|
SICHERHEIT.Dock = DockStyle.Fill
|
|
VERSCHLUESSE.Dock = DockStyle.Fill
|
|
|
|
'
|
|
'
|
|
AddHandler POSITIONEN.RohmasseChanged, Sub(rohmasse, packstuecke)
|
|
Label5.Text = packstuecke.ToString("N0") & " Pk"
|
|
Label7.Text = rohmasse.ToString("N2") & " kg"
|
|
|
|
End Sub
|
|
AddHandler POSITIONEN.PosAnzChanged, Sub(anz)
|
|
Label3.Text = anz
|
|
End Sub
|
|
|
|
If isSTAMMREF Then
|
|
Button1.Visible = False
|
|
cboDakosyAction.Visible = False
|
|
lblBezugsnummer.Text = "STAMMREFERENZ"
|
|
lblBezugsnummer.ForeColor = Color.Red
|
|
End If
|
|
|
|
|
|
If sentToDakosy Then
|
|
|
|
Try
|
|
Me.Button1.PerformClick()
|
|
Me.FindForm.Close()
|
|
Catch
|
|
End Try
|
|
End If
|
|
Try
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("ZOLL_DakosyZA_AVISO_Edit", "AVISO") Then
|
|
Me.FindForm.Close()
|
|
End If
|
|
Catch
|
|
End Try
|
|
End Sub
|
|
|
|
Sub buttonClick(sender As Object, e As EventArgs) 'HANDLED
|
|
Dim btn As System.Windows.Forms.Button = DirectCast(sender, System.Windows.Forms.Button)
|
|
|
|
For Each c In MyFlowLayoutPanel1.Controls
|
|
If c.GetType.ToString = GetType(System.Windows.Forms.Button).ToString Then
|
|
DirectCast(c, System.Windows.Forms.Button).BackColor = Drawing.Color.White
|
|
DirectCast(c, System.Windows.Forms.Button).ForeColor = Drawing.Color.Black
|
|
End If
|
|
Next
|
|
|
|
btn.BackColor = Drawing.Color.SteelBlue 'Drawing.Color.FromArgb(0, 54, 128)
|
|
btn.ForeColor = Drawing.Color.White
|
|
|
|
|
|
SplitContainer.Panel2.Controls.Clear()
|
|
|
|
If btn Is btnAllgemein Then
|
|
SplitContainer.Panel2.Controls.Add(ALLG)
|
|
ElseIf btn Is btnAdressen Then
|
|
SplitContainer.Panel2.Controls.Add(ADRESSEN)
|
|
ElseIf btn Is btnSicherheit Then
|
|
SplitContainer.Panel2.Controls.Add(SICHERHEIT)
|
|
ElseIf btn Is btnVerschlüsse Then
|
|
SplitContainer.Panel2.Controls.Add(VERSCHLUESSE)
|
|
ElseIf btn Is btnPositionen Then
|
|
SplitContainer.Panel2.Controls.Add(POSITIONEN)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Sub loaddataFromAVISO(ByRef cdy As VERAG_PROG_ALLGEMEIN.cNCTS_TR)
|
|
Try
|
|
|
|
'==> VORBLENDUNG:
|
|
|
|
' Dim cdy As New VERAG_PROG_ALLGEMEIN.cNCTS_TR
|
|
cdy.ncts_ObjectName = BezugsNr
|
|
cdy.ncts_AbgangsDienststellennummer = "" '"DE007701" ' Neuhaus (öSTERR:)
|
|
frmZollanmeldung.setZollstelle(cdy.ncts_AbgangsDienststellennummer, AVISO)
|
|
|
|
cdy.ncts_dyaArt = cDy_ART
|
|
If AVISO IsNot Nothing Then
|
|
cdy.ncts_Befoerderungsmittel_KennzeichenAbgang = AVISO.LKW_Nr
|
|
cdy.ncts_Befoerderungsmittel_SttaszugehoerigkeitAbgangCode = AVISO.LKW_Nationalitaet
|
|
If VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG = "ATILLA" Then
|
|
cdy.ncts_Befoerderungsmittel_KennzeichenGrenzueberschreitend = "X"
|
|
Else
|
|
cdy.ncts_Befoerderungsmittel_KennzeichenGrenzueberschreitend = AVISO.LKW_Nr
|
|
cdy.ncts_Befoerderungsmittel_StaatszugehoerigkeitGrenzueberschreitendCode = AVISO.LKW_Nationalitaet
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
cdy.ncts_Befoerderungsmittel_VerkehrszweigGrenzueberschreitent = "3"
|
|
cdy.ncts_Befoerderungsmittel_ArtGrenzueberschreitung = "35"
|
|
|
|
|
|
|
|
If VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG = "ATILLA" Then
|
|
cdy.ncts_SumA_KzSumASicherheit = True
|
|
cdy.ncts_SumA_BesondereUmstaende = "C"
|
|
cdy.ncts_SumA_BefoerderungskostenZahlungsweise = "D"
|
|
cdy.ncts_SumA_Ladeort = "DE"
|
|
cdy.ncts_SumA_KennnummerSendung = "OHNE"
|
|
|
|
If AVISO.Frächter_KdNr IsNot Nothing AndAlso IsNumeric(AVISO.Frächter_KdNr) AndAlso AVISO.Frächter_KdNr > 0 Then
|
|
Dim AD_Befoerderer As New VERAG_PROG_ALLGEMEIN.cAdressen(AVISO.Frächter_KdNr) ' Befoerderer
|
|
Dim KD_Befoerderer As New VERAG_PROG_ALLGEMEIN.cKunde(AVISO.Frächter_KdNr) ' Befoerderer
|
|
cdy.ncts_SumA_Befoerderer_EORI = KD_Befoerderer.EORITIN
|
|
If KD_Befoerderer.EORITIN IsNot Nothing Then cdy.ncts_SumA_Befoerderer_NLNR = KD_Befoerderer.EORITIN_NL
|
|
cdy.ncts_SumA_Befoerderer_Name = (If(AD_Befoerderer.Name_1, "") & " " & If(AD_Befoerderer.Name_2, "")).trim
|
|
cdy.ncts_SumA_Befoerderer_StrasseHausnummer = AD_Befoerderer.Straße
|
|
cdy.ncts_SumA_Befoerderer_PLZ = AD_Befoerderer.PLZ
|
|
cdy.ncts_SumA_Befoerderer_Ort = AD_Befoerderer.Ordnungsbegriff
|
|
cdy.ncts_SumA_Befoerderer_Land = cProgramFunctions.getISO2Land(AD_Befoerderer.LandKz)
|
|
Else
|
|
cdy.ncts_SumA_Befoerderer_Name = If(AVISO.Frächter, "")
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
If SENDUNG IsNot Nothing Then
|
|
|
|
Dim p As VERAG_PROG_ALLGEMEIN.cNCTS_TR_Warenposition = Nothing
|
|
If cdy.ncts_WARENPOS.Count > 0 Then
|
|
p = cdy.ncts_WARENPOS(0)
|
|
Else
|
|
p = New VERAG_PROG_ALLGEMEIN.cNCTS_TR_Warenposition
|
|
cdy.ncts_WARENPOS.Add(p) ' schon wieder...'nciht mehr anfügen
|
|
End If
|
|
p.nctsWP_Warenbezeichnung = SENDUNG.tblSnd_Warenbezeichnung
|
|
If SENDUNG.tblSnd_Colli IsNot Nothing AndAlso IsNumeric(SENDUNG.tblSnd_Colli) Then
|
|
Dim pk As New VERAG_PROG_ALLGEMEIN.cNCTS_TR_WarenpositionPackstuecke
|
|
pk.nctsWpPk_PackstueckeAnzahl = SENDUNG.tblSnd_Colli
|
|
pk.nctsWpPk_Verpackungsart = "PK"
|
|
pk.nctsWpPk_ZeichenNummern = "OHNE"
|
|
p.nctsWP_PACKSTUECKE.Add(pk)
|
|
End If
|
|
p.nctsWP_Rohmasse = SENDUNG.tblSnd_Gewicht
|
|
p.nctsWP_Warenwert = SENDUNG.tblSnd_Warenwert
|
|
p.nctsWP_WarenwertWaehrung = SENDUNG.tblSnd_WarenwertWaehrung
|
|
' p.nctsWP_Warenbezeichnung = SENDUNG.tblSnd_Warenbezeichnung
|
|
p.nctsWP_VorpapierTyp = "OHNE"
|
|
|
|
If VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG = "ATILLA" Then
|
|
p.nctsWP_BesondereVermeke_Export = True
|
|
End If
|
|
'cdy.ncts_WARENPOS.Add(p)
|
|
|
|
cdy.ncts_Empfaenger_EORI = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_EORI)
|
|
cdy.ncts_Empfaenger_NLNR = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_EORI_NL)
|
|
cdy.ncts_Empfaenger_Name = cProgramFunctions.isLeerNothing(SENDUNG.tblSnd_NCTSVerzollungsadresse)
|
|
cdy.ncts_Empfaenger_StrasseHausnummer = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_Strasse)
|
|
cdy.ncts_Empfaenger_PLZ = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_PLZ)
|
|
cdy.ncts_Empfaenger_Ort = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_Ort)
|
|
cdy.ncts_Empfaenger_Land = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Verzollungsadresse_Land)
|
|
cdy.ncts_BestimmungsstelleDienststellennummer = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Bestimmungszollstelle)
|
|
|
|
|
|
If SENDUNG.tblSnd_AbsenderKdNr > 0 Then
|
|
Dim adVERSENDER As New VERAG_PROG_ALLGEMEIN.cAdressen(SENDUNG.tblSnd_AbsenderKdNr)
|
|
Dim kdVERSENDER As New VERAG_PROG_ALLGEMEIN.cKunde(SENDUNG.tblSnd_AbsenderKdNr)
|
|
cdy.ncts_Versender_EORI = kdVERSENDER.EORITIN
|
|
cdy.ncts_Versender_NLNR = kdVERSENDER.EORITIN_NL
|
|
cdy.ncts_Versender_Name = If(adVERSENDER.Name_1, "") & If(adVERSENDER.Name_2, "")
|
|
cdy.ncts_Versender_StrasseHausnummer = adVERSENDER.Straße
|
|
cdy.ncts_Versender_PLZ = adVERSENDER.PLZ
|
|
cdy.ncts_Versender_Ort = adVERSENDER.Ort
|
|
If adVERSENDER.LandKz IsNot Nothing Then cdy.ncts_Versender_Land = cProgramFunctions.getISO2Land(adVERSENDER.LandKz)
|
|
' cdy.ncts_BestimmungsstelleDienststellennummer = cProgramFunctions.isLeerNothing(SENDUNG.NCTS_Bestimmungszollstelle)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
' NCTS= cdy
|
|
Catch ex As Exception
|
|
MsgBox(ex.StackTrace)
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
Sub setValue(ncts_OUT)
|
|
BezugsNr = ncts_OUT.ncts_ObjectName
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub pnl_Paint(sender As Object, e As PaintEventArgs)
|
|
|
|
End Sub
|
|
|
|
Sub loadDYZollanmeldungen(Optional Status As String = "") ' + Speichern
|
|
If DY_ANM Is Nothing Then
|
|
DY_ANM = New cDakosy_Zollanmeldungen(ncts_OUT.ncts_dyaAnmID)
|
|
End If
|
|
DY_ANM.dy_ART = ALLG.NCTS_ART 'cDy_ART
|
|
DY_ANM.dy_BezugsNr = BezugsNr
|
|
DY_ANM.dy_AvisoId = If(AVISO Is Nothing, Nothing, AVISO.AvisoID)
|
|
DY_ANM.dy_SendungsId = If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID)
|
|
'Status?
|
|
DY_ANM.SAVE() 'Speichern, ID wird erzeugt
|
|
|
|
End Sub
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
|
|
Me.Refresh()
|
|
Me.Cursor = Cursors.WaitCursor
|
|
If sentToDakosy OrElse vbYes = MsgBox("Sollen die Daten abgeschickt werden?" & vbNewLine & "Eine Änderung ist nur noch in der Dakosy Software möglich.", vbYesNoCancel) Then
|
|
' Dim cDyAnm As New cDakosy_Zollanmeldungen(cDy_ART, BezugsNr, AVISO.AvisoID, SENDUNG.tblSnd_SendungID)
|
|
loadDYZollanmeldungen()
|
|
|
|
If ncts_OUT IsNot Nothing Then
|
|
'Dim cDY As New VERAG_PROG_ALLGEMEIN.cNCTS_TR(cDyAnm.dy_Id, cDyAnm.dy_Erstellung_SB)
|
|
ncts_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
|
|
ncts_OUT.ncts_Erstellung_SB = DY_ANM.dy_Erstellung_SB
|
|
ncts_OUT.ncts_LetzteBearbeitung = Now
|
|
ncts_OUT.ncts_LetzteBearbeitung_SB = DY_ANM.dy_LetzteBearbeitung_SB
|
|
ncts_OUT.ncts_Partnersystem = "VERAG_SGS" ' eigene Anmeldungen in Fremdsystem
|
|
ncts_OUT.ncts_Status = DAKOSY_Worker.cDY_Statusliste.S_05
|
|
ncts_OUT.ncts_Status_KEWILL_Equivalent = DAKOSY_Worker.cDY_Statusliste.S_05
|
|
loadInClass_VersandanmeldungNCTS(ncts_OUT, Me, FIRMA_DY)
|
|
|
|
|
|
If Not ncts_OUT.SAVE_ALL() Then Exit Sub
|
|
|
|
Dim saveFile = ""
|
|
If VERAG_PROG_ALLGEMEIN.cSGSInterface.generateVersandanmeldungNCTS(ncts_OUT, saveFile, cboDakosyAction._value) Then
|
|
If saveFile <> "" Then
|
|
If cDakosyFunftions.send_Data_To_Dakosy_FTP(saveFile, BezugsNr, DY_ANM.dy_Id, FIRMA_DY) Then
|
|
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_03)
|
|
Else
|
|
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_09)
|
|
MsgBox("Sendefehler!")
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
DY_ANM.UPDATE_DATA()
|
|
Me.FindForm.Close()
|
|
End If
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
|
|
Private Sub SpeichernToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SpeichernToolStripMenuItem.Click
|
|
|
|
Me.Refresh()
|
|
|
|
' Dim cDyAnm As New cDakosy_Zollanmeldungen(cDy_ART, BezugsNr, If(AVISO Is Nothing, Nothing, AVISO.AvisoID), If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID))
|
|
loadDYZollanmeldungen()
|
|
|
|
If ncts_OUT IsNot Nothing Then
|
|
'Dim cDY As New VERAG_PROG_ALLGEMEIN.cNCTS_TR(cDyAnm.dy_Id, cDyAnm.dy_Erstellung_SB)
|
|
ncts_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
|
|
ncts_OUT.ncts_Erstellung_SB = DY_ANM.dy_Erstellung_SB
|
|
ncts_OUT.ncts_LetzteBearbeitung = Now
|
|
ncts_OUT.ncts_LetzteBearbeitung_SB = DY_ANM.dy_LetzteBearbeitung_SB
|
|
ncts_OUT.ncts_Partnersystem = "VERAG_SGS" ' eigene Anmeldungen in Fremdsystem
|
|
ncts_OUT.ncts_Status = DAKOSY_Worker.cDY_Statusliste.S_00
|
|
ncts_OUT.ncts_Status_KEWILL_Equivalent = DAKOSY_Worker.cDY_Statusliste.S_00
|
|
|
|
loadInClass_VersandanmeldungNCTS(ncts_OUT, Me, FIRMA_DY)
|
|
|
|
If Not ncts_OUT.SAVE_ALL() Then
|
|
'gespeichert
|
|
End If
|
|
|
|
|
|
End If
|
|
DY_ANM.UPDATE_DATA()
|
|
|
|
End Sub
|
|
|
|
Private Sub NeueBezugsnummerVergebenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NeueBezugsnummerVergebenToolStripMenuItem.Click
|
|
BezugsNr = getBezugsnr(BezugsNr)
|
|
End Sub
|
|
|
|
Function loadInClass_VersandanmeldungNCTS(ByRef NCTS As VERAG_PROG_ALLGEMEIN.cNCTS_TR, USRCNTL As usrCntlSGS_NCTS, FIRMA_DY As String) As VERAG_PROG_ALLGEMEIN.cNCTS_TR
|
|
Try
|
|
|
|
Select Case FIRMA_DY
|
|
Case "UNISPED"
|
|
NCTS.ncts_Trans_Partner = "UNAT"
|
|
Case Else
|
|
NCTS.ncts_Trans_Partner = "VERA"
|
|
End Select
|
|
|
|
NCTS.ncts_Trans_DatumZeit = Now
|
|
NCTS.ncts_Gestellt = False
|
|
NCTS.ncts_Status = "00"
|
|
NCTS.ncts_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
|
|
NCTS.ncts_Trans_Referenz = USRCNTL.BezugsNr & "_" & Now.ToString("ddMMyyHHmmSS") 'Eindeutig
|
|
NCTS.ncts_ObjectAlias = If(USRCNTL.AVISO IsNot Nothing, USRCNTL.AVISO.AvisoID, Nothing)
|
|
NCTS.ncts_Trans_Version = "003"
|
|
NCTS.ncts_Trans_Div1 = "ATILLA"
|
|
'NCTS.ncts_Trans_Div1 = "ATILLA"
|
|
'NCTS.ncts_Trans_Div1 = "ATILLA"
|
|
|
|
NCTS.ncts_Stammreferenz = If(USRCNTL.cboStammreferenz._value = "", Nothing, USRCNTL.cboStammreferenz._value)
|
|
NCTS.ncts_BezugsnummerVorblendung = NCTS.ncts_Stammreferenz
|
|
|
|
NCTS.ncts_ObjectName = USRCNTL.BezugsNr
|
|
'NCTS.ncts_ObjectAlias = USRCNTL.AVISO.AvisoID
|
|
USRCNTL.ALLG.getValues(NCTS)
|
|
USRCNTL.ADRESSEN.getValues_TR(NCTS)
|
|
USRCNTL.POSITIONEN.getValues_TR(NCTS)
|
|
NCTS.ncts_SICHERHEITSANGABEN = USRCNTL.SICHERHEIT.getValues_TR()
|
|
'USRCNTL.VERSCHLUESSE.getValues_TR(NCTS)
|
|
'NCTS.ncts_WARENPOS=USRCNTL.POSITIONEN.getValues()
|
|
'--------------------------------
|
|
|
|
|
|
|
|
Return NCTS
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message & ex.StackTrace)
|
|
Return Nothing
|
|
End Try
|
|
End Function
|
|
|
|
End Class
|
|
|