zugferd test

This commit is contained in:
Jonathan Jenne 2023-09-18 09:56:39 +02:00
parent 3c0f160f6e
commit 3fcb0324c8
3 changed files with 47 additions and 78 deletions

View File

@ -29,7 +29,6 @@ Partial Class Form1
Me.Button3 = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
Me.txtMD5Checksum = New System.Windows.Forms.TextBox()
Me.Button5 = New System.Windows.Forms.Button()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.Button7 = New System.Windows.Forms.Button()
@ -37,6 +36,7 @@ Partial Class Form1
Me.txtPropName = New System.Windows.Forms.TextBox()
Me.GroupBox4 = New System.Windows.Forms.GroupBox()
Me.Button6 = New System.Windows.Forms.Button()
Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog()
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.GroupBox3.SuspendLayout()
@ -100,19 +100,9 @@ Partial Class Form1
Me.txtMD5Checksum.TabIndex = 5
Me.txtMD5Checksum.Text = Global.ZUGFeRDTest.My.MySettings.Default.MD5Cheksum
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(6, 48)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(221, 23)
Me.Button5.TabIndex = 6
Me.Button5.Text = "Open Input Folder"
Me.Button5.UseVisualStyleBackColor = True
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Button1)
Me.GroupBox1.Controls.Add(Me.Button5)
Me.GroupBox1.Location = New System.Drawing.Point(12, 12)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(360, 92)
@ -208,7 +198,6 @@ Partial Class Form1
Friend WithEvents Button3 As Button
Friend WithEvents Button4 As Button
Friend WithEvents txtMD5Checksum As TextBox
Friend WithEvents Button5 As Button
Friend WithEvents GroupBox1 As GroupBox
Friend WithEvents GroupBox2 As GroupBox
Friend WithEvents GroupBox3 As GroupBox
@ -216,4 +205,5 @@ Partial Class Form1
Friend WithEvents GroupBox4 As GroupBox
Friend WithEvents Button6 As Button
Friend WithEvents Button7 As Button
Friend WithEvents FolderBrowserDialog1 As FolderBrowserDialog
End Class

View File

@ -120,4 +120,7 @@
<metadata name="OpenFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="FolderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>159, 17</value>
</metadata>
</root>

View File

@ -12,6 +12,7 @@ Imports DigitalData.Modules.Logging
Public Class Form1
Private _logConfig As LogConfig
Private _logger As Logger
Private _firebird As Firebird
Private _mssql As MSSQLServer
Private _zugferd As ZUGFeRDInterface
@ -23,82 +24,61 @@ Public Class Form1
_logConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath & "\Log", Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName) With {
.Debug = True
}
_logger = _logConfig.GetLogger()
_mssql = New MSSQLServer(_logConfig, My.Settings.MSSQL_CONNECTIONSTRING)
_zugferd = New ZUGFeRDInterface(_logConfig, "21182889975216572111813147150675976632")
End Sub
Private Function LoadFolderConfig(args As WorkerArgs)
Dim oSQL As String = "SELECT T1.FOLDER_TYPE, T.FOLDER_PATH FROM TBEDM_FOLDER T, TBEDM_FOLDER_TYPE T1 WHERE T.FOLDER_TYPE_ID = T1.GUID AND T1.""ACTIVE"" = True AND T.""ACTIVE"" = True"
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
For Each row As DataRow In oResult.Rows
Dim oFolderType = row.Item("FOLDER_TYPE")
Select Case oFolderType
Case ZUGFERD_IN
args.WatchDirectory = row.Item("FOLDER_PATH")
Case ZUGFERD_SUCCESS
args.SuccessDirectory = row.Item("FOLDER_PATH")
Case ZUGFERD_ERROR
args.ErrorDirectory = row.Item("FOLDER_PATH")
Case ZUGFERD_EML
args.OriginalEmailDirectory = row.Item("FOLDER_PATH")
Case ZUGFERD_REJECTED_EML
args.RejectedEmailDirectory = row.Item("FOLDER_PATH")
Case ZUGFERD_ATTACHMENTS
args.AttachmentsSubDirectory = row.Item("FOLDER_PATH")
End Select
Next
Return args
End Function
Private Function LoadPropertyMapFor(Args As WorkerArgs)
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE ACTIVE = True ORDER BY XML_PATH"
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
Try
Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH"
Dim oResult As DataTable = _mssql.GetDatatable(oSQL)
For Each oRow As DataRow In oResult.Rows
Dim xmlPath = oRow.Item("XML_PATH")
Dim tableName = oRow.Item("TABLE_NAME")
Dim tableColumn = oRow.Item("TABLE_COLUMN")
Dim description = oRow.Item("DESCRIPTION")
Dim isRequired = oRow.Item("IS_REQUIRED")
Dim isGrouped = oRow.Item("IS_GROUPED")
Dim groupScope = oRow.Item("GROUP_SCOPE")
Dim specification = oRow.Item("SPECIFICATION")
For Each oRow As DataRow In oResult.Rows
Dim xmlPath = oRow.Item("XML_PATH")
Dim tableName = oRow.Item("TABLE_NAME")
Dim tableColumn = oRow.Item("TABLE_COLUMN")
Dim description = oRow.Item("DESCRIPTION")
Dim isRequired = oRow.Item("IS_REQUIRED")
Dim isGrouped = oRow.Item("IS_GROUPED")
Dim groupScope = oRow.Item("GROUP_SCOPE")
Dim specification = oRow.Item("SPECIFICATION")
Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With {
.Description = description,
.TableName = tableName,
.TableColumn = tableColumn,
.IsRequired = isRequired,
.IsGrouped = isGrouped,
.GroupScope = groupScope,
.Specification = specification
})
Next
Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With {
.Description = description,
.TableName = tableName,
.TableColumn = tableColumn,
.IsRequired = isRequired,
.IsGrouped = isGrouped,
.GroupScope = groupScope,
.Specification = specification
})
Next
Return Args
Return Args
Catch ex As Exception
_Logger.Error(ex)
Return Args
End Try
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim args As New WorkerArgs() With {
.MaxAttachmentSizeInMegaBytes = 10,
.IgnoreRejectionStatus = False,
.NamePortal = "TEST FROM FORM"
}
args = LoadFolderConfig(args)
args = LoadPropertyMapFor(args)
Dim oResult = FolderBrowserDialog1.ShowDialog()
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _mssql)
If oResult = DialogResult.OK Then
Dim args As New WorkerArgs() With {
.MaxAttachmentSizeInMegaBytes = 10,
.IgnoreRejectionStatus = False,
.NamePortal = "TEST FROM FORM",
.WatchDirectory = FolderBrowserDialog1.SelectedPath
}
args = LoadPropertyMapFor(args)
job.Start(args)
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _mssql)
job.Start(args)
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
@ -192,10 +172,6 @@ Public Class Form1
End Try
End Function
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Process.Start("\\dd-sto01\DD-DFSR01\SharedObjects\Public\Projekte\Test\Import\ZUGFerD\Email_in")
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim oResult = OpenFileDialog1.ShowDialog()