Mailsender, status EZA send
This commit is contained in:
12
UID/usrctlProcedures.Designer.vb
generated
12
UID/usrctlProcedures.Designer.vb
generated
@@ -178,6 +178,7 @@ Partial Class usrctlProcedures
|
||||
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
|
||||
Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
|
||||
Me.Button55 = New System.Windows.Forms.Button()
|
||||
Me.Button56 = New System.Windows.Forms.Button()
|
||||
Me.tbTRStat.SuspendLayout()
|
||||
Me.TabPage3.SuspendLayout()
|
||||
Me.TabPage1.SuspendLayout()
|
||||
@@ -1688,10 +1689,20 @@ Partial Class usrctlProcedures
|
||||
Me.Button55.Text = "TEST T1"
|
||||
Me.Button55.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Button56
|
||||
'
|
||||
Me.Button56.Location = New System.Drawing.Point(414, 29)
|
||||
Me.Button56.Name = "Button56"
|
||||
Me.Button56.Size = New System.Drawing.Size(145, 49)
|
||||
Me.Button56.TabIndex = 68
|
||||
Me.Button56.Text = "KARACA"
|
||||
Me.Button56.UseVisualStyleBackColor = True
|
||||
'
|
||||
'usrctlProcedures
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.Controls.Add(Me.Button56)
|
||||
Me.Controls.Add(Me.Button55)
|
||||
Me.Controls.Add(Me.Button99)
|
||||
Me.Controls.Add(Me.Button43)
|
||||
@@ -1929,4 +1940,5 @@ Partial Class usrctlProcedures
|
||||
Friend WithEvents btnTCtoVERAEZA_File As Button
|
||||
Friend WithEvents cbxCD_Overwrite As CheckBox
|
||||
Friend WithEvents Button55 As Button
|
||||
Friend WithEvents Button56 As Button
|
||||
End Class
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.ComponentModel
|
||||
Imports System.Data.OleDb
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.DirectoryServices
|
||||
Imports System.IO
|
||||
Imports System.Net
|
||||
Imports System.Net.Mail
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text
|
||||
Imports System.Xml
|
||||
Imports System.Xml.Serialization
|
||||
@@ -15,6 +17,7 @@ Imports DAKOSY_Worker.FreierVerkehrAktVeredelUmwandlung_004
|
||||
Imports GrapeCity
|
||||
Imports itextsharp.text.pdf
|
||||
Imports Microsoft.Office.Interop
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports PdfSharp.Drawing
|
||||
Imports PdfSharp.Pdf
|
||||
Imports PdfSharp.Pdf.AcroForms
|
||||
@@ -22,7 +25,9 @@ Imports PdfSharp.Pdf.IO
|
||||
Imports Renci.SshNet
|
||||
Imports TELOTEC_Worker
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
Imports VERAG_PROG_ALLGEMEIN.cOpenAI
|
||||
Imports VERAG_PROG_ALLGEMEIN.cTelotecAPI
|
||||
|
||||
'Imports Microsoft.Office.Interop
|
||||
|
||||
Public Class usrctlProcedures
|
||||
@@ -4739,7 +4744,233 @@ OPTION (MAXRECURSION 1000);", "AVISO") '
|
||||
readT1.TEST(path)
|
||||
End Sub
|
||||
|
||||
Private Sub Button56_Click_1(sender As Object, e As EventArgs) Handles Button56.Click
|
||||
|
||||
Dim alleArtikel As List(Of ZollArtikelInput) =
|
||||
LoadArtikelAusExcel("D:\Andreas\Dokumente\KUNDEN\KARACA\Karaca.xlsx")
|
||||
|
||||
Dim fromCNTRY As String = "TR"
|
||||
Dim toCNTRY As String = "DE"
|
||||
Dim toLAN As String = "DE"
|
||||
|
||||
For Each a In alleArtikel
|
||||
|
||||
If If(a.tarifnummer_tuerkei, "") = "" Then Continue For
|
||||
|
||||
Dim KN8 As New VERAG_PROG_ALLGEMEIN.cTariffKN8_Interface
|
||||
a.kn8_text = KN8.getKN8FromTNR(a.tarifnummer_tuerkei)
|
||||
|
||||
If a.tarifnummer_tuerkei.Length >= 8 AndAlso a.tarifnummer_tuerkei.Length < 11 Then
|
||||
a.moegliche_eu_tarifnummern =
|
||||
VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.GetFullTariff(
|
||||
a.tarifnummer_tuerkei,
|
||||
fromCNTRY,
|
||||
toCNTRY,
|
||||
toLAN
|
||||
)
|
||||
End If
|
||||
|
||||
If a.moegliche_eu_tarifnummern Is Nothing Then
|
||||
a.moegliche_eu_tarifnummern = New List(Of String)
|
||||
End If
|
||||
|
||||
If a.moegliche_eu_tarifnummern.Count = 0 AndAlso If(a.kn8_text, "") <> "" Then
|
||||
a.moegliche_eu_tarifnummern.Add(a.kn8_text)
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
Dim unternehmensbeschreibung As String =
|
||||
"Karaca ist ein türkischer Hersteller, Exporteur und international tätiger Handelskonzern für Haushaltswaren, Porzellan, Geschirr, Küchen- und Kochartikel, Glaswaren, Besteck, Elektro-Kleingeräte, Heimtextilien und Wohnaccessoires.
|
||||
Das Unternehmen entwickelt, produziert und vertreibt Konsumgüter für den privaten Haushalt sowie teilweise für Gastronomie, Hotellerie und Retail. Die Waren werden über eigene Filialen, Onlinehandel, Großhandel und internationale Vertriebspartner in verschiedene Länder verkauft.
|
||||
Für den Zoll- und Außenhandelsbereich ist Karaca hauptsächlich als Anbieter von Home-&-Kitchen-Produkten einzuordnen. Die Waren betreffen je nach Material und Funktion insbesondere Porzellan-/Keramikwaren, Haushaltswaren, Kochgeschirr, Glaswaren, Besteck, elektrische Küchengeräte und Heimtextilien."
|
||||
|
||||
Dim gesamtergebnis As New List(Of String)
|
||||
|
||||
Dim blockGroesse As Integer = 200
|
||||
|
||||
For i As Integer = 0 To alleArtikel.Count - 1 Step blockGroesse
|
||||
|
||||
Dim artikelBlock As List(Of ZollArtikelInput) =
|
||||
alleArtikel.Skip(i).Take(blockGroesse).ToList()
|
||||
|
||||
Dim result As String = askAI_Zolltarif(
|
||||
unternehmensbeschreibung,
|
||||
artikelBlock
|
||||
)
|
||||
|
||||
gesamtergebnis.Add(result)
|
||||
Console.WriteLine(result)
|
||||
|
||||
Next
|
||||
|
||||
ExportErgebnisNachExcel(alleArtikel, gesamtergebnis, "D:\Andreas\Dokumente\KUNDEN\KARACA\Karaca_Ergebnis.xlsx")
|
||||
MsgBox("Fertig")
|
||||
|
||||
End Sub
|
||||
Public Shared Function LoadArtikelAusExcel(Datei As String) As List(Of ZollArtikelInput)
|
||||
|
||||
Dim artikel As New List(Of ZollArtikelInput)
|
||||
|
||||
Dim xlApp As Microsoft.Office.Interop.Excel.Application = Nothing
|
||||
Dim wb As Microsoft.Office.Interop.Excel.Workbook = Nothing
|
||||
Dim ws As Microsoft.Office.Interop.Excel.Worksheet = Nothing
|
||||
|
||||
Try
|
||||
|
||||
xlApp = New Microsoft.Office.Interop.Excel.Application
|
||||
wb = xlApp.Workbooks.Open(Datei, ReadOnly:=True)
|
||||
ws = CType(wb.Sheets(1), Microsoft.Office.Interop.Excel.Worksheet)
|
||||
|
||||
Dim row As Integer = 2
|
||||
|
||||
Do
|
||||
|
||||
Dim artikelNr As String = Trim(CStr(ws.Cells(row, 1).Text))
|
||||
Dim warenbeschreibung As String = Trim(CStr(ws.Cells(row, 2).Text))
|
||||
Dim tarifnummerTR As String = Trim(CStr(ws.Cells(row, 3).Text)).Replace(".", "").Replace("-", "").Replace(" ", "")
|
||||
|
||||
If artikelNr = "" AndAlso warenbeschreibung = "" AndAlso tarifnummerTR = "" Then
|
||||
Exit Do
|
||||
End If
|
||||
|
||||
artikel.Add(New ZollArtikelInput With {
|
||||
.artikelnummer = artikelNr,
|
||||
.kundenwarenbeschreibung = warenbeschreibung,
|
||||
.tarifnummer_tuerkei = tarifnummerTR,
|
||||
.kn8_text = "",
|
||||
.moegliche_eu_tarifnummern = New List(Of String)
|
||||
})
|
||||
|
||||
row += 1
|
||||
|
||||
Loop
|
||||
|
||||
Finally
|
||||
|
||||
If wb IsNot Nothing Then
|
||||
wb.Close(False)
|
||||
Marshal.ReleaseComObject(wb)
|
||||
End If
|
||||
|
||||
If ws IsNot Nothing Then
|
||||
Marshal.ReleaseComObject(ws)
|
||||
End If
|
||||
|
||||
If xlApp IsNot Nothing Then
|
||||
xlApp.Quit()
|
||||
Marshal.ReleaseComObject(xlApp)
|
||||
End If
|
||||
|
||||
GC.Collect()
|
||||
GC.WaitForPendingFinalizers()
|
||||
|
||||
End Try
|
||||
|
||||
Return artikel
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Sub ExportErgebnisNachExcel(
|
||||
originalArtikel As List(Of ZollArtikelInput),
|
||||
jsonErgebnisse As List(Of String),
|
||||
zielDatei As String
|
||||
)
|
||||
|
||||
Dim alleErgebnisse As New JArray()
|
||||
|
||||
For Each jsonObj In jsonErgebnisse
|
||||
Dim arr As JArray = JArray.Parse(jsonObj)
|
||||
For Each item In arr
|
||||
alleErgebnisse.Add(item)
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim xlApp As Microsoft.Office.Interop.Excel.Application = Nothing
|
||||
Dim wb As Microsoft.Office.Interop.Excel.Workbook = Nothing
|
||||
Dim ws As Microsoft.Office.Interop.Excel.Worksheet = Nothing
|
||||
|
||||
Try
|
||||
xlApp = New Microsoft.Office.Interop.Excel.Application
|
||||
wb = xlApp.Workbooks.Add()
|
||||
ws = CType(wb.Sheets(1), Microsoft.Office.Interop.Excel.Worksheet)
|
||||
|
||||
ws.Cells(1, 1).Value = "Artikelnummer"
|
||||
ws.Cells(1, 2).Value = "Original Warenbeschreibung"
|
||||
ws.Cells(1, 3).Value = "TR Tarifnummer"
|
||||
ws.Cells(1, 4).Value = "KN8 Text"
|
||||
ws.Cells(1, 5).Value = "Mögliche EU Tarifnummern"
|
||||
|
||||
ws.Cells(1, 6).Value = "EU TARIC"
|
||||
ws.Cells(1, 7).Value = "Accuracy EU"
|
||||
ws.Cells(1, 8).Value = "Warenbezeichnung DE"
|
||||
ws.Cells(1, 9).Value = "Klassifizierungsgrund EU"
|
||||
|
||||
ws.Cells(1, 10).Value = "UK Tarifnummer"
|
||||
ws.Cells(1, 11).Value = "Accuracy UK"
|
||||
ws.Cells(1, 12).Value = "Goods Description UK"
|
||||
ws.Cells(1, 13).Value = "Classification Reason UK"
|
||||
|
||||
Dim row As Integer = 2
|
||||
|
||||
For Each a In originalArtikel
|
||||
|
||||
Dim found As JObject = Nothing
|
||||
|
||||
For Each item As JObject In alleErgebnisse
|
||||
If CStr(item("artikelnummer")) = a.artikelnummer Then
|
||||
found = item
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
ws.Cells(row, 1).Value = a.artikelnummer
|
||||
ws.Cells(row, 2).Value = a.kundenwarenbeschreibung
|
||||
ws.Cells(row, 3).Value = a.tarifnummer_tuerkei
|
||||
ws.Cells(row, 4).Value = a.kn8_text
|
||||
|
||||
'If a.moegliche_eu_tarifnummern IsNot Nothing Then
|
||||
' ws.Cells(row, 5).Value = String.Join(", ", a.moegliche_eu_tarifnummern)
|
||||
'End If
|
||||
|
||||
If found IsNot Nothing Then
|
||||
|
||||
ws.Cells(row, 5).Value = CStr(found("moegliche_eu_tarifnummern"))
|
||||
ws.Cells(row, 6).Value = CStr(found("tarifnummer_eu"))
|
||||
ws.Cells(row, 7).Value = CStr(found("accuracy_eu"))
|
||||
ws.Cells(row, 8).Value = CStr(found("warenbezeichnung_de"))
|
||||
ws.Cells(row, 9).Value = CStr(found("klassifizierungsgrund_eu"))
|
||||
|
||||
ws.Cells(row, 10).Value = CStr(found("tarifnummer_uk"))
|
||||
ws.Cells(row, 11).Value = CStr(found("accuracy_uk"))
|
||||
ws.Cells(row, 12).Value = CStr(found("goods_description_uk"))
|
||||
ws.Cells(row, 13).Value = CStr(found("classification_reason_uk"))
|
||||
End If
|
||||
|
||||
row += 1
|
||||
Next
|
||||
|
||||
ws.Columns.AutoFit()
|
||||
wb.SaveAs(zielDatei)
|
||||
|
||||
Finally
|
||||
If wb IsNot Nothing Then
|
||||
wb.Close(False)
|
||||
Marshal.ReleaseComObject(wb)
|
||||
End If
|
||||
|
||||
If ws IsNot Nothing Then Marshal.ReleaseComObject(ws)
|
||||
|
||||
If xlApp IsNot Nothing Then
|
||||
xlApp.Quit()
|
||||
Marshal.ReleaseComObject(xlApp)
|
||||
End If
|
||||
|
||||
GC.Collect()
|
||||
GC.WaitForPendingFinalizers()
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
'Private Sub Button26_Click(sender As Object, e As EventArgs)
|
||||
' For Each d In System.IO.Directory.GetDirectories("\\192.168.0.91\Datenarchiv\DAKOSY\ECHTSYSTEM\Nachrichtendaten_Ablage\2019")
|
||||
|
||||
Reference in New Issue
Block a user