Syska (MDM-Import), uta, etc.
This commit is contained in:
@@ -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 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))
|
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
|
End If
|
||||||
|
|
||||||
If docxml.GetElementsByTagName("ram:ApplicableHeaderTradeAgreement").Count > 0 Then
|
Dim buyerID As String = ""
|
||||||
Dim count As Integer = 1
|
|
||||||
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
|
For Each node As XmlElement In docxml.GetElementsByTagName("ram:ApplicableHeaderTradeAgreement")
|
||||||
Kundenummer = CInt(element.InnerText) 'Kundennummer
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
Next
|
If node.HasChildNodes Then
|
||||||
|
|
||||||
count = count + 1
|
For Each element As XmlElement In node.ChildNodes
|
||||||
|
|
||||||
End If
|
If element.Name = "ram:BuyerTradeParty" Then
|
||||||
Next
|
|
||||||
|
|
||||||
|
'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
|
||||||
|
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
If buyerID <> "" AndAlso IsNumeric(buyerID) Then
|
||||||
|
Kundenummer = CInt(buyerID)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If docxml.GetElementsByTagName("ram:SpecifiedTradeProduct").Count > 0 Then
|
If docxml.GetElementsByTagName("ram:SpecifiedTradeProduct").Count > 0 Then
|
||||||
@@ -917,6 +934,9 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
found = True
|
found = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If invoiceNr <> "" AndAlso invoiceDate <> "" AndAlso Kundenummer > 0 AndAlso Rechnungsland <> "" Then
|
If invoiceNr <> "" AndAlso invoiceDate <> "" AndAlso Kundenummer > 0 AndAlso Rechnungsland <> "" Then
|
||||||
|
|
||||||
Dim parsedDate As DateTime = DateTime.ParseExact(invoiceDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
|
Dim parsedDate As DateTime = DateTime.ParseExact(invoiceDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
|
||||||
@@ -927,18 +947,18 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
|||||||
SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "', daIdgesetztDatum = getdate() where [Rechnungsnummer_pro_Lieferland] = '" & invoiceNr & "' AND cast(Rechnungsdatum as Date) = '" & invoiceDate & "' AND Kundennummer =" & Kundenummer & " and Lieferland_ISO2 ='" & Rechnungsland & "' and daId is null", "FMZOLL")
|
SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "', daIdgesetztDatum = getdate() where [Rechnungsnummer_pro_Lieferland] = '" & invoiceNr & "' AND cast(Rechnungsdatum as Date) = '" & invoiceDate & "' AND Kundennummer =" & Kundenummer & " and Lieferland_ISO2 ='" & Rechnungsland & "' and daId is null", "FMZOLL")
|
||||||
|
|
||||||
|
|
||||||
' If SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "' where [Rechnungsnummer_pro_Lieferland] = '" & invoiceNr & "' AND cast(Rechnungsdatum as Date) = '" & invoiceDate & "' AND Kundennummer =" & Kundenummer & " and Abrechnungsnummer =" & r.Item("Abrechnungsnummer") & " and daId is null ", "FMZOLL") Then
|
' If SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "' where [Rechnungsnummer_pro_Lieferland] = '" & invoiceNr & "' AND cast(Rechnungsdatum as Date) = '" & invoiceDate & "' AND Kundennummer =" & Kundenummer & " and Abrechnungsnummer =" & r.Item("Abrechnungsnummer") & " and daId is null ", "FMZOLL") Then
|
||||||
' frmStartOptions.moveFile_DateBack(d, zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
' frmStartOptions.moveFile_DateBack(d, zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||||
' cntDatenEingelesen += 1
|
' cntDatenEingelesen += 1
|
||||||
' End If
|
' End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Catch ex As System.Exception
|
Catch ex As System.Exception
|
||||||
MsgBox(ex.StackTrace)
|
MsgBox(ex.StackTrace)
|
||||||
End Try
|
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 customerNo As Integer
|
||||||
Dim invoiceNo As String = ""
|
Dim invoiceNo As String = ""
|
||||||
@@ -946,39 +966,54 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
|||||||
Dim outputDate = ""
|
Dim outputDate = ""
|
||||||
Dim documenttype As String = ""
|
Dim documenttype As String = ""
|
||||||
|
|
||||||
|
Dim fi_Name_bereinigt As String = fi.Name
|
||||||
|
|
||||||
If fi.Name.Length >= 37 Then
|
If Not fi_Name_bereinigt.StartsWith("AP", StringComparison.OrdinalIgnoreCase) Then
|
||||||
customerNo = fi.Name.Substring(2, 6)
|
Dim pos As Integer = fi_Name_bereinigt.IndexOf("AP", StringComparison.OrdinalIgnoreCase)
|
||||||
invoiceNo = fi.Name.Substring(9, 8)
|
|
||||||
dateNo = fi.Name.Substring(18, 10)
|
If pos >= 0 Then
|
||||||
documenttype = fi.Name.Substring(33, 3)
|
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)
|
Dim parsedDate As DateTime = DateTime.ParseExact(dateNo, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture)
|
||||||
outputDate = parsedDate.ToString("dd.MM.yyyy")
|
outputDate = parsedDate.ToString("dd.MM.yyyy")
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
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
|
Dim document As New cUTA.UTADocuments(invoiceNo, customerNo, outputDate, documenttype)
|
||||||
document.DocumentName = fi.Name
|
|
||||||
document.daId = DS.da_id
|
If Not document.hasEntry Then
|
||||||
document.DocumentTyp = documenttype
|
|
||||||
document.RechnungsNr = invoiceNo
|
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "UTA", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
|
||||||
document.KundenNr = customerNo
|
DS.uploadDataToDATENSERVER(d,,,,,, True)
|
||||||
document.Datum = outputDate
|
|
||||||
document.Zeitstempel = Now()
|
document.DocumentName = fi_Name_bereinigt
|
||||||
|
document.daId = DS.da_id
|
||||||
|
document.DocumentTyp = documenttype
|
||||||
|
document.RechnungsNr = invoiceNo
|
||||||
|
document.KundenNr = customerNo
|
||||||
|
document.Datum = outputDate
|
||||||
|
document.Zeitstempel = Now()
|
||||||
|
|
||||||
|
If document.SAVE() Then cntDatenEingelesen += 1
|
||||||
|
frmStartOptions.moveFile_DateBack(d, zielpfad & "EPN_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||||
|
cntDatenEingelesen += 1
|
||||||
|
End If
|
||||||
|
|
||||||
If document.SAVE() Then cntDatenEingelesen += 1
|
|
||||||
frmStartOptions.moveFile_DateBack(d, zielpfad & "EPN_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
|
||||||
cntDatenEingelesen += 1
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If fi.Name.ToLower.Contains("pdf") Then addDGVEinarbeitung("PDF", fi.Name)
|
If fi.Name.ToLower.Contains("pdf") Then addDGVEinarbeitung("PDF", fi.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user