Fehlerhandling verbessert, AMBAR CMR

This commit is contained in:
2023-09-01 14:30:57 +02:00
parent 6cdca15d8f
commit 2bf8cf0bea
4 changed files with 197 additions and 110 deletions

View File

@@ -20,7 +20,7 @@ Public Class cATEZ_NCTS_DATA
Public Property DAKOSY_Division1 As String
Public Property DAKOSY_Division2 As String
Public Property DAKOSY_Division3 As String
Public Property status As Object = 0
Public Property status As String = "0"
Property erstellung As DateTime = Now
Public Property Route_Country As String
Public Property Carrier_Name As String
@@ -36,6 +36,7 @@ Public Class cATEZ_NCTS_DATA
Public Property json As String
Public Property dakosy_ref As String
Public Property selectedDocuments As String
Public Property fehlerbeschreibung As String
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
@@ -71,6 +72,7 @@ Public Class cATEZ_NCTS_DATA
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("json", json))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("dakosy_ref", dakosy_ref))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("selectedDocuments", selectedDocuments))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("fehlerbeschreibung", fehlerbeschreibung))
Return list
End Function
@@ -565,7 +567,7 @@ Public Class cATEZ_NCTS_IN
Dim sbRequestBody As New Chilkat.StringBuilder
jsonData.EmitSb(sbRequestBody)
Debug.WriteLine(sbRequestBody)
'Debug.WriteLine(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST", "/api/integrations/verag", sbRequestBody, sbResponseBody)
@@ -577,11 +579,21 @@ Public Class cATEZ_NCTS_IN
Else
If (rest.ResponseStatusCode <> 200) Then
failureDesc = rest.ResponseStatusCode & "-" & rest.ResponseStatusText
Return failureDesc
If rest.ResponseStatusCode = 500 Then
Dim jsonResultFailure As New Chilkat.JsonObject
jsonResultFailure.LoadSb(sbResponseBody)
jsonResultFailure.Emit()
failureDesc = jsonResultFailure.StringOf("code") & "-" & jsonResultFailure.StringOf("message")
Return failureDesc
Else
failureDesc = rest.ResponseStatusCode & "-" & rest.ResponseStatusText
Return failureDesc
End If
Else
Dim jsonResult As New Chilkat.JsonObject
Dim jsonResult As New Chilkat.JsonObject
success = jsonResult.LoadSb(sbResponseBody)
jsonResult.Emit()
Return jsonResult.StringOf("atezId")
@@ -596,7 +608,7 @@ Public Class cATEZ_NCTS_IN
End Try
End Function
Shared Function setJson(ncts As cATEZ_NCTS_DATA, dgv As DataGridView)
Shared Function setJson(ncts As cATEZ_NCTS_DATA)
Dim success As Boolean
@@ -638,7 +650,17 @@ Public Class cATEZ_NCTS_IN
i = i + 1
Next
ncts.json = jsonData.Emit()
Return success
End Function
Public Function setJsonPDF(ncts As cATEZ_NCTS_DATA, dgv As DataGridView)
Dim success As Boolean
Dim i As Integer = 0
For Each r As DataGridViewRow In dgv.Rows
Dim isSelected = IIf(DBNull.Value Is r.Cells("anh_selekt").Value, False, r.Cells("anh_selekt").Value)
i = 0
@@ -652,10 +674,8 @@ Public Class cATEZ_NCTS_IN
success = jsonData.UpdateString("Attachments.Attachment[" & i & "].base64BinaryStream", bd.GetEncoded("base64"))
i = i + 1
End If
Next
ncts.json = jsonData.Emit()
jsonData.Emit()
Return success