MS GerneratorID

This commit is contained in:
SchreiberM 2020-08-24 14:11:45 +02:00
parent f803b39d0c
commit c075475cdc
7 changed files with 73 additions and 69 deletions

View File

@ -54,6 +54,9 @@
<setting name="YDistance" serializeAs="String">
<value>720</value>
</setting>
<setting name="GEN_ID" serializeAs="String">
<value>01</value>
</setting>
</WISAG_PM_REPORT.My.MySettings>
</applicationSettings>
</configuration>

View File

@ -31,6 +31,7 @@ Partial Class Form1
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
Me.ToolStripStatusLabel2 = New System.Windows.Forms.ToolStripStatusLabel()
Me.tsiGENKey = New System.Windows.Forms.ToolStripStatusLabel()
Me.TimerMinute = New System.Windows.Forms.Timer(Me.components)
Me.ToolStrip1 = New System.Windows.Forms.ToolStrip()
Me.ToolStripLabel1 = New System.Windows.Forms.ToolStripLabel()
@ -188,7 +189,7 @@ Partial Class Form1
'
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1, Me.ToolStripStatusLabel2})
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1, Me.ToolStripStatusLabel2, Me.tsiGENKey})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 779)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(1007, 22)
@ -207,6 +208,13 @@ Partial Class Form1
Me.ToolStripStatusLabel2.Size = New System.Drawing.Size(116, 17)
Me.ToolStripStatusLabel2.Text = "Timer: 3 min; 06-23h"
'
'tsiGENKey
'
Me.tsiGENKey.Image = CType(resources.GetObject("tsiGENKey.Image"), System.Drawing.Image)
Me.tsiGENKey.Name = "tsiGENKey"
Me.tsiGENKey.Size = New System.Drawing.Size(136, 17)
Me.tsiGENKey.Text = "ToolStripStatusLabel3"
'
'TimerMinute
'
Me.TimerMinute.Enabled = True
@ -229,6 +237,7 @@ Partial Class Form1
'
'txtDocID
'
Me.txtDocID.Font = New System.Drawing.Font("Segoe UI", 9.0!)
Me.txtDocID.Name = "txtDocID"
Me.txtDocID.Size = New System.Drawing.Size(100, 25)
'
@ -1391,4 +1400,5 @@ Partial Class Form1
Friend WithEvents VWCUST_STAMPTableAdapter As MyDatasetTableAdapters.VWCUST_STAMPTableAdapter
Friend WithEvents ToolStripButton6 As ToolStripButton
Friend WithEvents ToolStripStatusLabel2 As ToolStripStatusLabel
Friend WithEvents tsiGENKey As ToolStripStatusLabel
End Class

View File

@ -132,13 +132,21 @@
<metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>829, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsiGENKey.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
xAAADsQBlSsOGwAAAIhJREFUOE+lkUEOABEMRZ3NXuImjsxiZjb2th01JUgzNCQP+dWXQAHAEWwogQ0l
sKGEb/oZKSWb8RkgcG+xthTgwRgjOOdAa13APWZYawIys/TNvSTX/CCYD/UYY+C+nkLNsOdIEEIYBVXS
r8jWFejBWmNdM3uPWAUzlK+/8QQ2lMCGEthwH1AvkxW67ZxkSbQAAAAASUVORK5CYII=
</value>
</data>
<metadata name="TimerMinute.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>946, 17</value>
</metadata>
<metadata name="ToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1067, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="ToolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8

View File

@ -40,6 +40,7 @@ Public Class Form1
Next
Me.TimerMinute.Start()
txtDocID.Text = My.Settings.MyDocID
tsiGENKey.Text = "Generator-ID: " & My.Settings.GEN_ID
End Sub
Dim Run_Active As Boolean = False
Private Sub TimerMinute_Tick(sender As Object, e As EventArgs) Handles TimerMinute.Tick
@ -50,14 +51,25 @@ Public Class Form1
Try
Dim oDT As DataTable = MySQLSDB.GetDatatable(My.Settings.oSQLGetDocId)
If Not IsNothing(oDT) Then
Dim oDocID As Long
If oDT.Rows.Count > 0 Then
For Each oRow As DataRow In oDT.Rows
oDocID = oRow.Item(0).ToString
Dim oInsert = $"INSERT INTO TBCUST_PM_RPT_2BCREATED (DocID,GEN_ID) VALUES ({oDocID},'{My.Settings.GEN_ID}')"
MySQLSDB.ExecuteNonQuery(oInsert)
Next
Run_Active = True
For Each oRow As DataRow In oDT.Rows
Dim oSQL = $"select count(*) from VWCUST_RPTPM_INV_RPT_STAMP_CHECK WHERE docID = {oRow.Item(0).ToString}"
oDocID = oRow.Item(0).ToString
Dim oSQL = $"select count(*) from VWCUST_RPTPM_INV_RPT_STAMP_CHECK WHERE docID = {oDocID.ToString}"
If MySQLSDB.GetScalarValue(oSQL) >= 1 Then
Create_Report(oRow.Item(0).ToString, 0)
Create_Report(oDocID.ToString, 0)
Else
Logger.Info($"ATTENTION - No FinalFreigabe for DocID: {oRow.Item(0).ToString}")
Logger.Info($"ATTENTION - No FinalFreigabe for DocID: {oDocID.ToString}")
Dim oDELETE = $"DELETE FROM TBCUST_PM_RPT_2BCREATED WHERE DocID = {oDocID} AND GEN_ID = '{My.Settings.GEN_ID}'"
MySQLSDB.ExecuteNonQuery(oDELETE)
End If
Next
End If
@ -74,62 +86,17 @@ Public Class Form1
End Sub
Sub Create_Report(DocID As String, ReportOption As Integer)
Sub Create_Report(pDocID As String, ReportOption As Integer)
MyFreigabebericht = ""
MyStempel = ""
MyOriginStamped = ""
Logger.Info($"Trying to create report for DocID: {DocID}...")
Logger.Info($"Trying to create report for DocID: {pDocID}...")
Dim errortext As String
Try
If DEBUG = True Then
DocumentViewer1.DocumentSource = Nothing
End If
' Me.MyDataset.VWCUST_RPTPM_UNION.Clear()
' VWCUST_RPTPM_UNIONTableAdapter.Connection.ConnectionString = My.Settings.CONF_SQLSERVER
' Me.VWCUST_RPTPM_UNIONTableAdapter.Fill(Me.MyDataset.VWCUST_RPTPM_UNION, DocID)
' Logger.Debug($"---VWCUST_RPTPM_UNION.Rows.Count = [{MyDataset.VWCUST_RPTPM_UNION.Rows.Count}]!---")
' If Me.MyDataset.VWCUST_RPTPM_UNION.Rows.Count = 0 Then
' Logger.Debug($"no rows for UnionView VWCUST_RPTPM_UNION for DocID {DocID}")
' Logger.Debug("My.Settings.CONF_SQLSERVER: " & My.Settings.CONF_SQLSERVER)
' Dim oSQL = $"SELECT GroupTypeID, GroupType, DOC_ID, KreditorNummer, KreditorName_Lang, KreditorName, RechnungNr, Referenz, Nettobetrag, Bruttobetrag, Zahlungsziel, Mandant, [Mandant Name], Kostenstelle, [Erhalten wann], Belegdatum,
' FG_Email, FG_Freigabe, FG_Wann, WHO, [WHEN], DELEGATION
'FROM VWCUST_RPTPM_UNION
'WHERE (DOC_ID = {DocID}) AND (LEN(RechnungNr) > 0)"
' Dim oCHECKDT As DataTable = MySQLSDB.GetDatatable(oSQL)
' Dim oMsg
' If oCHECKDT.Rows.Count <> 0 Then
' Logger.Debug("Now trying to add rows from regular select row by row...")
' Try
' For Each oRow As DataRow In oCHECKDT.Rows
' MyDataset.VWCUST_RPTPM_UNION.ImportRow(oRow)
' Next
' MyDataset.VWCUST_RPTPM_UNION.AcceptChanges()
' Logger.Debug($"Added {MyDataset.VWCUST_RPTPM_UNION.Rows.Count} rows!!")
' Catch ex As Exception
' Logger.Debug($"Ups: Unexpected error in Adding rows row by row: {ex.Message}")
' Logger.Warn($"Unexpected error in Adding rows row by row: {ex.Message}")
' End Try
' If Me.MyDataset.VWCUST_RPTPM_UNION.Rows.Count <> 0 Then
' oMsg = $"...BUT REGULAR SELECT [{oSQL}] returned {oCHECKDT.Rows.Count} rows!!!!"
' Logger.Warn(oMsg)
' End If
' Else
' Logger.Warn($"no rows for UnionView VWCUST_RPTPM_UNION for DocID {DocID}")
' Logger.Debug("My.Settings.CONF_SQLSERVER: " & My.Settings.CONF_SQLSERVER)
' End If
' If DEBUG = True And Me.MyDataset.VWCUST_RPTPM_UNION.Rows.Count = 0 Then
' If oCHECKDT.Rows.Count <> 0 Then
' MsgBox($"No rows for UnionView VWCUST_RPTPM_UNION for DocID {DocID}! " & vbNewLine & oMsg)
' Else
' MsgBox($"No rows for UnionView VWCUST_RPTPM_UNION for DocID {DocID}")
' End If
' Exit Sub
' End If
'End If
Catch ex As Exception
If DEBUG = True Then
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in 1:")
@ -140,14 +107,14 @@ Public Class Form1
Try
Dim report As New XtraReport2()
report.ReportPrintOptions.PrintOnEmptyDataSource = False
report.FilterString = "DocID = " + DocID
report.FilterString = "DocID = " + pDocID
'report.ObjectDataSource1.Parameters(0).Value = Convert.ToInt64(TextBox1.Text)
report.CreateDocument(False)
If DEBUG = True Then
DocumentViewer1.DocumentSource = report
End If
Dim oMyErgebnisbericht As String = Path.Combine(My.Settings.CONCAT_TEMPFolder, DocID & "_ERPT.pdf")
Dim oMyErgebnisbericht As String = Path.Combine(My.Settings.CONCAT_TEMPFolder, pDocID & "_ERPT.pdf")
If File.Exists(oMyErgebnisbericht) Then
Try
File.Delete(oMyErgebnisbericht)
@ -166,7 +133,7 @@ Public Class Form1
End If
MyFreigabebericht = oMyErgebnisbericht
Dim oOriginFile As String
Dim osql = $"select dbo.FNDD_GET_WINDREAM_FILE_PATH ({DocID},1)"
Dim osql = $"select dbo.FNDD_GET_WINDREAM_FILE_PATH ({pDocID},1)"
oOriginFile = MySQLSDB.GetScalarValue(osql)
If File.Exists(oOriginFile) = False Then
Logger.Warn($"File {oOriginFile} is not existing. Check the pathconfiguration!")
@ -176,17 +143,17 @@ Public Class Form1
If Not IsNothing(oOriginFile) Then
If File.Exists(My.Settings.Path2PDFTK) Then
If Create_MyStempel(DEBUG, DocID) = True Then
If Create_MyStempel(DEBUG, pDocID) = True Then
'Jetzt Stempeln des OriginakBeleges mit dem Stamp-Report
Dim oStampedResult = CreateStampedPDF(oOriginFile, DocID)
Dim oStampedResult = CreateStampedPDF(oOriginFile, pDocID)
If oStampedResult <> "" Then
If Concat_Files(DocID, oOriginFile) = True Then
If Concat_Files(pDocID, oOriginFile) = True Then
If DEBUG Then
MsgBox($"The ResultReport has been created: {MyEndResult}", MsgBoxStyle.Information)
End If
If DEBUG = False Then
Dim oInsert = $"INSERT INTO TBCUST_PM_RPT_CREATED (DocID) VALUES ({Convert.ToInt64(DocID)})"
Dim oInsert = $"INSERT INTO TBCUST_PM_RPT_CREATED (DocID) VALUES ({Convert.ToInt64(pDocID)})"
MySQLSDB.ExecuteNonQuery(oInsert)
End If
Logger.Info($"Concatted file [{oStampedResult}] created!")
@ -208,6 +175,8 @@ Public Class Form1
End If
Catch ex As Exception
Dim oUpdate = $"DELETE FROM TBCUST_PM_RPT_2BCREATED WHERE DocID = {pDocID} AND GEN_ID = '{My.Settings.GEN_ID}'"
MySQLSDB.ExecuteNonQuery(oUpdate)
errortext = "ex.message: " & ex.Message & vbNewLine & "ex.StackTrace: " & ex.StackTrace.ToString & vbNewLine & "ex.InnerException: " & ex.InnerException.Message
If DEBUG = True Then
MsgBox(errortext, MsgBoxStyle.Critical, "Error in 2:")
@ -216,9 +185,9 @@ Public Class Form1
Logger.Error(ex)
End Try
End Sub
Private Function Create_MyStempel(istest As Boolean, DocID As String)
Private Function Create_MyStempel(istest As Boolean, pDocID As String)
MyStempel = ""
Logger.Info($"Trying to create Stampreport for DocID: {DocID}...")
Logger.Info($"Trying to create Stampreport for DocID: {pDocID}...")
Dim errortext As String
Try
If istest = True Then
@ -236,14 +205,14 @@ Public Class Form1
Try
Dim myReport As New RptStampIcon()
myReport.ReportPrintOptions.PrintOnEmptyDataSource = False
myReport.FilterString = "DocID = " + DocID
myReport.FilterString = "DocID = " + pDocID
'report.ObjectDataSource1.Parameters(0).Value = Convert.ToInt64(TextBox1.Text)
myReport.CreateDocument(False)
If istest = True Then
DocumentViewer1.DocumentSource = myReport
End If
Dim oTempStempel As String = Path.Combine(My.Settings.CONCAT_TEMPFolder, DocID & "_Stamp.jpg")
Dim oTempStempel As String = Path.Combine(My.Settings.CONCAT_TEMPFolder, pDocID & "_Stamp.jpg")
If File.Exists(oTempStempel) Then
Try
File.Delete(oTempStempel)
@ -264,9 +233,9 @@ Public Class Form1
If File.Exists(oTempStempel) Then
MyStempel = oTempStempel
Logger.Info($"Stampreport created for DocID: {DocID}!")
Logger.Info($"Stampreport created for DocID: {pDocID}!")
If istest = True Then
MsgBox($"Stampreport [{oTempStempel}] created for DocID [{DocID}]!", MsgBoxStyle.Information)
MsgBox($"Stampreport [{oTempStempel}] created for DocID [{pDocID}]!", MsgBoxStyle.Information)
End If
Return True
Else
@ -276,6 +245,8 @@ Public Class Form1
Catch ex As Exception
errortext = "ex.message: " & ex.Message & vbNewLine & "ex.StackTrace: " & ex.StackTrace.ToString & vbNewLine & "ex.InnerException: " & ex.InnerException.Message
Dim oUpdate = $"DELETE FROM TBCUST_PM_RPT_2BCREATED WHERE DocID = {pDocID} AND GEN_ID = '{My.Settings.GEN_ID}'"
MySQLSDB.ExecuteNonQuery(oUpdate)
If istest = True Then
MsgBox(errortext, MsgBoxStyle.Critical, "Error in Create_StampReport:")
Clipboard.SetText(errortext)
@ -284,9 +255,9 @@ Public Class Form1
Return False
End Try
End Function
Private Function CreateStampedPDF(oOriginFile As String, DocID As Integer)
Private Function CreateStampedPDF(oOriginFile As String, pDocID As Integer)
Try
Logger.Info($"Trying to create stamp on OriginWMFile for DocID: {DocID}...")
Logger.Info($"Trying to create stamp on OriginWMFile for DocID: {pDocID}...")
Logger.Debug($"Now in CreateStampedPDF")
Dim myProcess As New Process
Dim ProcID

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.0.0")>
<Assembly: AssemblyVersion("2.1.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

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", "15.7.0.0"), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
@ -164,6 +164,15 @@ Namespace My
Return CType(Me("YDistance"),Integer)
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("01")> _
Public ReadOnly Property GEN_ID() As String
Get
Return CType(Me("GEN_ID"),String)
End Get
End Property
End Class
End Namespace

View File

@ -40,5 +40,8 @@
<Setting Name="YDistance" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">720</Value>
</Setting>
<Setting Name="GEN_ID" Type="System.String" Scope="Application">
<Value Profile="(Default)">01</Value>
</Setting>
</Settings>
</SettingsFile>