Syska (MDM-Import), uta, etc.

This commit is contained in:
2026-09-17 16:45:01 +02:00
parent e38010fd79
commit 10c67ef095

View File

@@ -814,7 +814,9 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
If True Then 'Not System.IO.Directory.Exists(zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\") Then System.IO.Directory.CreateDirectory(zielpfad & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
If (fi.Name.ToString.StartsWith("AP") AndAlso fi.Name.ToLower.Contains("zugferd")) OrElse (fi.Name.ToString.Contains("(") AndAlso fi.Name.ToString.Contains(")") AndAlso fi.Name.ToString.Contains("_RE_")) Then 'Rechnungen per Mail oder manuelle RE!
'If (fi.Name.ToString.Contains("AP") AndAlso fi.Name.ToLower.Contains("zugferd")) OrElse (fi.Name.ToString.Contains("(") AndAlso fi.Name.ToString.Contains(")") AndAlso fi.Name.ToString.Contains("_RE_")) Then 'Rechnungen per Mail oder manuelle RE!
If (fi.Name.ToString.Contains("AP") AndAlso fi.Name.ToLower.Contains("zugferd") AndAlso Not fi.Name.ToLower.Contains("epn") AndAlso Not fi.Name.ToLower.Contains("gsb")) Then 'Rechnungen per Mail oder manuelle RE!
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "UTA", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
@@ -870,24 +872,39 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
End If
If docxml.GetElementsByTagName("ram:ApplicableHeaderTradeAgreement").Count > 0 Then
Dim count As Integer = 1
Dim buyerID As String = ""
For Each node As XmlElement In docxml.GetElementsByTagName("ram:ApplicableHeaderTradeAgreement")
If node.HasChildNodes Then
For Each element As XmlElement In node.ChildNodes
If element.Name = "ram:BuyerReference" Then
Kundenummer = CInt(element.InnerText) 'Kundennummer
If element.Name = "ram:BuyerTradeParty" Then
'Kundennummer / Buyer ID
For Each buyerElement As XmlElement In element.ChildNodes
If buyerElement.Name = "ram:ID" Then
buyerID = buyerElement.InnerText.Trim()
Exit For
End If
Next
count = count + 1
Exit For
End If
Next
End If
Next
If buyerID <> "" AndAlso IsNumeric(buyerID) Then
Kundenummer = CInt(buyerID)
End If
If docxml.GetElementsByTagName("ram:SpecifiedTradeProduct").Count > 0 Then
@@ -917,6 +934,9 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
End If
found = True
If invoiceNr <> "" AndAlso invoiceDate <> "" AndAlso Kundenummer > 0 AndAlso Rechnungsland <> "" Then
Dim parsedDate As DateTime = DateTime.ParseExact(invoiceDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
@@ -938,7 +958,7 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
MsgBox(ex.StackTrace)
End Try
ElseIf fi.Name.ToString.StartsWith("AP") AndAlso fi.Name.ToLower.Contains("epn") Then 'nur einzelpostennachweise
ElseIf fi.Name.ToString.Contains("AP") AndAlso fi.Name.ToLower.Contains("epn") Then 'nur einzelpostennachweise
Dim customerNo As Integer
Dim invoiceNo As String = ""
@@ -946,23 +966,36 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
Dim outputDate = ""
Dim documenttype As String = ""
Dim fi_Name_bereinigt As String = fi.Name
If fi.Name.Length >= 37 Then
customerNo = fi.Name.Substring(2, 6)
invoiceNo = fi.Name.Substring(9, 8)
dateNo = fi.Name.Substring(18, 10)
documenttype = fi.Name.Substring(33, 3)
If Not fi_Name_bereinigt.StartsWith("AP", StringComparison.OrdinalIgnoreCase) Then
Dim pos As Integer = fi_Name_bereinigt.IndexOf("AP", StringComparison.OrdinalIgnoreCase)
If pos >= 0 Then
fi_Name_bereinigt = fi_Name_bereinigt.Substring(pos)
End If
End If
If fi_Name_bereinigt.Length >= 37 Then
customerNo = fi_Name_bereinigt.Substring(2, 6)
invoiceNo = fi_Name_bereinigt.Substring(9, 8)
dateNo = fi_Name_bereinigt.Substring(18, 10)
documenttype = "EPN"
Dim parsedDate As DateTime = DateTime.ParseExact(dateNo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture)
outputDate = parsedDate.ToString("dd.MM.yyyy")
End If
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "UTA", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
Dim document As New cUTA.UTADocuments(invoiceNo, customerNo, outputDate, documenttype)
If Not document.hasEntry Then
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "UTA", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
DS.uploadDataToDATENSERVER(d,,,,,, True)
Dim document As New cUTA.UTADocuments
document.DocumentName = fi.Name
document.DocumentName = fi_Name_bereinigt
document.daId = DS.da_id
document.DocumentTyp = documenttype
document.RechnungsNr = invoiceNo
@@ -973,6 +1006,8 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
If document.SAVE() Then cntDatenEingelesen += 1
frmStartOptions.moveFile_DateBack(d, zielpfad & "EPN_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
cntDatenEingelesen += 1
End If
End If