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 (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
|
||||
For Each node As XmlElement In docxml.GetElementsByTagName("ram:ApplicableHeaderTradeAgreement")
|
||||
If node.HasChildNodes Then
|
||||
For Each element As XmlElement In node.ChildNodes
|
||||
Dim buyerID As String = ""
|
||||
|
||||
If element.Name = "ram:BuyerReference" Then
|
||||
Kundenummer = CInt(element.InnerText) 'Kundennummer
|
||||
Exit For
|
||||
End If
|
||||
For Each node As XmlElement In docxml.GetElementsByTagName("ram:ApplicableHeaderTradeAgreement")
|
||||
|
||||
Next
|
||||
If node.HasChildNodes Then
|
||||
|
||||
count = count + 1
|
||||
For Each element As XmlElement In node.ChildNodes
|
||||
|
||||
End If
|
||||
Next
|
||||
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
|
||||
|
||||
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)
|
||||
@@ -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")
|
||||
|
||||
|
||||
' 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") & "\")
|
||||
' cntDatenEingelesen += 1
|
||||
' End If
|
||||
End If
|
||||
' 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") & "\")
|
||||
' cntDatenEingelesen += 1
|
||||
' End If
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As System.Exception
|
||||
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,39 +966,54 @@ 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))
|
||||
|
||||
DS.uploadDataToDATENSERVER(d,,,,,, True)
|
||||
|
||||
Dim document As New cUTA.UTADocuments
|
||||
document.DocumentName = fi.Name
|
||||
document.daId = DS.da_id
|
||||
document.DocumentTyp = documenttype
|
||||
document.RechnungsNr = invoiceNo
|
||||
document.KundenNr = customerNo
|
||||
document.Datum = outputDate
|
||||
document.Zeitstempel = Now()
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
If fi.Name.ToLower.Contains("pdf") Then addDGVEinarbeitung("PDF", fi.Name)
|
||||
|
||||
Reference in New Issue
Block a user