neu
This commit is contained in:
@@ -11,32 +11,33 @@ Module Mail
|
||||
Dim last_sent As String = sPath & "last_sent.txt" '" & Now.ToString("ddMMyyyyHHmmss") & ".csv"
|
||||
Dim betragOpTr = 1000
|
||||
Sub Main()
|
||||
Try
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein.ERR_OP_GLOBAL = VERAG_PROG_ALLGEMEIN.ERROR_OP.MAIL
|
||||
|
||||
|
||||
Dim PARAM = ""
|
||||
Dim parameter() As String = Environment.GetCommandLineArgs().ToArray
|
||||
If (parameter.Count - 1) >= 1 Then 'Höher als 1 weil der index 0 der Pfad zum programm ist
|
||||
PARAM = parameter(1)
|
||||
'For i = 1 To parameter.Count - 1
|
||||
' 'If parameter(i) = "HISTORY" Then PARAM = True
|
||||
' Next
|
||||
End If
|
||||
Dim PARAM = ""
|
||||
Dim parameter() As String = Environment.GetCommandLineArgs().ToArray
|
||||
If (parameter.Count - 1) >= 1 Then 'Höher als 1 weil der index 0 der Pfad zum programm ist
|
||||
PARAM = parameter(1)
|
||||
'For i = 1 To parameter.Count - 1
|
||||
' 'If parameter(i) = "HISTORY" Then PARAM = True
|
||||
' Next
|
||||
End If
|
||||
|
||||
System.Console.WriteLine("MailSender gestartet ...")
|
||||
' If IO.File.Exists(options) Then
|
||||
System.Console.WriteLine("MailSender gestartet ...")
|
||||
' If IO.File.Exists(options) Then
|
||||
|
||||
'If Not IO.File.Exists(last_sent) Then
|
||||
'IO.File.Create(last_sent)
|
||||
' End If
|
||||
'If Not IO.File.Exists(last_sent) Then
|
||||
'IO.File.Create(last_sent)
|
||||
' End If
|
||||
|
||||
' Dim o As String = getOption()
|
||||
If PARAM = "" Then
|
||||
System.Console.WriteLine("OPTION nicht erkannt!")
|
||||
Exit Sub
|
||||
End If
|
||||
Dim cnt = 0
|
||||
' MsgBox(DoesProcessExists("MailSender"))
|
||||
While DoesProcessExists("MailSender") Or cnt > 20
|
||||
' Dim o As String = getOption()
|
||||
If PARAM = "" Then
|
||||
System.Console.WriteLine("OPTION nicht erkannt!")
|
||||
Exit Sub
|
||||
End If
|
||||
Dim cnt = 0
|
||||
' MsgBox(DoesProcessExists("MailSender"))
|
||||
While DoesProcessExists("MailSender") Or cnt > 20
|
||||
System.Console.WriteLine("MailSender wurde nicht beendet, warten ...")
|
||||
Threading.Thread.Sleep(1000)
|
||||
cnt += 1
|
||||
@@ -177,7 +178,13 @@ Module Mail
|
||||
System.Console.WriteLine("Programm beendet in 2")
|
||||
Threading.Thread.Sleep(1000)
|
||||
System.Console.WriteLine("Programm beendet in 1")
|
||||
Threading.Thread.Sleep(1000)
|
||||
Threading.Thread.Sleep(1000)
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Function getOption() As String
|
||||
@@ -940,11 +947,22 @@ Module Mail
|
||||
Dim von = CDate("01." & Now.AddMonths(-1).Month & "." & Now.AddMonths(-1).Year)
|
||||
Dim bis = CDate("01." & Now.Month & "." & Now.Year).AddDays(-1)
|
||||
|
||||
sqlstr &= " SELECT Aviso.[Grenzstelle], SUM(Speditionsbuch.Abfertigungsanzahl) as Anzahl FROM Speditionsbuch INNER JOIN [BUCHHALTUNG\SQLEXPRESS].AVISO.dbo.AVISO on Aviso.avisoid=Speditionsbuch.AvisoID WHERE PersonalnummerQS is not null "
|
||||
'sqlstr &= " SELECT Aviso.[Grenzstelle], SUM(Speditionsbuch.Abfertigungsanzahl) as Anzahl FROM Speditionsbuch INNER JOIN [SQLGUIDE01.verag.ost.dmn].AVISO.dbo.AVISO on Aviso.avisoid=Speditionsbuch.AvisoID "
|
||||
'sqlstr &= " WHERE PersonalnummerQS is not null "
|
||||
'sqlstr &= " and FilialenNr NOT IN ( 4801,4806,5501 ) "
|
||||
'sqlstr &= " and Abfertigungsdatum between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' " &
|
||||
' " GROUP BY Aviso.[Grenzstelle]" &
|
||||
' " ORDER BY Anzahl DESC"
|
||||
|
||||
sqlstr &= " SELECT [Grenzstelle], SUM(Speditionsbuch.Abfertigungsanzahl) as Anzahl FROM Speditionsbuch "
|
||||
sqlstr &= " WHERE FilialenNrAbklaerung ='4803' " 'QS SUB
|
||||
' sqlstr &= " WHERE Filiale "
|
||||
sqlstr &= " and FilialenNr NOT IN ( 4801,4806,5501 ) "
|
||||
|
||||
sqlstr &= " and Abfertigungsdatum between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' " &
|
||||
" GROUP BY Aviso.[Grenzstelle]" &
|
||||
" GROUP BY [Grenzstelle]" &
|
||||
" ORDER BY Anzahl DESC"
|
||||
|
||||
Dim dt As DataTable = loadDgvBySqlFMZOLL(sqlstr)
|
||||
|
||||
Dim exclApp As Object 'as Application
|
||||
@@ -996,10 +1014,17 @@ Module Mail
|
||||
Dim von = CDate("01." & Now.AddMonths(-1).Month & "." & Now.AddMonths(-1).Year)
|
||||
Dim bis = CDate("01." & Now.Month & "." & Now.Year).AddDays(-1)
|
||||
|
||||
sqlstr &= " SELECT Aviso.[Grenzstelle], SUM(Speditionsbuch.Abfertigungsanzahl) as Anzahl FROM Speditionsbuch INNER JOIN [BUCHHALTUNG\SQLEXPRESS].AVISO.dbo.AVISO on Aviso.avisoid=Speditionsbuch.AvisoID WHERE Abfertigungsart IN (26,28) "
|
||||
sqlstr &= " AND Aviso.[Grenzstelle] <> 'SFD' and FilialenNr NOT IN ( 4801,4806 ) "
|
||||
'sqlstr &= " SELECT Aviso.[Grenzstelle], SUM(Speditionsbuch.Abfertigungsanzahl) as Anzahl FROM Speditionsbuch INNER JOIN [SQLGUIDE01.verag.ost.dmn].AVISO.dbo.AVISO on Aviso.avisoid=Speditionsbuch.AvisoID WHERE Abfertigungsart IN (26,28) "
|
||||
'sqlstr &= " AND Aviso.[Grenzstelle] <> 'SFD' and FilialenNr NOT IN ( 4801,4806 ) "
|
||||
'sqlstr &= " and Abfertigungsdatum between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' " &
|
||||
' " GROUP BY Aviso.[Grenzstelle]" &
|
||||
' " ORDER BY Anzahl DESC"
|
||||
|
||||
|
||||
sqlstr &= " SELECT [Grenzstelle], SUM(Speditionsbuch.Abfertigungsanzahl) as Anzahl FROM Speditionsbuch WHERE Abfertigungsart IN (26,28) "
|
||||
sqlstr &= " AND [Grenzstelle] <> 'SFD' and FilialenNr NOT IN ( 4801,4806 ) "
|
||||
sqlstr &= " and Abfertigungsdatum between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' " &
|
||||
" GROUP BY Aviso.[Grenzstelle]" &
|
||||
" GROUP BY [Grenzstelle]" &
|
||||
" ORDER BY Anzahl DESC"
|
||||
Dim dt As DataTable = loadDgvBySqlFMZOLL(sqlstr)
|
||||
|
||||
@@ -1084,7 +1109,7 @@ Module Mail
|
||||
|
||||
sqlstr &= " SELECT count(*)"
|
||||
sqlstr &= " FROM tblEABelegnummer as EAB inner join tblEABelegposition as POS on EAB.Mandant=POS.Mandant and EAB.[Niederlassung]=POS.[Niederlassung] and EAB.[Benutzer]=POS.[Benutzer] and EAB.[BelegDat]=POS.[BelegDat] and EAB.[BelegNr]=POS.[BelegNr]"
|
||||
sqlstr &= " where LeistungsNr=480 and [EAB].BelegDat between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' and gebucht=1 and storniert=0 "
|
||||
sqlstr &= " where LeistungsNr=480 and [EAB].BelegDat between '" & von.ToShortDateString & "' and '" & bis.ToShortDateString & "' and gebucht=1 and storniert=0 and EAB.Mandant='IMEX' "
|
||||
|
||||
Dim anzahl = 0
|
||||
|
||||
@@ -1303,9 +1328,9 @@ Module Mail
|
||||
Public Function loadDgvBySqlFMZOLL(ByVal sql As String) As DataTable
|
||||
Try
|
||||
Dim myTable = New DataTable()
|
||||
Dim conn As New SqlConnection
|
||||
conn.ConnectionString = "Data Source=192.168.0.91\SQLFMZOLL;Initial Catalog=VERAG;Integrated Security=false;User ID=test;Password=BmWr501956;"
|
||||
conn.Open()
|
||||
Dim conn As SqlConnection = VERAG_PROG_ALLGEMEIN.SQL.GetNewOpenConnectionFMZOLL
|
||||
'conn.ConnectionString = "Data Source=192.168.0.91\SQLFMZOLL;Initial Catalog=VERAG;Integrated Security=false;User ID=test;Password=BmWr501956;"
|
||||
'conn.Open()
|
||||
|
||||
Using cmd As New SqlCommand(sql, conn)
|
||||
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
||||
@@ -1324,9 +1349,9 @@ Module Mail
|
||||
Public Function loadDgvBySqlSDL(ByVal sql As String) As DataTable
|
||||
Try
|
||||
Dim myTable = New DataTable()
|
||||
Dim conn As New SqlConnection
|
||||
conn.ConnectionString = "Data Source=192.168.0.91\SQLFMZOLL;Initial Catalog=SDL;Integrated Security=false;User ID=test;Password=BmWr501956;"
|
||||
conn.Open()
|
||||
Dim conn As SqlConnection = VERAG_PROG_ALLGEMEIN.SQL.GetNewOpenConnectionFMZOLL
|
||||
'conn.ConnectionString = "Data Source=192.168.0.91\SQLFMZOLL;Initial Catalog=SDL;Integrated Security=false;User ID=test;Password=BmWr501956;"
|
||||
'conn.Open()
|
||||
|
||||
Using cmd As New SqlCommand(sql, conn)
|
||||
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
||||
|
||||
Reference in New Issue
Block a user