Asfinag Bugfix

This commit is contained in:
2023-12-04 10:55:52 +01:00
parent bec09948bf
commit 5b537e9887
3 changed files with 152 additions and 56 deletions

View File

@@ -304,8 +304,13 @@ Public Class cAsfinag
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Sub New(PKFileName, OBUID)
Me.PKFileName = PKFileName
'Sub New(PKFileName, OBUID)
' Me.PKFileName = PKFileName
' Me.OBUID = OBUID
' LOAD()
'End Sub
Sub New(OBUID)
Me.OBUID = OBUID
LOAD()
End Sub
@@ -335,7 +340,8 @@ Public Class cAsfinag
Public Function SAVE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN If EXISTS(Select * FROM CLFArchiv WHERE PKFileName=@PKFileName AND OBUID = @OBUID) " &
'Dim sqlstr = " BEGIN TRAN If EXISTS(Select * FROM CLFArchiv WHERE PKFileName=@PKFileName AND OBUID = @OBUID) " &
Dim sqlstr = " BEGIN TRAN If EXISTS(Select * FROM CLFArchiv WHERE OBUID = @OBUID) " &
" BEGIN " & getUpdateCmd() & " End " &
" Else " &
" BEGIN " & getInsertCmd() & " End " &
@@ -348,8 +354,9 @@ Public Class cAsfinag
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionAsfinag()
Using cmd As New SqlCommand("Select * FROM CLFArchiv WHERE PKFileName=@PKFileName AND OBUID = @OBUID ", conn)
cmd.Parameters.AddWithValue("@PKFileName", PKFileName)
Using cmd As New SqlCommand("Select * FROM CLFArchiv WHERE OBUID = @OBUID ", conn)
'Using cmd As New SqlCommand("Select * FROM CLFArchiv WHERE PKFileName=@PKFileName AND OBUID = @OBUID ", conn)
'cmd.Parameters.AddWithValue("@PKFileName", PKFileName)
cmd.Parameters.AddWithValue("@OBUID", OBUID)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
@@ -386,7 +393,8 @@ Public Class cAsfinag
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
Return (" UPDATE [CLFArchiv] SET " & str & " WHERE PKFileName=@PKFileName AND OBUID = @OBUID ")
'Return (" UPDATE [CLFArchiv] SET " & str & " WHERE PKFileName=@PKFileName AND OBUID = @OBUID ")
Return (" UPDATE [CLFArchiv] SET " & str & " WHERE OBUID = @OBUID ")
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
@@ -1579,19 +1587,21 @@ Public Class cAsfinag
Dim dtAsfinag As DataTable = SQL.loadDgvBySql_Param(strSQLASFINAG, "ASFINAG")
Dim clfArchiv As New cAsfinag.CLFArchiv(fi.Name, Trim(Mid(strZeile, 35, 18)))
Dim clfArchiv As New cAsfinag.CLFArchiv(Trim(Mid(strZeile, 35, 18)))
If dtAsfinag.Rows.Count = 0 Then
With clfArchiv
'Dim clfArchiv As New cAsfinag.CLFArchiv(fi.Name, Trim(Mid(strZeile, 35, 18)))
'If dtAsfinag.Rows.Count = 0 Then
With clfArchiv
.PKFileName = fi.Name
.RecordType = Trim(Mid(strZeile, 1, 2))
.fileVersion = Trim(Mid(strZeile, 3, 2))
.fileNumber = Trim(Mid(strZeile, 5, 3))
.cardNumber = Trim(Mid(strZeile, 9, 22))
.validTo = Trim(Mid(strZeile, 31, 4))
.OBUID = Trim(Mid(strZeile, 35, 18))
.vehicleLicensePlate = Trim(Mid(strZeile, 53, 10))
.nationality = Trim(Mid(strZeile, 63, 3))
'.OBUID = Trim(Mid(strZeile, 35, 18))
.vehicleLicensePlate = Trim(Mid(strZeile, 53, 10))
.nationality = Trim(Mid(strZeile, 63, 3))
.vehicleCategory = Trim(Mid(strZeile, 66, 1))
.emissionCategory = Trim(Mid(strZeile, 67, 2))
.status = Trim(Mid(strZeile, 69, 2))
@@ -1601,32 +1611,32 @@ Public Class cAsfinag
.contractType = Trim(Mid(strZeile, 83, 1))
.SAVE()
End With
End If
'End If
For Each r As DataRow In dtAsfinag.Rows
' For Each r As DataRow In dtAsfinag.Rows
clfArchiv = New cAsfinag.CLFArchiv(r.Item("PKFileName"), r.Item("OBUID"))
' clfArchiv = New cAsfinag.CLFArchiv(r.Item("PKFileName"), r.Item("OBUID"))
With clfArchiv
.PKFileName = fi.Name
.RecordType = Trim(Mid(strZeile, 1, 2))
.fileVersion = Trim(Mid(strZeile, 3, 2))
.fileNumber = Trim(Mid(strZeile, 5, 3))
.cardNumber = Trim(Mid(strZeile, 9, 22))
.validTo = Trim(Mid(strZeile, 31, 4))
.OBUID = Trim(Mid(strZeile, 35, 18))
.vehicleLicensePlate = Trim(Mid(strZeile, 53, 10))
.nationality = Trim(Mid(strZeile, 63, 3))
.vehicleCategory = Trim(Mid(strZeile, 66, 1))
.emissionCategory = Trim(Mid(strZeile, 67, 2))
.status = Trim(Mid(strZeile, 69, 2))
.contractDate = DateSerial(Mid(strZeile, 71, 4), Mid(strZeile, 75, 2), Mid(strZeile, 77, 2))
.engineCharacteristics = Trim(Mid(strZeile, 79, 3))
.CO2EmissionsClass = Trim(Mid(strZeile, 82, 1))
.contractType = Trim(Mid(strZeile, 83, 1))
.SAVE()
End With
Next
' With clfArchiv
' .PKFileName = fi.Name
' .RecordType = Trim(Mid(strZeile, 1, 2))
' .fileVersion = Trim(Mid(strZeile, 3, 2))
' .fileNumber = Trim(Mid(strZeile, 5, 3))
' .cardNumber = Trim(Mid(strZeile, 9, 22))
' .validTo = Trim(Mid(strZeile, 31, 4))
' .OBUID = Trim(Mid(strZeile, 35, 18))
' .vehicleLicensePlate = Trim(Mid(strZeile, 53, 10))
' .nationality = Trim(Mid(strZeile, 63, 3))
' .vehicleCategory = Trim(Mid(strZeile, 66, 1))
' .emissionCategory = Trim(Mid(strZeile, 67, 2))
' .status = Trim(Mid(strZeile, 69, 2))
' .contractDate = DateSerial(Mid(strZeile, 71, 4), Mid(strZeile, 75, 2), Mid(strZeile, 77, 2))
' .engineCharacteristics = Trim(Mid(strZeile, 79, 3))
' .CO2EmissionsClass = Trim(Mid(strZeile, 82, 1))
' .contractType = Trim(Mid(strZeile, 83, 1))
' .SAVE()
' End With
'Next
Case "90"