ncts_fremd
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.Xml
|
Imports System.Xml
|
||||||
Imports com.sun.corba.se.spi.orb
|
Imports com.sun.corba.se.spi.orb
|
||||||
|
Imports Newtonsoft.Json
|
||||||
|
Imports VERAG_PROG_ALLGEMEIN.cATEZ_NCTS_declarations_ApiResponseHandler
|
||||||
|
|
||||||
Public Class cATEZ_ncts_api
|
Public Class cATEZ_ncts_api
|
||||||
|
|
||||||
@@ -35,6 +37,108 @@ Public Class cATEZ_ncts_api
|
|||||||
Debug.WriteLine(resp.StatusCode)
|
Debug.WriteLine(resp.StatusCode)
|
||||||
Debug.WriteLine(resp.BodyStr)
|
Debug.WriteLine(resp.BodyStr)
|
||||||
|
|
||||||
|
|
||||||
|
Dim handler As New cATEZ_NCTS_declarations_ApiResponseHandler()
|
||||||
|
Dim responseObject As cATEZ_NCTS_declarations_ApiResponseHandler.cATEZ_NCTS_declarations_welcome = handler.ProcessJsonResponse(resp.BodyStr)
|
||||||
|
|
||||||
|
' Beispiel: Zugriff auf die Inhalte
|
||||||
|
For Each NCTS_TMP In responseObject.Content
|
||||||
|
'Console.WriteLine("GRN: " & item.Grn)
|
||||||
|
'Console.WriteLine("Guarantee Amount: " & item.GuaranteeAmount)
|
||||||
|
|
||||||
|
If Not checkDY_NCTS(NCTS_TMP.Mrn) Then
|
||||||
|
|
||||||
|
Dim NCTS_FREMD = VERAG_PROG_ALLGEMEIN.cNCTS_FREMD.LOADByMRN(NCTS_TMP.Mrn, True)
|
||||||
|
If NCTS_FREMD Is Nothing Then NCTS_FREMD = New cNCTS_FREMD
|
||||||
|
NCTS_FREMD.ncts_Partnersystem = "ATEZ"
|
||||||
|
NCTS_FREMD.ncts_MRN = NCTS_TMP.Mrn
|
||||||
|
|
||||||
|
|
||||||
|
NCTS_FREMD.ncts_Eroeffnung = NCTS_TMP.MrnDate
|
||||||
|
|
||||||
|
If NCTS_TMP.MrnDate IsNot Nothing Then
|
||||||
|
If If(NCTS_FREMD.ncts_LimitDate, "").ToString = "" Then NCTS_FREMD.ncts_LimitDate = CDate(NCTS_TMP.MrnDate).AddDays(10)
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
'RELEASED
|
||||||
|
'IN_USE
|
||||||
|
If NCTS_TMP.GuaranteeUsageStatus IsNot Nothing Then
|
||||||
|
Select Case NCTS_TMP.GuaranteeUsageStatus
|
||||||
|
Case "IN_USE"
|
||||||
|
NCTS_FREMD.ncts_Eroeffnung = NCTS_TMP.MrnDate
|
||||||
|
NCTS_FREMD.ncts_Status = 50
|
||||||
|
Case "RELEASED"
|
||||||
|
NCTS_FREMD.ncts_Eroeffnung = NCTS_TMP.MrnDate
|
||||||
|
If If(NCTS_FREMD.ncts_Ankunft, "").ToString = "" Then NCTS_FREMD.ncts_Ankunft = NCTS_TMP.MrnDate
|
||||||
|
If If(NCTS_FREMD.ncts_Erledigung, "").ToString = "" Then NCTS_FREMD.ncts_Erledigung = NCTS_TMP.MrnDate
|
||||||
|
NCTS_FREMD.ncts_Status = 60
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
|
|
||||||
|
'WRT_NOT
|
||||||
|
'MRN_NOTIFIED
|
||||||
|
'GUAINF
|
||||||
|
'CTR_DEC
|
||||||
|
'CTRINFDEP
|
||||||
|
'MRN_ALL
|
||||||
|
'REL_TRA
|
||||||
|
'TRANSIT_CLOSE
|
||||||
|
'ARR_ADV
|
||||||
|
If NCTS_TMP.Status IsNot Nothing Then
|
||||||
|
Select Case NCTS_TMP.Status
|
||||||
|
Case "ARR_ADV"
|
||||||
|
If If(NCTS_FREMD.ncts_Ankunft, "").ToString = "" Then NCTS_FREMD.ncts_Ankunft = NCTS_TMP.MrnDate
|
||||||
|
NCTS_FREMD.ncts_Status = 53
|
||||||
|
Case "TRANSIT_CLOSE"
|
||||||
|
If If(NCTS_FREMD.ncts_Ankunft, "").ToString = "" Then NCTS_FREMD.ncts_Ankunft = NCTS_TMP.MrnDate
|
||||||
|
If If(NCTS_FREMD.ncts_Erledigung, "").ToString = "" Then NCTS_FREMD.ncts_Erledigung = NCTS_TMP.MrnDate
|
||||||
|
NCTS_FREMD.ncts_Status = 60
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
|
|
||||||
|
NCTS_FREMD.ncts_Status_KEWILL_Equivalent = NCTS_FREMD.ncts_Status
|
||||||
|
NCTS_FREMD.ncts_ObjectName = NCTS_TMP.Lrn
|
||||||
|
NCTS_FREMD.ncts_ActiveBorderTransportMeans_1_IdentificationNumber = NCTS_TMP.Trailer
|
||||||
|
|
||||||
|
|
||||||
|
NCTS_FREMD.LOAD_Guarantee()
|
||||||
|
|
||||||
|
NCTS_FREMD.ncts_GUARANTEE.Clear()
|
||||||
|
|
||||||
|
|
||||||
|
If NCTS_TMP.GuaranteeAmount > 0 AndAlso NCTS_TMP.Grn IsNot Nothing Then
|
||||||
|
|
||||||
|
Dim GRT = New cNCTS_FREMD_Guarantee
|
||||||
|
GRT.nctsGRT_Type = Nothing
|
||||||
|
|
||||||
|
GRT.nctsGRT_AccessCode = Nothing
|
||||||
|
GRT.nctsGRT_GRN = NCTS_TMP.Grn
|
||||||
|
GRT.nctsGRT_AmountToBeCoveredFremdWaehrung = NCTS_TMP.GuaranteeAmount
|
||||||
|
GRT.nctsGRT_Currency = NCTS_TMP.GuaranteeAmountCurrency
|
||||||
|
|
||||||
|
' MsgBox(If(GRT.nctsGRT_Currency, ""))
|
||||||
|
'--> EUR
|
||||||
|
If GRT.nctsGRT_AmountToBeCoveredFremdWaehrung IsNot Nothing Then
|
||||||
|
If If(GRT.nctsGRT_Currency, "") <> "EUR" Then
|
||||||
|
Dim betragEUR = VERAG_PROG_ALLGEMEIN.cEZB_Waehrungskurse.EXCHANGE_CURTOEUR(GRT.nctsGRT_AmountToBeCoveredFremdWaehrung, GRT.nctsGRT_Currency, NCTS_FREMD.ncts_Trans_DatumZeit.ToShortDateString)
|
||||||
|
GRT.nctsGRT_AmountToBeCovered = If(betragEUR > 0, betragEUR, GRT.nctsGRT_AmountToBeCoveredFremdWaehrung)
|
||||||
|
Else
|
||||||
|
GRT.nctsGRT_AmountToBeCovered = GRT.nctsGRT_AmountToBeCoveredFremdWaehrung
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
NCTS_FREMD.ncts_GUARANTEE.Clear()
|
||||||
|
NCTS_FREMD.ncts_GUARANTEE.Add(GRT)
|
||||||
|
End If
|
||||||
|
|
||||||
|
NCTS_FREMD.SAVE_ALL()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
'Dim SS = VERAG_PROG_ALLGEMEIN.cNCTS_ATEZ_query_declaration_response.root.LoadFromFile("")
|
'Dim SS = VERAG_PROG_ALLGEMEIN.cNCTS_ATEZ_query_declaration_response.root.LoadFromFile("")
|
||||||
|
|
||||||
'For Each c In SS.properties.content
|
'For Each c In SS.properties.content
|
||||||
@@ -48,6 +152,16 @@ Public Class cATEZ_ncts_api
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Function checkDY_NCTS(MRN As String) As Boolean
|
||||||
|
Return ((New VERAG_PROG_ALLGEMEIN.SQL).DLookup("COUNT(*)", "[tblDakosy_NCTSOut004]", "ncts_MRN='" & MRN & "'", "FMZOLL", 0)) > 0
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Shared Function checkDY_TC(MRN As String) As Boolean
|
||||||
|
Return ((New VERAG_PROG_ALLGEMEIN.SQL).DLookup("COUNT(*)", "[tblTelotec_Anmeldung]", "[telanm_CRN]='" & MRN & "'", "FMZOLL", 0)) > 0
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Shared Function get_ie015_xml_by_mrn(MRN As String) As Boolean
|
Public Shared Function get_ie015_xml_by_mrn(MRN As String) As Boolean
|
||||||
Try
|
Try
|
||||||
Dim result = False
|
Dim result = False
|
||||||
@@ -188,10 +302,8 @@ Public Class cATEZ_ncts_api
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If NCTS_P5.Consignment IsNot Nothing AndAlso NCTS_P5.Consignment.HouseConsignment IsNot Nothing AndAlso NCTS_P5.Consignment.HouseConsignment.Count >= 0 Then
|
If NCTS_P5.Consignment IsNot Nothing AndAlso NCTS_P5.Consignment.HouseConsignment IsNot Nothing AndAlso NCTS_P5.Consignment.HouseConsignment.Count >= 0 Then
|
||||||
|
|
||||||
For Each NCTS_P5_HC In NCTS_P5.Consignment.HouseConsignment
|
For Each NCTS_P5_HC In NCTS_P5.Consignment.HouseConsignment
|
||||||
Dim HC = New cNCTS_FREMD_HouseConsignment
|
Dim HC = New cNCTS_FREMD_HouseConsignment
|
||||||
|
|
||||||
HC.nctsHC_GrossMass = NCTS_P5_HC.grossMass
|
HC.nctsHC_GrossMass = NCTS_P5_HC.grossMass
|
||||||
HC.nctsHC_ReferenceNumberUCR = NCTS_P5_HC.referenceNumberUCR
|
HC.nctsHC_ReferenceNumberUCR = NCTS_P5_HC.referenceNumberUCR
|
||||||
HC.nctsHC_CountryOfDestination = NCTS_P5_HC.countryOfDestination
|
HC.nctsHC_CountryOfDestination = NCTS_P5_HC.countryOfDestination
|
||||||
@@ -212,3 +324,62 @@ Public Class cATEZ_ncts_api
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|
||||||
|
Public Class cATEZ_NCTS_declarations_ApiResponseHandler
|
||||||
|
' Root class representing the schema.
|
||||||
|
Public Class cATEZ_NCTS_declarations_welcome
|
||||||
|
Public Property Content As List(Of cATEZ_NCTS_declarations_Content)
|
||||||
|
Public Property Pageable As cATEZ_NCTS_declarations_Pageable
|
||||||
|
Public Property TotalPages As Integer
|
||||||
|
Public Property TotalElements As Integer
|
||||||
|
Public Property Last As Boolean
|
||||||
|
Public Property Number As Integer
|
||||||
|
Public Property Size As Integer
|
||||||
|
Public Property NumberOfElements As Integer
|
||||||
|
Public Property Sort As cATEZ_NCTS_declarations_Sort
|
||||||
|
Public Property First As Boolean
|
||||||
|
Public Property Empty As Boolean
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Public Class cATEZ_NCTS_declarations_Content
|
||||||
|
Public Property GuaranteeAmountCurrency As String
|
||||||
|
Public Property GuaranteeAmount As Decimal
|
||||||
|
Public Property GuaranteeUsageStatus As String
|
||||||
|
Public Property LrnDate As DateTime?
|
||||||
|
Public Property Grn As String
|
||||||
|
Public Property Id As String
|
||||||
|
Public Property Lrn As String
|
||||||
|
Public Property MrnDate As DateTime?
|
||||||
|
Public Property Mrn As String
|
||||||
|
Public Property Status As String
|
||||||
|
Public Property Trailer As String
|
||||||
|
Public Property Tractor As String
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Public Class cATEZ_NCTS_declarations_Pageable
|
||||||
|
Public Property PageNumber As Integer
|
||||||
|
Public Property PageSize As Integer
|
||||||
|
Public Property Sort As cATEZ_NCTS_declarations_Sort
|
||||||
|
Public Property Offset As Integer
|
||||||
|
Public Property Paged As Boolean
|
||||||
|
Public Property Unpaged As Boolean
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Public Class cATEZ_NCTS_declarations_Sort
|
||||||
|
Public Property Sorted As Boolean
|
||||||
|
Public Property Empty As Boolean
|
||||||
|
Public Property Unsorted As Boolean
|
||||||
|
End Class
|
||||||
|
|
||||||
|
' Function to process JSON response and return deserialized object
|
||||||
|
Public Function ProcessJsonResponse(jsonResponse As String) As cATEZ_NCTS_declarations_welcome
|
||||||
|
Try
|
||||||
|
Dim result As cATEZ_NCTS_declarations_welcome = JsonConvert.DeserializeObject(Of cATEZ_NCTS_declarations_welcome)(jsonResponse)
|
||||||
|
Return result
|
||||||
|
Catch ex As Exception
|
||||||
|
' Handle error (e.g., log or rethrow)
|
||||||
|
Throw New Exception("Error while processing JSON response: " & ex.Message)
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user