neue Logik für DFDS
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
<PublishUrl>\\ftps.verag.ag\g\FTP\Programme\VeragAddin\</PublishUrl>
|
<PublishUrl>\\ftps.verag.ag\g\FTP\Programme\VeragAddin\</PublishUrl>
|
||||||
<InstallUrl>http://ftps.verag.ag/VERAGAddin/</InstallUrl>
|
<InstallUrl>http://ftps.verag.ag/VERAGAddin/</InstallUrl>
|
||||||
<TargetCulture>de</TargetCulture>
|
<TargetCulture>de</TargetCulture>
|
||||||
<ApplicationVersion>1.0.1.138</ApplicationVersion>
|
<ApplicationVersion>1.0.1.139</ApplicationVersion>
|
||||||
<AutoIncrementApplicationRevision>true</AutoIncrementApplicationRevision>
|
<AutoIncrementApplicationRevision>true</AutoIncrementApplicationRevision>
|
||||||
<UpdateEnabled>true</UpdateEnabled>
|
<UpdateEnabled>true</UpdateEnabled>
|
||||||
<UpdateInterval>0</UpdateInterval>
|
<UpdateInterval>0</UpdateInterval>
|
||||||
|
|||||||
@@ -745,36 +745,46 @@ Public Class AVISO_Mail_Functions
|
|||||||
New DataColumn("Quantity"),
|
New DataColumn("Quantity"),
|
||||||
New DataColumn("GrossWeight"),
|
New DataColumn("GrossWeight"),
|
||||||
New DataColumn("OrderCustoms"),
|
New DataColumn("OrderCustoms"),
|
||||||
|
New DataColumn("Address"),
|
||||||
|
New DataColumn("Code"),
|
||||||
New DataColumn("OperationType"),
|
New DataColumn("OperationType"),
|
||||||
New DataColumn("Description"),
|
New DataColumn("Links") ' store ALL links (doc + cmr)
|
||||||
New DataColumn("LinkText"),
|
})
|
||||||
New DataColumn("LinkUrl")
|
|
||||||
})
|
|
||||||
|
|
||||||
Dim doc As New HtmlAgilityPack.HtmlDocument()
|
Dim doc As New HtmlAgilityPack.HtmlDocument()
|
||||||
doc.LoadHtml(mailItem.HTMLBody)
|
doc.LoadHtml(mailItem.HTMLBody)
|
||||||
|
|
||||||
Dim rows = doc.DocumentNode.SelectNodes("//tr[td]")
|
Dim rows = doc.DocumentNode.SelectNodes("//tr")
|
||||||
|
|
||||||
If rows Is Nothing Then Return dt
|
If rows Is Nothing Then Return dt
|
||||||
|
|
||||||
For Each row In rows
|
For Each row In rows
|
||||||
|
|
||||||
Dim cells = row.SelectNodes("td")
|
Dim cells = row.SelectNodes("td")
|
||||||
If cells Is Nothing OrElse cells.Count < 8 Then Continue For
|
If cells Is Nothing Then Continue For
|
||||||
|
|
||||||
Dim linkNode = cells(7).SelectSingleNode(".//a")
|
Dim recordText As String = Clean(cells(0).InnerText)
|
||||||
|
|
||||||
dt.Rows.Add(
|
If Not IsNumeric(recordText) Then Continue For
|
||||||
Clean(cells(0).InnerText),
|
|
||||||
Clean(cells(1).InnerText),
|
Dim linkNodes = row.SelectNodes(".//a")
|
||||||
Clean(cells(2).InnerText),
|
Dim links As New List(Of String)
|
||||||
Clean(cells(3).InnerText),
|
|
||||||
Clean(cells(4).InnerText),
|
If linkNodes IsNot Nothing Then
|
||||||
Clean(cells(5).InnerText),
|
For Each ln In linkNodes
|
||||||
Clean(cells(6).InnerText),
|
Dim href = ln.GetAttributeValue("href", "")
|
||||||
If(linkNode IsNot Nothing, Clean(linkNode.InnerText), ""),
|
If href <> "" Then links.Add(href)
|
||||||
If(linkNode IsNot Nothing, linkNode.GetAttributeValue("href", ""), "")
|
Next
|
||||||
)
|
End If
|
||||||
|
|
||||||
|
Dim GetCell = Function(index As Integer) As String
|
||||||
|
If cells.Count > index Then
|
||||||
|
Return Clean(cells(index).InnerText)
|
||||||
|
End If
|
||||||
|
Return ""
|
||||||
|
End Function
|
||||||
|
|
||||||
|
dt.Rows.Add(recordText, GetCell(1), GetCell(2), GetCell(3), GetCell(4), GetCell(5), GetCell(6), GetCell(7), String.Join("|", links))
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -783,53 +793,60 @@ Public Class AVISO_Mail_Functions
|
|||||||
Dim sendungsNrOld As String = ""
|
Dim sendungsNrOld As String = ""
|
||||||
Dim missingDocuments As String = ""
|
Dim missingDocuments As String = ""
|
||||||
|
|
||||||
For Each r In dt.Rows
|
For Each r As DataRow In dt.Rows
|
||||||
|
|
||||||
If r("LinkUrl") <> "" AndAlso r("LinkUrl").ToString.Contains("https://web01.ekoltransport.com.tr/dfdsdocumentservice/download/") Then
|
Dim links = r("Links").ToString().Split("|"c)
|
||||||
|
|
||||||
Dim link As String = r("LinkUrl")
|
For Each linkRaw In links
|
||||||
|
|
||||||
If link.EndsWith("%20") And link.Length > 3 Then
|
If String.IsNullOrWhiteSpace(linkRaw) Then Continue For
|
||||||
link = link.Remove(link.Length - 3)
|
|
||||||
|
If linkRaw.Contains("dfdsdocumentservice/download") Then
|
||||||
|
|
||||||
|
Dim link As String = linkRaw.Trim()
|
||||||
|
|
||||||
|
If link.EndsWith("%20") Then
|
||||||
|
link = link.Substring(0, link.Length - 3)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim sendungsNr As String = r("Record")
|
Dim sendungsNr As String = r("Record").ToString()
|
||||||
|
Dim descr As String = r("Consignee").ToString()
|
||||||
|
|
||||||
Dim Descr As String = r("Description")
|
If descr <> "" Then
|
||||||
|
descr = descr.Replace(";", "_").
|
||||||
|
Replace(".", "_").
|
||||||
|
Replace(" ", "_")
|
||||||
|
|
||||||
If Descr <> "" Then
|
descr = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(descr)
|
||||||
Descr = Descr.ToString.Replace(";", "_")
|
|
||||||
Descr = Descr.ToString.Replace(".", "_")
|
|
||||||
Descr = Descr.ToString.Replace(" ", "_")
|
|
||||||
Descr = VERAG_PROG_ALLGEMEIN.cDATENSERVER.replaceInvalidCahr(Descr)
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If sendungsNrOld <> "" AndAlso sendungsNrOld <> sendungsNr Then
|
If sendungsNrOld <> "" AndAlso sendungsNrOld <> sendungsNr Then
|
||||||
counter = 1
|
counter = 1
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim file = VERAG_PROG_ALLGEMEIN.cFormularManager.getFile_FromURLStream(link, r("Record") & "_" & counter & "_" & IIf(Descr <> "", Descr, ""),, False)
|
Dim filename As String = sendungsNr & "_" & counter &
|
||||||
|
If(descr <> "", "_" & descr, "")
|
||||||
|
|
||||||
|
Dim file = VERAG_PROG_ALLGEMEIN.cFormularManager.getFile_FromURLStream(link, filename,, False)
|
||||||
|
|
||||||
If IO.File.Exists(file) Then
|
If IO.File.Exists(file) Then
|
||||||
ATT.Add(file)
|
ATT.Add(file)
|
||||||
|
|
||||||
Else
|
Else
|
||||||
If missingDocuments <> "" Then
|
If missingDocuments <> "" Then
|
||||||
missingDocuments &= vbNewLine & r("Record") & "_" & counter & "_" & IIf(Descr <> "", Descr, "")
|
missingDocuments &= vbNewLine & filename
|
||||||
Else
|
Else
|
||||||
missingDocuments = "fehlende Dokumente: " & vbNewLine & r("Record") & "_" & counter & "_" & IIf(Descr <> "", Descr, "")
|
missingDocuments = "fehlende Dokumente:" & vbNewLine & filename
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
counter += 1
|
counter += 1
|
||||||
|
sendungsNrOld = sendungsNr
|
||||||
sendungsNrOld = r("Record")
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
If missingDocuments <> "" Then
|
If missingDocuments <> "" Then
|
||||||
INFO = missingDocuments
|
INFO = missingDocuments
|
||||||
|
|||||||
Reference in New Issue
Block a user