This commit is contained in:
2025-02-04 13:22:22 +01:00
parent cf0679ec37
commit af5eb95094
4 changed files with 211 additions and 79 deletions

View File

@@ -1307,6 +1307,8 @@ Public Class cDakosy_EXG_Position
Property exgPos_AdditionalInformation_8_Text As Object = Nothing
Property exgPos_AdditionalInformation_9_Code As Object = Nothing
Property exgPos_AdditionalInformation_9_Text As Object = Nothing
Property exgPos_RequestedProcedure As Object = Nothing
Property exgPos_PreviousProcedure As Object = Nothing
Property exgPos_PACKAGING As New List(Of cDakosy_EXG_Position_Packaging)
@@ -1493,7 +1495,8 @@ Public Class cDakosy_EXG_Position
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("exgPos_AdditionalInformation_8_Text", exgPos_AdditionalInformation_8_Text))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("exgPos_AdditionalInformation_9_Code", exgPos_AdditionalInformation_9_Code))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("exgPos_AdditionalInformation_9_Text", exgPos_AdditionalInformation_9_Text))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("exgPos_RequestedProcedure", exgPos_RequestedProcedure))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("exgPos_PreviousProcedure", exgPos_PreviousProcedure))
Return list

View File

@@ -52,7 +52,6 @@
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />

View File

@@ -100,7 +100,13 @@ Public Class cWorker_AES_EXG
EXG_ITEM.exgPos_GrossMass = ITEM.GrossMass
If RESP.GoodsItem IsNot Nothing Then
If ITEM.Procedure IsNot Nothing Then
EXG_ITEM.exgPos_PreviousProcedure = ITEM.Procedure.PreviousProcedure
EXG_ITEM.exgPos_RequestedProcedure = ITEM.Procedure.RequestedProcedure
End If
If ITEM.Packaging IsNot Nothing Then
For Each ITEM_PK In ITEM.Packaging
Dim EXG_ITEM_PK As New cDakosy_EXG_Position_Packaging
@@ -137,85 +143,114 @@ Public Class cWorker_AES_EXG
'----------------------------------------------------------------------
'Wenn markiert wurde, dass die NCTS Daten ergänzt werden sollten
'----------------------------------------------------------------------
If EXG.exg_AutoFill_DyId IsNot Nothing AndAlso EXG.exg_AutoFill_DyId >= 0 Then
Dim testDY = True
If testDY Or (EXG.exg_AutoFill_DyId IsNot Nothing AndAlso EXG.exg_AutoFill_DyId >= 0) Then
Dim NCTS_OUT = DAKOSY_Worker.cDakosyNCTSOut004.LOADByAnmIDFull(EXG.exg_AutoFill_DyId, False)
If testDY Then
If NCTS_OUT Is Nothing Then
NCTS_OUT = New DAKOSY_Worker.cDakosyNCTSOut004
NCTS_OUT.ncts_ObjectName = "TEEEESSSSTTT"
End If
End If
If NCTS_OUT IsNot Nothing Then
Dim HC As New cDakosy_NCTSOut004_HouseConsignment
HC.nctsHC_Consignee_Name = EXG.exg_Consignee_Name
HC.nctsHC_Consignee_IdentificationNumber = EXG.exg_Consignee_IdentificationNumber
HC.nctsHC_Consignee_SubsidiaryNumber = EXG.exg_Consignee_SubsidiaryNumber
HC.nctsHC_Consignee_StreetNumber = EXG.exg_Consignee_StreetNumber
HC.nctsHC_Consignee_City = EXG.exg_Consignee_City
HC.nctsHC_Consignee_Postcode = EXG.exg_Consignee_Postcode
HC.nctsHC_Consignee_Country = EXG.exg_Consignee_Country
HC.nctsHC_Consignee_ContactPerson_Name = EXG.exg_Consignee_ContactPerson_Name
HC.nctsHC_Consignee_ContactPerson_PhoneNumber = EXG.exg_Consignee_ContactPerson_PhoneNumber
HC.nctsHC_Consignee_ContactPerson_EMailAddress = EXG.exg_Consignee_ContactPerson_EMailAddress
HC.nctsHC_Consignee_AdressCode = EXG.exg_Consignee_AdressCode
Dim HC As New cDakosy_NCTSOut004_HouseConsignment
HC.nctsHC_Consignee_Name = EXG.exg_Consignee_Name
HC.nctsHC_Consignee_IdentificationNumber = EXG.exg_Consignee_IdentificationNumber
HC.nctsHC_Consignee_SubsidiaryNumber = EXG.exg_Consignee_SubsidiaryNumber
HC.nctsHC_Consignee_StreetNumber = EXG.exg_Consignee_StreetNumber
HC.nctsHC_Consignee_City = EXG.exg_Consignee_City
HC.nctsHC_Consignee_Postcode = EXG.exg_Consignee_Postcode
HC.nctsHC_Consignee_Country = EXG.exg_Consignee_Country
HC.nctsHC_Consignee_ContactPerson_Name = EXG.exg_Consignee_ContactPerson_Name
HC.nctsHC_Consignee_ContactPerson_PhoneNumber = EXG.exg_Consignee_ContactPerson_PhoneNumber
HC.nctsHC_Consignee_ContactPerson_EMailAddress = EXG.exg_Consignee_ContactPerson_EMailAddress
HC.nctsHC_Consignee_AdressCode = EXG.exg_Consignee_AdressCode
HC.nctsHC_Consignor_Name = EXG.exg_Consignor_Name
HC.nctsHC_Consignor_IdentificationNumber = EXG.exg_Consignor_IdentificationNumber
HC.nctsHC_Consignor_SubsidiaryNumber = EXG.exg_Consignor_SubsidiaryNumber
HC.nctsHC_Consignor_StreetNumber = EXG.exg_Consignor_StreetNumber
HC.nctsHC_Consignor_City = EXG.exg_Consignor_City
HC.nctsHC_Consignor_Postcode = EXG.exg_Consignor_Postcode
HC.nctsHC_Consignor_Country = EXG.exg_Consignor_Country
HC.nctsHC_Consignor_ContactPerson_Name = EXG.exg_Consignor_ContactPerson_Name
HC.nctsHC_Consignor_ContactPerson_PhoneNumber = EXG.exg_Consignor_ContactPerson_PhoneNumber
HC.nctsHC_Consignor_ContactPerson_EMailAddress = EXG.exg_Consignor_ContactPerson_EMailAddress
HC.nctsHC_Consignor_AdressCode = EXG.exg_Consignor_AdressCode
HC.nctsHC_Consignor_Name = EXG.exg_Consignor_Name
HC.nctsHC_Consignor_IdentificationNumber = EXG.exg_Consignor_IdentificationNumber
HC.nctsHC_Consignor_SubsidiaryNumber = EXG.exg_Consignor_SubsidiaryNumber
HC.nctsHC_Consignor_StreetNumber = EXG.exg_Consignor_StreetNumber
HC.nctsHC_Consignor_City = EXG.exg_Consignor_City
HC.nctsHC_Consignor_Postcode = EXG.exg_Consignor_Postcode
HC.nctsHC_Consignor_Country = EXG.exg_Consignor_Country
HC.nctsHC_Consignor_ContactPerson_Name = EXG.exg_Consignor_ContactPerson_Name
HC.nctsHC_Consignor_ContactPerson_PhoneNumber = EXG.exg_Consignor_ContactPerson_PhoneNumber
HC.nctsHC_Consignor_ContactPerson_EMailAddress = EXG.exg_Consignor_ContactPerson_EMailAddress
HC.nctsHC_Consignor_AdressCode = EXG.exg_Consignor_AdressCode
HC.nctsHC_GrossMass = EXG.exg_GrossMass
HC.nctsHC_ReferenceNumberUCR = EXG.exg_ReferenceNumberUCR
HC.nctsHC_GrossMass = EXG.exg_GrossMass
HC.nctsHC_ReferenceNumberUCR = EXG.exg_ReferenceNumberUCR
HC.nctsHC_CountryOfDestination = EXG.exg_CountryOfDestination
HC.nctsHC_CountryOfDispatch = EXG.exg_CountryOfDispatch
HC.nctsHC_CountryOfDestination = EXG.exg_CountryOfDestination
HC.nctsHC_CountryOfDispatch = EXG.exg_CountryOfDispatch
HC.nctsHC_PreviousDocument_1_Type = "N830"
HC.nctsHC_PreviousDocument_1_ReferenceNumber = EXG.exg_MRN
'HC.nctsHC_PreviousDocument_1_ComplementOfInformation =
For Each EXG_POS In EXG.exg_POSITION
Dim HC_ITEM As New cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem
HC_ITEM.nctsHCCI_CommodityCode = EXG_POS.exgPos_CommodityCode
HC_ITEM.nctsHCCI_DescriptionOfGoods = EXG_POS.exgPos_DescriptionOfGoods
HC_ITEM.nctsHCCI_GrossMass = EXG_POS.exgPos_GrossMass
HC_ITEM.nctsHCCI_NetMass = EXG_POS.exgPos_NetMass
HC.nctsHC_PreviousDocument_1_Type = "N830"
HC.nctsHC_PreviousDocument_1_ReferenceNumber = EXG.exg_MRN
'HC.nctsHC_PreviousDocument_1_ComplementOfInformation =
If EXG.exg_AutoTranslate Then
If EXG.exg_ForceTranslate Then
cDeeplAPI.deepl_Translate(EXG_POS.exgPos_DescriptionOfGoods, HC_ITEM.nctsHCCI_DescriptionOfGoods, "DE")
Else
HC_ITEM.nctsHCCI_DescriptionOfGoods = cTariffKN8_Interface.getKN8FromTNR(EXG_POS.exgPos_CommodityCode)
For Each EXG_POS In EXG.exg_POSITION
Dim HC_ITEM As New cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem
HC_ITEM.nctsHCCI_CommodityCode = EXG_POS.exgPos_CommodityCode
HC_ITEM.nctsHCCI_DescriptionOfGoods = EXG_POS.exgPos_DescriptionOfGoods
HC_ITEM.nctsHCCI_GrossMass = EXG_POS.exgPos_GrossMass
HC_ITEM.nctsHCCI_NetMass = EXG_POS.exgPos_NetMass
If EXG_POS.exgPos_PreviousProcedure IsNot Nothing And EXG_POS.exgPos_RequestedProcedure IsNot Nothing Then
HC_ITEM.nctsHCCI_DeclarationType = DetermineTransitProcedure(EXG_POS.exgPos_RequestedProcedure, EXG_POS.exgPos_PreviousProcedure)
End If
End If
For Each EXG_PK In EXG_POS.exgPos_PACKAGING
Dim HC_PK = New cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem_Packaging
If EXG.exg_AutoTranslate Then
If EXG.exg_ForceTranslate Then
cDeeplAPI.deepl_Translate(EXG_POS.exgPos_DescriptionOfGoods, HC_ITEM.nctsHCCI_DescriptionOfGoods, "DE")
Else
HC_ITEM.nctsHCCI_DescriptionOfGoods = cTariffKN8_Interface.getKN8FromTNR(EXG_POS.exgPos_CommodityCode)
End If
End If
HC_PK.nctsHCCIPK_NumberOfPackages = EXG_PK.exgPosPk_NumberOfPackages
HC_PK.nctsHCCIPK_TypeOfPackages = EXG_PK.exgPosPk_TypeOfPackages
HC_PK.nctsHCCIPK_ShippingMarks = EXG_PK.exgPosPk_ShippingMarks
For Each EXG_PK In EXG_POS.exgPos_PACKAGING
Dim HC_PK = New cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem_Packaging
HC_ITEM.nctsHCCI_PACKAGING.Add(HC_PK)
HC_PK.nctsHCCIPK_NumberOfPackages = EXG_PK.exgPosPk_NumberOfPackages
HC_PK.nctsHCCIPK_TypeOfPackages = EXG_PK.exgPosPk_TypeOfPackages
HC_PK.nctsHCCIPK_ShippingMarks = EXG_PK.exgPosPk_ShippingMarks
HC_ITEM.nctsHCCI_PACKAGING.Add(HC_PK)
Next
HC.nctsWP_CONSIGNMENT_ITEM.Add(HC_ITEM)
Next
NCTS_OUT.ncts_HOUSE_CONSIGNMENT.Add(HC)
HC.nctsWP_CONSIGNMENT_ITEM.Add(HC_ITEM)
Next
NCTS_OUT.ncts_HOUSE_CONSIGNMENT.Add(HC)
NCTS_OUT.INSERT_HouseConsignment()
cDakosyEXG.UPDATE_FillNCTS_ID_Completed(EXG.exg_Id) 'Eintrag, dass AutoFill durchgelaufen ist
' NCTS_OUT.INSERT_HouseConsignment()
'--------Declarationtype-----------------------------------------------
Dim declType = GetDeclarationType(NCTS_OUT.ncts_HOUSE_CONSIGNMENT)
If declType <> "" Then
emptyAllDeclarationItems(NCTS_OUT.ncts_HOUSE_CONSIGNMENT) ' Leert alle DeclType in den Pos
NCTS_OUT.ncts_Declarationtype = declType ' Sezt es im Kopf
Else
NCTS_OUT.ncts_Declarationtype = "T-" ' Sezt es im Kopf
End If
'----------------------------------------------------------------------
cDakosyEXG.UPDATE_FillNCTS_ID_Completed(EXG.exg_Id) 'Eintrag, dass AutoFill durchgelaufen ist
'Prüfen ob alle EXG Daten gekommen sind --> NCTS Senden!
If cDakosyEXG.isFillNCTS_ID_ALLCompleted(EXG.exg_AutoFill_DyId) Then
If testDY Or (cDakosyEXG.isFillNCTS_ID_ALLCompleted(EXG.exg_AutoFill_DyId)) Then
Dim DY_ANM = New cDakosy_Zollanmeldungen(EXG.exg_AutoFill_DyId)
If NCTS_OUT IsNot Nothing Then
@@ -228,15 +263,28 @@ Public Class cWorker_AES_EXG
NCTS_OUT.ncts_niederlassung = EXG.exg_niederlassung
' DAKOSY_Interface_SEND.loadInClass_VersandanmeldungNCTSDE_004(NCTS_OUT, Me, DY_ANM, Me.FIRMA_DY)
If NCTS_OUT.SAVE_ALL() Then
'VON HIER löschnen ohne test
If testDY OrElse NCTS_OUT.SAVE_ALL() Then
If If(EXG.exg_AutoFill_DyId, -1) > 0 Then 'Nur speichern wenn bei test exg_AutoFill_DyId befüllt ist
NCTS_OUT.SAVE_ALL()
End If
Dim saveFile = ""
Dim testDY = True
If cDakosyNCTSOut004.generateVersandanmeldungNCTSDE_004(NCTS_OUT, saveFile, "CREATE", Application.StartupPath) Then
If saveFile <> "" Then
If testDY Then
frmStartOptions.copyFile(saveFile, "\\datenarchiv\Datenarchiv\DAKOSY\ECHTSYSTEM\EXG\upl\NCTS\")
Else
frmStartOptions.copyFile(saveFile, "\\datenarchiv\Datenarchiv\DAKOSY\ECHTSYSTEM\EXG\upl\NCTS\")
End If
End If
Else
'BIS HIER löschnen ohne test
If NCTS_OUT.SAVE_ALL() Then
Dim saveFile = ""
If cDakosyNCTSOut004.generateVersandanmeldungNCTSDE_004(NCTS_OUT, saveFile, "CREATE", Application.StartupPath) Then
If saveFile <> "" Then
If cDakosyFunftions.send_Data_To_Dakosy_FTP(saveFile, NCTS_OUT.ncts_ObjectName, DY_ANM.dy_Id, NCTS_OUT.ncts_firma) Then
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_03)
'If SENDUNG IsNot Nothing Then SENDUNG.SET_VGMA() ' MA Vorgeschrieben in Sendung setzen.
@@ -244,17 +292,22 @@ Public Class cWorker_AES_EXG
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_09)
MsgBox("Sendefehler!")
End If
End If
End If
End If
End If
End If
DY_ANM.UPDATE_DATA()
If Not testDY Or If(EXG.exg_AutoFill_DyId, -1) > 0 Then 'Kann ganz weg kenn kein test
'Beim Senden soll die Sendung überhnommen + tblSnd_VG_MA gesetzt werden --> damit gleich gesehen wird, dass der Akt in Bearbeitung ist.
DY_ANM.UPDATE_AVISO_SND(DY_ANM.dy_SendungsId)
DY_ANM.UPDATE_DATA()
'Beim Senden soll die Sendung überhnommen + tblSnd_VG_MA gesetzt werden --> damit gleich gesehen wird, dass der Akt in Bearbeitung ist.
DY_ANM.UPDATE_AVISO_SND(DY_ANM.dy_SendungsId)
End If
End If
End If
@@ -326,6 +379,83 @@ Public Class cWorker_AES_EXG
End Try
End Function
' Funktion zur Bestimmung des Declaration Type
Shared Function GetDeclarationType(HC_LIST As List(Of cDakosy_NCTSOut004_HouseConsignment)) As String
Dim declType As String = Nothing
Dim isConsistent As Boolean = True ' Flag zur Überprüfung der Konsistenz
' Iteration über alle Positionen
For Each HC In HC_LIST
For Each HC_ITEM In HC.nctsWP_CONSIGNMENT_ITEM
Dim currentType = HC_ITEM.nctsHCCI_DeclarationType
' Abbruch, wenn ein Wert leer oder Nothing ist
If String.IsNullOrWhiteSpace(currentType) Then
isConsistent = False
Exit For
End If
' Setze declType, wenn noch nicht gesetzt
If declType Is Nothing Then
declType = currentType
ElseIf declType <> currentType Then
' Unterschiedlicher Wert gefunden → Abbruch
isConsistent = False
Exit For
End If
Next
Next
' Rückgabe des einheitlichen declType oder leer, wenn inkonsistent
If isConsistent AndAlso Not String.IsNullOrWhiteSpace(declType) Then
Return declType
Else
Return ""
End If
End Function
Shared Sub emptyAllDeclarationItems(ByRef HC_LIST As List(Of cDakosy_NCTSOut004_HouseConsignment))
Dim declType As String = Nothing
Dim isConsistent As Boolean = True ' Flag zur Überprüfung der Konsistenz
' Iteration über alle Positionen
For Each HC In HC_LIST
For Each HC_ITEM In HC.nctsWP_CONSIGNMENT_ITEM
HC_ITEM.nctsHCCI_DeclarationType = ""
Next
Next
End Sub
Shared Function DetermineTransitProcedure(requestedProcedure As String, previousProcedure As String) As String
' Entscheidungslogik für Transitverfahren (immer in der EU eröffnet)
Select Case requestedProcedure
Case "10" ' Ausfuhrverfahren
If previousProcedure = "00" Then
Return "T2" ' Ware ist weiterhin Unionsware, obwohl Ausfuhr vorgesehen ist
ElseIf previousProcedure = "40" Then
Return "T2" ' Ware im freien Verkehr (Unionsware)
ElseIf previousProcedure = "61" Then
Return "T1" ' Ware verlässt ein Zolllager (Nicht-Unionsware)
Else
Return "T2" ' Standardfall: Unionsware im Ausfuhrverfahren
End If
Case "40" ' Überlassung zum freien Verkehr
Return "T2" ' Ware wird Unionsware nach Import
Case "31" ' Versandverfahren
Return "T-" ' Beibehaltung des ursprünglichen Status
Case "51" ' Passive Veredelung
Return "T1" ' Rückkehr von Nicht-Unionsware nach Verarbeitung
Case Else
Return "Unbekannt" ' Unbekannter Verfahrenscode
End Select
End Function
Shared Function generateInformationenZumAusgang003(EXG As cDakosyEXG, ByVal Bezugsnummer As String, ByRef saveFile As String, DY_ACTIONS As List(Of String), IOPartner As String, IODivision3 As String, DAKOSY_SB As String) As Boolean
Dim Interface_VERSION = "003"

View File

@@ -462,15 +462,15 @@ Public Class frmMDMNachrichtenVerarbeitung
frmStartOptions.moveFile_DateBack(d, ZIEL_PFAD & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
'frmStartOptions.copyFile_DateBack(d, ZIEL_PFAD & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
addDGVEinarbeitung("PDF", DS.da_name)
dgvEinarbeitung.Refresh()
'frmStartOptions.copyFile_DateBack(d, ZIEL_PFAD & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
addDGVEinarbeitung("PDF", DS.da_name)
dgvEinarbeitung.Refresh()
'Eintrag
End If
Case 5
frmStartOptions.moveFile_DateBack(d, ERROR_PFAD)
dsNichtErkannt += 1
'Eintrag
End If
Case 5
frmStartOptions.moveFile_DateBack(d, ERROR_PFAD)
dsNichtErkannt += 1
End Select