MS Log erweitert
This commit is contained in:
parent
22bdb96d42
commit
418df6f817
@ -9,7 +9,7 @@
|
|||||||
<add name="EB_Creator.My.MySettings.MyConnectionString" connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd" providerName="System.Data.SqlClient"/>
|
<add name="EB_Creator.My.MySettings.MyConnectionString" connectionString="Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd" providerName="System.Data.SqlClient"/>
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||||
</startup>
|
</startup>
|
||||||
<applicationSettings>
|
<applicationSettings>
|
||||||
<EB_Creator.My.MySettings>
|
<EB_Creator.My.MySettings>
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
<AssemblyName>EB_Creator</AssemblyName>
|
<AssemblyName>EB_Creator</AssemblyName>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<MyType>Console</MyType>
|
<MyType>Console</MyType>
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
|
|||||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
|||||||
' indem Sie "*" wie unten gezeigt eingeben:
|
' indem Sie "*" wie unten gezeigt eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("1.3.0.0")>
|
<Assembly: AssemblyVersion("2.0.0.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.3.0.0")>
|
<Assembly: AssemblyFileVersion("2.0.0.0")>
|
||||||
|
|||||||
@ -7,6 +7,8 @@ Imports GdPicture14
|
|||||||
Imports System.Drawing
|
Imports System.Drawing
|
||||||
Imports DigitalData.Modules.Windream
|
Imports DigitalData.Modules.Windream
|
||||||
Imports System.Threading
|
Imports System.Threading
|
||||||
|
Imports DevExpress.XtraRichEdit
|
||||||
|
Imports DevExpress.Pdf.Native
|
||||||
|
|
||||||
Public Class MyService
|
Public Class MyService
|
||||||
#Region "+++++ variables +++++"
|
#Region "+++++ variables +++++"
|
||||||
@ -113,14 +115,14 @@ Public Class MyService
|
|||||||
If Not _threadRunner1.IsBusy Then
|
If Not _threadRunner1.IsBusy Then
|
||||||
_threadRunner1.RunWorkerAsync()
|
_threadRunner1.RunWorkerAsync()
|
||||||
Else
|
Else
|
||||||
Logger.Info("##### THREAD 1 Is STILL RUNNING #####")
|
Logger.Info("##### Thread 1 IsBusy #####")
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Public Sub Thread_Run2()
|
Public Sub Thread_Run2()
|
||||||
If Not _threadRunner2.IsBusy Then
|
If Not _threadRunner2.IsBusy Then
|
||||||
_threadRunner2.RunWorkerAsync()
|
_threadRunner2.RunWorkerAsync()
|
||||||
Else
|
Else
|
||||||
Logger.Info("##### THREAD 2 Is STILL RUNNING #####")
|
Logger.Info("##### Thread 2 IsBusy #####")
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Public Sub RUN_THREAD1(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
|
Public Sub RUN_THREAD1(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
|
||||||
@ -147,6 +149,7 @@ Public Class MyService
|
|||||||
Logger.Info($"##### THREAD for Generator {GeneratorID} has [{oDTEB_Workload.Rows.Count}] results 2Bworked #####")
|
Logger.Info($"##### THREAD for Generator {GeneratorID} has [{oDTEB_Workload.Rows.Count}] results 2Bworked #####")
|
||||||
For Each oRow As DataRow In oDTEB_Workload.Rows
|
For Each oRow As DataRow In oDTEB_Workload.Rows
|
||||||
oDocID = oRow.Item(0).ToString
|
oDocID = oRow.Item(0).ToString
|
||||||
|
Logger.Debug($"WORKING ON DOCID - {oDocID.ToString}")
|
||||||
Try
|
Try
|
||||||
oOutputfilename = oRow.Item("Outputfilename").ToString
|
oOutputfilename = oRow.Item("Outputfilename").ToString
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -195,7 +198,7 @@ Public Class MyService
|
|||||||
Dim oError = False
|
Dim oError = False
|
||||||
If My.Settings.PROC_BEFORE_POS = True Then
|
If My.Settings.PROC_BEFORE_POS = True Then
|
||||||
oSQL = $"EXEC PRCUST_CREATE_RPTERGEBNISBERICHT_POS {oDocID.ToString}"
|
oSQL = $"EXEC PRCUST_CREATE_RPTERGEBNISBERICHT_POS {oDocID.ToString}"
|
||||||
Logger.Debug($"Now executing [{oSQL}]")
|
Logger.Debug($"DocID - {oDocID.ToString} Now executing [{oSQL}]")
|
||||||
If MyDatabase.ExecuteNonQuery(oSQL, 500) = False Then
|
If MyDatabase.ExecuteNonQuery(oSQL, 500) = False Then
|
||||||
Delete_EB2bCreated(oDocID)
|
Delete_EB2bCreated(oDocID)
|
||||||
oError = True
|
oError = True
|
||||||
@ -206,11 +209,13 @@ Public Class MyService
|
|||||||
Dim oDTEB = MyDatabase.GetDatatable(oSQL)
|
Dim oDTEB = MyDatabase.GetDatatable(oSQL)
|
||||||
If oDTEB.Rows.Count > 0 Then
|
If oDTEB.Rows.Count > 0 Then
|
||||||
Create_EB_Report(oDocID.ToString, GeneratorID, oOutputfilename, OutputFolder, oReRun)
|
Create_EB_Report(oDocID.ToString, GeneratorID, oOutputfilename, OutputFolder, oReRun)
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Logger.Warn($"No EB-Rows [{oSQL}]")
|
Logger.Warn($"DocID - {oDocID.ToString} - No EB-Rows [{oSQL}]")
|
||||||
Delete_EB2bCreated(oDocID)
|
Delete_EB2bCreated(oDocID)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
Logger.Debug($"")
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@ -235,7 +240,7 @@ Public Class MyService
|
|||||||
End Sub
|
End Sub
|
||||||
Protected Overrides Sub OnStop()
|
Protected Overrides Sub OnStop()
|
||||||
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
|
' Hier Code zum Ausführen erforderlicher Löschvorgänge zum Beenden des Dienstes einfügen.
|
||||||
Logger.Info("## Service has been stopped manually. ##")
|
Logger.Info("## Service stopped manually. ##")
|
||||||
Try
|
Try
|
||||||
If UsedTempFile = True Then
|
If UsedTempFile = True Then
|
||||||
Try
|
Try
|
||||||
@ -297,30 +302,30 @@ Public Class MyService
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Logger.Info($"#### Trying to Create_EB_Report (EB-Protokoll) for DocID: {pDocID} - GENID: {GENID}... ####")
|
Logger.Info($"#### Starting Create_EB_Report (EB-Protokoll) for DocID: {pDocID} - GENID: {GENID}... ####")
|
||||||
Dim errortext As String
|
Dim errortext As String
|
||||||
Dim oStep As String
|
Dim oStep As String
|
||||||
Try
|
Try
|
||||||
Dim oReport As New XtraReportSR()
|
Dim oReport As New RptErgebnisbericht()
|
||||||
Dim oDatasource As SqlDataSource = oReport.DataSource
|
Dim oDatasource As SqlDataSource = oReport.DataSource
|
||||||
'Parameter für 1.Query
|
'Parameter für 1.Query
|
||||||
Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0)
|
Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0)
|
||||||
'-------
|
'-------
|
||||||
If oSelectQuery.Parameters.Count = 1 Then
|
If oSelectQuery.Parameters.Count = 1 Then
|
||||||
Logger.Debug($"Exactly [{oSelectQuery.Parameters.Count}] Parameter in Query 1!")
|
Logger.Debug($"DocID: {pDocID} - Exactly [{oSelectQuery.Parameters.Count}] Parameter in Query 1!")
|
||||||
Else
|
Else
|
||||||
Delete_EB2bCreated(pDocID)
|
Delete_EB2bCreated(pDocID)
|
||||||
Logger.Warn($"There is no parameter in Query 1 - Check the parameters for Query1")
|
Logger.Warn($"DocID: {pDocID} - There is no parameter in Query 1 - Check the parameters for Query1")
|
||||||
DocID = 0
|
DocID = 0
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
'-------
|
'-------
|
||||||
Logger.Debug($"Now passing the value [{pDocID}] to parameter 0 of Query 1...")
|
Logger.Debug($"DocID: {pDocID} - Now passing the value [{pDocID}] to parameter 0 of Query 1...")
|
||||||
oStep = $"Now passing the value [{pDocID}] to parameter 0 of Query 1..."
|
oStep = $"DocID: {pDocID} - Now passing the value [{pDocID}] to parameter 0 of Query 1..."
|
||||||
Dim oParameter As QueryParameter = oSelectQuery.Parameters(0)
|
Dim oParameter As QueryParameter = oSelectQuery.Parameters(0)
|
||||||
oParameter.Value = pDocID
|
oParameter.Value = pDocID
|
||||||
'---------
|
'---------
|
||||||
Logger.Debug($"Parameter passed successfully!")
|
Logger.Debug($"DocID: {pDocID} - Parameter passed successfully!")
|
||||||
oStep = $"Parameter passed successfully!"
|
oStep = $"Parameter passed successfully!"
|
||||||
'---------
|
'---------
|
||||||
'Parameter für 2.Query
|
'Parameter für 2.Query
|
||||||
@ -344,12 +349,12 @@ Public Class MyService
|
|||||||
'----------
|
'----------
|
||||||
oReport.ReportPrintOptions.PrintOnEmptyDataSource = False
|
oReport.ReportPrintOptions.PrintOnEmptyDataSource = False
|
||||||
|
|
||||||
oStep = $"Trying to create the report-document.."
|
oStep = $"DocID: {pDocID} - Trying to create the report-document.."
|
||||||
oReport.CreateDocument(False)
|
oReport.CreateDocument(False)
|
||||||
Dim filePath As String = $"C:\Temp\{DocID}.prnx"
|
Dim filePath As String = $"C:\Temp\{DocID}.prnx"
|
||||||
|
|
||||||
|
|
||||||
Logger.Debug($"oReport successfully created!")
|
Logger.Debug($"DocID: {pDocID} - oReport successfully created!")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Delete_EB2bCreated(pDocID)
|
Delete_EB2bCreated(pDocID)
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
@ -424,7 +429,7 @@ Public Class MyService
|
|||||||
MyDatabase.ExecuteNonQuery(oInsert)
|
MyDatabase.ExecuteNonQuery(oInsert)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Logger.Info($"#### Created Ergebnisbericht for DocID: {pDocID} - GENID: {GENID}! #####")
|
Logger.Info($"#### DocID: {pDocID} - Created Ergebnisbericht - GENID: {GENID}! #####")
|
||||||
If UsedTempFile = True Then
|
If UsedTempFile = True Then
|
||||||
Try
|
Try
|
||||||
File.Delete(TempFile)
|
File.Delete(TempFile)
|
||||||
@ -435,16 +440,16 @@ Public Class MyService
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Logger.Info("ERROR: oFilewithStamp = False or """)
|
Logger.Info($"DocID: {pDocID} - ERROR: oFilewithStamp = False or """)
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Logger.Warn("Create_MyStempel = False")
|
Logger.Warn($"DocID: {pDocID} - Create_MyStempel = False")
|
||||||
Delete_EB2bCreated(pDocID)
|
Delete_EB2bCreated(pDocID)
|
||||||
DocID = 0
|
DocID = 0
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Logger.Warn("OriginFile is nothing!!")
|
Logger.Warn($"DocID: {pDocID} - OriginFile is nothing!!")
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
Logger.Warn($"Error in Create_EB_Report for DocID: {pDocID} - GENID: {GENID} - ERROR: EB_Reportfile {oMyErgebnisbericht} is not existing!!")
|
Logger.Warn($"Error in Create_EB_Report for DocID: {pDocID} - GENID: {GENID} - ERROR: EB_Reportfile {oMyErgebnisbericht} is not existing!!")
|
||||||
@ -468,7 +473,8 @@ Public Class MyService
|
|||||||
|
|
||||||
Dim errortext As String
|
Dim errortext As String
|
||||||
Try
|
Try
|
||||||
|
Logger.Info($"### DocID: {pDocID} - Create_MyStempel starting - GENID {GENID} ###")
|
||||||
|
Logger.Debug($"### DocID: {pDocID} - Create_MyStempel starting - GENID {GENID} ###")
|
||||||
Dim oRptStampFirstPage As New RptStampIcon()
|
Dim oRptStampFirstPage As New RptStampIcon()
|
||||||
Dim oDatasource As SqlDataSource = oRptStampFirstPage.DataSource
|
Dim oDatasource As SqlDataSource = oRptStampFirstPage.DataSource
|
||||||
Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0)
|
Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0)
|
||||||
@ -505,7 +511,7 @@ Public Class MyService
|
|||||||
MyStempel1 = oTempStempel
|
MyStempel1 = oTempStempel
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Logger.Info($"...Stampreport created for DocID: {pDocID} - GENID {GENID}!")
|
Logger.Info($"DocID: {pDocID} - Stampreport created - GENID {GENID}!")
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
If GENID = "02" Then
|
If GENID = "02" Then
|
||||||
@ -525,7 +531,9 @@ Public Class MyService
|
|||||||
End Function
|
End Function
|
||||||
Private Function CreateStampedPDF(oOriginFile As String, pDocID As Integer, GENID As String)
|
Private Function CreateStampedPDF(oOriginFile As String, pDocID As Integer, GENID As String)
|
||||||
Try
|
Try
|
||||||
Logger.Info($"Trying to CreateStampedPDF for DocID: {pDocID} - GENID {GENID}...")
|
|
||||||
|
Logger.Info($"### DocID: {pDocID} - CreateStampedPDF starting - GENID {GENID} ###")
|
||||||
|
Logger.Debug($"### DocID: {pDocID} - CreateStampedPDF starting - GENID {GENID} ###")
|
||||||
Dim MyLocalStempel As String
|
Dim MyLocalStempel As String
|
||||||
If GENID = "01" Then
|
If GENID = "01" Then
|
||||||
MyLocalStempel = MyStempel1
|
MyLocalStempel = MyStempel1
|
||||||
@ -542,17 +550,17 @@ Public Class MyService
|
|||||||
Dim oGdPictureImaging As New GdPictureImaging()
|
Dim oGdPictureImaging As New GdPictureImaging()
|
||||||
'Creating a new empty PDF document.
|
'Creating a new empty PDF document.
|
||||||
If oGdPicturePDF.LoadFromFile(oOriginFile, False) = GdPictureStatus.OK Then
|
If oGdPicturePDF.LoadFromFile(oOriginFile, False) = GdPictureStatus.OK Then
|
||||||
Logger.Debug($"{pDocID}..oGdPicturePDF Created")
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ..oGdPicturePDF Created")
|
||||||
Dim oYDistance = oGdPicturePDF.GetPageHeight
|
Dim oYDistance = oGdPicturePDF.GetPageHeight
|
||||||
'Just to remind you that units are set to points and the origin is set to bottom left by default.
|
'Just to remind you that units are set to points and the origin is set to bottom left by default.
|
||||||
'Loading an image from a file.
|
'Loading an image from a file.
|
||||||
Dim imageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile(MyLocalStempel)
|
Dim imageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile(MyLocalStempel)
|
||||||
|
|
||||||
If oGdPictureImaging.GetStat() = GdPictureStatus.OK Then
|
If oGdPictureImaging.GetStat() = GdPictureStatus.OK Then
|
||||||
Logger.Debug($"{pDocID}..GdPictureImaging.GetStat")
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ..GdPictureImaging.GetStat")
|
||||||
'Adding an image as a resource into the PDF document - we decided not to draw the image in this moment.
|
'Adding an image as a resource into the PDF document - we decided not to draw the image in this moment.
|
||||||
Dim imageResName As String = oGdPicturePDF.AddImageFromGdPictureImage(imageID, False, False)
|
Dim imageResName As String = oGdPicturePDF.AddImageFromGdPictureImage(imageID, False, False)
|
||||||
Logger.Debug($"{pDocID}..oGdPicturePDF.AddImageFromGdPictureImage")
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ..oGdPicturePDF.AddImageFromGdPictureImage")
|
||||||
|
|
||||||
Dim oStempelHEight = oGdPictureImaging.GetHeight(imageID) / 5
|
Dim oStempelHEight = oGdPictureImaging.GetHeight(imageID) / 5
|
||||||
oYDistance = (oYDistance - oStempelHEight) - 10
|
oYDistance = (oYDistance - oStempelHEight) - 10
|
||||||
@ -564,19 +572,19 @@ Public Class MyService
|
|||||||
'MessageBox.Show("The example has NOT been followed successfully. Error: " + oGdPicturePDF.GetStat().ToString(), "Adding an image Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
'MessageBox.Show("The example has NOT been followed successfully. Error: " + oGdPicturePDF.GetStat().ToString(), "Adding an image Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||||
Return ""
|
Return ""
|
||||||
End If
|
End If
|
||||||
Logger.Debug($"{pDocID}..oGdPicturePDF.SaveToFile")
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ..oGdPicturePDF.SaveToFile")
|
||||||
'Releasing the image.
|
'Releasing the image.
|
||||||
oGdPictureImaging.ReleaseGdPictureImage(imageID)
|
oGdPictureImaging.ReleaseGdPictureImage(imageID)
|
||||||
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Logger.Warn($"The image [{MyLocalStempel}] can't be loaded. Error: " + oGdPictureImaging.GetStat().ToString())
|
Logger.Warn($"CreateStampedPDF - DocID: {pDocID} - The image [{MyLocalStempel}] can't be loaded. Error: " + oGdPictureImaging.GetStat().ToString())
|
||||||
Return ""
|
Return ""
|
||||||
'MessageBox.Show("The image can't be loaded. Error: " + oGdPictureImaging.GetStat().ToString(), "Adding an image Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
'MessageBox.Show("The image can't be loaded. Error: " + oGdPictureImaging.GetStat().ToString(), "Adding an image Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||||
End If
|
End If
|
||||||
oGdPicturePDF.CloseDocument()
|
oGdPicturePDF.CloseDocument()
|
||||||
Else
|
Else
|
||||||
Logger.Warn("The new PDF document can't be created. Error: " + oGdPicturePDF.GetStat().ToString())
|
Logger.Warn($"CreateStampedPDF - DocID: {pDocID} - The new PDF document can't be created. Error: {oGdPicturePDF.GetStat().ToString()}")
|
||||||
'MessageBox.Show("The new PDF document can't be created. Error: " + oGdPicturePDF.GetStat().ToString(), "Adding an image Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
'MessageBox.Show("The new PDF document can't be created. Error: " + oGdPicturePDF.GetStat().ToString(), "Adding an image Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||||
Return ""
|
Return ""
|
||||||
End If
|
End If
|
||||||
@ -587,13 +595,15 @@ Public Class MyService
|
|||||||
Dim sw As Stopwatch = New Stopwatch()
|
Dim sw As Stopwatch = New Stopwatch()
|
||||||
Dim oSuccess As Boolean = True
|
Dim oSuccess As Boolean = True
|
||||||
sw.Start()
|
sw.Start()
|
||||||
Logger.Debug("Waiting for file: " & oStampedOriginWithPicture)
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - Waiting for file: {oStampedOriginWithPicture}")
|
||||||
|
|
||||||
Do While File.Exists(oStampedOriginWithPicture) = False
|
Do While File.Exists(oStampedOriginWithPicture) = False
|
||||||
If sw.Elapsed.TotalSeconds = 30 Then
|
If sw.Elapsed.TotalSeconds = 30 Then
|
||||||
Logger.Info("ATTENTION: Still waiting (30 sec) for file: " & oStampedOriginWithPicture)
|
Logger.Info($"CreateStampedPDF - DocID: {pDocID} - ATTENTION: Still waiting (30 sec) for file: {oStampedOriginWithPicture}")
|
||||||
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ATTENTION: Still waiting (30 sec) for file: {oStampedOriginWithPicture}")
|
||||||
ElseIf sw.Elapsed.TotalMinutes = 1 Then
|
ElseIf sw.Elapsed.TotalMinutes = 1 Then
|
||||||
Logger.Info("ATTENTION: Still waiting (60 sec) for file: " & oStampedOriginWithPicture)
|
Logger.Info($"CreateStampedPDF - DocID: {pDocID} - ATTENTION: Still waiting (60 sec) for file: {oStampedOriginWithPicture}")
|
||||||
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ATTENTION: Still waiting (60 sec) for file: {oStampedOriginWithPicture}")
|
||||||
oSuccess = False
|
oSuccess = False
|
||||||
Exit Do
|
Exit Do
|
||||||
End If
|
End If
|
||||||
@ -602,9 +612,9 @@ Public Class MyService
|
|||||||
sw.Stop()
|
sw.Stop()
|
||||||
Try
|
Try
|
||||||
File.Delete(MyLocalStempel)
|
File.Delete(MyLocalStempel)
|
||||||
Logger.Debug($"Deleted StempelFile [{MyLocalStempel}]!")
|
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - Deleted StempelFile [{MyLocalStempel}]!")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Warn($"Could not delete reportfile {MyLocalStempel} after creating concatted file: {ex.Message}")
|
Logger.Warn($"CreateStampedPDF - DocID: {pDocID} - Could not delete reportfile {MyLocalStempel} after creating concatted file: {ex.Message}")
|
||||||
End Try
|
End Try
|
||||||
If oSuccess = True Then
|
If oSuccess = True Then
|
||||||
Return oStampedOriginWithPicture
|
Return oStampedOriginWithPicture
|
||||||
@ -618,10 +628,11 @@ Public Class MyService
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
Private Function Concat_Files(DocID As String, oOriginFile As String, GENID As String, Outputfilename As String, pOutputFolder As String, pFilewithStamp As String, MyFreigabebericht As String)
|
Private Function Concat_Files(pDocID As String, oOriginFile As String, GENID As String, Outputfilename As String, pOutputFolder As String, pFilewithStamp As String, MyFreigabebericht As String)
|
||||||
Dim oConcatSuccessfull As Boolean = True
|
Dim oConcatSuccessfull As Boolean = True
|
||||||
Dim MyFile2Concat As String
|
Dim MyFile2Concat As String
|
||||||
Try
|
Try
|
||||||
|
Logger.Debug($"######### Function Concat_Files - DocID {pDocID} #############")
|
||||||
If Outputfilename = "STANDARD" Then
|
If Outputfilename = "STANDARD" Then
|
||||||
Outputfilename = Path.GetFileNameWithoutExtension(oOriginFile) & My.Settings.Concatted_File_Suffix + ".pdf"
|
Outputfilename = Path.GetFileNameWithoutExtension(oOriginFile) & My.Settings.Concatted_File_Suffix + ".pdf"
|
||||||
End If
|
End If
|
||||||
@ -634,7 +645,7 @@ Public Class MyService
|
|||||||
Try
|
Try
|
||||||
File.Delete(MyFile2Concat)
|
File.Delete(MyFile2Concat)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Warn($"Could not delete ConcattedFile {MyFile2Concat}: {ex.Message}")
|
Logger.Warn($"Concat_Files - DocID {pDocID} - Could not delete ConcattedFile {MyFile2Concat}: {ex.Message}")
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
@ -648,7 +659,7 @@ Public Class MyService
|
|||||||
Dim _argument As String = $"""{pFilewithStamp}"" ""{MyFreigabebericht}"" cat output ""{MyFile2Concat}"""
|
Dim _argument As String = $"""{pFilewithStamp}"" ""{MyFreigabebericht}"" cat output ""{MyFile2Concat}"""
|
||||||
|
|
||||||
oPDFTKProcess.StartInfo.Arguments = _argument
|
oPDFTKProcess.StartInfo.Arguments = _argument
|
||||||
Logger.Debug("Arguments: " & _argument)
|
Logger.Debug($"Concat_Files - DocID {pDocID} - Arguments: [{_argument}]")
|
||||||
oPDFTKProcess.Start()
|
oPDFTKProcess.Start()
|
||||||
ProcID = oPDFTKProcess.Id
|
ProcID = oPDFTKProcess.Id
|
||||||
|
|
||||||
@ -671,13 +682,13 @@ Public Class MyService
|
|||||||
'Logger.Debug("...process has exited: ")
|
'Logger.Debug("...process has exited: ")
|
||||||
'sw.Stop()
|
'sw.Stop()
|
||||||
Thread.Sleep(500)
|
Thread.Sleep(500)
|
||||||
Logger.Debug("Now waiting for final concatted file [" & MyFile2Concat & "] ...")
|
Logger.Debug($"Concat_Files - DocID {pDocID} - Now waiting for final concatted file [{MyFile2Concat}] ...")
|
||||||
sw.Start()
|
sw.Start()
|
||||||
Do While File.Exists(MyFile2Concat) = False
|
Do While File.Exists(MyFile2Concat) = False
|
||||||
If sw.Elapsed.TotalSeconds = 30 Then
|
If sw.Elapsed.TotalSeconds = 30 Then
|
||||||
Logger.Info("ATTENTION: Still waiting (30 sec) for file: " & MyFile2Concat)
|
Logger.Info($"Concat_Files - DocID {pDocID} - ATTENTION: Still waiting (30 sec) for file: {MyFile2Concat}")
|
||||||
ElseIf sw.Elapsed.TotalMinutes = 1 Then
|
ElseIf sw.Elapsed.TotalMinutes = 1 Then
|
||||||
Logger.Info("ATTENTION: waiting (60 sec) for file: " & MyFile2Concat)
|
Logger.Info($"Concat_Files - DocID {pDocID} - ATTENTION: waiting (60 sec) for file: {MyFile2Concat}")
|
||||||
oConcatSuccessfull = False
|
oConcatSuccessfull = False
|
||||||
Exit Do
|
Exit Do
|
||||||
End If
|
End If
|
||||||
@ -687,11 +698,11 @@ Public Class MyService
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
File.Delete(pFilewithStamp)
|
File.Delete(pFilewithStamp)
|
||||||
Logger.Debug($"Deleted file [{pFilewithStamp}]!")
|
Logger.Debug($"Concat_Files - DocID {pDocID} - Deleted file [{pFilewithStamp}]!")
|
||||||
File.Delete(MyFreigabebericht)
|
File.Delete(MyFreigabebericht)
|
||||||
Logger.Debug($"Deleted file [{MyFreigabebericht}]!")
|
Logger.Debug($"Concat_Files - DocID {pDocID} - Deleted file [{MyFreigabebericht}]!")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Warn($"Could not delete reportfile after creating concatted file: {ex.Message}")
|
Logger.Warn($"Concat_Files - DocID {pDocID} - Could not delete reportfile after creating concatted file: {ex.Message}")
|
||||||
End Try
|
End Try
|
||||||
Return oConcatSuccessfull
|
Return oConcatSuccessfull
|
||||||
|
|
||||||
@ -702,11 +713,13 @@ Public Class MyService
|
|||||||
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Logger.Warn("pdftk is not existing")
|
Logger.Warn($"Concat_Files - DocID {pDocID} - pdftk is not existing")
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
Logger.Warn($"Concat_Files - DocID {pDocID} - Unexpected Error: {ex.Message}")
|
||||||
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
Sub Delete_EB2bCreated(pDocID As Long)
|
Sub Delete_EB2bCreated(pDocID As Long)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user