You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2603 lines
120 KiB

Imports System.IO.File
Imports System.IO
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.ComponentModel
Imports System.SystemException
Imports System.Threading
Imports ICSharpCode.SharpZipLib.Checksums
Imports ICSharpCode.SharpZipLib.Zip
Imports ICSharpCode.SharpZipLib.GZip
Imports System.Reflection
Imports System.Drawing.Printing
Module ModMain
#Region "Deklarationen"
Public m_log As bms.Logging
Dim log As New clsLog
' Dim objword As Word.ApplicationClass 'Vor Office 2003
Dim objword As Word.Application 'Seit Office 2003
Dim docword As Word.DocumentClass
'Dim objexcel As Excel.ApplicationClass 'Vor Office 2003
Dim objexcel As Excel.Application 'Seit Office 2003
Dim docexcel As Excel.WorkbookClass
Dim Outputfile As String = ""
Dim OutputfilePS As String = ""
Dim SourceFilename As String
Dim stat As New Statushandling
Dim dostart As Boolean
Dim StartInfo As New ProcessStartInfo
Dim colFileCount As New Collection
Dim FileCount As New clsFileCounter
Dim ZipFileName As String
Dim objCrc32 As New Crc32
Dim strmZipOutputStream As ZipOutputStream
Dim filestozip As New Collection
Dim cmdret As Integer
Dim Prozess As String
Dim archivdatum As DataTable
Dim prozessdata As DataTable
Dim FileLastAccess As DateTime
#End Region
#Region "Main"
Sub Main()
Try
Dim m_log1 As New bms.Logging(4, Common.Common.JobType.StartJob)
m_log = m_log1
m_log.Start()
Catch ex As Exception
WirteLog("BMS-Connection / XML: " + ex.Message, ApplicationPath() + "Error.txt")
'MsgBox("BMS-Connection / XML: " + ex.Message, ApplicationPath() + "Error.txt")
'Exit Sub
End Try
Try 'BUD - 2006.10.04 - Try eingebaut
Thread.Sleep(5000)
Dim looper As Integer = 0
Dim Ret As String
Dim db_conn As New EDOKA.DB_Connection
dostart = False
Fehler = 0
log.Startlog(1)
log.InsertJournale("EDKB02: Start Archivierung " + CType(Now, String), clsLog.Enum_InfoTyp.Information)
Ret = Params.Loadparameters
Console.WriteLine(Params.PostScript)
Console.WriteLine(Params.PostScriptDriver)
Console.WriteLine(Params.PostScriptDriverColor)
Console.WriteLine(Params.PDFDir)
Console.WriteLine("****************")
If Ret <> "" Then
log.InsertJournale("Error 1: Load Parameters laden: " + Ret, clsLog.Enum_InfoTyp.Fehler)
Fehler = 1
End If
'Neu EDKB02Starter integriert
If Check_ReturnCodeStarter() <> 0 Then
m_log.Ende()
Exit Sub
End If
'Tempor<6F>re Dateien l<>schen die <20>lter als x Tage sind
delete_tempfiles(3)
'Zip Dateien l<>schen die <20>lter als x Tage sind
delete_zipfiles(3)
'Stop / Start Spooler
stop_start_spooler()
'EDOKA-Datenbank - Connection Test
Try
Dim testdb As New SqlDataAdapter("Select * from applikation", Globals.sConnectionString_edoka)
Dim testdsi As New DataSet
Dim s As String
testdb.Fill(testdsi, "testtable")
s = testdsi.Tables(0).Rows(0).Item(0)
testdsi.Dispose()
testdb.Dispose()
Catch
log.InsertJournale("Error 2: EDOKA-Datenbank nicht verf<72>gbar", clsLog.Enum_InfoTyp.Fehler)
Fehler = 3
End Try
filestozip = Nothing
filestozip = New Collection
If Fehler = 0 Then Check_ReturnCode()
If Fehler = 0 Then
FileOpen(4, Params.PathColdDateien + Params.FileReturnCode, OpenMode.Output)
PrintLine(4, "3")
FileClose(4)
FileOpen(9, Params.PathColdDateien + Params.CMDDatei, OpenMode.Output)
FileOpen(5, Params.PathColdDateien + Params.FileUpdate, OpenMode.Output)
End If
If Fehler = 0 Then ColdReturn_Verarbeiten()
If Fehler = 0 Then Eingangsarchivierung()
If Fehler = 0 Then Ausgangsarchivierung()
If Fehler = 0 Then COLDUpdate()
If Fehler = 0 Then EDOKA_Mehrfachscan_Bearbeiten_2()
If Fehler = 0 Then Update_BL()
If Fehler = 0 Then Delete_BL()
FileClose(5)
If Fehler = 0 Then
'' UC4 Anpassung
ZipFileName = "__TGKBData" + Format(Now, "yyyyMMddHHmmss") + ".zip"
If Not Params.Test = "True" Then
zipfiles()
End If
'' Braucht kein DTO mehr ==> UC4
'Print_cmd(Params.PathColdDateien + ZipFileName, ZipFileName, 3)
'printdto_start()
FileClose(9)
Dim I As Integer
If dostart Then
If Not Params.Test = "True" Then
FileCount.Write_File(log)
'I = Shell(Params.PathColdDateien + Params.CMDDatei, AppWinStyle.NormalFocus, False, 5000000)
End If
FileOpen(4, Params.PathColdDateien + Params.FileReturnCode, OpenMode.Output)
PrintLine(4, "9")
FileClose(4)
If I <> 0 Then Fehler = 999
Else
FileOpen(4, Params.PathColdDateien + Params.FileReturnCode, OpenMode.Output)
PrintLine(4, "0")
FileClose(4)
FileCount.Write_File(log)
End If
Sendmail(Params.MailAdresse, 0)
Else
FileClose(9)
Sendmail(Params.MailAdresse1, Fehler)
End If
log.InsertJournale("Ende Archvierung " + CType(Now, String), clsLog.Enum_InfoTyp.Information)
'' ZIP Umbenennen f<>r UC4
Rename(Params.PathColdDateien + ZipFileName, Params.PathColdDateien + "TGKBData" + Format(Now, "yyyyMMddHHmmss") + ".zip")
'BUD - 2006.10.31 - Try Catch ausgebaut
Try
Generic_Select(10)
Catch
End Try
Catch ex As Exception
m_log.Log("ModMain:ModMain:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Error)
setStatusFilesToStart()
Finally
m_log.Ende()
End Try
End Sub
Private Sub setStatusFilesToStart()
Try
'RS 2006-11-06: alle files zuerst closen, weil ev noch offen -> io.exception
FileClose(4)
FileClose(5)
FileOpen(4, Params.PathColdDateien + Params.FileReturnCode, OpenMode.Output)
PrintLine(4, "0")
FileClose(4)
FileOpen(5, Params.PathColdDateien + "FileCount.txt", OpenMode.Output)
PrintLine(5, "")
FileClose(5)
Catch ex As Exception
m_log.Log("ModMain:setStatusFilesToStart:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Error)
Finally
'RS 2006-11-06: file W<>RKLI schl<68>sse
FileClose(4)
FileClose(5)
End Try
End Sub
#Region "Update Banklagernd"
'EDEX Banklagernd
Private Sub Update_BL()
Try
FileOpen(4, Params.PathColdDateien + "updateBL.txt", OpenMode.Output)
Dim i As Integer
Dim s As String
Dim dt As New DataTable
dt = get_dok_to_delete(0)
For i = 0 To dt.Rows.Count - 1
If dt.Rows(i).Item("TYP") = 0 Then
'EDOKA-Doks
s = "[-f TGKB EDOKA-Banklagernd] [-G TGKB-C35-EW-EDOKA-BL-Put1.0] "
s = s + "[ -i ""WHERE NRDOC00 LIKE '" + dt.Rows(i).Item("dokumentid") + "%'"" ]"
Else
If Len(dt.Rows(i).Item("nrpar00")) > 8 Then
'HOST-DOKS
s = "[-f TGKB EDOKA-Banklagernd] [-G TGKB-C35-EW-EDOKA-BL-Put1.0] "
s = s + "[ -i ""WHERE NRDOK00 LIKE '" + dt.Rows(i).Item("dokumentid") + "%'"" ]"
Else
'AVQ-DOKS
s = "[-f TGKB EDOKA-Banklagernd] [-G TGKB-C35-EW-EDOKA-BL-Put2.0] "
s = s + "[ -i ""WHERE MAILINGID LIKE '" + dt.Rows(i).Item("dokumentid") + "%'"" ]"
End If
End If
If dt.Rows(i).Item("bl_status") = -1 Then
s = s + "[ -n BESTA00 = 'Nicht aush<73>ndigen' ]"
Else
s = s + "[ -n BESTA00 = 'Dokument ausgeh<65>ndigt' ]"
End If
PrintLine(4, s)
Next
Catch
Finally
Try
FileClose(4)
Catch ex As Exception
log.InsertJournale("Update_BL - File Close ist fehlgeschlagen:" + ex.Message, clsLog.Enum_InfoTyp.Warnung)
End Try
End Try
End Sub
Private Sub Delete_BL()
Try
'If Hour(Now) < 19 Then
If Hour(Now) < Params.BlDelTime Then
Exit Sub
End If
Dim fn As String
fn = "BL_DEL_" + Format(Now, "yyyyMMddmm")
FileOpen(4, Params.PathColdDateien + fn, OpenMode.Append)
Dim i As Integer
Dim s As String
Dim p As String
Dim dt As New DataTable
dt = get_dok_to_delete(1)
For i = 0 To dt.Rows.Count - 1
'MNK 20081030 - Partnernr zuweisung fehlte
p = dt.Rows(i).Item("nrpar00")
If dt.Rows(i).Item("TYP") = 0 Then
'EDOKA-Doks
s = "[-f TGKB EDOKA-Banklagernd] [-G TGKB-C35-EW-EDOKA-BL-Put1.0] "
s = s + "[ -i ""WHERE NRPAR00=" + p + " and NRDOC00 LIKE '" + dt.Rows(i).Item("dokumentid") + "%'"" ]"
Else
If Len(dt.Rows(i).Item("nrpar00")) > 8 Then
'HOST-Doks
s = "[-f TGKB EDOKA-Banklagernd] [-G TGKB-C35-EW-EDOKA-BL-Put1.0] "
s = s + "[ -i ""WHERE NRPAR00=" + p + " and NRDOK00 LIKE '" + dt.Rows(i).Item("dokumentid") + "%'"" ]"
Else
'Avaloq-Doks
s = "[-f TGKB EDOKA-Banklagernd] [-G TGKB-C35-EW-EDOKA-BL-Put2.0] "
s = s + "[ -i ""WHERE BPKEYNRINHAB=" + p + " and MAILINGID LIKE '" + dt.Rows(i).Item("dokumentid") + "%'"" ]"
End If
End If
PrintLine(4, s)
Next
FileClose(4)
If i > 0 Then
cmdret = Shell(Params.PathColdDateien + "deljob.cmd " + fn, AppWinStyle.NormalFocus, False)
End If
Catch EX As Exception
log.InsertJournale("Delete_BL ist fehlgeschlagen:" + EX.Message, clsLog.Enum_InfoTyp.Warnung)
Finally
Try
FileClose(4)
Catch
End Try
End Try
End Sub
Private Function get_dok_to_delete(ByVal fnkt As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand
Dim dtToReturn As DataTable = New DataTable
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.CommandText = "dbo.sp_edex_bl_update_status"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.Int, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, fnkt))
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
Throw New Exception("sp_edex_bl_update_status::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
#End Region
#Region "Handle Temp- and ZIP-Files"
Private Sub delete_tempfiles(ByVal TageBehalten As Integer)
Try
'2005-05-27 - Delete alte Dateien
Dim di As New IO.DirectoryInfo(Params.PathTemp)
Dim diar1 As IO.FileInfo() = di.GetFiles("*.*")
Dim dra As IO.FileInfo
Dim d1 As DateTime = Now
For Each dra In diar1
If DateDiff(DateInterval.Day, dra.CreationTime, Now) > TageBehalten Then
Try
dra.Delete()
Catch
End Try
End If
Next
Catch ex As Exception
m_log.Log("ModMain:delete_tempfiles:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End Sub
Private Sub delete_zipfiles(ByVal TageBehalten As Integer)
Try
'2005-05-27 - Delete alte Dateien
Dim di As New IO.DirectoryInfo(Params.PathColdDateien)
Dim diar1 As IO.FileInfo() = di.GetFiles("*.zip")
Dim dra As IO.FileInfo
Dim d1 As DateTime = Now
For Each dra In diar1
If DateDiff(DateInterval.Day, dra.CreationTime, Now) > TageBehalten Then
Try
dra.Delete()
Catch
End Try
End If
Next
Catch ex As Exception
m_log.Log("ModMain:delete_zipfiles:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End Sub
Private Sub zipfiles()
strmZipOutputStream = New ZipOutputStream(File.Create(Params.PathColdDateien + ZipFileName))
strmZipOutputStream.SetLevel(6)
Dim strFile As String
For Each strFile In filestozip
If Params.PostScript = True Then
AddToZip(Params.PDFDir + UCase(strFile))
Else
AddToZip(Params.PathTif + UCase(strFile))
End If
Next
AddToZip(Params.PathColdDateien + Params.FileNeu)
AddToZip(Params.PathColdDateien + Params.FileUpdate)
AddToZip(Params.PathColdDateien + "updateBL.txt")
strmZipOutputStream.Finish()
strmZipOutputStream.Close()
End Sub
Private Sub AddToZip(ByVal Filename As String)
Dim strmFile As FileStream = File.OpenRead(Filename)
Dim abyBuffer(strmFile.Length - 1) As Byte
strmFile.Read(abyBuffer, 0, abyBuffer.Length)
Dim objZipEntry As ZipEntry = New ZipEntry(Filename)
objZipEntry.DateTime = DateTime.Now
objZipEntry.Size = strmFile.Length
strmFile.Close()
objCrc32.Reset()
objCrc32.Update(abyBuffer)
objZipEntry.Crc = objCrc32.Value
strmZipOutputStream.PutNextEntry(objZipEntry)
strmZipOutputStream.Write(abyBuffer, 0, abyBuffer.Length)
End Sub
#End Region
#Region "Starter_Check"
Private Function Check_ReturnCodeStarter() As Integer
Dim s As String = ""
Try
FileOpen(2, Params.PathColdDateien + Params.FileReturnCode, OpenMode.Input)
Input(2, s)
s = RTrim(LTrim(s))
If s = "9" Then
log.InsertJournale("Error 3: ColdRetrun 9 - keine Antwort vom COLD-System ", clsLog.Enum_InfoTyp.Fehler)
Fehler = 3
End If
FileLastAccess = System.IO.File.GetLastWriteTime(Params.PathColdDateien + Params.FileReturnCode)
If s = "3" Then
log.InsertJournale("Error 4: ColdRetrun 3 - Die Verarbeitung EDKB02 ist aktiv seit " + FileLastAccess.ToString, clsLog.Enum_InfoTyp.Fehler)
Fehler = 4
End If
FileClose(2)
Catch ex As Exception
log.InsertJournale("Error 2: Coldreturn : File " + Params.PathColdDateien + Params.FileReturnCode + " not found.", clsLog.Enum_InfoTyp.Fehler)
Fehler = 2
End Try
Check_ReturnCodeStarter = Fehler
End Function
#End Region
#End Region
#Region "BMS"
Private Sub WirteLog(ByVal stext As String, ByVal sPfad As String)
Try
Dim FiStr As FileStream = New FileStream(sPfad, FileMode.Append)
Dim StrWr As StreamWriter = New StreamWriter(FiStr)
StrWr.WriteLine("Fehler: " + Now())
StrWr.WriteLine("Fehlertext:" + stext)
StrWr.Close()
Catch ex As Exception
End Try
End Sub
Public Function ApplicationPath() As String
'Return Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
Return Path.GetDirectoryName([Assembly].GetEntryAssembly().Location) + "\"
End Function
#End Region
#Region "Cold_Return Verarbeitung"
Private Sub ColdReturn_Verarbeiten()
Dim s As String = ""
StartInfo.FileName = Params.PathColdDateien + Params.CMDCopyStat
StartInfo.WindowStyle = ProcessWindowStyle.Normal
StartInfo.WorkingDirectory = Params.PathColdDateien
Console.WriteLine("Copy Return-Dateien Start")
System.Diagnostics.Process.Start(StartInfo)
Console.WriteLine("Copy Return-Dateien Ende")
Thread.Sleep(3000)
log.insert_journaldatei(Params.FileColdReturn, Params.PathColdDateien + Params.FileColdReturn)
Try
FileOpen(1, Params.PathColdDateien + Params.FileColdReturn, OpenMode.Input)
Input(1, s)
While s <> Nothing Or EOF(1)
Edoka_Verarbeiten(Left(s, 22), s)
Input(1, s)
End While
FileClose(1)
Catch ex As Exception
FileClose(1)
Finally
FileOpen(1, Params.PathColdDateien + Params.FileColdReturn, OpenMode.Output)
FileClose(1)
End Try
End Sub
Private Sub Edoka_Verarbeiten(ByVal dokumentid As String, ByVal ColdDokumentiD As String)
'EDOKA-Import
If Left(dokumentid, 6) = "EDKIMP" Then
Dim dokid As String = dokumentid.Replace("EDKIMP", "OFFEDK")
Globals.DokumentID = dokid
Barcode_Importiertes_Dokument_Verarbeiten(dokid, ColdDokumentiD)
Exit Sub
End If
Dim dok As New edokadb.clsDokument
Globals.DokumentID = dokumentid
dok.sDokumentid = New SqlString(CType(dokumentid, String))
dok.cpMainConnectionProvider = conn_edoka
Try
dok.SelectOne()
'-- Importierte Dokumente im Status "Bereit zur Eingangsarchivierung"
Dim ds As New edokadb.clsDokument_status
Try
ds.iDokument_statusnr = New SqlInt32(CType(dok.iStatusnr, Int32))
ds.cpMainConnectionProvider = conn_edoka
ds.SelectOne()
If ds.iStatus_bezeichnungnr = 11 Then
Barcode_Importiertes_Dokument_Verarbeiten(dokumentid, ColdDokumentiD)
Exit Sub
End If
Catch
Finally
ds.Dispose()
End Try
'-- Importierte Dokumente im Status "Bereit zur Eingangsarchivierung"
'hutter
Try
If dok.sColddokumentid.Value Is System.DBNull.Value Then
dok.sColddokumentid = New SqlString(CType(dokumentid, String))
End If
Catch
End Try
Try
If dok.sColddokumentid.Value = "" Then
dok.sColddokumentid = New SqlString(CType(dokumentid, String))
End If
Catch
End Try
dok.bAusgangsarchiviert = New SqlBoolean(CType(True, Boolean))
dok.bBereit_zur_archivierung = New SqlBoolean(CType(False, Boolean))
dok.daDatum_ausgangsarchivierung = New SqlDateTime(CType(Now, DateTime))
dok.iStatus_edoka_batch_ausgang = New SqlInt32(CType(1, Int32))
dok.iColdstatus = New SqlInt32(CType(1, Int32))
log.InsertJournale("EDOKA: Coldreturn: Dokument Ausgangsarchiviert: " + dokumentid, clsLog.Enum_InfoTyp.Keine)
'26.10.03
Dim stnr As Integer
'02.12.2004 SHU
stat.Erneut_BZA = 0
stat.Erneute_Bearbeitung = False
stnr = stat.Set_Ausgangsarchiviert(dokumentid)
If stat.Erneut_BZA = 1 Then
dok.bBereit_zur_archivierung = New SqlBoolean(CType(True, Boolean))
End If
'Status des Dokumentes nur setzen, sofern eine Statusnr <> 0 zur<75>ck geliefert wird.
If stnr - dok.iStatusnr.Value = 1 And stnr <> 0 Then
dok.iStatusnr = New SqlInt32(CType(stnr, Int32))
End If
'dok.iStatusnr = New SqlInt32(CType(stat.Set_Ausgangsarchiviert(dokumentid), Int32))
conn_edoka.OpenConnection()
dok.Update()
conn_edoka.CloseConnection(True)
Update_DokumentColdIndexwert(dokumentid, 1, 7, "Aktuell")
Update_DokumentColdIndexwert(dokumentid, 1, 10, ColdDokumentiD)
Update_DokumentColdIndexwert(dokumentid, 1, 13, "999")
'2004-12-06
'Sofern ein Dokument wieder bearbeitet wurde, werden die Indexwerte kopiert
If stat.Erneute_Bearbeitung = True Then
Dim arc As New EDOKA.clsarchivfnkt
arc.copy_indexdata(dokumentid, "Ung<EFBFBD>ltig")
Insert_ColdUpdate(ColdDokumentiD, dokumentid, 1, 7, "Ung<EFBFBD>ltig")
End If
If Datenzugriffe.bereits_eingangsarchiviert(dok.sDokumentid.Value) Then
EDOKA_Eingang_Ersetzt_Ausgang(dok.sDokumentid.Value, dok.iDokumenttypnr.Value)
End If
EDOKA_Dokumente_Ersetzen(dok.sDokumentid.Value, dok.iDokumenttypnr.Value, False)
stat.Meldung_Status(dokumentid, dok.iStatusnr.Value)
stat.check_abschluss(dokumentid, 9998)
conn_edoka.CloseConnection(True)
'Journaleintrag erstellen
Dim jo As New clsJournal
jo.Journaleintrag(3, "dokument", "dokumentid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Dokument", dokumentid)
jo.Journaleintrag(3, "dokumentcoldindexwert", "dokumentid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Dokumentcoldindexwert", dokumentid)
jo.Journaleintrag(3, "dokument_status", "dokumenitid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Dokument_Status", dokumentid)
jo.Journaleintrag(3, "statushistory", "dokumentid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Statushistory", dokumentid)
jo.Journaleintrag(3, "dokumentersetzen", "hauptdokumentid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Dokument ersetzen", dokumentid)
jo.Journaleintrag(3, "dokumentfunktiongruppe", "dokumentid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Berechtigungseinschr<EFBFBD>nkung", dokumentid)
jo.Journaleintrag(3, "dokumentinfomeldung", "dokumentid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Informationsmeldungen", dokumentid)
jo.Journaleintrag(3, "dokumentzuordnungen", "dokumentid1", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Zuordnungen", dokumentid)
jo.Journaleintrag(3, "notizen", "dokumentid", "'" + dokumentid + "'", "Ausgangsarchivierung", "", "Notizen", dokumentid)
jo = Nothing
If Microsoft.VisualBasic.Left(dok.sDokumentname.Value, 4) = "Imp_" Then
delete_dok_physisch(dokumentid)
End If
Catch ex As Exception
log.InsertJournale("EDOKA: Warning ColdReturn: Dokument ID " + dokumentid + " in der EDOKA-Datenbank nicht vorhanden", clsLog.Enum_InfoTyp.Warnung)
End Try
End Sub
'EDOKA-Import
Private Sub Barcode_Importiertes_Dokument_Verarbeiten(ByVal dokumentid As String, ByVal colddokumentid As String)
Dim d As New edokadb.clsDokument
Dim dt As DataTable
d.cpMainConnectionProvider = Globals.conn_edoka
d.sDokumentid = New SqlString(CType(dokumentid, String))
dt = d.SelectOne()
'd.daDatum_eingangsarchivierung = New SqlDateTime(CType(get_importdatum(dokumentid), DateTime))
d.daDatum_eingangsarchivierung = New SqlDateTime(CType(Now, DateTime))
d.bEingangsarchiviert = New SqlBoolean(CType(True, Boolean))
d.sColddokumentid = New SqlString(CType(colddokumentid, String))
d.iStatus_edoka_batch_eingang = New SqlInt32(CType(3, Int32))
conn_edoka.OpenConnection()
d.Update()
conn_edoka.CloseConnection(True)
d.Dispose()
Update_DokumentColdIndexwert(dokumentid, 2, 7, "Aktuell")
Update_DokumentColdIndexwert(dokumentid, 2, 10, colddokumentid)
Update_BCImport(dokumentid)
'BUD - 22.06.2006
insert_mehrfachscann(dokumentid, colddokumentid)
log.InsertJournale("EDOKA: Coldreturn: EDKIMP verarbeitet: " + dokumentid, clsLog.Enum_InfoTyp.Information)
delete_dok_physisch("EDKIMP" + Microsoft.VisualBasic.Right(dokumentid, 16))
End Sub
Private Function get_importdatum(ByVal dokumentid As String) As DateTime
End Function
Private Sub insert_mehrfachscann(ByVal DokumentID As String, ByVal ColdDokID As String)
'BUD - 19.07.2006
'Schreibt den Mehrfachscan Eintrag in die Mehrfachscan Tabelle
Try
Dim dbkey As New edokadb.clsMyKey_Tabelle
Dim key As Long
dbkey.cpMainConnectionProvider = conn_edoka
conn_edoka.OpenConnection()
key = dbkey.get_dbkey("mehrfachscann")
'BUD - 2006-11-30 - eins abz<62>hlen weil Cold/Scanning den Key direkt liest ;-)
key = key - 1
If key = 0 Then
Throw New Exception("ModMain.insert_mehrfachscann.: Nr aus sp_get_dbkey ist 0 f<>r Tabelle mehrfachscann.")
End If
conn_edoka.CloseConnection(True)
Dim objmfsc As New edokadb.clsMehrfachscann
objmfsc.cpMainConnectionProvider = Globals.conn_edoka
'ID / Primary Key / kein Autowert
objmfsc.iNreintrag = New SqlInt32(CType(key, Int32))
'Mutationsdatum
objmfsc.daMutationsdatum = New SqlDateTime(CType(Now, DateTime))
'ColddokumentID
objmfsc.sColddokumentid = New SqlString(CType(ColdDokID, String))
'Stapel Nummer / wird leer gelassen
objmfsc.sStapelnr = New SqlString(CType("", String))
'Status = 2
objmfsc.iStatus = New SqlInt32(CType(1, Int32))
'Statusdatum
objmfsc.daStatusdatum = New SqlDateTime(CType(Now, DateTime))
'* MandantNr = NULL
'* aktiv = NULL
'* erstellt_am = NULL
'Mutiert_AM
objmfsc.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
'* Mutierer = NULL
'Dokumentid
objmfsc.sDokumentid = New SqlString(CType(DokumentID, String))
conn_edoka.OpenConnection()
objmfsc.Insert()
conn_edoka.CloseConnection(True)
objmfsc = Nothing
Catch ex As Exception
log.InsertJournale("EDOKA: insert_mehrfachscann: " + DokumentID + " Fehler:" + ex.Message, clsLog.Enum_InfoTyp.Warnung)
End Try
End Sub
Private Sub delete_dok_physisch(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_edoka_import_delete_original_dok"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Sub
'EDOKA_Import
Private Sub Update_BCImport(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_edoka_import_update_bcimport"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Sub
#End Region
#Region "Eingangsarchivierung"
Private Sub Eingangsarchivierung()
'Anpassung MNK
'BL Status soll zuerst gesetzt werden.
EDOKA_BL_Eingang()
EDOKA_Eingangsarchivierung()
'EDEX_Banklagernd
End Sub
'EDEX Banklagernd
Private Sub EDOKA_BL_Eingang()
Dim data As New DataTable
Dim blindex As New edokadb.clsEDEX_BL_BLIndex
Dim dok As New edokadb.clsDokument
Dim i As Integer
Dim stnr As Integer
Dim dokumentid As String
Dim dokidmehrfachscan As String
dok.cpMainConnectionProvider = conn_edoka
blindex.cpMainConnectionProvider = conn_edoka
data = get_bl_index()
For i = 0 To data.Rows.Count - 1
blindex.iBLIndexnr = New SqlInt32(CType(data.Rows(i).Item("blindexnr"), Int32))
blindex.SelectOne()
If blindex.iBl_status.Value > -1 Then
If data.Rows(i).Item("bedrdokumentid") <> "" Then
dokumentid = data.Rows(i).Item("bedrdokumentid")
Else
dokumentid = data.Rows(i).Item("dokumentid")
End If
dokidmehrfachscan = data.Rows(i).Item("dokumentid")
dok.sDokumentid = New SqlString(CType(dokumentid, String))
dok.SelectOne()
stnr = stat.Set_Eingangsarchiviert_blindex(dokumentid)
dok.iStatusnr = New SqlInt32(CType(stnr, Int32))
conn_edoka.OpenConnection()
dok.Update()
conn_edoka.CloseConnection(True)
blindex.iBatch_status = New SqlInt32(CType(1, Int32))
stat.check_abschluss(dokumentid, 9998)
log.InsertJournale("EDOKA: BL-Eingangsarchivierung: Dokument BL eingangsarchiviert: " & dok.sDokumentid.Value, clsLog.Enum_InfoTyp.Keine)
conn_edoka.OpenConnection()
'If blindex.sDokumentid.Value <> dokumentid Then
' blindex.sBedrdokumentid = New SqlString(CType(blindex.sDokumentid.Value, String))
' blindex.sDokumentid = New SqlString(CType(dokumentid, String))
' log.InsertJournale("EDOKA: BL-Eingangsarchivierung: BedR-Dokumentid gewechselt: " & dokumentid)
'End If
blindex.Update()
conn_edoka.CloseConnection(True)
'update_mehrfachscan(dokidmehrfachscan)
End If
'dok.sDokumentid = New SqlString(CType(data.Rows(i).Item("dokumentid"), String))
'dok.SelectOne()
'blindex.iBLIndexnr = New SqlInt32(CType(data.Rows(i).Item("blindexnr"), Int32))
'blindex.SelectOne()
'If blindex.iBl_status.Value > -1 Then
' stnr = stat.Set_Eingangsarchiviert_blindex(data.Rows(i).Item("dokumentid"))
' dok.iStatusnr = New SqlInt32(CType(stnr, Int32))
' 'dok.bBl_scan = New SqlBoolean(CType(False, Boolean))
' conn_edoka.OpenConnection()
' dok.Update()
' conn_edoka.CloseConnection(True)
' 'blindex.iBl_status = New SqlInt32(CType(1, Int32))
' blindex.iBatch_status = New SqlInt32(CType(1, Int32))
' stat.check_abschluss(data.Rows(i).Item("dokumentid"), 9998)
' log.InsertJournale("EDOKA: BL-Eingangsarchivierung: Dokument BL eingangsarchiviert: " & dok.sDokumentid.Value)
' conn_edoka.OpenConnection()
' blindex.Update()
' conn_edoka.CloseConnection(True)
' update_mehrfachscan(data.Rows(i).Item("dokumentid"))
'End If
Next
blindex.Dispose()
dok.Dispose()
End Sub
'EDEX Banklagernd
Private Sub update_mehrfachscan(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.sp_edex_bl_update_mehrfachscan"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
'MsgBox(ex.Message)
' // some error occured. Bubble it to caller and encapsulate Exception object
Thread.Sleep(1000)
log.InsertJournale("Update Mehrfachscan:" + ex.Message, clsLog.Enum_InfoTyp.Information)
'Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Sub
Private Function get_bl_index() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand
Dim dtToReturn As DataTable = New DataTable
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.CommandText = "dbo.sp_edex_bl_blindex_eingang"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
'RS 2006-11-06 increaded default timeout to 100 secs
scmCmdToExecute.CommandTimeout = 100
Try
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Private Sub EDOKA_Eingangsarchivierung()
Dim dok As New edokadb.clsDokument
Dim i As Integer
Dim data As DataTable
data = Datenzugriffe.Generic_Select(1)
For i = 0 To data.Rows.Count - 1
Globals.DokumentID = data.Rows(i).Item("dokumentid")
Console.WriteLine("Eingangsarchivierung: " & data.Rows(i).Item("dokumentid"))
Try
dok.cpMainConnectionProvider = conn_edoka
dok.sDokumentid = New SqlString(CType(data.Rows(i).Item("dokumentid"), String))
dok.SelectOne()
Dim alterscan As Boolean = False
Try
If dok.iStatus_edoka_batch_eingang.Value = 2 Then alterscan = True
Catch
alterscan = False
End Try
dok.iStatus_edoka_batch_eingang = New SqlInt32(CType(1, Integer))
If Left(Globals.DokumentID, 7) = "SCANEDK" Then
dok.iStatusnr = New SqlInt32(CType(EDOKA_Insert_Status(-2), Int32))
dok.iZustaendiger = New SqlInt32(CType(9998, Int32))
dok.iVerantwortlich = New SqlInt32(CType(9998, Int32))
dok.bVertraulich = New SqlBoolean(CType(False, Boolean))
dok.daErstelltam = New SqlDateTime(CType(EDOKA_get_coldindexfeld(dok.sDokumentid.Value, 2, 5), DateTime))
dok.sColdfolder = New SqlString(CType("TGKB EDOKA-Partner", String))
dok.sColdschema = New SqlString(CType("TGKB-C35-EW-EDOKA-Put1.0", String))
dok.daMutiertam = New SqlDateTime(CType(EDOKA_get_coldindexfeld(dok.sDokumentid.Value, 2, 5), DateTime))
dok.daArchivierungsdatum = New SqlDateTime(CType(dok.daMutiertam.Value, DateTime))
EDOKA_Insert_Status(-3)
EDOKA_Insert_Note(Globals.DokumentID)
Dim ss As String
ss = EDOKA_get_coldindexfeld(dok.sDokumentid.Value, 2, 10)
printout_coldupdate(dok.sColdfolder.Value, dok.sColdschema.Value, ss, "BERES01", LTrim(Str(dok.iDokumenttypnr.Value)))
prozessdata = Generic_Select(13)
Try
Prozess = prozessdata.Rows(0).Item(0)
Catch
Prozess = ""
End Try
printout_coldupdate(dok.sColdfolder.Value, dok.sColdschema.Value, ss, "BERES03", Prozess)
Else
If alterscan = False Then
If dok.iDokumenttypnr.Value <> 1166 Then
stat.Meldung_Eingang(DokumentID, 104, dok.iVerantwortlich.Value)
End If
Dim stnr As Integer
stnr = stat.Set_Eingangsarchiviert(data.Rows(i).Item("dokumentid"))
If stnr - dok.iStatusnr.Value = 1 Then
dok.iStatusnr = New SqlInt32(CType(stnr, Int32))
End If
Try
If dok.sDokumentname.Value = "" And dok.iBRVernichtungnachTagen.Value > 0 Then
dok.bBedRRetourniert = New SqlBoolean(CType(True, Boolean))
Insert_Zuordnung(dok.sDokumentid.Value)
End If
Catch
End Try
conn_edoka.OpenConnection()
dok.Update()
conn_edoka.CloseConnection(True)
log.InsertJournale("EDOKA: Eingangsarchivierung: Dokument eingangsarchiviert: " & dok.sDokumentid.Value, clsLog.Enum_InfoTyp.Keine)
Update_DokumentColdIndexwert(DokumentID, 2, 7, "Aktuell")
If Left(Globals.DokumentID, 7) = "SCANEDK" Then
Update_DokumentColdIndexwert(DokumentID, 2, 20, Prozess)
Update_DokumentColdIndexwert(DokumentID, 2, 5, EDOKA_get_coldindexfeld(dok.sDokumentid.Value, 2, 5))
Update_VVNR(DokumentID)
End If
Update_DokumentColdIndexwert(DokumentID, 2, 10, dok.sColddokumentid.Value)
Update_DokumentColdIndexwert(DokumentID, 2, 13, "9999")
If Left(Globals.DokumentID, 7) = "SCANEDK" Then
Else
EDOKA_Mehrfachsacn_Bearbeiten(Globals.DokumentID)
EDOKA_Eingang_Ersetzt_Ausgang(Globals.DokumentID, dok.iDokumenttypnr.Value)
EDOKA_Dokumente_Ersetzen(Globals.DokumentID, dok.iDokumenttypnr.Value, True)
End If
stat.Meldung_Status(DokumentID, dok.iStatusnr.Value)
Check_AusgangEingang(DokumentID)
stat.check_abschluss(DokumentID, 9998)
Else
'20050428 Alter Scan
Dim stnr As Integer
stnr = stat.Set_Eingangsarchiviert(data.Rows(i).Item("dokumentid"), dok.daDatum_eingangsarchivierung.Value)
If stnr - dok.iStatusnr.Value = 1 Then
dok.iStatusnr = New SqlInt32(CType(stnr, Int32))
End If
conn_edoka.OpenConnection()
dok.Update()
conn_edoka.CloseConnection(True)
log.InsertJournale("EDOKA: Eingangsarchivierung: Dokument eingangsarchiviert: " & dok.sDokumentid.Value, clsLog.Enum_InfoTyp.Keine)
End If
check_and_update_banklagerndquittung(DokumentID)
End If
Dim jo As New clsJournal
jo.Journaleintrag(3, "dokument", "dokumentid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Dokument", DokumentID)
jo.Journaleintrag(3, "dokumentcoldindexwert", "dokumentid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Dokumentcoldindexwert", DokumentID)
jo.Journaleintrag(3, "dokument_status", "dokumenitid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Dokument_Status", DokumentID)
jo.Journaleintrag(3, "statushistory", "dokumentid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Statushistory", DokumentID)
jo.Journaleintrag(3, "dokumentersetzen", "hauptdokumentid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Dokument ersetzen", DokumentID)
jo.Journaleintrag(3, "dokumentfunktiongruppe", "dokumentid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Berechtigungseinschr<EFBFBD>nkung", DokumentID)
jo.Journaleintrag(3, "dokumentinfomeldung", "dokumentid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Informationsmeldungen", DokumentID)
jo.Journaleintrag(3, "dokumentzuordnungen", "dokumentid1", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Zuordnungen", DokumentID)
jo.Journaleintrag(3, "notizen", "dokumentid", "'" + DokumentID + "'", "Eingangsarchivierung", "", "Notizen", DokumentID)
jo = Nothing
Catch ex As Exception
log.InsertJournale("EDOKA: Eingangsarchivierung:DokID:" + Globals.DokumentID + "::" + ex.Message + ex.StackTrace, clsLog.Enum_InfoTyp.Information)
stat.Meldung_FehlerVerantwortlicher(DokumentID, 200)
End Try
Next
data.Dispose()
End Sub
'EDEX Banklagernd
Private Function check_and_update_banklagerndquittung(ByVal dokumentid As String) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand
Dim dtToReturn As DataTable = New DataTable
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.CommandText = "dbo.sp_edex_check_and_update_blquittung"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Private Sub Check_AusgangEingang(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_archiv_check_ausgangeingang"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
'MsgBox(ex.Message)
' // some error occured. Bubble it to caller and encapsulate Exception object
Thread.Sleep(1000)
log.InsertJournale(ex.Message, clsLog.Enum_InfoTyp.Information)
'Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Sub
Private Sub Update_VVNR(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.sp_update_dokument_vvnr"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
'MsgBox(ex.Message)
' // some error occured. Bubble it to caller and encapsulate Exception object
Thread.Sleep(1000)
log.InsertJournale(ex.Message, clsLog.Enum_InfoTyp.Information)
'Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Sub
Private Function EDOKA_Insert_Status(ByVal STBNR As Integer) As Integer
Dim stat As New edokadb.clsDokument_status
stat.cpMainConnectionProvider = conn_edoka
stat.bAktiv = New SqlBoolean(CType(True, Boolean))
stat.bDokument_ausgangsarchivierung = New SqlBoolean(CType(False, Boolean))
stat.bDokument_bearbeitung_abgeschlossen = New SqlBoolean(CType(False, Boolean))
stat.bDokument_bearbeitung_moeglich = New SqlBoolean(CType(False, Boolean))
stat.bFolgestatus_durch_anderen_verantwortlichen = New SqlBoolean(CType(False, Boolean))
stat.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
stat.iErledigung_ab = New SqlInt32(CType(0, Int32))
stat.iMutierer = New SqlInt32(CType(9999, Int32))
stat.iStatus_bezeichnungnr = New SqlInt32(CType(STBNR, Int32))
If STBNR = -2 Then
stat.sBezeichnung = New SqlString(CType("Abgeschlossen", String))
Else
stat.sBezeichnung = New SqlString(CType("Aufgehoben", String))
End If
stat.sDokumenitid = New SqlString(CType(Globals.DokumentID, String))
conn_edoka.OpenConnection()
stat.Insert()
conn_edoka.CloseConnection(True)
Return stat.iDokument_statusnr.Value
stat.Dispose()
End Function
Private Sub EDOKA_Insert_Note(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_Dokument_Notizen"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.Parameters.Add(New SqlParameter("@notiznr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
scmCmdToExecute.Parameters.Add(New SqlParameter("@betreff", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, "Dokument aus Erst<73>bernahme"))
scmCmdToExecute.Parameters.Add(New SqlParameter("@value", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, "Dokument aus Erst<73>bernahme"))
scmCmdToExecute.Parameters.Add(New SqlParameter("@aktiv", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
Thread.Sleep(1000)
log.InsertJournale(ex.Message, clsLog.Enum_InfoTyp.Information)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Sub
Private Function EDOKA_get_coldindexfeld(ByVal dokumentid As String, ByVal indextyp As Integer, ByVal indexfeld As Integer) As String
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_archiv_get_coldindexwert"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.Parameters.Add(New SqlParameter("@indextyp", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, indextyp))
scmCmdToExecute.Parameters.Add(New SqlParameter("@coldindexfeld", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, indexfeld))
scmCmdToExecute.Parameters.Add(New SqlParameter("@wert", SqlDbType.VarChar, 255, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, ""))
scmCmdToExecute.ExecuteNonQuery()
Dim s As String
s = scmCmdToExecute.Parameters("@wert").Value
If indexfeld = 5 Then
EDOKA_get_coldindexfeld = Left(s, 4) + "." + Mid(s, 5, 2) + "." + Right(s, 2)
Else
EDOKA_get_coldindexfeld = scmCmdToExecute.Parameters("@wert").Value
End If
Catch ex As Exception
Thread.Sleep(1000)
log.InsertJournale(ex.Message, clsLog.Enum_InfoTyp.Information)
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Function
Private Sub EDOKA_Eingang_Ersetzt_Ausgang(ByVal dokumentid As String, ByVal dokumenttypnr As Integer)
'BUD - 2006.10.05 - Try
Try
'Hutter 20050421 - Korrektur bei Barcodeimportierten Dokumenten soll kein COLD-Update erstellt werden
Dim d As New edokadb.clsDokument
d.cpMainConnectionProvider = conn_edoka
d.sDokumentid = New SqlString(CType(dokumentid, String))
d.SelectOne()
If Microsoft.VisualBasic.Left(d.sDokumentname.Value, 4) = "Imp_" Then
d.Dispose()
Exit Sub
End If
Dim dt As New edokadb.clsDokumenttyp
dt.cpMainConnectionProvider = conn_edoka
dt.iDokumenttypnr = New SqlInt32(CType(dokumenttypnr, Int32))
dt.SelectOne()
If dt.bEingang_ersetzt_ausgang.Value = True And dt.bZu_retournieren.Value = True Then
Insert_ColdUpdate(dokumentid, "", 1, 7, "Alt")
Update_DokumentColdIndexwert(dokumentid, 1, 7, "Alt")
Update_DokumentColdIndexwert(dokumentid, 1, 13, "9999")
log.InsertJournale("EDOKA: Eingang ersetzt Ausgang: " & dokumentid, clsLog.Enum_InfoTyp.Keine)
End If
dt.Dispose()
Catch ex As Exception
m_log.Log("ModMain:EDOKA_Eingang_Ersetzt_Ausgang:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End Sub
#End Region
#Region "Ausgangsarchivierung"
'EDOKA-Import
Dim Dateiformat As String = ""
Dim OutputDateiformat As String
Private Sub Ausgangsarchivierung()
Try
FileOpen(3, Params.PathColdDateien + Params.FileNeu, OpenMode.Output)
EDOKA_Ausgangsarchivierung()
'Hutter BCI
EDOKA_Barcodeimportierte_Dokumente()
FileClose(3)
Catch ex As Exception
m_log.Log("ModMain:Ausgangsarchivierung:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Error)
End Try
End Sub
Private Sub EDOKA_Ausgangsarchivierung()
Try
Dim data As New DataTable
Dim ind As DataTable
Dim i As Integer
If Params.PrintFarbigAb < Now() Then
data = Generic_Select(15)
Else
data = Generic_Select(2)
End If
For i = 0 To data.Rows.Count - 1
Try
Globals.DokumentID = data.Rows(i).Item("dokumentid")
Console.WriteLine("------------------------------------------------------------------------")
Console.WriteLine(" Ausgangsarchivierung neues Dokument -> DokID: " + Globals.DokumentID)
Console.WriteLine("------------------------------------------------------------------------")
If Convert_EDOKA_To_Tif(Globals.DokumentID, Globals.DokumentID, "") Then
Try
Globals.Indextyp = 1
ind = Generic_Select(3)
If ind.Rows.Count = 0 Then
Insert_dokumentcoldindex(Globals.DokumentID)
ind = Generic_Select(3)
End If
'Anpassungen Umstrukturierung COLD-Index
PrintOutIndex(ind)
log.InsertJournale("EDOKA: Ausgangsarchivierung: Dokument vorbereitet: " + Globals.DokumentID, clsLog.Enum_InfoTyp.Keine)
filestozip.Add(Globals.DokumentID + "." + OutputDateiformat)
dostart = True
FileCount.Add(ind.Rows(0).Item("coldapplication"), 1)
set_ausgangsarchivierung(Globals.DokumentID)
Catch ex As Exception
log.InsertJournale("EDOKA: Fehler beim Schreiben der Outputparameter: " & Globals.DokumentID, clsLog.Enum_InfoTyp.Information)
End Try
Else
stat.Meldung_FehlerVerantwortlicher(Globals.DokumentID, 202)
End If
stat.check_abschluss(DokumentID, 9998)
Catch ex As Exception
End Try
Next
Console.WriteLine("------------------------------------------------------------------------")
Catch ex As Exception
m_log.Log("ModMain:EDOKA_Ausgangsarchivierung:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Error)
End Try
End Sub
Private Sub PrintOutIndex(ByVal ind As DataTable)
Dim s As String
PrintLine(3, "COMMENT:" + OutputDateiformat)
PrintLine(3, "GROUP_FIELD_NAME:BEORT00")
Try
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("BEORT00"))
Catch
PrintLine(3, "GROUP_FIELD_VALUE:")
End Try
PrintLine(3, "GROUP_FIELD_NAME:NRDOC00")
PrintLine(3, "GROUP_FIELD_VALUE:" + Globals.DokumentID)
PrintLine(3, "GROUP_FIELD_NAME:NRSTA00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("NRSTA00"))
PrintLine(3, "GROUP_FIELD_NAME:BEGSF00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("BEGSF00"))
PrintLine(3, "GROUP_FIELD_NAME:BEUSR00")
PrintLine(3, "GROUP_FIELD_VALUE:9999")
PrintLine(3, "GROUP_FIELD_NAME:BERES03")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("coldbezeichnung"))
PrintLine(3, "GROUP_FIELD_NAME:BKPAR00")
s = ind.Rows(0).Item("bkpar00")
If Len(s) > 35 Then
s = Left(s, 35)
End If
PrintLine(3, "GROUP_FIELD_VALUE:" + s)
PrintLine(3, "GROUP_FIELD_NAME:NAVVG00")
Dim nav As String
nav = LTrim(RTrim(ind.Rows(0).Item("navvg00")))
PrintLine(3, "GROUP_FIELD_VALUE:" + FormatVV(nav))
PrintLine(3, "GROUP_FIELD_NAME:BEBEZ00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("BEBEZ00"))
PrintLine(3, "GROUP_FIELD_NAME:DMSTA01")
PrintLine(3, "GROUP_FIELD_VALUE:" + GETDATE(ind.Rows(0).Item("DMSTA01")))
PrintLine(3, "GROUP_FIELD_NAME:BEDAT00")
PrintLine(3, "GROUP_FIELD_VALUE:" + GETDATE(ind.Rows(0).Item("BEDAT00")))
PrintLine(3, "GROUP_FIELD_NAME:BESTA00")
PrintLine(3, "GROUP_FIELD_VALUE:" + "Aktuell")
PrintLine(3, "GROUP_FIELD_NAME:NRPAR00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("NRPAR00"))
PrintLine(3, "GROUP_FIELD_NAME:BERES01")
Try
PrintLine(3, "GROUP_FIELD_VALUE:" + LTrim(Str(ind.Rows(0).Item("Dokumenttypnr"))))
Globals.dokumenttyp = ind.Rows(0).Item("Dokumenttypnr")
Catch
PrintLine(3, "GROUP_FIELD_VALUE:")
End Try
PrintLine(3, "GROUP_FIELD_NAME:BERES02")
PrintLine(3, "GROUP_FIELD_VALUE:" + Globals.DokumentID)
PrintLine(3, "GROUP_FIELD_NAME:BERES04")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_FIELD_NAME:BERES05")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_FIELD_NAME:BERES06")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_FIELD_NAME:BERES07")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_OFFSET:0")
PrintLine(3, "GROUP_LENGTH:0")
PrintLine(3, "GROUP_FILENAME:" + Globals.DokumentID + "." + OutputDateiformat)
End Sub
Private Sub EDOKA_Barcodeimportierte_Dokumente()
Try
Dim dt As New DataTable
Dim ind As DataTable
Dim i As Integer
Dim s As String
dt = Get_Pendente_BCI_Dokumente()
For i = 0 To dt.Rows.Count - 1
Globals.DokumentID = dt.Rows(i).Item("edokadokumentid")
Console.WriteLine("Ausgangsarchivierung: " + Globals.DokumentID)
If Convert_EDOKA_To_Tif(dt.Rows(i).Item("edokadokumentid"), dt.Rows(i).Item("dokumentid"), dt.Rows(i).Item("Dateiformat")) Then
Try
Globals.Indextyp = 2
ind = Generic_Select(3)
log.InsertJournale("EDOKA: Ausgangsarchivierung: Dokument vorbereitet: " + Globals.DokumentID, clsLog.Enum_InfoTyp.Information)
filestozip.Add(dt.Rows(i).Item("dokumentid") + "." + OutputDateiformat)
dostart = True
FileCount.Add(ind.Rows(0).Item("coldapplication"), 1)
PrintLine(3, "COMMENT:" + OutputDateiformat)
PrintLine(3, "GROUP_FIELD_NAME:BEORT00")
Try
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("BEORT00"))
Catch
PrintLine(3, "GROUP_FIELD_VALUE:")
End Try
PrintLine(3, "GROUP_FIELD_NAME:NRDOC00")
PrintLine(3, "GROUP_FIELD_VALUE:" + "EDKIMP" + Right(Globals.DokumentID, 16))
PrintLine(3, "GROUP_FIELD_NAME:NRSTA00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("NRSTA00"))
PrintLine(3, "GROUP_FIELD_NAME:BEGSF00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("BEGSF00"))
PrintLine(3, "GROUP_FIELD_NAME:BEUSR00")
PrintLine(3, "GROUP_FIELD_VALUE:9999")
PrintLine(3, "GROUP_FIELD_NAME:BERES03")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("coldbezeichnung"))
PrintLine(3, "GROUP_FIELD_NAME:BKPAR00")
s = ind.Rows(0).Item("bkpar00")
If Len(s) > 35 Then
s = Left(s, 35)
End If
PrintLine(3, "GROUP_FIELD_VALUE:" + s)
PrintLine(3, "GROUP_FIELD_NAME:NAVVG00")
Dim nav As String
nav = LTrim(RTrim(ind.Rows(0).Item("navvg00")))
PrintLine(3, "GROUP_FIELD_VALUE:" + FormatVV(nav))
PrintLine(3, "GROUP_FIELD_NAME:BEBEZ00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("BEBEZ00"))
PrintLine(3, "GROUP_FIELD_NAME:DMSTA01")
PrintLine(3, "GROUP_FIELD_VALUE:" + GETDATE(ind.Rows(0).Item("DMSTA01")))
PrintLine(3, "GROUP_FIELD_NAME:BEDAT00")
PrintLine(3, "GROUP_FIELD_VALUE:" + GETDATE(ind.Rows(0).Item("BEDAT00")))
PrintLine(3, "GROUP_FIELD_NAME:BESTA00")
PrintLine(3, "GROUP_FIELD_VALUE:" + "Aktuell")
PrintLine(3, "GROUP_FIELD_NAME:NRPAR00")
PrintLine(3, "GROUP_FIELD_VALUE:" + ind.Rows(0).Item("NRPAR00"))
PrintLine(3, "GROUP_FIELD_NAME:BERES01")
Try
PrintLine(3, "GROUP_FIELD_VALUE:" + LTrim(Str(ind.Rows(0).Item("Dokumenttypnr"))))
Globals.dokumenttyp = ind.Rows(0).Item("Dokumenttypnr")
Catch
PrintLine(3, "GROUP_FIELD_VALUE:")
End Try
PrintLine(3, "GROUP_FIELD_NAME:BERES02")
PrintLine(3, "GROUP_FIELD_VALUE:" + dt.Rows(i).Item("edokadokumentid"))
PrintLine(3, "GROUP_FIELD_NAME:BERES04")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_FIELD_NAME:BERES05")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_FIELD_NAME:BERES06")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_FIELD_NAME:BERES07")
PrintLine(3, "GROUP_FIELD_VALUE:")
PrintLine(3, "GROUP_OFFSET:0")
PrintLine(3, "GROUP_LENGTH:0")
PrintLine(3, "GROUP_FILENAME:" + dt.Rows(i).Item("dokumentid") + "." + OutputDateiformat)
Catch ex As Exception
log.InsertJournale("EDOKA: Fehler beim Schreiben der Outputparameter: " & Globals.DokumentID, clsLog.Enum_InfoTyp.Information)
End Try
Else
stat.Meldung_FehlerVerantwortlicher(Globals.DokumentID, 202)
End If
Next
Catch ex As Exception
m_log.Log("ModMain:EDOKA_Barcodeimportierte_Dokumente:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Error)
End Try
End Sub
Private Function Get_Pendente_BCI_Dokumente() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand
Dim dtToReturn As DataTable = New DataTable
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.CommandText = "dbo.sp_edoka_import_get_bcimportdokumente"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Try
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Public Sub set_ausgangsarchivierung(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
Dim dtToReturn As DataTable = New DataTable
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.CommandText = "dbo.SP_archiv_set_ausgangsarchivierung"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
sdaAdapter.Fill(dtToReturn)
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Sub
Public Function FormatVV(ByVal Sinput As String) As String
Try
Dim erstelltAm As Date
erstelltAm = FindOutErstellungsdatum(Globals.DokumentID)
Dim x As String
Dim y As String = ""
Dim i As Integer
Dim i1 As Integer
If Sinput.Length > 16 Then Sinput = Left(Sinput, 16)
i = Sinput.Length
If i < 1 Then
Return ""
Exit Function
End If
x = Sinput
For i1 = 1 To i
If Mid(x, i1, 1) = "0" Then y = y + "0"
If Mid(x, i1, 1) = "1" Then y = y + "1"
If Mid(x, i1, 1) = "2" Then y = y + "2"
If Mid(x, i1, 1) = "3" Then y = y + "3"
If Mid(x, i1, 1) = "4" Then y = y + "4"
If Mid(x, i1, 1) = "5" Then y = y + "5"
If Mid(x, i1, 1) = "6" Then y = y + "6"
If Mid(x, i1, 1) = "7" Then y = y + "7"
If Mid(x, i1, 1) = "8" Then y = y + "8"
If Mid(x, i1, 1) = "9" Then y = y + "9"
Next
While Len(y) < 16
y = "0" + y
End While
If y = "0000000000000000" Then y = ""
Return y
Catch
Return ""
End Try
End Function
Private Function FindOutErstellungsdatum(ByVal dokumentid As String) As Date
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.sp_dokument_getErstelltam"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.Parameters.Add(New SqlParameter("@output", SqlDbType.DateTime, 255, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, ""))
scmCmdToExecute.ExecuteNonQuery()
Dim s As String
s = scmCmdToExecute.Parameters("@wert").Value
Return s
Catch
Return ""
Finally
scmCmdToExecute.Dispose()
End Try
End Function
Private Sub Insert_dokumentcoldindex(ByVal dokumentid As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_korrektur_insert_coldindex"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Try
conn_edoka.OpenConnection()
Catch
End Try
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
Throw New Exception("Insert_Dokumentcoldindex::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
conn_edoka.CloseConnection(True)
log.InsertJournale("EDOKA: Dokument in EDOKA gel<65>scht: " & dokumentid, clsLog.Enum_InfoTyp.Keine)
End Try
End Sub
#End Region
#Region "COLD-Update"
Private Sub COLDUpdate()
EDOKA_ColdUpdate()
' AMS_ColdUpdate()
End Sub
Private Sub EDOKA_ColdUpdate()
Dim i As Integer
Dim s As String
Dim s1 As String
Dim data As DataTable
data = Generic_Select(7)
For i = 0 To data.Rows.Count - 1
Try
If data.Rows(i).Item("Feldname") = "DMSTA01" Then
s1 = data.Rows(i).Item("neuerwert")
s = Right(s1, 2) + "." + Mid(s1, 5, 2) + "." + Left(s1, 4)
printout_coldupdate(data.Rows(i).Item("COLDFOLDER"), data.Rows(i).Item("coldschema"), UCase(data.Rows(i).Item("dokumentid")), data.Rows(i).Item("feldname"), s)
Else
If data.Rows(i).Item("COLDFOLDER") = "TGKB Kundenoutput ab 01.08.2008" Then
printout_coldupdate_kundenoutput(data.Rows(i).Item("COLDFOLDER"), data.Rows(i).Item("coldschema"), UCase(data.Rows(i).Item("dokumentid")), data.Rows(i).Item("feldname"), data.Rows(i).Item("neuerwert"))
ElseIf data.Rows(i).Item("COLDFOLDER") = "TGKB EDOKA-Banklagernd" Then
printout_coldupdate_kundenoutput(data.Rows(i).Item("COLDFOLDER"), data.Rows(i).Item("coldschema"), UCase(data.Rows(i).Item("dokumentid")), data.Rows(i).Item("feldname"), data.Rows(i).Item("neuerwert"))
Else
printout_coldupdate(data.Rows(i).Item("COLDFOLDER"), data.Rows(i).Item("coldschema"), UCase(data.Rows(i).Item("dokumentid")), data.Rows(i).Item("feldname"), data.Rows(i).Item("neuerwert"))
'printout_coldupdate(data.Rows(i).Item("COLDFOLDER"), data.Rows(i).Item("coldschema"), UCase(data.Rows(i).Item("originaldokumentid")), data.Rows(i).Item("feldname"), data.Rows(i).Item("neuerwert"))
End If
End If
Catch
End Try
Globals.KeyNr = data.Rows(i).Item("nreintrag")
Generic_Select(8)
dostart = True
Next
data.Dispose()
End Sub
Private Sub printout_coldupdate(ByVal foler As String, ByVal schema As String, ByVal dokumentid As String, ByVal feldname As String, ByVal wert As String)
Dim s As String
s = "[ -f """ & foler & """ ] "
s = s + "[ -g """ & schema & """ ]"
s = s & "[ -i ""WHERE NRDOC00 LIKE '" & dokumentid & "%'"" ] "
s = s & "[ -n " & feldname & " = '" & wert & "' ]"
PrintLine(5, s)
'log.InsertJournale("ColdUpdate: " & dokumentid & " " & feldname & " " & wert, clsLog.Enum_InfoTyp.Information)
log.InsertJournale("ColdUpdate: " & s.ToString, clsLog.Enum_InfoTyp.Information)
dostart = True
End Sub
Private Sub printout_coldupdate_kundenoutput(ByVal foler As String, ByVal schema As String, ByVal dokumentid As String, ByVal feldname As String, ByVal wert As String)
' Vorgabe SCIS
'[ -f "TGKB Kundenoutput ab 01.08.2008" ] [ -g "TGKB-C35-10-XOMA-Rel1.0" ][ -i "WHERE MAILINGID = 2582674" ] [ -n BPKEYNRINHAB = 1411369 ]
'[ -f "TGKB Kundenoutput ab 01.08.2008" ] [ -g "TGKB-C35-10-XOMA-Rel1.0" ][ -i "WHERE MAILINGID = 2582674" ] [ -n MACCKEYNR = 172046710309 ]''
'[-f TGKB EDOKA-Banklagernd] [-G TGKB-C35-EW-EDOKA-BL-Put1.0] [ -i "WHERE NRDOK00 LIKE '0009200511240000006700000000150001%'" ][ -n BESTA00 = 'Dokument ausgeh<65>ndigt' ]
Dim s As String
If foler = "TGKB EDOKA-Banklagernd" Then
s = "[-f " & foler & " ] "
s = s + "[-G " & schema & " ]"
s = s & "[ -i ""WHERE MAILINGID = " & dokumentid & """ ] "
s = s & "[ -n " & feldname & " = '" & wert & "' ]"
Else
s = "[ -f """ & foler & """ ] "
s = s + "[ -g """ & schema & """ ]"
s = s & "[ -i ""WHERE MAILINGID = " & dokumentid & """ ] "
s = s & "[ -n " & feldname & " = " & wert & " ]"
End If
PrintLine(5, s)
'log.InsertJournale("ColdUpdate: " & dokumentid & " " & feldname & " " & wert, clsLog.Enum_InfoTyp.Information)
log.InsertJournale("ColdUpdate: " & s.ToString, clsLog.Enum_InfoTyp.Information)
dostart = True
End Sub
'Private Function AMS_ColdUpdate()
' Try
' Dim i As Integer
' Dim s As String
' Dim co As New SqlDataAdapter("Select * from agicoldupdate where status=0 order by statusdatum", Globals.sConnectionString_ams)
' Dim di As New DataSet()
' co.Fill(di, "di")
' For i = 0 To di.Tables(0).Rows.Count - 1
' Select Case di.Tables(0).Rows(i).Item("funktion")
' Case 1
' s = "Aktuell"
' If Datenzugriffe.AMS_Check_Edoka_Dokument(di.Tables(0).Rows(i).Item("agicolddokumentid")) > 0 Then
' log.InsertJournale("AMS: COLD-Update: EDOKA-Dokument Status Aktuell: " & di.Tables(0).Rows(i).Item("agicolddokumentid"))
' End If
' Case 2
' s = "Alt"
' Case 3
' s = "Ung<6E>ltig"
' Case 0
' s = di.Tables(0).Rows(i).Item("vvnr")
' Case 4
' s = di.Tables(0).Rows(i).Item("dokdatum")
' Case Else
' s = ""
' End Select
' If di.Tables(0).Rows(i).Item("agicoldfolder") Is System.DBNull.Value Then di.Tables(0).Rows(i).Item("agicoldfolder") = "unknown"
' AMS_Cold_Update(di.Tables(0).Rows(i).Item("agicolddokumentid"), di.Tables(0).Rows(i).Item("agicoldfolder"), s, di.Tables(0).Rows(i).Item("funktion"))
' If di.Tables(0).Rows(i).Item("funktion") <> 0 Then
' log.InsertJournale("AMS: Cold-Update durchgef<65>hrt" + di.Tables(0).Rows(i).Item("agicolddokumentid") & "/" & di.Tables(0).Rows(i).Item("agicoldfolder") + "/" + s)
' Else
' log.InsertJournale("AMS: Cold-Update durchgef<65>hrt" + di.Tables(0).Rows(i).Item("agicolddokumentid") & "/" & di.Tables(0).Rows(i).Item("agicoldfolder"))
' End If
' di.Tables(0).Rows(i).Item("status") = 1
' di.Tables(0).Rows(i).Item("statusdatum") = Now
' Dim cb1 As New SqlCommandBuilder(co)
' co.Update(di, "di")
' cb1.Dispose()
' Dim doknr As String
' If Left(di.Tables(0).Rows(i).Item("agicolddokumentid"), 3) = "SCA" Then
' doknr = "OFF" & Right(di.Tables(0).Rows(i).Item("agicolddokumentid"), Len(di.Tables(0).Rows(i).Item("agicolddokumentid")) - 3)
' Else
' doknr = di.Tables(0).Rows(i).Item("agicolddokumentid")
' End If
' Dim ad As New SqlDataAdapter("select * from dokument where dokumentnr='" + doknr + "'", Globals.sConnectionString_ams)
' Dim da As New DataSet()
' ad.Fill(da, "Dokument")
' If da.Tables(0).Rows.Count <> 0 Then
' If Left(di.Tables(0).Rows(i).Item("agicolddokumentid"), 3) = "OFF" Then
' da.Tables(0).Rows(0).Item("coldstatusausgang") = s
' da.Tables(0).Rows(0).Item("colddatumausgang") = Now
' Else
' da.Tables(0).Rows(0).Item("coldstatuseingang") = s
' da.Tables(0).Rows(0).Item("colddatumeingang") = Now
' End If
' End If
' Dim cb2 As New SqlCommandBuilder(ad)
' ad.Update(da, "Dokument")
' cb1.Dispose()
' da.Dispose()
' ad.Dispose()
' Next
' co.Dispose()
' di.Dispose()
' Catch ex As Exception
' ' MsgBox(ex.Message)
' End Try
'End Function
'Public Function AMS_Cold_Update(ByVal dokumentid As String, ByVal folder As String, ByVal status As String, ByVal Funktion As Integer)
' Dim coldfolder As String
' Dim coldschema As String
' Dim dada As New SqlDataAdapter("SELECT * FROM coldfolderundschema where dokumentid = '" & RTrim(LTrim(dokumentid)) & "'", Globals.sConnectionString_ams)
' Dim dt As New DataSet()
' dada.Fill(dt, "Coldinfo")
' If dt.Tables(0).Rows.Count = 0 Then
' coldfolder = "TGKB Kredite"
' coldschema = "TGKB-C35-EW-Schema-26-PLR012-Put1.9"
' Else
' coldfolder = dt.Tables(0).Rows(0).Item(1)
' coldschema = dt.Tables(0).Rows(0).Item(2)
' End If
' dt.Dispose()
' dada.Dispose()
' Dim s As String
' Dim xfolder As String
' Dim xstatus As String
' Dim i As Integer
' i = InStr(dokumentid, " ")
' If i > 0 Then
' dokumentid = Left(dokumentid, i - 1)
' dokumentid = dokumentid & " "
' End If
' xfolder = "Kredite"
' If status = "Alt" Or status = "Aktuell" Or status = "Ung<6E>ltig" Then
' 'Status
' s = "[ -f """ & coldfolder & """ ] "
' s = s & "[ -g """ & coldschema & """ ] "
' s = s & "[ -i ""WHERE NRDOC00 LIKE '" & RTrim(LTrim(dokumentid)) & "%'"" ] "
' s = s & "[ -n BESTA00 = '" & status & "' ]"
' PrintLine(5, s)
' dostart = True
' Else
' 'datum
' If Funktion = 4 Then
' Dim xx As String
' Dim jj As String
' Dim mm As String
' Dim dd As String
' xx = status
' jj = Year(xx)
' If Left(jj, 1) = " " Then jj = Right(jj, Len(jj) - 1)
' If Len(jj) > 2 Then jj = Right(jj, 2)
' mm = Month(xx)
' If Left(mm, 1) = " " Then mm = Right(mm, Len(mm) - 1)
' If Len(mm) < 2 Then mm = "0" & mm
' dd = Day(xx)
' If Left(dd, 1) = " " Then dd = Right(dd, Len(dd) - 1)
' If Len(dd) < 2 Then dd = "0" & dd
' s = "[ -f """ & coldfolder & """ ] "
' s = s & "[ -g """ & coldschema & """ ] "
' s = s & "[ -i ""WHERE NRDOC00 LIKE '" & dokumentid & "%'"" ] "
' s = s & "[ -n DMSTA01 = '" & mm & "/" & dd & "/" & jj & "' ]"
' PrintLine(5, s)
' dostart = True
' Else
' 'vvnr
' xstatus = sonderzeichentfernen(status, " ")
' xstatus = sonderzeichentfernen(xstatus, ".")
' xstatus = sonderzeichentfernen(xstatus, "-")
' s = "[ -f """ & coldfolder & """ ] "
' s = s & "[ -g """ & coldschema & """ ] "
' s = s & "[ -i ""WHERE NRDOC00 LIKE '" & dokumentid & "%'"" ] "
' s = s & "[ -n NAVVG00 = '" & xstatus & "' ]"
' PrintLine(5, s)
' dostart = True
' End If
' dostart = True
' End If
'End Function
#End Region
#Region "Utils"
Private Sub ErrorHandling()
Dim betreff As String
Dim meldung As String
betreff = "EDKB01: Job konnte nicht gestartet werden"
Select Case Fehler
Case 1
meldung = "Die Parameterdatei parameters.cfg konnte nicht gefunden werden.)"
Case 2
meldung = "AMS-Fileserver Laufwerk X: steht nicht zur Verf<72>gung"
Case 3
meldung = "EDOKA-Datenbank steht nicht zur Verf<72>gung"
Case 4
meldung = "AMS-Datenbanksteht nicht zur Verf<72>gung"
Case 5
meldung = "COLD-Return nicht 0"
Case 6
meldung = "Anzahl von COLD zur<75>ckgemeldete Dokumente stimmt nicht mit gesendeten <20>berein"
Case 7
meldung = "Allg. techn. Fehler"
Case 8
meldung = "Word konnte nicht gestartet werden"
Case 8
meldung = "Excel konnte nicht gestartet werden"
Case 10
meldung = "Fehler beim Stop bzw. Start des Spoolers"
Case Else
End Select
End Sub
Public Function FileExist(ByVal dn As String) As Boolean
If Dir(dn) <> "" Then FileExist = True Else FileExist = False
End Function
Private Function Check_ReturnCode() As Boolean
Try
If FileCount.CountReturnfiles(log) = False Then
Fehler = 6
End If
Catch ex As Exception
' log.InsertJournale("Error 2: Coldreturn : File " + Params.PathColdDateien + Params.FileReturnCode + " not found.")
Fehler = 7
End Try
End Function
Public Function GETDATE(ByVal DATUM As String) As String
Dim DD, MM, JJJJ As String
If DATUM = "" Then DATUM = Now
Try
DD = LTrim(Str(Day(DATUM)))
MM = LTrim(Str(Month(DATUM)))
JJJJ = LTrim(Str(Year(DATUM)))
If Len(DD) = 1 Then DD = "0" + DD
If Len(MM) = 1 Then MM = "0" + MM
If Len(JJJJ) = 2 Then JJJJ = "20" + JJJJ
GETDATE = JJJJ + MM + DD
Catch
GETDATE = DATUM
End Try
End Function
Public Sub Print_cmd(ByVal outputfilename As String, ByVal filename As String, ByVal type As Integer)
Select Case type
Case 1
' FileOpen(2, Params.PathColdDateien + Params.ParameterFileBin, OpenMode.Input)
Case 2
' FileOpen(2, Params.PathColdDateien + Params.ParameterFileTxt, OpenMode.Input)
Case 3
FileOpen(2, Params.PathColdDateien + Params.ParameterFileBin, OpenMode.Input)
Case Else
End Select
If type = 3 Then
Dim s As String = ""
Dim s1 As String = ""
Dim s2 As String = ""
Input(2, s)
Input(2, s1)
Input(2, s2)
s = s & outputfilename & " " & s2 & filename
PrintLine(9, s)
FileClose(2)
End If
End Sub
Public Sub printdto_start()
Dim s As String = ""
Dim s1 As String = ""
Dim s2 As String = ""
Dim s3 As String = ""
FileOpen(2, Params.PathColdDateien + Params.FileDtoStart, OpenMode.Input)
Input(2, s)
Input(2, s1)
Input(2, s2)
Input(2, s3)
s = s & " " & s1 & " " & ZipFileName & s3
PrintLine(9, s)
FileClose(2)
End Sub
Public Function unformat(ByVal x As String) As String
Dim s As String
s = x
Dim i As Integer
i = InStr(s, ".")
While i > 0
s = Left(s, i - 1) & "" & Right(s, Len(s) - i)
i = InStr(s, ".")
End While
i = InStr(s, "-")
While i > 0
s = Left(s, i - 1) & "" & Right(s, Len(s) - i)
i = InStr(s, "-")
End While
i = InStr(s, " ")
While i > 0
s = Left(s, i - 1) & "" & Right(s, Len(s) - i)
i = InStr(s, " ")
End While
unformat = s
End Function
Public Function sonderzeichentfernen(ByVal x As String, ByVal delimiter As String) As String
Dim xx() As String
Dim s As String = ""
Dim i As Integer
xx = Split(x, delimiter)
i = 0
Try
While Not xx(i) Is System.DBNull.Value
s = s & xx(i)
i = i + 1
End While
Catch
End Try
sonderzeichentfernen = s
End Function
#End Region
#Region "Convert"
Public Function Convert_EDOKA_To_Tif(ByVal dokumentid As String, ByVal filedokumentid As String, ByVal format As String) As Boolean
'Rel 4.1
If Params.Test = "True" Then
Convert_EDOKA_To_Tif = True
Return True
End If
Dim doc As New DocMgmt
Dim tdoctype As New DataTable
Dim doctype As String
Convert_EDOKA_To_Tif = True
'BUD - 2006.10.04
Dim dokumenttypNR As Integer = 0
Dim istFarbigArchivieren As Boolean = False
Console.WriteLine("format=" & format)
If format = "" Then
Try
'EDOKA-Import
Dim d As New edokadb.clsDokument
d.cpMainConnectionProvider = conn_edoka
d.sDokumentid = New SqlString(CType(dokumentid, String))
d.SelectOne()
dokumenttypNR = d.iDokumenttypnr.Value
doctype = Right(d.sDokumentname.Value, 3)
Dateiformat = doctype
d.Dispose()
'
' tdoctype = Generic_Select(4)
' doctype = tdoctype.Rows(0).Item(0)
'Abrufen des Farbig Druck Flags
Dim dokTyp As New edokadb.clsDokumenttyp
dokTyp.cpMainConnectionProvider = conn_edoka
dokTyp.iDokumenttypnr = New SqlInt32(CType(dokumenttypNR, Integer))
'dokTyp.istFarbigArchiviert = New SqlBoolean(CType(False, Boolean))
dokTyp.SelectOne()
Console.WriteLine("Pr<EFBFBD>fung Dokumenttyp ist farbig")
istFarbigArchivieren = Convert.ToBoolean(dokTyp.istFarbigArchiviert.Value)
Console.WriteLine("-> ist Farbig? : " & istFarbigArchivieren.ToString)
dokTyp.Dispose()
Console.WriteLine("DokumenttypNr: " & dokumenttypNR)
Catch ex As Exception
Console.WriteLine("EX:InFormat:" & ex.Message & ex.StackTrace)
doctype = "doc"
Dateiformat = doctype
End Try
Else
doctype = format
Dateiformat = doctype
End If
If format = "" Then
Select Case UCase(doctype)
Case "DOC"
If Params.PostScript = True Then
Outputfile = Params.PDFDir + Globals.DokumentID + ".pdf"
OutputfilePS = Params.PSDir + Globals.DokumentID + ".ps"
OutputDateiformat = "ps"
Else
Outputfile = Params.PathTif + Globals.DokumentID + ".tif"
OutputDateiformat = "tif"
End If
Case "XLS"
If Params.PostScript = True Then
OutputDateiformat = "tif"
Outputfile = Params.PDFDir + Globals.DokumentID + ".pdf"
OutputfilePS = Params.PSDir + Globals.DokumentID + ".ps"
Else
OutputDateiformat = "tif"
Outputfile = Params.PathTif + Globals.DokumentID + ".tif"
End If
Case "PDF", "JPG", "TIF"
If Params.PostScript = True Then
Outputfile = Params.PDFDir + filedokumentid + "." + doctype
OutputDateiformat = LCase(doctype)
Else
Outputfile = Params.PathTif + filedokumentid + "." + doctype
OutputDateiformat = LCase(doctype)
End If
Case Else
log.InsertJournale("Ung<EFBFBD>ltiger Dateityp: " + doctype + " " + Globals.DokumentID, clsLog.Enum_InfoTyp.Information)
End Select
Else
Select Case UCase(doctype)
Case "DOC"
If Params.PostScript = True Then
Outputfile = Params.PDFDir + filedokumentid + ".pdf"
OutputfilePS = Params.PSDir + filedokumentid + ".ps"
OutputDateiformat = "tif"
Else
Outputfile = Params.PathTif + filedokumentid + ".tif"
OutputDateiformat = "tif"
End If
Case "XLS"
If Params.PostScript = True Then
Outputfile = Params.PDFDir + filedokumentid + ".pdf"
OutputfilePS = Params.PSDir + filedokumentid + ".ps"
OutputDateiformat = "tif"
Else
Outputfile = Params.PathTif + filedokumentid + ".tif"
OutputDateiformat = "tif"
End If
Case "PDF", "JPG", "TIF"
If Params.PostScript = True Then
Outputfile = Params.PDFDir + filedokumentid + "." + doctype
OutputDateiformat = LCase(doctype)
Else
Outputfile = Params.PathTif + filedokumentid + "." + doctype
OutputDateiformat = LCase(doctype)
End If
Case Else
log.InsertJournale("Ung<EFBFBD>ltiger Dateityp: " + doctype + " " + Globals.DokumentID, clsLog.Enum_InfoTyp.Information)
End Select
End If
'Try
' tdoctype = Generic_Select(4)
' doctype = tdoctype.Rows(0).Item(0)
'Catch
' doctype = "doc"
'End Try
'Outputfile = Params.PathTif + Globals.DokumentID + ".tif"
SourceFilename = Params.PathTemp + Globals.DokumentID + "." + doctype
If doc.Get_From_DB(filedokumentid, SourceFilename) = False Then
log.InsertJournale("EDOKA: Fehler: Dokument " & Globals.DokumentID & " ist auf der Datenbank nicht vorhanden.", clsLog.Enum_InfoTyp.Information)
stat.Meldung_FehlerVerantwortlicher(Globals.DokumentID, 201)
End If
Select Case UCase(doctype)
Case "DOC"
If Not Convert_Word(istFarbigArchivieren) Then
Convert_EDOKA_To_Tif = False
End If
Case "XLS"
If Not Convert_Excel(istFarbigArchivieren) Then
Convert_EDOKA_To_Tif = False
End If
Case "PDF", "JPG", "TIF"
FileCopy(SourceFilename, Outputfile)
Convert_EDOKA_To_Tif = True
Dateiformat = UCase(doctype)
Case Else
log.InsertJournale("Warnung: Filetyp des Dokumentes " + doctype + " unbekannt - Konvertierung abgebrochen", clsLog.Enum_InfoTyp.Information)
End Select
End Function
Public Sub StartWord()
Try
objword = CreateObject("Word.application")
objword.Visible = False
Catch
log.InsertJournale("Error 4: Word konnte nicht gestartet werden", clsLog.Enum_InfoTyp.Warnung)
'Fehler = 8
End Try
End Sub
Public Sub StartExcel()
Try
kill("EXCEL")
Catch
End Try
Try
objexcel = GetObject(, "Excel.application")
objexcel.Visible = False
Catch
Try
objexcel = CreateObject("Excel.Application")
Catch
log.InsertJournale("Error 4: Excel konnte nicht gestartet werden", clsLog.Enum_InfoTyp.Warnung)
End Try
End Try
End Sub
Private Function Convert_Word(ByVal istFarbigArchivieren As Boolean) As Boolean
' Test
If Params.Test = "True" Then Return True
Dim pages As Long
Dim Prop As Object
Convert_Word = True
Try
StartWord()
Convert_Word = True
objword.Documents.Open(FileName:=SourceFilename.ToString, ReadOnly:=True)
docword = objword.ActiveDocument
'Z<>hlen der Seiten je Dokument
'Dieser Z<>hler wird nach der Konvertierung ben<65>tigt, um die Wartezeit zu beinflussen,
'bis die Verarbeitung weiterlaufen soll
'2004-11-12 SHU
For Each Prop In docword.BuiltInDocumentProperties
If UCase(Prop.name) = "NUMBER OF PAGES" Then
pages = Prop.value
End If
Next
If UCase(Params.Printtype) = "DIREKT" Then
'objword.ActivePrinter = Params.PrinterDriver
'BUD - 2006.10.12 - Drucker setzten (Farbig / SW)
If istFarbigArchivieren Then
Try
If Params.PostScript = True Then
Console.WriteLine("Drucker: " + Params.PostScriptDriverColor)
objword.ActivePrinter = Params.PostScriptDriverColor
Else
Console.WriteLine("Drucker: " + Params.PrinterdriverColor)
objword.ActivePrinter = Params.PrinterdriverColor
End If
log.InsertJournale("EDOKA: Dokument farbig archiviert: DokumentID: " + Globals.DokumentID, clsLog.Enum_InfoTyp.Keine)
Catch ex As Exception
Console.WriteLine("ModMain:Convert_Word:ColorPrinter:" + ex.Message)
m_log.Log("ModMain:Convert_Word:ColorPrinter:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
Else
Try
If Params.PostScript = True Then
Console.WriteLine("Drucker: " + Params.PostScriptDriver)
objword.ActivePrinter = Params.PostScriptDriver
Else
Console.WriteLine("Drucker: " + Params.PrinterDriver)
objword.ActivePrinter = Params.PrinterDriver
End If
Catch ex As Exception
Console.WriteLine("ModMain:Convert_Word:SW-Printer:" + ex.Message)
m_log.Log("ModMain:Convert_Word:SW-Printer:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End If
'objword.WordBasic.FilePrintSetup(Printer:=Params.PrinterDriver, DoNotSetAsSysDefault:=1)
Outputfile = UCase(Outputfile)
OutputfilePS = UCase(OutputfilePS)
Try
If Params.PostScript = True Then
docword.PrintOut(OutputFileName:=OutputfilePS.ToString, PrintToFile:=False, Copies:=1)
Else
objword.ActiveDocument.PrintOut(Background:=True)
End If
Catch
docword.Close(SaveChanges:=False)
docword = Nothing
Convert_Word = False
Try
objword.Quit(SaveChanges:=False)
objword.Quit()
Catch
End Try
log.InsertJournale("AMS/EDOKA: Ausgangsarchivierung: Datei konnte nicht erstellt werden: " + Outputfile, clsLog.Enum_InfoTyp.Information)
Return False
End Try
Else
If Params.PostScript = True Then
objword.WordBasic.FilePrintSetup(Printer:=Params.PostScriptDriver, DoNotSetAsSysDefault:=1)
objword.ActivePrinter = Params.PrinterDriver
docword.PrintOut(OutputFileName:=OutputfilePS.ToString, PrintToFile:=True, Copies:=1)
Else
objword.WordBasic.FilePrintSetup(Printer:=Params.PrinterDriver, DoNotSetAsSysDefault:=1)
objword.ActivePrinter = Params.PrinterDriver
docword.PrintOut(OutputFileName:=Outputfile.ToString, PrintToFile:=True, Copies:=1)
End If
End If
If Not Wait_for_outputfile() Then
log.InsertJournale("AMS/EDOKA: Ausgangsarchivierung: Datei konnte nicht erstellt werden: " + Outputfile, clsLog.Enum_InfoTyp.Information)
Convert_Word = False
'Try
' kill("WINWORD")
'Catch
'End Try
stop_start_spooler()
Else
'Abh<62>nging von den gez<65>hlten Seiten wird 1,5 Sekunden pro zu druckende Seite gewartet
'bis die Verarbeitung weiterl<72>uft.
'BUD - 2006.10.17 - L<>nger Warten wenn es ein Farbig DokTyp ist
Dim iWartezeitNormal As Integer
Dim iWartezeitProSeite As Integer
If istFarbigArchivieren Then
iWartezeitNormal = 45000
iWartezeitProSeite = 10000
Else
iWartezeitNormal = 2000
iWartezeitProSeite = 500
End If
If pages > 6 Then
Console.WriteLine("Warte: " + (pages * iWartezeitProSeite).ToString + " MiliSekunden ")
Thread.Sleep(pages * iWartezeitProSeite)
Else
Console.WriteLine("Warte: " + iWartezeitNormal.ToString + " MiliSekunden ")
Thread.Sleep(iWartezeitNormal)
End If
System.IO.File.Move(Outputfile, UCase(Outputfile))
End If
docword.Saved = True
docword.Close(SaveChanges:=False)
docword = Nothing
Try
objword.Quit(SaveChanges:=False)
Catch ex As Exception
log.InsertJournale("Word Quit konnte nicht durchgef<65>hrt werden:" + ex.Message, clsLog.Enum_InfoTyp.Warnung)
End Try
Try
objword = Nothing
Catch ex As Exception
log.InsertJournale("Word auf nothing setzen konnte nicht durchgef<65>hrt werden:" + ex.Message, clsLog.Enum_InfoTyp.Warnung)
End Try
Exit Function
Catch ex As Exception
log.InsertJournale("Ausgangsarchivierung: Dokument wurde nicht ausgangsarchiviert: " + Globals.DokumentID + " Fehler:" & ex.Message, clsLog.Enum_InfoTyp.Information)
Try
objword.Quit()
Catch
End Try
Convert_Word = False
End Try
End Function
Private Function Convert_Excel(ByVal istFarbigArchivieren As Boolean) As Boolean
' Test
If Params.Test = "True" Then Return True
Convert_Excel = True
Try
StartExcel()
Convert_Excel = True
docexcel = objexcel.Workbooks.Open(Filename:=SourceFilename)
If UCase(Params.Printtype) = "DIREKT" Then
'docexcel.PrintOut(, , , , Params.PrinterDriver, , , )
'BUD - 2006.10.12 - Drucker setzten (Farbig / SW)
If istFarbigArchivieren Then
Try
Console.WriteLine("Drucker: " + Params.PrinterdriverColor)
'Versuchen den StandartDrucker zu setzen, gehl leider nur wenn Default Drucker nicht Acrobat ist.
Try
If Params.PostScript = True Then
docexcel.Application.ActivePrinter = Params.PostScriptDriverColor
Else
docexcel.Application.ActivePrinter = Params.PrinterdriverColor
End If
Catch ex As Exception
Console.WriteLine("ModMain:Convert_Excel:Drucker zuweisen:" + ex.Message)
m_log.Log("ModMain:Convert_Excel:Drucker zuweisen:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
'DPi auf 150 setzten. Da Default Wert bei Excel nicht zieht.
Try
docexcel.ActiveSheet.Pagesetup.Printquality = 150
Catch ex As Exception
Console.WriteLine("ModMain:Convert_Excel:Druckqualit<69>t setzten:" + ex.Message)
m_log.Log("ModMain:Convert_Excel:Druckqualit<69>t setzten:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
If Params.PostScript = True Then
docexcel.PrintOut(, , , , Params.PostScriptDriverColor, , , OutputfilePS.ToString)
Else
docexcel.PrintOut(, , , , Params.PrinterdriverColor, , , )
End If
log.InsertJournale("EDOKA: Dokument farbig archiviert: DokumentID: " + Globals.DokumentID, clsLog.Enum_InfoTyp.Keine)
Catch ex As Exception
Console.WriteLine("ModMain:Convert_Excel:ColorPrinter:" + ex.Message)
m_log.Log("ModMain:Convert_Excel:ColorPrinter:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
Else
Try
Console.WriteLine("Drucker: " + Params.PrinterDriver)
If Params.PostScript = True Then
docexcel.PrintOut(, , , , Params.PostScriptDriver, , , OutputfilePS.ToString)
Else
docexcel.PrintOut(, , , , Params.PrinterDriver, , , )
End If
Catch ex As Exception
Console.WriteLine("ModMain:Convert_Excel:SW-Printer:" + ex.Message)
m_log.Log("ModMain:Convert_Word:SW-Printer:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End If
End If
If Not Wait_for_outputfile() Then
log.InsertJournale("AMS/EDOKA: Ausgangsarchivierung Excel: Datei konnte nicht erstellt werden: " + Outputfile, clsLog.Enum_InfoTyp.Information)
Convert_Excel = False
stop_start_spooler()
Else
'Abh<62>nging von den gez<65>hlten Seiten wird 1,5 Sekunden pro zu druckende Seite gewartet
'bis die Verarbeitung weiterl<72>uft.
'BUD - 2006.10.17 - L<>nger Warten wenn es ein Farbig DokTyp ist
Dim iWartezeitNormal As Integer
Dim iWartezeitProSeite As Integer
If istFarbigArchivieren Then
iWartezeitNormal = 20000
iWartezeitProSeite = 10000
Else
iWartezeitNormal = 2000
iWartezeitProSeite = 500
End If
Console.WriteLine("Warte: " + iWartezeitNormal.ToString + " MiliSekunden ")
Thread.Sleep(iWartezeitNormal)
End If
docexcel.Saved = True
docexcel.Close(SaveChanges:=False)
Try
objexcel.Quit()
Catch
End Try
Exit Function
Catch ex As Exception
log.InsertJournale("Ausgangsarchivierung: Dokument wurde nicht ausgangsarchiviert Excel: " + Globals.DokumentID + " Fehler:" & ex.Message, clsLog.Enum_InfoTyp.Information)
Try
objexcel.Quit()
Catch
End Try
Convert_Excel = False
End Try
End Function
Public Function Wait_for_outputfile() As Boolean
Dim i As Integer
Dim filefound As Boolean = False
i = 0
While i < 50 And filefound = False
Console.WriteLine("Warte 2 Sekunden, das " + (i + 1).ToString + " mal!")
System.Threading.Thread.Sleep(2000)
If FileExist(Outputfile) Then filefound = True
i = i + 1
End While
'Produktion
'System.Threading.Thread.Sleep(2000)
'Test
System.Threading.Thread.Sleep(5000)
If filefound Then Wait_for_outputfile = True Else Wait_for_outputfile = False
End Function
Private Sub kill(ByVal application As String)
Dim myProcess() As Process
Try
myProcess = Process.GetProcessesByName(application)
If myProcess.Length > 0 Then
myProcess(0).Kill()
Thread.Sleep(5000)
'log.InsertJournale("Applikation gestoppt: " & application, clsLog.Enum_InfoTyp.Information)
End If
Catch
Finally
End Try
End Sub
#End Region
#Region "Mehrfachscan / Dokumente ersetzen"
Private Sub EDOKA_Mehrfachsacn_Bearbeiten(ByVal Dokumentid As String)
'BUD - 2006.10.05 - Try
Try
Dim i As Integer
Dim s As String
Dim ze As DataTable
Globals.DokumentID = Dokumentid
ze = Generic_Select(5)
If ze.Rows.Count < 2 Then Exit Sub
For i = 0 To ze.Rows.Count - 2
s = "[ -f """ & ze.Rows(i).Item("coldfolder") & """ ] "
s = s + "[ -g """ & ze.Rows(i).Item("ColdSchema") & """ ]"
s = s & "[ -i ""WHERE NRDOC00 LIKE '" & UCase(ze.Rows(i).Item("colddokumentid")) & "%'"" ] "
s = s & "[ -n BESTA00 = 'ALT' ]"
PrintLine(5, s)
log.InsertJournale("EDOKA: Mehrfachsan auf Status Alt setzen: " & ze.Rows(i).Item("colddokumentid"), clsLog.Enum_InfoTyp.Information)
Globals.KeyNr = ze.Rows(i).Item("nreintrag")
Generic_Select(6)
dostart = True
Next
ze.Dispose()
Catch ex As Exception
m_log.Log("ModMain:EDOKA_Mehrfachsacn_Bearbeiten:" & ex.Message & ex.StackTrace, Common.Common.JournalEntryType.Warning)
End Try
End Sub
Private Sub EDOKA_Mehrfachscan_Bearbeiten_2()
Dim i As Integer
Dim o As Integer
Dim mt As New DataTable
Dim ze As New DataTable
Dim s As String
mt = Generic_Select(11)
For o = 0 To mt.Rows.Count - 1
Globals.DokumentID = mt.Rows(o).Item(0)
ze = Generic_Select(5)
If ze.Rows.Count > 1 Then
For i = 0 To ze.Rows.Count - 2
s = "[ -f """ & ze.Rows(i).Item("coldfolder") & """ ] "
s = s + "[ -g """ & ze.Rows(i).Item("ColdSchema") & """ ]"
s = s & "[ -i ""WHERE NRDOC00 LIKE '" & UCase(ze.Rows(i).Item("colddokumentid")) & "%'"" ] "
s = s & "[ -n BESTA00 = 'ALT' ]"
PrintLine(5, s)
log.InsertJournale("EDOKA: Mehrfachsan auf Status Alt setzen: " & ze.Rows(i).Item("colddokumentid"), clsLog.Enum_InfoTyp.Information)
Globals.KeyNr = ze.Rows(i).Item("nreintrag")
Generic_Select(6)
dostart = True
Next
End If
Globals.KeyNr = mt.Rows(o).Item(1)
Generic_Select(12)
Next
End Sub
Private Sub EDOKA_Dokumente_Ersetzen(ByVal dokumentid As String, ByVal DOKUMENTTYP As Integer, ByVal eingangsarchivierung As Boolean)
Dim data As New DataTable
Dim data1 As New DataTable
Dim dt As New edokadb.clsDokumenttyp
Dim i As Integer
Dim archivfnkt As New EDOKA.clsarchivfnkt
dt.cpMainConnectionProvider = Globals.conn_edoka
dt.iDokumenttypnr = New SqlInt32(CType(DOKUMENTTYP, Int32))
Try
dt.SelectOne()
If (dt.bZu_retournieren.Value = True And eingangsarchivierung) Or (dt.bZu_retournieren.Value = False And eingangsarchivierung = False) Then
data = Datenzugriffe.Generic_Select(9)
For i = 0 To data.Rows.Count - 1
data1 = archivfnkt.set_aufgehoben(data.Rows(i).Item("dokumentid"))
If Globals.Aufgehoben = False Then
delete_dokument(data.Rows(i).Item("dokumentid"), True)
Else
delete_dokument(data.Rows(i).Item("dokumentid"), False)
log.InsertJournale("EDOKA: Dokument aufgehoben: " & data.Rows(i).Item("dokumentid"), clsLog.Enum_InfoTyp.Keine)
End If
Ersetzen_Status(data.Rows(i).Item("dokumentersetzennr"))
Next
End If
Catch
End Try
End Sub
Public Sub delete_dokument(ByVal dokumentid As String, ByVal inaktivieren As Boolean)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_Dokument_delete"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Try
conn_edoka.OpenConnection()
Catch
End Try
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
scmCmdToExecute.Parameters.Add(New SqlParameter("@mitarbeiter", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 9998))
scmCmdToExecute.Parameters.Add(New SqlParameter("@loeschgrund", SqlDbType.VarChar, 1924, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, "*** Dokument durch EDKB02 geloescht / ersetzt"))
scmCmdToExecute.Parameters.Add(New SqlParameter("@anzeigestatus", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
If inaktivieren = True Then
scmCmdToExecute.Parameters.Add(New SqlParameter("@aktiv", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
Else
scmCmdToExecute.Parameters.Add(New SqlParameter("@aktiv", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
End If
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
conn_edoka.CloseConnection(True)
log.InsertJournale("EDOKA: Dokument in EDOKA gel<65>scht: " & dokumentid, clsLog.Enum_InfoTyp.Keine)
End Try
End Sub
Public Sub Ersetzen_Status(ByVal key As Integer)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_archiv_dokumente_ersetzen_done"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Try
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Catch
End Try
Try
conn_edoka.OpenConnection()
Catch
End Try
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@key", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, key))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
conn_edoka.CloseConnection(True)
log.InsertJournale("EDOKA: Dokument in EDOKA gel<65>scht: " & DokumentID, clsLog.Enum_InfoTyp.Keine)
End Try
End Sub
#End Region
Public Function Sendmail(ByVal email As String, ByVal msg As Integer) As Boolean
'Mails im Fehler- bzw. im OK-Fall versenden
Dim meldung As String = ""
Dim betreff As String = ""
Select Case msg
Case 0
Dim d As New GenericList("", 0)
betreff = "EDKB02 - Return 0: EDOKA/AMS-Archivierung ordnungsgem<65>ss durchgef<65>hrt / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde ordnungsgem<65>ss durchgef<65>hrt:" + vbCrLf + vbCrLf + _
"Archivierte Dokumente: " & ArchivierteDokumente.ToString & vbNewLine + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 1
betreff = "EDKB02 - Return 16: Fehler Datei parameters.cfg ist nicht vorhanden oder fehlerhaft / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt:" + vbCrLf + vbCrLf + _
"Fehler: Datei c:\prg\edoka\edkb02\parameters.cfg ist nicht vorhanden oder ung<6E>ltig" + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 2
betreff = "EDKB02 - Return 16: Datenbank EDOKA oder AMS steht nicht zur Verf<72>gung / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt." + vbCrLf + vbCrLf + _
"Fehler: Eine der beiden Dantebenkane (EDOKA oder AMS) steht nicht zur Verf<72>gung" + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 3
betreff = "EDKB02 - Return 16: Datenbank EDOKA steht nicht zur Verf<72>gung / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt." + vbCrLf + vbCrLf + _
"Fehler: Die Datenbank EDOKA steht nicht zur Verf<72>gung." + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 3
betreff = "EDKB02 - Return 16: Datenbank AMS steht nicht zur Verf<72>gung / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt." + vbCrLf + vbCrLf + _
"Fehler: Die Datenbank AMS steht nicht zur Verf<72>gung." + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 6
betreff = "EDKB02 - Return 16: Die Anzahl von COLD zur<75>ckgemeldeten Datein stimmt nicht mit der Anzahl der gesendeten <20>berein: / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt:" + vbCrLf + vbCrLf + _
"Fehler: Die Anzahl von COLD zur<75>ckgemeldeten Datein stimmt nicht mit der Anzahl der gesendeten <20>berein:" + vbCrLf + vbCrLf + _
"Anzahl gesendet: " + Str(FileCount.Sent) + vbCrLf + _
"Anzahl gemeldet: " + Str(FileCount.got) + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 8
betreff = "EDKB02 - Return 16: Die Anwendung Microsoft-Word konnte nicht gestartet werden: / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt:" + vbCrLf + vbCrLf + _
"Fehler: Die Anwendung Microsoft-Word konnte nicht gestartet werden." + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 9
betreff = "EDKB02 - Return 16: Die Anwendung Microsoft-Excel konnte nicht gestartet werden: / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt:" + vbCrLf + vbCrLf + _
"Fehler: Die Anwendung Microsoft-Excel konnte nicht gestartet werden." + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
Case 10
betreff = "EDKB02 - Return 16: Stop bzw. Start des Druckspoolers ist fehlgeschlagen / " + Format(Now, "yyyyMMddHHmmss")
meldung = "Die Verarbeitung EDKB02 wurde nicht ordnungsgem<65>ss durchgef<65>hrt:" + vbCrLf + vbCrLf + _
"Fehler: Stop bzw. Start des Druckspoolers ist fehlgeschlagen." + vbCrLf + vbCrLf + _
"Dieses Mail wurde durch den Job EDKB02 ausgel<65>st" + vbCrLf + _
"------------------------------------------------"
End Select
'If msg = 0 Then
log.InsertJournale(betreff, clsLog.Enum_InfoTyp.Information)
log.InsertJournale(meldung, clsLog.Enum_InfoTyp.Information)
'Else
' log.InsertJournale(betreff + vbCrLf + meldung, clsLog.Enum_InfoTyp.Fehler)
'End If
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_SendMail"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable
scmCmdToExecute.Parameters.Add(New SqlParameter("@email", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, email))
scmCmdToExecute.Parameters.Add(New SqlParameter("@betreff", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, betreff))
scmCmdToExecute.Parameters.Add(New SqlParameter("@meldung", SqlDbType.VarChar, 1024, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, meldung))
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
Try
conn_edoka.OpenConnection()
Catch
End Try
Sendmail = True
Try
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
Sendmail = False
Finally
scmCmdToExecute.Dispose()
conn_edoka.CloseConnection(True)
End Try
End Function
Private Sub Insert_Zuordnung(ByVal dokumentid1 As String)
Dim scmCmdToExecute As SqlCommand = New SqlCommand
scmCmdToExecute.CommandText = "dbo.SP_Dokumentzuordnungen_ausloeser_sichern"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
scmCmdToExecute.Connection = conn_edoka.scoDBConnection
scmCmdToExecute.Connection.Open()
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid1))
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentzuordnungnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 0))
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid2", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, ""))
scmCmdToExecute.Parameters.Add(New SqlParameter("@zuordnungnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 5))
scmCmdToExecute.Parameters.Add(New SqlParameter("@aktiv", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
scmCmdToExecute.Parameters.Add(New SqlParameter("@mitarbeiternr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 9998))
scmCmdToExecute.Parameters.Add(New SqlParameter("@mandant", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
scmCmdToExecute.ExecuteNonQuery()
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Connection.Close()
scmCmdToExecute.Dispose()
End Try
End Sub
Private Sub stop_start_spooler()
cmdret = Shell(Params.PathColdDateien + "stopspooler.cmd", AppWinStyle.NormalFocus, True)
If cmdret <> 0 Then
log.InsertJournale("Stoppen des Spooler ist fehlgeschlagen", clsLog.Enum_InfoTyp.Fehler)
Fehler = 10
End If
Thread.Sleep(10000)
cmdret = Shell(Params.PathColdDateien + "startspooler.cmd", AppWinStyle.NormalFocus, True)
If cmdret <> 0 Then
log.InsertJournale("Starten des Spooler ist fehlgeschlagen", clsLog.Enum_InfoTyp.Fehler)
Fehler = 10
End If
Thread.Sleep(3000)
End Sub
End Module