Anbindung AZEZ-KI API, etc.

This commit is contained in:
2025-04-29 11:29:23 +02:00
parent 99d9549c95
commit aedf2c7375
8 changed files with 937 additions and 615 deletions

View File

@@ -17,9 +17,17 @@ Public Class cUStVLeistender
Dim SQL As New SQL
Sub New(UStV_Leistender As String)
Me.UStV_Leistender = UStV_Leistender
LOAD()
Sub New(UStV_Leistender As String, Optional searchbyUID As Boolean = False)
If Not searchbyUID Then
Me.UStV_Leistender = UStV_Leistender
LOAD()
Else
Me.UstV_Leistender_UstNr = UStV_Leistender
LOADBYUID()
End If
End Sub
Sub New(Id As Integer)
@@ -147,6 +155,35 @@ Public Class cUStVLeistender
End Try
End Sub
Public Sub LOADByUID()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblUStVLeistender WHERE UstV_Leistender_UstNr=@UstV_Leistender_UstNr ", conn)
cmd.Parameters.AddWithValue("@UstV_Leistender_UstNr", UstV_Leistender_UstNr)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each li In getParameterList()
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
If dr.Item(li.Text) Is DBNull.Value Then
propInfo.SetValue(Me, Nothing)
Else
propInfo.SetValue(Me, dr.Item(li.Text))
End If
Next
hasEntry = True
End If
dr.Close()
End Using
End Using
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
Public Sub LOADByLand(Land As String)
Try
hasEntry = False

View File

@@ -854,27 +854,19 @@ Public Class cATEZ_NCTS_IN
success = jsonResult.LoadSb(sbResponseBody)
jsonResult.Emit()
'--------------------------------
Dim num As Integer = jsonResult.Size
Dim data
Dim sizeArray = jsonResult.SizeOfArray("data")
If dt IsNot Nothing Then
Dim data
Dim num As Integer = 1
If sizeArray > 0 Then
If True Then
data = New Chilkat.JsonObject
data = jsonResult
If (data.LastMethodSuccess = False) Then
Debug.WriteLine("data member not found.")
End If
If num = -1 Then
Return "FEHLER Array Data ist leer"
End If
Else
num = jsonResult.SizeOfArray("data")
num = sizeArray
data = jsonResult.ArrayOf("data")
If (jsonResult.LastMethodSuccess = False) Then
@@ -882,44 +874,112 @@ Public Class cATEZ_NCTS_IN
End If
Else
data = New Chilkat.JsonObject
data = jsonResult
num = 1 'nur ein Object
If (data.LastMethodSuccess = False) Then
Debug.WriteLine("data member not found.")
End If
End If
'Dim i As Integer'
'For i = 0 To num - 1
' Dim name As String = jsonResult.NameAt(i)
' Dim value As String = jsonResult.StringAt(i)
' Debug.WriteLine(name & ": " & value)
' Dim iValue As Integer = jsonResult.IntAt(i)
' Debug.WriteLine(name & " as integer: " & iValue)
'Next
'--------------------------------
'num = jsonResult.SizeOfArray("data")
'If num = -1 Then
' If dt IsNot Nothing Then
' Dim data
' 'TODO: Check if array, else jsonObject
' If True Then
' data = New Chilkat.JsonObject
' data = jsonResult
' If (data.LastMethodSuccess = False) Then
' Debug.WriteLine("data member not found.")
' End If
' If num = -1 Then
' Return "FEHLER Array Data ist leer"
' End If
' Else
' data = jsonResult.ArrayOf("data")
' If (jsonResult.LastMethodSuccess = False) Then
' Return "data not found."
' End If
'End If
'--------------------------------
Dim j As Integer = 0
While j < num
While j < num
Dim invoice As Chilkat.JsonObject = jsonResult.ObjectAt(j)
Dim invoice As Chilkat.JsonObject = data.ObjectAt(j)
Dim R As DataRow = dt.NewRow
R("currency") = checkNullStr(invoice.StringOf("currency"))
Dim totalAmonut As String = invoice.StringOf("total_VAT_amount").Replace(".", ",")
R("total_VAT_amount") = CDbl(checkNulDbl(totalAmonut))
R("invoice_id") = checkNullStr(invoice.StringOf("invoice_id"))
R("invoice_date") = checkNullStr(invoice.StringOf("invoice_date"))
Dim R As DataRow = dt.NewRow
R("count") = j + 1
R("currency") = checkNullStr(invoice.StringOf("currency"))
Dim totalAmonut As String = invoice.StringOf("total_VAT_amount").Replace(".", ",")
R("total_VAT_amount") = CDbl(checkNulDbl(totalAmonut))
R("invoice_id") = checkNullStr(invoice.StringOf("invoice_id"))
R("invoice_date") = checkNullStr(invoice.StringOf("invoice_date"))
R("seller_VAT_id") = checkNullStr(invoice.StringOf("seller_VAT_id"))
R("seller_name") = checkNullStr(invoice.StringOf("seller_name"))
R("seller_address_city") = checkNullStr(invoice.StringOf("seller_address_city"))
R("seller_address_country") = checkNullStr(invoice.StringOf("seller_address_country"))
R("seller_address_postcode") = checkNullStr(invoice.StringOf("seller_address_postcode"))
R("seller_address_street") = checkNullStr(invoice.StringOf("seller_address_street"))
R("status") = checkNullStr(jsonResult.StringOf("status"))
R("seller_address_country") = checkNullStr(invoice.StringOf("seller_address_country"))
R("seller_address_postcode") = checkNullStr(invoice.StringOf("seller_address_postcode"))
R("seller_address_street") = checkNullStr(invoice.StringOf("seller_address_street"))
R("status") = checkNullStr(jsonResult.StringOf("status"))
R("document_count") = checkNulInt(jsonResult.IntOf("document_count"))
dt.Rows.Add(R)
dt.Rows.Add(R)
j = j + 1
End While
j = j + 1
End While
Return jsonResult.StringOf("status")
Return jsonResult.StringOf("status")
End If
End If
Return jsonResult.StringOf("atezId")
Return jsonResult.StringOf("atezId")
End If
End If
End If
Catch ex As WebException
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
@@ -942,6 +1002,17 @@ Public Class cATEZ_NCTS_IN
Return 0
End If
End Function
Public Shared Function checkNulInt(ByVal o As Object) As Double
If o IsNot Nothing And o IsNot DBNull.Value Then
If IsNumeric(o) Then
Return CInt(o)
Else
Return 0
End If
Else
Return 0
End If
End Function
Shared Function setJsonNCTS(ncts As cATEZ_NCTS_DATA)

View File

@@ -2,6 +2,7 @@
Imports GrapeCity.ActiveReports.Document
Imports System.ComponentModel
Imports System.Data.SqlClient
Imports System.IO
Public Class cAllgemein
Public Shared FIRMA As String
@@ -597,6 +598,40 @@ Public Class cAllgemein
End If
Return ""
End Function
Public Shared Function ExtractPdfPages(ByVal SourceFile As String, ByVal TargetFile As String, pageStart As Integer, pagesEnd As Integer) As Boolean 'ITEXTSHARP
Try
Dim impPage As iTextSharp.text.pdf.PdfImportedPage = Nothing
If SourceFile.Contains(" ") Then SourceFile = SourceFile
Dim Reader As New iTextSharp.text.pdf.PdfReader(SourceFile)
If Not TargetFile.ToLower.EndsWith(".pdf") Then TargetFile = TargetFile & ".pdf"
Dim srcDoc As New iTextSharp.text.Document() 'Reader.GetPageSizeWithRotation(0))
Dim PdfCopyProvider As New iTextSharp.text.pdf.PdfCopy(srcDoc, New FileStream(TargetFile, System.IO.FileMode.Create))
PdfCopyProvider.SetFullCompression()
srcDoc.Open()
For p As Integer = pageStart To pagesEnd
If p > Reader.NumberOfPages Then
MsgBox("Seitenanzahl überschritten!")
srcDoc.Close() : Reader.Close()
Return False
End If
impPage = PdfCopyProvider.GetImportedPage(Reader, p)
' ----- Ermitteln der Seitenauflösung und setzen für die neue Seite
PdfCopyProvider.SetPageSize(New iTextSharp.text.Rectangle(0.0F, 0.0F, impPage.Width, impPage.Height, Reader.GetPageRotation(p)))
' ----- PDF Seite in das neue Dokument einfügen
PdfCopyProvider.AddPage(impPage)
Next
' ----- neues PDF Dokument und den Reader schließen
srcDoc.Close()
Reader.Close()
Return True
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return False
End Function
End Class
Public Class cNCTS_GUARANTEES
@@ -635,4 +670,6 @@ Public Class cNCTS_GUARANTEES
End Function
End Class