USTVA; MDM-Einarbeitung

This commit is contained in:
2025-10-03 09:12:44 +02:00
parent 44d3949da5
commit 584c88c68e
6 changed files with 131 additions and 17 deletions

View File

@@ -680,7 +680,16 @@ Public Class usrCntlUSTV
Else Else
Dim frm As New frmUSTVoffeneAntraege()
Dim start_date As New Date(Today.Year, 1, 1)
Dim end_date As New Date(Today.Year, 12, 31)
Dim ADR As cAdressen = New cAdressen(kdNr)
Dim frm As New frmUSTVoffeneAntraege(start_date, end_date, kdNr, ADR.Name_1)
frm.Show() frm.Show()
End If End If

View File

@@ -342,6 +342,10 @@ Public Class cIDS
objFileRead.DiscardBufferedData() objFileRead.DiscardBufferedData()
objFileRead.BaseStream.Seek(0, System.IO.SeekOrigin.Begin) objFileRead.BaseStream.Seek(0, System.IO.SeekOrigin.Begin)
Dim counTrans As Integer = 0
Dim savedTrans As Integer = 0
Dim MDMEinarb As New cMDMEinarbeitung("IDS", Now())
Do While (objFileRead.Peek() > -1) Do While (objFileRead.Peek() > -1)
Dim currentRow As String() Dim currentRow As String()
@@ -354,7 +358,6 @@ Public Class cIDS
Return False Return False
End If End If
Else Else
Try Try
@@ -388,6 +391,8 @@ Public Class cIDS
With ids With ids
.YearMonthDay = isleernothing((currentRow(0))) .YearMonthDay = isleernothing((currentRow(0)))
.CustomerCode = isleernothing((currentRow(1))) .CustomerCode = isleernothing((currentRow(1)))
@@ -398,6 +403,10 @@ Public Class cIDS
.OutletCode = isleernothing((currentRow(6))) .OutletCode = isleernothing((currentRow(6)))
.ProductTypeCode = isleernothing((currentRow(7))) .ProductTypeCode = isleernothing((currentRow(7)))
If lngRecordCount = 2 Then
MDMEinarb.invoicedate = CDate(.YearMonthDay)
End If
'Dim transVol_old = .TransactionVolume 'Dim transVol_old = .TransactionVolume
'Dim transVol_new = isleernothing((currentRow(8))) 'Dim transVol_new = isleernothing((currentRow(8)))
@@ -471,9 +480,9 @@ Public Class cIDS
Console.WriteLine("IDS: " & isleernothing((currentRow(1))) & " - " & lngRecordCount & " - " & isleernothing((currentRow(10)))) Console.WriteLine("IDS: " & isleernothing((currentRow(1))) & " - " & lngRecordCount & " - " & isleernothing((currentRow(10))))
If isOBO Then If isOBO Then
.SAVE_OBO() If .SAVE_OBO() Then counTrans += 1
Else Else
.SAVE_VR() If .SAVE_VR() Then counTrans += 1
End If End If
'.SAVE() '.SAVE()
@@ -488,6 +497,16 @@ Public Class cIDS
Loop Loop
cnt = CInt(lngRecordCount) cnt = CInt(lngRecordCount)
MDMEinarb.ds_total += cnt - 1
MDMEinarb.ds_count += counTrans
MDMEinarb.import_date = Now()
If MDMEinarb.ds_total = MDMEinarb.ds_count Then
MDMEinarb.completed = True
MDMEinarb.completed_date = Now()
End If
MDMEinarb.SAVE()
objFileRead.Close() objFileRead.Close()
Return True Return True

View File

@@ -1,15 +1,17 @@
 
Imports System.Data.SqlClient Imports System.Data.SqlClient
Imports System.Reflection Imports System.Reflection
Imports com.sun.xml.internal.rngom.digested
Public Class cMDMEInarbeitung Public Class cMDMEinarbeitung
Property id As Integer Property id As Integer
Property supplier As Object = Nothing Property supplier As Object = Nothing
Property invoicedate As Object = Nothing Property invoicedate As Object = Nothing
Property ds_count As Object = Nothing Property ds_count As Object = Nothing
Property ds_total As Object = Nothing Property ds_total As Object = Nothing
Property completed As Object = Nothing Property completed As Boolean = False
Property completed_date As Object = Nothing Property completed_date As Object = Nothing
Property import_date As Object = Nothing
Public hasEntry = False Public hasEntry = False
@@ -27,6 +29,13 @@ Public Class cMDMEInarbeitung
LOAD(supplier, invoicedate) LOAD(supplier, invoicedate)
End Sub End Sub
Sub New(supplier, invoicedate, importdate)
Me.supplier = supplier
Me.invoicedate = invoicedate
Me.import_date = import_date
LOAD(supplier, invoicedate, import_date)
End Sub
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("id", id,, True)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("id", id,, True))
@@ -36,6 +45,7 @@ Public Class cMDMEInarbeitung
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ds_total", ds_total)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ds_total", ds_total))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed", completed)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed", completed))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed_date", completed_date)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed_date", completed_date))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("import_date", import_date))
Return list Return list
End Function End Function
@@ -111,6 +121,36 @@ Public Class cMDMEInarbeitung
End Try End Try
End Sub End Sub
Public Sub LOAD(supplier, invoicedate, import_date)
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblMDMEinarbeitung WHERE supplier=@supplier and invoicedate=@invoicedate and import_date=@import_date ", conn)
cmd.Parameters.AddWithValue("@supplier", supplier)
cmd.Parameters.AddWithValue("@invoicedate", invoicedate)
cmd.Parameters.AddWithValue("@import_date", import_date)
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 Function getUpdateCmd() As String Public Function getUpdateCmd() As String
@@ -153,4 +193,33 @@ Public Class cMDMEInarbeitung
Return "" Return ""
End Function End Function
Shared Function setInvoicingDate(ByRef import_date As Date, ByRef MDM_OBJ As cMDMEinarbeitung) As Boolean
Dim REDat
If import_date.Day < 15 Then
'vor 15, letzer Monat Monatsletzter!
If import_date.Month <> 1 Then
'Monatsletzter aus Vorjahr
REDat = New Date(Today.Year, Today.Month - 1, DateTime.DaysInMonth(import_date.Year, import_date.Month - 1))
Else
REDat = New Date(Today.Year - 1, 12, DateTime.DaysInMonth(import_date.Year - 1, 12))
End If
ElseIf Today().Day >= 15 Then
REDat = New Date(import_date.Year, import_date.Month, 15)
End If
If REDat IsNot Nothing AndAlso IsDate(REDat) Then
MDM_OBJ.invoicedate = REDat
Return True
Else
Return False
End If
End Function
End Class End Class

View File

@@ -148,7 +148,7 @@ Public Class cUIDPruefung
End Function End Function
Public Shared Function doUIDPruefungALL(Optional datum As Object = Nothing, Optional SaveErgInAdressen As Boolean = True, Optional Sciherheitsabfrage As Boolean = True, Optional MaxEintraege As Integer = -1, Optional showErr As Boolean = True, Optional finanzOnline As Boolean = True, Optional veroegerungMs As Integer = 1000) As DataTable Public Shared Function doUIDPruefungALL(Optional datum As Object = Nothing, Optional SaveErgInAdressen As Boolean = True, Optional Sciherheitsabfrage As Boolean = True, Optional MaxEintraege As Integer = -1, Optional showErr As Boolean = True, Optional finanzOnline As Boolean = True, Optional veroegerungMs As Integer = 1500) As DataTable
Dim dt As DataTable = Nothing Dim dt As DataTable = Nothing
If datum = Nothing Then datum = CDate("15." & Now.ToString("MM.yyyy")).AddMonths(-1) If datum = Nothing Then datum = CDate("15." & Now.ToString("MM.yyyy")).AddMonths(-1)

View File

@@ -989,6 +989,11 @@ Public Class cUTA
Dim lngÜbertragungsposition As Integer Dim lngÜbertragungsposition As Integer
Dim curChecksumme As Double Dim curChecksumme As Double
Dim counTrans As Integer = 0
Dim savedTrans As Integer = 0
Dim MDMEinarb As New cMDMEinarbeitung("UTA", Now())
MDMEinarb.setInvoicingDate(Now(), MDMEinarb)
Dim lngRecordCount As Long Dim lngRecordCount As Long
Try Try
@@ -1209,7 +1214,7 @@ Public Class cUTA
.SAVE() .SAVE()
End If End If
Else Else
.SAVE() If .SAVE() Then savedTrans += 1
End If End If
@@ -1324,6 +1329,7 @@ Public Class cUTA
.Anzahl_Sätze = Mid(strZeile, 3, 13) .Anzahl_Sätze = Mid(strZeile, 3, 13)
.Checksumme = Mid(strZeile, 16, 18) / 100 .Checksumme = Mid(strZeile, 16, 18) / 100
.SAVE() .SAVE()
MDMEinarb.ds_total += .Anzahl_Sätze
End With End With
@@ -1334,6 +1340,15 @@ Public Class cUTA
Loop Loop
MDMEinarb.ds_count += savedTrans
MDMEinarb.import_date = Now()
If MDMEinarb.ds_count = MDMEinarb.ds_total Then
MDMEinarb.completed = True
MDMEinarb.completed_date = Now()
End If
MDMEinarb.SAVE()
Catch ex As Exception Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name) VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try End Try

View File

@@ -78,7 +78,7 @@ Public Class cMSEAPI
End Function End Function
Public Function getNewestTransactions(jwt As String, dt As DataTable, ByRef batchNr As Integer, ByRef totalPages As Integer, ByRef currentPage As Integer, onlyBilledTransactions As Boolean) As String Public Function getNewestTransactions(jwt As String, dt As DataTable, ByRef batchNr As Integer, ByRef totalPages As Integer, ByRef currentPage As Integer, onlyBilledTransactions As Boolean, ByRef savedTrans As Integer) As String
Try Try
Dim returnText As String = "" Dim returnText As String = ""
Dim failureText As String = "" Dim failureText As String = ""
@@ -155,7 +155,7 @@ Public Class cMSEAPI
Return "FEHLER im TransaktionArray" Return "FEHLER im TransaktionArray"
End If End If
If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver"), onlyBilledTransactions) If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver"), onlyBilledTransactions, savedTrans)
Catch ex As WebException Catch ex As WebException
@@ -413,7 +413,7 @@ Public Class cMSEAPI
End If End If
If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver")) If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver"), 0)
Catch ex As WebException Catch ex As WebException
@@ -526,7 +526,7 @@ Public Class cMSEAPI
End If End If
'If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver")) 'If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver"))
saveTransactions(num, dt, transactions, json.StringOf("receiver"), True,) ' wenn ID explizit aufgerufen keine Prüfung auf receivcer und purchaseDate saveTransactions(num, dt, transactions, json.StringOf("receiver"), 0, True,) ' wenn ID explizit aufgerufen keine Prüfung auf receivcer und purchaseDate
End If End If
Next row Next row
@@ -545,7 +545,7 @@ Public Class cMSEAPI
End Function End Function
Public Function getTransactionsFromBatchNrAndPage(jwt As String, dt As DataTable, ByRef batchNr As Integer, ByRef totalPages As Integer, ByRef currentPage As Integer) As String Public Function getTransactionsFromBatchNrAndPage(jwt As String, dt As DataTable, ByRef batchNr As Integer, ByRef totalPages As Integer, ByRef currentPage As Integer, ByRef savedTrans As Integer) As String
Try Try
Dim returnText As String = "" Dim returnText As String = ""
Dim failureText As String = "" Dim failureText As String = ""
@@ -625,7 +625,7 @@ Public Class cMSEAPI
Return "FEHLER Array Transaktions ist leer" Return "FEHLER Array Transaktions ist leer"
End If End If
If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver")) If json.StringOf("receiver") = "10738" Then saveTransactions(num, dt, transactions, json.StringOf("receiver"), savedTrans)
Catch ex As WebException Catch ex As WebException
@@ -1048,7 +1048,7 @@ Public Class cMSEAPI
End Function End Function
Public Sub saveTransactions(num As Integer, dt As DataTable, transactions As Chilkat.JsonArray, receiver As Integer, Optional ignorePurchaseDate As Boolean = False, Optional onlyBilledTransactions As Boolean = True) Public Sub saveTransactions(num As Integer, dt As DataTable, transactions As Chilkat.JsonArray, receiver As Integer, ByRef savedTrans As Integer, Optional ignorePurchaseDate As Boolean = False, Optional onlyBilledTransactions As Boolean = True)
Dim j As Integer = 0 Dim j As Integer = 0
@@ -1215,9 +1215,11 @@ Public Class cMSEAPI
'trans.distance_km = CDbl(R("distance_km")) 'trans.distance_km = CDbl(R("distance_km"))
If onlyBilledTransactions Then If onlyBilledTransactions Then
If trans.transaction_status = "Billed" Then trans.SAVE() If trans.transaction_status = "Billed" Then
If trans.SAVE() Then savedTrans += 1
End If
Else Else
trans.SAVE() If trans.SAVE() Then savedTrans += 1
End If End If