Compare commits

3 Commits

Author SHA1 Message Date
418df6f817 MS Log erweitert 2023-04-27 13:16:14 +02:00
22bdb96d42 MS rename GIT 2023-01-12 15:27:39 +01:00
1647171569 MS Parameter 2023-01-12 15:24:06 +01:00
13 changed files with 138 additions and 120 deletions

View File

@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="EB_Creator.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="EB_Creator.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<connectionStrings>
<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>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
<applicationSettings>
<EB_Creator.My.MySettings>
@@ -42,7 +41,7 @@
<value>1</value>
</setting>
<setting name="oSQLThread2" serializeAs="String">
<value />
<value/>
</setting>
<setting name="PROC_BEFORE_POS" serializeAs="String">
<value>False</value>
@@ -52,4 +51,4 @@
</setting>
</EB_Creator.My.MySettings>
</applicationSettings>
</configuration>
</configuration>

View File

@@ -11,9 +11,10 @@
<AssemblyName>EB_Creator</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Console</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -117,6 +118,7 @@
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="MyService.vb">
<SubType>Component</SubType>

View File

@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="EB_Creator.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="EB_Creator.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<connectionStrings>
<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>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<applicationSettings>
<EB_Creator.My.MySettings>
@@ -46,4 +45,4 @@
</setting>
</EB_Creator.My.MySettings>
</applicationSettings>
</configuration>
</configuration>

View File

@@ -11,9 +11,10 @@
<AssemblyName>EB_Creator</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Console</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -108,6 +109,7 @@
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="MyService.vb">
<SubType>Component</SubType>

View File

@@ -1,10 +1,10 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------

View File

@@ -1,40 +1,41 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
@@ -44,17 +45,17 @@ Namespace My.Resources
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
Set
resourceCulture = value
End Set
End Property

View File

@@ -15,7 +15,7 @@ Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0"), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase

View File

@@ -0,0 +1 @@
DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -1,10 +1,10 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.3.0.0")>
<Assembly: AssemblyFileVersion("1.3.0.0")>
<Assembly: AssemblyVersion("2.0.0.0")>
<Assembly: AssemblyFileVersion("2.0.0.0")>

View File

@@ -1,40 +1,41 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
@@ -44,17 +45,17 @@ Namespace My.Resources
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
Set
resourceCulture = value
End Set
End Property

View File

@@ -7,6 +7,8 @@ Imports GdPicture14
Imports System.Drawing
Imports DigitalData.Modules.Windream
Imports System.Threading
Imports DevExpress.XtraRichEdit
Imports DevExpress.Pdf.Native
Public Class MyService
#Region "+++++ variables +++++"
@@ -113,14 +115,14 @@ Public Class MyService
If Not _threadRunner1.IsBusy Then
_threadRunner1.RunWorkerAsync()
Else
Logger.Info("##### THREAD 1 Is STILL RUNNING #####")
Logger.Info("##### Thread 1 IsBusy #####")
End If
End Sub
Public Sub Thread_Run2()
If Not _threadRunner2.IsBusy Then
_threadRunner2.RunWorkerAsync()
Else
Logger.Info("##### THREAD 2 Is STILL RUNNING #####")
Logger.Info("##### Thread 2 IsBusy #####")
End If
End Sub
Public Sub RUN_THREAD1(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
@@ -128,7 +130,7 @@ Public Class MyService
If My.Computer.Clock.LocalTime.Hour <> 4 And My.Computer.Clock.LocalTime.Hour <> 5 Then
Generator_Run("01", My.Settings.oSQLThread1)
Else
Logger.Debug($"In Sleep Mode 04-05h: {Now.ToString}")
Logger.Debug($"In Sleep Mode 04-05h: {Now.ToString}")
End If
Catch ex As Exception
Logger.Error(ex)
@@ -147,6 +149,7 @@ Public Class MyService
Logger.Info($"##### THREAD for Generator {GeneratorID} has [{oDTEB_Workload.Rows.Count}] results 2Bworked #####")
For Each oRow As DataRow In oDTEB_Workload.Rows
oDocID = oRow.Item(0).ToString
Logger.Debug($"WORKING ON DOCID - {oDocID.ToString}")
Try
oOutputfilename = oRow.Item("Outputfilename").ToString
Catch ex As Exception
@@ -195,7 +198,7 @@ Public Class MyService
Dim oError = False
If My.Settings.PROC_BEFORE_POS = True Then
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
Delete_EB2bCreated(oDocID)
oError = True
@@ -206,11 +209,13 @@ Public Class MyService
Dim oDTEB = MyDatabase.GetDatatable(oSQL)
If oDTEB.Rows.Count > 0 Then
Create_EB_Report(oDocID.ToString, GeneratorID, oOutputfilename, OutputFolder, oReRun)
Else
Logger.Warn($"No EB-Rows [{oSQL}]")
Logger.Warn($"DocID - {oDocID.ToString} - No EB-Rows [{oSQL}]")
Delete_EB2bCreated(oDocID)
End If
End If
Logger.Debug($"")
Next
End If
End If
@@ -235,7 +240,7 @@ Public Class MyService
End Sub
Protected Overrides Sub OnStop()
' 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
If UsedTempFile = True Then
Try
@@ -297,30 +302,30 @@ Public Class MyService
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 oStep As String
Try
Dim oReport As New XtraReportSR()
Dim oReport As New RptErgebnisbericht()
Dim oDatasource As SqlDataSource = oReport.DataSource
'Parameter für 1.Query
Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0)
'-------
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
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
Exit Sub
End If
'-------
Logger.Debug($"Now passing the value [{pDocID}] to parameter 0 of Query 1...")
oStep = $"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 = $"DocID: {pDocID} - Now passing the value [{pDocID}] to parameter 0 of Query 1..."
Dim oParameter As QueryParameter = oSelectQuery.Parameters(0)
oParameter.Value = pDocID
'---------
Logger.Debug($"Parameter passed successfully!")
Logger.Debug($"DocID: {pDocID} - Parameter passed successfully!")
oStep = $"Parameter passed successfully!"
'---------
'Parameter für 2.Query
@@ -344,12 +349,12 @@ Public Class MyService
'----------
oReport.ReportPrintOptions.PrintOnEmptyDataSource = False
oStep = $"Trying to create the report-document.."
oStep = $"DocID: {pDocID} - Trying to create the report-document.."
oReport.CreateDocument(False)
Dim filePath As String = $"C:\Temp\{DocID}.prnx"
Logger.Debug($"oReport successfully created!")
Logger.Debug($"DocID: {pDocID} - oReport successfully created!")
Catch ex As Exception
Delete_EB2bCreated(pDocID)
Logger.Error(ex)
@@ -424,7 +429,7 @@ Public Class MyService
MyDatabase.ExecuteNonQuery(oInsert)
End If
Logger.Info($"#### Created Ergebnisbericht for DocID: {pDocID} - GENID: {GENID}! #####")
Logger.Info($"#### DocID: {pDocID} - Created Ergebnisbericht - GENID: {GENID}! #####")
If UsedTempFile = True Then
Try
File.Delete(TempFile)
@@ -435,16 +440,16 @@ Public Class MyService
End If
End If
Else
Logger.Info("ERROR: oFilewithStamp = False or """)
Logger.Info($"DocID: {pDocID} - ERROR: oFilewithStamp = False or """)
End If
Else
Logger.Warn("Create_MyStempel = False")
Logger.Warn($"DocID: {pDocID} - Create_MyStempel = False")
Delete_EB2bCreated(pDocID)
DocID = 0
End If
End If
Else
Logger.Warn("OriginFile is nothing!!")
Logger.Warn($"DocID: {pDocID} - OriginFile is nothing!!")
End If
Else
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
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 oDatasource As SqlDataSource = oRptStampFirstPage.DataSource
Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0)
@@ -505,7 +511,7 @@ Public Class MyService
MyStempel1 = oTempStempel
End If
Logger.Info($"...Stampreport created for DocID: {pDocID} - GENID {GENID}!")
Logger.Info($"DocID: {pDocID} - Stampreport created - GENID {GENID}!")
Return True
Else
If GENID = "02" Then
@@ -525,7 +531,9 @@ Public Class MyService
End Function
Private Function CreateStampedPDF(oOriginFile As String, pDocID As Integer, GENID As String)
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
If GENID = "01" Then
MyLocalStempel = MyStempel1
@@ -542,17 +550,17 @@ Public Class MyService
Dim oGdPictureImaging As New GdPictureImaging()
'Creating a new empty PDF document.
If oGdPicturePDF.LoadFromFile(oOriginFile, False) = GdPictureStatus.OK Then
Logger.Debug($"{pDocID}..oGdPicturePDF Created")
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ..oGdPicturePDF Created")
Dim oYDistance = oGdPicturePDF.GetPageHeight
'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.
Dim imageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile(MyLocalStempel)
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.
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
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)
Return ""
End If
Logger.Debug($"{pDocID}..oGdPicturePDF.SaveToFile")
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - ..oGdPicturePDF.SaveToFile")
'Releasing the image.
oGdPictureImaging.ReleaseGdPictureImage(imageID)
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 ""
'MessageBox.Show("The image can't be loaded. Error: " + oGdPictureImaging.GetStat().ToString(), "Adding an image Example", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
oGdPicturePDF.CloseDocument()
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)
Return ""
End If
@@ -587,13 +595,15 @@ Public Class MyService
Dim sw As Stopwatch = New Stopwatch()
Dim oSuccess As Boolean = True
sw.Start()
Logger.Debug("Waiting for file: " & oStampedOriginWithPicture)
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - Waiting for file: {oStampedOriginWithPicture}")
Do While File.Exists(oStampedOriginWithPicture) = False
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
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
Exit Do
End If
@@ -602,9 +612,9 @@ Public Class MyService
sw.Stop()
Try
File.Delete(MyLocalStempel)
Logger.Debug($"Deleted StempelFile [{MyLocalStempel}]!")
Logger.Debug($"CreateStampedPDF - DocID: {pDocID} - Deleted StempelFile [{MyLocalStempel}]!")
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
If oSuccess = True Then
Return oStampedOriginWithPicture
@@ -618,10 +628,11 @@ Public Class MyService
End Try
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 MyFile2Concat As String
Try
Logger.Debug($"######### Function Concat_Files - DocID {pDocID} #############")
If Outputfilename = "STANDARD" Then
Outputfilename = Path.GetFileNameWithoutExtension(oOriginFile) & My.Settings.Concatted_File_Suffix + ".pdf"
End If
@@ -634,7 +645,7 @@ Public Class MyService
Try
File.Delete(MyFile2Concat)
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
End Try
@@ -648,7 +659,7 @@ Public Class MyService
Dim _argument As String = $"""{pFilewithStamp}"" ""{MyFreigabebericht}"" cat output ""{MyFile2Concat}"""
oPDFTKProcess.StartInfo.Arguments = _argument
Logger.Debug("Arguments: " & _argument)
Logger.Debug($"Concat_Files - DocID {pDocID} - Arguments: [{_argument}]")
oPDFTKProcess.Start()
ProcID = oPDFTKProcess.Id
@@ -671,13 +682,13 @@ Public Class MyService
'Logger.Debug("...process has exited: ")
'sw.Stop()
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()
Do While File.Exists(MyFile2Concat) = False
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
Logger.Info("ATTENTION: waiting (60 sec) for file: " & MyFile2Concat)
Logger.Info($"Concat_Files - DocID {pDocID} - ATTENTION: waiting (60 sec) for file: {MyFile2Concat}")
oConcatSuccessfull = False
Exit Do
End If
@@ -687,11 +698,11 @@ Public Class MyService
Try
File.Delete(pFilewithStamp)
Logger.Debug($"Deleted file [{pFilewithStamp}]!")
Logger.Debug($"Concat_Files - DocID {pDocID} - Deleted file [{pFilewithStamp}]!")
File.Delete(MyFreigabebericht)
Logger.Debug($"Deleted file [{MyFreigabebericht}]!")
Logger.Debug($"Concat_Files - DocID {pDocID} - Deleted file [{MyFreigabebericht}]!")
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
Return oConcatSuccessfull
@@ -702,11 +713,13 @@ Public Class MyService
Else
Logger.Warn("pdftk is not existing")
Logger.Warn($"Concat_Files - DocID {pDocID} - pdftk is not existing")
Return False
End If
Catch ex As Exception
Logger.Error(ex)
Logger.Warn($"Concat_Files - DocID {pDocID} - Unexpected Error: {ex.Message}")
Return False
End Try
End Function
Sub Delete_EB2bCreated(pDocID As Long)