dy imort
This commit is contained in:
@@ -16,23 +16,28 @@ Public Class cDakosyEZA_Greenpulse
|
|||||||
Dim declarant = GuessAddressByType(eza.eza_ADRESSEN, {"DT", "DEC", "ANM", "DECLARANT"})
|
Dim declarant = GuessAddressByType(eza.eza_ADRESSEN, {"DT", "DEC", "ANM", "DECLARANT"})
|
||||||
|
|
||||||
' --- Rechnungsdaten (Unterlagen N380) ---
|
' --- Rechnungsdaten (Unterlagen N380) ---
|
||||||
Dim inv = eza.eza_UNTERLAGEN?.FirstOrDefault(Function(u) SafeStr(u.ezaUl_Art).Equals("N380", StringComparison.OrdinalIgnoreCase) _
|
Dim inv = If(eza.eza_UNTERLAGEN IsNot Nothing,
|
||||||
AndAlso Not String.IsNullOrWhiteSpace(SafeStr(u.ezaUl_Nummer)))
|
eza.eza_UNTERLAGEN.FirstOrDefault(Function(u) SafeStr(u.ezaUl_Art).Equals("N380", StringComparison.OrdinalIgnoreCase) _
|
||||||
|
AndAlso Not String.IsNullOrWhiteSpace(SafeStr(u.ezaUl_Nummer))),
|
||||||
|
Nothing)
|
||||||
|
|
||||||
' --- Kopf/Zielschema ---
|
' --- Kopf/Zielschema ---
|
||||||
Dim dest As New cATEZ_Greenpulse_KafkaDecs With {
|
Dim dest As New cATEZ_Greenpulse_KafkaDecs With {
|
||||||
.Declaration = New cATEZ_Greenpulse_KafkaDecs.DeclarationNode With {
|
.Declaration = New cATEZ_Greenpulse_KafkaDecs.DeclarationNode With {
|
||||||
.DeclarationSourceId = SafeStr(eza.eza_ANR), ' interne Bezugsnr./ANR
|
.DeclarationSourceId = SafeStr(eza.eza_ANR),
|
||||||
.DeclarationNo = SafeStr(eza.eza_MRN), ' MRN, falls vorhanden
|
.DeclarationNo = SafeStr(eza.eza_MRN),
|
||||||
.DeclarationDate = ToDateYMD(FirstNonEmpty(eza.eza_Anmeldedatum, eza.eza_Erstellung)),
|
.DeclarationDate = ToDateYMD(FirstNonEmpty(eza.eza_Anmeldedatum, eza.eza_Erstellung)),
|
||||||
.RequestedProcedure = SafeStr(eza.eza_VerfahrenBeantragtCode), ' z.B. "40"
|
.RequestedProcedure = SafeStr(eza.eza_VerfahrenBeantragtCode),
|
||||||
.PreviousProcedure = "", ' ggf. unten aus Position ableiten
|
.PreviousProcedure = "",
|
||||||
.Goods = New List(Of cATEZ_Greenpulse_KafkaDecs.GoodItem)()
|
.Goods = New List(Of cATEZ_Greenpulse_KafkaDecs.GoodItem)()
|
||||||
},
|
},
|
||||||
.Parties = New cATEZ_Greenpulse_KafkaDecs.PartiesNode With {
|
.Parties = New cATEZ_Greenpulse_KafkaDecs.PartiesNode With {
|
||||||
.ImporterIdentificationNumber = FirstNonEmptyStr(importer?.ezaAd_TeilnehmerEORI, importer?.ezaAd_AdressCode),
|
.ImporterIdentificationNumber = FirstNonEmptyStr(If(importer IsNot Nothing, importer.ezaAd_TeilnehmerEORI, Nothing),
|
||||||
.ExporterIdentificationNumber = FirstNonEmptyStr(exporter?.ezaAd_TeilnehmerEORI, exporter?.ezaAd_AdressCode),
|
If(importer IsNot Nothing, importer.ezaAd_AdressCode, Nothing)),
|
||||||
.ReportingDeclarantEORINumber = FirstNonEmptyStr(declarant?.ezaAd_TeilnehmerEORI, declarant?.ezaAd_AdressCode),
|
.ExporterIdentificationNumber = FirstNonEmptyStr(If(exporter IsNot Nothing, exporter.ezaAd_TeilnehmerEORI, Nothing),
|
||||||
|
If(exporter IsNot Nothing, exporter.ezaAd_AdressCode, Nothing)),
|
||||||
|
.ReportingDeclarantEORINumber = FirstNonEmptyStr(If(declarant IsNot Nothing, declarant.ezaAd_TeilnehmerEORI, Nothing),
|
||||||
|
If(declarant IsNot Nothing, declarant.ezaAd_AdressCode, Nothing)),
|
||||||
.TypeOfRepresentation = SafeStr(eza.eza_VertretungsVerhaeltnisCode)
|
.TypeOfRepresentation = SafeStr(eza.eza_VertretungsVerhaeltnisCode)
|
||||||
},
|
},
|
||||||
.Commercial = New cATEZ_Greenpulse_KafkaDecs.CommercialNode With {
|
.Commercial = New cATEZ_Greenpulse_KafkaDecs.CommercialNode With {
|
||||||
@@ -40,27 +45,45 @@ Public Class cDakosyEZA_Greenpulse
|
|||||||
.InvoiceDate = If(inv IsNot Nothing, ToDateYMD(inv.ezaUl_DatumAusstellung), "")
|
.InvoiceDate = If(inv IsNot Nothing, ToDateYMD(inv.ezaUl_DatumAusstellung), "")
|
||||||
},
|
},
|
||||||
.ExporterDetails = New cATEZ_Greenpulse_KafkaDecs.ExporterDetailsNode With {
|
.ExporterDetails = New cATEZ_Greenpulse_KafkaDecs.ExporterDetailsNode With {
|
||||||
.ExporterTitle = FirstNonEmptyStr(exporter?.ezaAd_NameFirma1, exporter?.ezaAd_NameFirma2),
|
.ExporterTitle = FirstNonEmptyStr(If(exporter IsNot Nothing, exporter.ezaAd_NameFirma1, Nothing),
|
||||||
|
If(exporter IsNot Nothing, exporter.ezaAd_NameFirma2, Nothing)),
|
||||||
.ExporterEmail = "",
|
.ExporterEmail = "",
|
||||||
.ExporterPhone = ""
|
.ExporterPhone = ""
|
||||||
},
|
},
|
||||||
.ImporterDetails = New cATEZ_Greenpulse_KafkaDecs.ImporterDetailsNode With {
|
.ImporterDetails = New cATEZ_Greenpulse_KafkaDecs.ImporterDetailsNode With {
|
||||||
.ImporterTitle = FirstNonEmptyStr(importer?.ezaAd_NameFirma1, importer?.ezaAd_NameFirma2),
|
.ImporterTitle = FirstNonEmptyStr(If(importer IsNot Nothing, importer.ezaAd_NameFirma1, Nothing),
|
||||||
|
If(importer IsNot Nothing, importer.ezaAd_NameFirma2, Nothing)),
|
||||||
.ImporterEmail = "",
|
.ImporterEmail = "",
|
||||||
.ImporterPhone = "",
|
.ImporterPhone = "",
|
||||||
.ImporterCountryCodeOrMemberState = SafeStr(importer?.ezaAd_LandCode),
|
.ImporterCountryCodeOrMemberState = SafeStr(If(importer IsNot Nothing, importer.ezaAd_LandCode, Nothing)),
|
||||||
.ImporterSubdivision = "",
|
.ImporterSubdivision = "",
|
||||||
.ImporterCity = SafeStr(importer?.ezaAd_Ort),
|
.ImporterCity = SafeStr(If(importer IsNot Nothing, importer.ezaAd_Ort, Nothing)),
|
||||||
.ImporterStreet = MergeStreet(importer),
|
.ImporterStreet = MergeStreet(importer),
|
||||||
.ImporterStreetAdditional = SafeStr(importer?.ezaAd_StrasseHausNr2),
|
.ImporterStreetAdditional = SafeStr(If(importer IsNot Nothing, importer.ezaAd_StrasseHausNr2, Nothing)),
|
||||||
.ImporterAddressNumber = "",
|
.ImporterAddressNumber = "",
|
||||||
.ImporterPostCode = SafeStr(importer?.ezaAd_PLZ),
|
.ImporterPostCode = SafeStr(If(importer IsNot Nothing, importer.ezaAd_PLZ, Nothing)),
|
||||||
.ImporterPoBox = "",
|
.ImporterPoBox = "",
|
||||||
.ImporterCoordinateLongitudeX = "",
|
.ImporterCoordinateLongitudeX = "",
|
||||||
.ImporterCoordinateLatitudeY = ""
|
.ImporterCoordinateLatitudeY = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
' --- Falls EORI vorhanden: spezifisch befüllen (Lookup/Mapping via Helper) ---
|
||||||
|
Dim impEori As String = SafeStr(If(importer IsNot Nothing, importer.ezaAd_TeilnehmerEORI, Nothing))
|
||||||
|
If Not String.IsNullOrWhiteSpace(impEori) Then
|
||||||
|
PopulateImporterByEori(impEori, dest.Parties, dest.ImporterDetails)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim expEori As String = SafeStr(If(exporter IsNot Nothing, exporter.ezaAd_TeilnehmerEORI, Nothing))
|
||||||
|
If Not String.IsNullOrWhiteSpace(expEori) Then
|
||||||
|
PopulateExporterByEori(expEori, dest.Parties, dest.ExporterDetails)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim decEori As String = SafeStr(If(declarant IsNot Nothing, declarant.ezaAd_TeilnehmerEORI, Nothing))
|
||||||
|
If Not String.IsNullOrWhiteSpace(decEori) Then
|
||||||
|
PopulateDeclarantByEori(decEori, dest.Parties)
|
||||||
|
End If
|
||||||
|
|
||||||
' --- Warenpositionen -> Goods ---
|
' --- Warenpositionen -> Goods ---
|
||||||
If eza.eza_WARENPOS IsNot Nothing Then
|
If eza.eza_WARENPOS IsNot Nothing Then
|
||||||
For Each wp In eza.eza_WARENPOS
|
For Each wp In eza.eza_WARENPOS
|
||||||
@@ -70,7 +93,7 @@ Public Class cDakosyEZA_Greenpulse
|
|||||||
.NetMass = ToInvariantStr(wp.ezaWP_Eigenmasse),
|
.NetMass = ToInvariantStr(wp.ezaWP_Eigenmasse),
|
||||||
.TypeOfMeasurementUnit = UnitCodeToKafkaName(FirstNonEmptyStr(wp.ezaWP_WarenMasseinheit1, wp.ezaWP_AHStatMengeMasseinheit, "KGM")),
|
.TypeOfMeasurementUnit = UnitCodeToKafkaName(FirstNonEmptyStr(wp.ezaWP_WarenMasseinheit1, wp.ezaWP_AHStatMengeMasseinheit, "KGM")),
|
||||||
.SpecialProcedures = New cATEZ_Greenpulse_KafkaDecs.SpecialProceduresNode With {
|
.SpecialProcedures = New cATEZ_Greenpulse_KafkaDecs.SpecialProceduresNode With {
|
||||||
.MemberStateAutharization = SafeStr(importer?.ezaAd_LandCode), ' Heuristik
|
.MemberStateAutharization = SafeStr(If(importer IsNot Nothing, importer.ezaAd_LandCode, Nothing)),
|
||||||
.DischargeBillWaiver = "",
|
.DischargeBillWaiver = "",
|
||||||
.Authorisation = FirstNonEmptyStr(wp.ezaWP_Bewilligungsnummer, eza.eza_BewilligungsIDZLAVUV),
|
.Authorisation = FirstNonEmptyStr(wp.ezaWP_Bewilligungsnummer, eza.eza_BewilligungsIDZLAVUV),
|
||||||
.StartTime = "",
|
.StartTime = "",
|
||||||
@@ -83,7 +106,7 @@ Public Class cDakosyEZA_Greenpulse
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' --- Previous/Requested Procedure ggf. aus erster Position ziehen ---
|
' --- Previous/Requested Procedure ggf. aus erster Position ziehen ---
|
||||||
Dim wp0 = eza.eza_WARENPOS?.FirstOrDefault()
|
Dim wp0 = If(eza.eza_WARENPOS IsNot Nothing, eza.eza_WARENPOS.FirstOrDefault(), Nothing)
|
||||||
If wp0 IsNot Nothing Then
|
If wp0 IsNot Nothing Then
|
||||||
If String.IsNullOrWhiteSpace(dest.Declaration.RequestedProcedure) Then
|
If String.IsNullOrWhiteSpace(dest.Declaration.RequestedProcedure) Then
|
||||||
dest.Declaration.RequestedProcedure = SafeStr(wp0.ezaWP_Zollverfahren)
|
dest.Declaration.RequestedProcedure = SafeStr(wp0.ezaWP_Zollverfahren)
|
||||||
@@ -94,6 +117,62 @@ Public Class cDakosyEZA_Greenpulse
|
|||||||
Return dest
|
Return dest
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
' =========================
|
||||||
|
' Populate-Helper (mit TODO)
|
||||||
|
' =========================
|
||||||
|
|
||||||
|
' Importer: ergänzt Parties.ImporterIdentificationNumber und ImporterDetails anhand EORI
|
||||||
|
Private Shared Sub PopulateImporterByEori(eori As String,
|
||||||
|
ByRef parties As cATEZ_Greenpulse_KafkaDecs.PartiesNode,
|
||||||
|
ByRef details As cATEZ_Greenpulse_KafkaDecs.ImporterDetailsNode)
|
||||||
|
' Pflicht: EORI in Parties
|
||||||
|
parties.ImporterIdentificationNumber = eori
|
||||||
|
Dim AD As VERAG_PROG_ALLGEMEIN.cAdressen = cZOLL_IMPORT.getAdresseFromEORI(eori, "", "")
|
||||||
|
|
||||||
|
If AD IsNot Nothing Then
|
||||||
|
details.ImporterTitle = (If(AD.Name_1, "") & " " & If(AD.Name_2, "")).trim
|
||||||
|
details.ImporterCountryCodeOrMemberState = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2Land(AD.LandKz)
|
||||||
|
details.ImporterCity = AD.Ort
|
||||||
|
details.ImporterStreet = AD.Straße
|
||||||
|
details.ImporterAddressNumber = ""
|
||||||
|
details.ImporterPostCode = AD.PLZ
|
||||||
|
details.ImporterEmail = AD.E_Mail
|
||||||
|
details.ImporterPhone = AD.Telefon
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' Exporter: ergänzt Parties.ExporterIdentificationNumber und ExporterDetails anhand EORI
|
||||||
|
Private Shared Sub PopulateExporterByEori(eori As String,
|
||||||
|
ByRef parties As cATEZ_Greenpulse_KafkaDecs.PartiesNode,
|
||||||
|
ByRef details As cATEZ_Greenpulse_KafkaDecs.ExporterDetailsNode)
|
||||||
|
parties.ExporterIdentificationNumber = eori
|
||||||
|
Dim AD As VERAG_PROG_ALLGEMEIN.cAdressen = cZOLL_IMPORT.getAdresseFromEORI(eori, "", "")
|
||||||
|
|
||||||
|
If AD IsNot Nothing Then
|
||||||
|
details.ExporterTitle = (If(AD.Name_1, "") & " " & If(AD.Name_2, "")).trim
|
||||||
|
'details.exporterCountryCodeOrMemberState = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2Land(AD.LandKz)
|
||||||
|
'details.exporterCity = AD.Ort
|
||||||
|
'details.exporterStreet = AD.Straße
|
||||||
|
'details.exporterAddressNumber = ""
|
||||||
|
'details.exporterPostCode = AD.PLZ
|
||||||
|
details.ExporterEmail = AD.E_Mail
|
||||||
|
details.ExporterPhone = AD.Telefon
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' Declarant: ergänzt Parties.ReportingDeclarantEORINumber (weitere Daten optional)
|
||||||
|
Private Shared Sub PopulateDeclarantByEori(eori As String,
|
||||||
|
ByRef parties As cATEZ_Greenpulse_KafkaDecs.PartiesNode)
|
||||||
|
parties.ReportingDeclarantEORINumber = eori
|
||||||
|
|
||||||
|
' TODO: Optional Stammdaten-Lookup für weitere deklarantenbezogene Daten,
|
||||||
|
' z. B. Standard-Vertretungsverhältnis, Niederlassungsnummer etc.
|
||||||
|
' Dim m = PartnerRepo.GetByEori(eori)
|
||||||
|
' If m IsNot Nothing Then
|
||||||
|
' ' ggf. parties.TypeOfRepresentation = m.DefaultRepType
|
||||||
|
' End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
' JSON-Wrapper
|
' JSON-Wrapper
|
||||||
Public Shared Function BuildJsonByMrn(eza As cDakosyEZA, Optional pretty As Boolean = True) As String
|
Public Shared Function BuildJsonByMrn(eza As cDakosyEZA, Optional pretty As Boolean = True) As String
|
||||||
Dim obj = BuildByMrn(eza)
|
Dim obj = BuildByMrn(eza)
|
||||||
|
|||||||
@@ -1491,10 +1491,10 @@ Public Class cZOLL_IMPORT
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Function getAdresseFromEORI(EORI, EORI_NL, Firma)
|
Shared Function getAdresseFromEORI(EORI, EORI_NL, Firma)
|
||||||
If EORI Is Nothing Then Return Nothing
|
If EORI Is Nothing Then Return Nothing
|
||||||
If If(EORI, "") <> "" Then
|
If If(EORI, "") <> "" Then
|
||||||
Dim kdNrTmp = KDSQL.getFMZOLLKdNrFromEORI(EORI, EORI_NL, Firma)
|
Dim kdNrTmp = SQL.getFMZOLLKdNrFromEORI(EORI, EORI_NL, Firma)
|
||||||
If IsNumeric(kdNrTmp) Then
|
If IsNumeric(kdNrTmp) Then
|
||||||
Dim ADRESSE As New VERAG_PROG_ALLGEMEIN.cAdressen(kdNrTmp)
|
Dim ADRESSE As New VERAG_PROG_ALLGEMEIN.cAdressen(kdNrTmp)
|
||||||
Return ADRESSE
|
Return ADRESSE
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.2.4.0")>
|
<Assembly: AssemblyVersion("1.2.4.1")>
|
||||||
<Assembly: AssemblyFileVersion("1.2.4.0")>
|
<Assembly: AssemblyFileVersion("1.2.4.1")>
|
||||||
|
|||||||
Reference in New Issue
Block a user