CBAM/VERAG Zollanmeldungen

This commit is contained in:
2026-01-13 10:01:43 +01:00
parent 11bc5bfa95
commit a8504ac3a2
10 changed files with 158 additions and 77 deletions

View File

@@ -431,6 +431,18 @@ list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("eza_BezugsnummerBEAnteilZL", eza_
End Try
Return LOADByAnmID
End Function
Sub loadAll()
Me.LOAD_Unterlagen()
Me.LOAD_Warenposition()
Me.LOAD_Adressen()
Me.LOAD_Aufschub()
Me.LOAD_BEAnteilZLAVUV()
Me.LOAD_SumABeendigungsAnteil()
End Sub
Shared Function LOADByBezugsNr(bezugsNr As String, loadALL As Boolean, Optional checkValidStatus As Boolean = False) As cDakosyEZA
Try
Dim EZA As New cDakosyEZA

View File

@@ -208,6 +208,30 @@ Public Class cDakosyEZA_Greenpulse
Return dest
End Function
Public Shared Sub INSERT_KAFKA(za As cVERAG_CustomsDeclarations)
Try
If VERAG_PROG_ALLGEMEIN.cAllgemein.PARAMS Is Nothing Then
VERAG_PROG_ALLGEMEIN.cAllgemein.PARAMS = New cParameterList(VERAG_PROG_ALLGEMEIN.cAllgemein.PROGID)
End If
If VERAG_PROG_ALLGEMEIN.cAllgemein.PARAMS.GET_PARAMETER_VALUE_BOOL("CBAM_INSERT_KAFKA") Then
Dim key = cATEZ_Greenpulse_KafkaDecs.GetUniqueKey_Pipe_FromVERAG_CustomsDec(za, za.za_MRN)
Dim rec = cDakosyEZA_Greenpulse.BuildByMrn(za)
Dim dr = cATEZ_Greenpulse_KafkaDecs.InsertOrUpdateToKafkaSync_Bool(rec, key, 30000)
'Unlerlagen
If za.za_SendungsId IsNot Nothing AndAlso za.za_SendungsId > 0 Then
Dim rec_inv = cDakosyEZA_Greenpulse.BuildInvoices(za.za_SendungsId)
Dim dr_inv = cATEZ_Greenpulse_KafkaInvoices.InsertOrUpdateToKafkaSync_Bool(rec_inv, key, 30000)
End If
End If
Catch ex As Exception
Try
cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & vbNewLine & za.za_MRN, Reflection.MethodInfo.GetCurrentMethod.Name)
Catch ex2 As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Try
End Sub
Public Shared Function BuildByMrn(za As cVERAG_CustomsDeclarations) As cATEZ_Greenpulse_KafkaDecs
If za Is Nothing Then Throw New ArgumentNullException(NameOf(za))

View File

@@ -13,7 +13,7 @@ Public Class cImporter_DHFToVERAG
' =====================================================================
' MAIN ENTRY
' =====================================================================
Public Function ImportEZOLLByLRN(CRN As String, EZOLL_DB As String, Optional overwrite As Boolean = True, Optional freshInsert As Boolean = True) As Boolean
Public Function ImportEZOLLByLRN(CRN As String, EZOLL_DB As String, Optional overwrite As Boolean = True, Optional freshInsert As Boolean = False) As Boolean
Try
If String.IsNullOrWhiteSpace(CRN) Then Return False
@@ -192,10 +192,12 @@ Public Class cImporter_DHFToVERAG
ZA.checkfreshCBAMWarning()
End If
' ---------------------------------------------------------------
' SAVE
' ---------------------------------------------------------------
Return ZA.SAVE()
Dim saved = ZA.SAVE()
' ======KAFKA==========================================================
If freshInsert Then cDakosyEZA_Greenpulse.INSERT_KAFKA(ZA)
' ================================================================
Return saved
Catch ex As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, MethodInfo.GetCurrentMethod.Name)

View File

@@ -34,92 +34,92 @@ Public Class cImporter_DakosyToVERAG
' ================================================================
' HEADER
' ================================================================
Dim VERAG_ZA As cVERAG_CustomsDeclarations
Dim ZA As cVERAG_CustomsDeclarations
If If(eza.eza_MRN, If(eza.eza_ANR, "")) = "" Then
VERAG_ZA = New cVERAG_CustomsDeclarations
ZA = New cVERAG_CustomsDeclarations
Else
VERAG_ZA = cVERAG_CustomsDeclarations.loadByMRN(If(eza.eza_MRN, If(eza.eza_ANR, "")), False)
ZA = cVERAG_CustomsDeclarations.loadByMRN(If(eza.eza_MRN, If(eza.eza_ANR, "")), False)
End If
VERAG_ZA.za_System = "DAKOSY"
VERAG_ZA.za_CustomsSystem = "ATLAS"
VERAG_ZA.za_REGIME = "IMPORT"
VERAG_ZA.za_CustomsSystemCountry = "DE"
VERAG_ZA.za_IsExternalSystem = False
VERAG_ZA.za_IsFinalDeclaration = True
ZA.za_System = "DAKOSY"
ZA.za_CustomsSystem = "ATLAS"
ZA.za_REGIME = "IMPORT"
ZA.za_CustomsSystemCountry = "DE"
ZA.za_IsExternalSystem = False
ZA.za_IsFinalDeclaration = True
VERAG_ZA.za_Firma = eza.eza_firma
VERAG_ZA.za_Niederlassung = eza.eza_niederlassung
ZA.za_Firma = eza.eza_firma
ZA.za_Niederlassung = eza.eza_niederlassung
VERAG_ZA.za_MRN = If(eza.eza_MRN, eza.eza_ANR)
VERAG_ZA.za_LRN = eza.eza_ObjectName
ZA.za_MRN = If(eza.eza_MRN, eza.eza_ANR)
ZA.za_LRN = eza.eza_ObjectName
VERAG_PROG_ALLGEMEIN.cProgramFunctions.tryGetFirmaNiederlassung(VERAG_ZA.za_Firma, VERAG_ZA.za_Niederlassung, "", VERAG_ZA.za_LRN)
VERAG_PROG_ALLGEMEIN.cProgramFunctions.tryGetAvisoId_SndId_ByLRN(VERAG_ZA.za_LRN, VERAG_ZA.za_AvisoId, VERAG_ZA.za_SendungsId)
VERAG_PROG_ALLGEMEIN.cProgramFunctions.tryGetFirmaNiederlassung(ZA.za_Firma, ZA.za_Niederlassung, "", ZA.za_LRN)
VERAG_PROG_ALLGEMEIN.cProgramFunctions.tryGetAvisoId_SndId_ByLRN(ZA.za_LRN, ZA.za_AvisoId, ZA.za_SendungsId)
Dim DY = cDakosy_Zollanmeldungen.LOADById(eza.eza_dyaAnmID)
If DY IsNot Nothing Then
If VERAG_ZA.za_AvisoId Is Nothing AndAlso DY.dy_AvisoId IsNot Nothing Then VERAG_ZA.za_AvisoId = DY.dy_AvisoId
If VERAG_ZA.za_SendungsId Is Nothing AndAlso DY.dy_SendungsId IsNot Nothing Then VERAG_ZA.za_SendungsId = DY.dy_SendungsId
If ZA.za_AvisoId Is Nothing AndAlso DY.dy_AvisoId IsNot Nothing Then ZA.za_AvisoId = DY.dy_AvisoId
If ZA.za_SendungsId Is Nothing AndAlso DY.dy_SendungsId IsNot Nothing Then ZA.za_SendungsId = DY.dy_SendungsId
End If
If eza.eza_Anmeldedatum IsNot Nothing AndAlso eza.eza_Anmeldedatum.ToString <> "" Then
VERAG_ZA.za_DeclarationDate = CDate(eza.eza_Anmeldedatum)
VERAG_ZA.za_ReleaseDate = CDate(eza.eza_Anmeldedatum)
ZA.za_DeclarationDate = CDate(eza.eza_Anmeldedatum)
ZA.za_ReleaseDate = CDate(eza.eza_Anmeldedatum)
Else
Dim dateumRelease As String = (New VERAG_PROG_ALLGEMEIN.SQL).DLookup("isnull(dySt_DakosyTransaktionsDatum,'')", "[tblDakosy_Statusmeldungen]", " dySt_status = 60 And dySt_dyId = '" & eza.eza_dyaAnmID & "' Order By [dySt_DakosyTransaktionsDatum] desc", "FMZOLL",)
If dateumRelease <> "" AndAlso IsDate(dateumRelease) Then
VERAG_ZA.za_DeclarationDate = CDate(dateumRelease)
VERAG_ZA.za_ReleaseDate = CDate(dateumRelease)
ZA.za_DeclarationDate = CDate(dateumRelease)
ZA.za_ReleaseDate = CDate(dateumRelease)
Else
VERAG_ZA.za_DeclarationDate = ToNullableDate(If(eza.eza_Anmeldedatum, eza.eza_LetzteBearbeitung))
VERAG_ZA.za_ReleaseDate = ToNullableDate(If(eza.eza_Anmeldedatum, eza.eza_LetzteBearbeitung))
ZA.za_DeclarationDate = ToNullableDate(If(eza.eza_Anmeldedatum, eza.eza_LetzteBearbeitung))
ZA.za_ReleaseDate = ToNullableDate(If(eza.eza_Anmeldedatum, eza.eza_LetzteBearbeitung))
End If
End If
VERAG_ZA.za_MainProcedure = eza.eza_VerfahrenBeantragtCode
VERAG_ZA.za_RepresentationCode = eza.eza_VertretungsVerhaeltnisCode
VERAG_ZA.za_FiscalRepFlag = ToNullableBool(eza.eza_FiskalvertretungKz)
VERAG_ZA.za_ApplicantVATNo = ToStringSafe(eza.eza_UstIdAnmelder)
VERAG_ZA.za_ApplicantTaxOffice = ToStringSafe(eza.eza_FinanzamtAnmelder)
VERAG_ZA.za_TaxDeduction = ToNullableBool(eza.eza_Vorsteuerabzug)
ZA.za_MainProcedure = eza.eza_VerfahrenBeantragtCode
ZA.za_RepresentationCode = eza.eza_VertretungsVerhaeltnisCode
ZA.za_FiscalRepFlag = ToNullableBool(eza.eza_FiskalvertretungKz)
ZA.za_ApplicantVATNo = ToStringSafe(eza.eza_UstIdAnmelder)
ZA.za_ApplicantTaxOffice = ToStringSafe(eza.eza_FinanzamtAnmelder)
ZA.za_TaxDeduction = ToNullableBool(eza.eza_Vorsteuerabzug)
VERAG_ZA.za_CountryDispatch = eza.eza_VersendungsLandCode
VERAG_ZA.za_CountryDestination = eza.eza_Bestimmungsland
VERAG_ZA.za_CountryDestinationState = eza.eza_Bestimmungsbundesland
ZA.za_CountryDispatch = eza.eza_VersendungsLandCode
ZA.za_CountryDestination = eza.eza_Bestimmungsland
ZA.za_CountryDestinationState = eza.eza_Bestimmungsbundesland
VERAG_ZA.za_ContainerNr1 = eza.eza_ContainerNr1
VERAG_ZA.za_ContainerNr2 = eza.eza_ContainerNr2
VERAG_ZA.za_ContainerNr3 = eza.eza_ContainerNr3
VERAG_ZA.za_ContainerNr4 = eza.eza_ContainerNr4
VERAG_ZA.za_ContainerNr5 = eza.eza_ContainerNr5
VERAG_ZA.za_ContainerNr6 = eza.eza_ContainerNr6
VERAG_ZA.za_ContainerNr7 = eza.eza_ContainerNr7
VERAG_ZA.za_ContainerNr8 = eza.eza_ContainerNr8
VERAG_ZA.za_ContainerNr9 = eza.eza_ContainerNr9
ZA.za_ContainerNr1 = eza.eza_ContainerNr1
ZA.za_ContainerNr2 = eza.eza_ContainerNr2
ZA.za_ContainerNr3 = eza.eza_ContainerNr3
ZA.za_ContainerNr4 = eza.eza_ContainerNr4
ZA.za_ContainerNr5 = eza.eza_ContainerNr5
ZA.za_ContainerNr6 = eza.eza_ContainerNr6
ZA.za_ContainerNr7 = eza.eza_ContainerNr7
ZA.za_ContainerNr8 = eza.eza_ContainerNr8
ZA.za_ContainerNr9 = eza.eza_ContainerNr9
VERAG_ZA.za_MeansOfTransport_Vehicle = eza.eza_KennzeichenNameBefoerderungsmittelAnkunft
VERAG_ZA.za_MeansOfTransport_Nationality = eza.eza_BeförderungsmittelGrenzeStaatszugehörigkeitCode
VERAG_ZA.za_MeansOfTransport_Type = eza.eza_BeförderungsmittelGrenzeArt
VERAG_ZA.za_CountryImport = "DE"
VERAG_ZA.za_WarehouseCode = eza.eza_Warenort
VERAG_ZA.za_InvoiceAmount = eza.eza_Rechnungspreis
VERAG_ZA.za_InvoiceCurrency = eza.eza_Rechnungswaehrung
VERAG_ZA.za_DV1Flag = ToNullableBool(eza.eza_DV1Kz)
VERAG_ZA.za_PrevDocument_No = eza.eza_VorpapierNr
VERAG_ZA.za_PrevDocument_Type = eza.eza_VorpapierArtCode
ZA.za_MeansOfTransport_Vehicle = eza.eza_KennzeichenNameBefoerderungsmittelAnkunft
ZA.za_MeansOfTransport_Nationality = eza.eza_BeförderungsmittelGrenzeStaatszugehörigkeitCode
ZA.za_MeansOfTransport_Type = eza.eza_BeförderungsmittelGrenzeArt
ZA.za_CountryImport = "DE"
ZA.za_WarehouseCode = eza.eza_Warenort
ZA.za_InvoiceAmount = eza.eza_Rechnungspreis
ZA.za_InvoiceCurrency = eza.eza_Rechnungswaehrung
ZA.za_DV1Flag = ToNullableBool(eza.eza_DV1Kz)
ZA.za_PrevDocument_No = eza.eza_VorpapierNr
ZA.za_PrevDocument_Type = eza.eza_VorpapierArtCode
VERAG_ZA.za_Incoterms = eza.eza_LieferbedingungCode
VERAG_ZA.za_IncotermsPlace = eza.eza_LieferbedingungOrt
ZA.za_Incoterms = eza.eza_LieferbedingungCode
ZA.za_IncotermsPlace = eza.eza_LieferbedingungOrt
VERAG_ZA.za_Sachbearbeiter = eza.eza_AnmeldenderBearbeiterName
VERAG_ZA.za_TotGrossMass = ToNullableDecimal(eza.eza_GesamtRohmasse)
ZA.za_Sachbearbeiter = eza.eza_AnmeldenderBearbeiterName
ZA.za_TotGrossMass = ToNullableDecimal(eza.eza_GesamtRohmasse)
VERAG_ZA.za_TransportModeBorder = ToStringSafe(eza.eza_VerkehrszweigGrenze)
ZA.za_TransportModeBorder = ToStringSafe(eza.eza_VerkehrszweigGrenze)
' ================================================================
' ADRESSEN
@@ -160,7 +160,7 @@ Public Class cImporter_DakosyToVERAG
End If
VERAG_ZA.Parties.Add(party)
ZA.Parties.Add(party)
Next
End If
@@ -185,7 +185,7 @@ Public Class cImporter_DakosyToVERAG
duty.zaDuty_Currency = "EUR"
duty.zaDuty_LimitDate = ToNullableDate(d.ezaAfb_Faelligkeit)
VERAG_ZA.Duties.Add(duty)
ZA.Duties.Add(duty)
Next
End If
@@ -205,7 +205,7 @@ Public Class cImporter_DakosyToVERAG
VERAG_ZA.Documents.Add(doc)
ZA.Documents.Add(doc)
Next
End If
@@ -285,7 +285,7 @@ Public Class cImporter_DakosyToVERAG
Next
End If
VERAG_ZA.Items.Add(item)
ZA.Items.Add(item)
Next
End If
@@ -293,16 +293,16 @@ Public Class cImporter_DakosyToVERAG
'CBAM WARNING
' ================================================================
If freshInsert Then
VERAG_ZA.checkfreshCBAMWarning()
ZA.checkfreshCBAMWarning()
End If
' ================================================================
' ================================================================
' SAVE
Dim saved = ZA.SAVE()
' ======KAFKA==========================================================
If freshInsert Then cDakosyEZA_Greenpulse.INSERT_KAFKA(ZA)
' ================================================================
Return VERAG_ZA.SAVE()
Return saved
Catch ex As Exception

View File

@@ -11,7 +11,7 @@ Public Class cImporter_TelotecToVERAG
' =====================================================================
' MAIN ENTRY
' =====================================================================
Public Function ImportTelotec(CRN As String, Optional overwrite As Boolean = True, Optional freshInsert As Boolean = True) As Boolean
Public Function ImportTelotec(CRN As String, Optional overwrite As Boolean = True, Optional freshInsert As Boolean = False) As Boolean
If CRN Is Nothing Then Return False
If CRN = "" Then Return False
@@ -22,7 +22,7 @@ Public Class cImporter_TelotecToVERAG
Return False
End Function
Public Function ImportTelotec(tel As cTelotec_Anmeldung, Optional overwrite As Boolean = True, Optional freshinsert As Boolean = True) As Boolean
Public Function ImportTelotec(tel As cTelotec_Anmeldung, Optional overwrite As Boolean = True, Optional freshinsert As Boolean = False) As Boolean
Try
If tel Is Nothing Then Return False
If String.IsNullOrWhiteSpace(ToStringSafe(tel.Refs_LRN)) AndAlso
@@ -187,8 +187,11 @@ Public Class cImporter_TelotecToVERAG
' ================================================================
' ================================================================
' SAVE
Dim saved = ZA.SAVE()
' ======KAFKA==========================================================
cDakosyEZA_Greenpulse.INSERT_KAFKA(ZA)
' ================================================================
Return ZA.SAVE()
Return saved
Catch ex As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, MethodInfo.GetCurrentMethod.Name)