EXG Automatisierung Gestellungsprozess, NCTS Erstellung

This commit is contained in:
2025-01-26 21:53:50 +01:00
parent 444293a564
commit 946c8c165a
15 changed files with 2636 additions and 20 deletions

View File

@@ -132,6 +132,132 @@ Public Class cWorker_AES_EXG
STATUS.SAVE()
'----------------------------------------------------------------------
'NCTS AKtualisieren!
'----------------------------------------------------------------------
'----------------------------------------------------------------------
'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 NCTS_OUT = DAKOSY_Worker.cDakosyNCTSOut004.LOADByAnmIDFull(EXG.exg_AutoFill_DyId, False)
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
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_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
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
For Each EXG_PK In EXG_POS.exgPos_PACKAGING
Dim HC_PK = New cDakosy_NCTSOut004_HouseConsignment_ConsignmentItem_Packaging
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)
NCTS_OUT.INSERT_HouseConsignment()
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
Dim DY_ANM = New cDakosy_Zollanmeldungen(EXG.exg_AutoFill_DyId)
If NCTS_OUT IsNot Nothing Then
'Dim cDY As New cDakosyNCTSOut(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_firma = FIRMA_DY
' DAKOSY_Interface_SEND.loadInClass_VersandanmeldungNCTSDE_004(NCTS_OUT, Me, DY_ANM, Me.FIRMA_DY)
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, Me.FIRMA_DY) 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.
Else
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
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
'----------------------------------------------------------------------
'QULAIFIZIERUNG!
'----------------------------------------------------------------------
@@ -231,6 +357,10 @@ Public Class cWorker_AES_EXG
'TransitOperation:
XML_EG.HeaderData.InformationType = "NV"
'XML_EG.HeaderData.ActiveBorderTransportMeans.DepartureDateAndTime = Now '_Nicht, sonst fehler
XML_EG.HeaderData.Finalization = True
XML_EG.HeaderData.ModeOfTransportAtTheBorder = 3
'XML_EG.HeaderData.MRN = MRN
'If cDY.ncts_CountryOfDispatch IsNot Nothing Then XML.EinzelEingangsanzeige.TransitOperation.CustomsOfficeOfDestinationActual = cDY.ncts_CountryOfDispatch
'If SND.tblSnd_ATB_T1 IsNot Nothing Then XML.EinzelEingangsanzeige.TransitOperation.MRN = SND.tblSnd_ATB_T1
@@ -246,7 +376,7 @@ Public Class cWorker_AES_EXG
System.IO.Directory.CreateDirectory(saveDir)
End If
saveFile = saveDir & "DY_EXP_" & Now.ToString("yyMMdd_HHmmss") & ".xml"
saveFile = saveDir & "DY_EXP_" & Now.ToString("yyMMdd_HHmmss_fff") & ".xml"
XML.SaveToFile(saveFile)