Finish FinalSQL, GLN/EAN for export, double click to open template, exporting multiple documents
This commit is contained in:
@@ -6,6 +6,7 @@ Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports MultiTool.Shared
|
||||
Imports MultiTool.Shared.Templates
|
||||
Imports MultiTool.Shared.Exceptions
|
||||
Imports MultiTool.Shared.Winline
|
||||
Imports MultiTool.Shared.Winline.Entities
|
||||
|
||||
@@ -57,7 +58,7 @@ Public Class frmExportMain
|
||||
|
||||
Winline = My.Winline
|
||||
FileEx = New DigitalData.Modules.Filesystem.File(LogConfig)
|
||||
WebService = New WebServiceData(LogConfig, My.GeneralConfiguration.Webservice, My.GeneralConfiguration)
|
||||
WebService = New WebServiceData(LogConfig, Winline, My.GeneralConfiguration.Webservice, My.GeneralConfiguration)
|
||||
AddHandler WebService.WebServiceProgress, AddressOf WebService_Progress
|
||||
|
||||
Catch ex As Exception
|
||||
@@ -79,6 +80,12 @@ Public Class frmExportMain
|
||||
lookupDocumentKind.Properties.DataSource = Winline.DocumentKinds
|
||||
lookupDocumentKind.ForceInitialize()
|
||||
lookupDocumentKind.Properties.View.BestFitColumns()
|
||||
|
||||
If ConfigManager.Config.LastUsedMandator <> "" Then
|
||||
lookupMandator.EditValue = Winline.Mandators.
|
||||
Where(Function(mandator) mandator.Id = ConfigManager.Config.LastUsedMandator).
|
||||
FirstOrDefault()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowError(ex, "Initialisierung der Form")
|
||||
End Try
|
||||
@@ -96,6 +103,9 @@ Public Class frmExportMain
|
||||
Dim oMandator As Mandator = lookupMandator.EditValue
|
||||
lookupAccount.Properties.DataSource = Winline.Accounts.Where(Function(acc) acc.Mandator.Equals(oMandator))
|
||||
lookupDocumentKind.Properties.DataSource = Winline.DocumentKinds.Where(Function(kind) kind.Mandator.Equals(oMandator))
|
||||
|
||||
ConfigManager.Config.LastUsedMandator = oMandator.Id
|
||||
ConfigManager.Save()
|
||||
End Sub
|
||||
|
||||
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) _
|
||||
@@ -156,16 +166,33 @@ Public Class frmExportMain
|
||||
Try
|
||||
SplashScreenManager.ShowWaitForm()
|
||||
|
||||
Dim oDocument As Document = GridViewDocuments.GetRow(GridViewDocuments.FocusedRowHandle)
|
||||
Dim oMandator As Mandator = lookupMandator.EditValue
|
||||
Dim oExportResult = False
|
||||
Dim oRowHandles = GridViewDocuments.GetSelectedRows()
|
||||
Dim oExportCount = 0
|
||||
|
||||
Dim oExportResult = Await WebService.ExportDocumentFromWinline(oDocument, CurrentTemplate, oMandator)
|
||||
For Each oRowHandle In oRowHandles
|
||||
oExportCount += 1
|
||||
|
||||
If oExportResult = True Then
|
||||
'TODO: Execute the FinalSql before exiting
|
||||
'TODO: Replace a few numbers like account numbers back to GLNs
|
||||
MsgBox("Datei wurde ergfolgreich exportiert!", MsgBoxStyle.Information, Text)
|
||||
End If
|
||||
Dim oDocument As Document = GridViewDocuments.GetRow(oRowHandle)
|
||||
Dim oMandator As Mandator = lookupMandator.EditValue
|
||||
|
||||
Dim oMessage = String.Format("Beleg {0} exportieren.. ({1}/{2})", oDocument.Number, oExportCount, oRowHandles.Length)
|
||||
SplashScreenManager.SetWaitFormDescription(oMessage)
|
||||
|
||||
Await WebService.ExportDocumentFromWinline(oDocument, CurrentTemplate, oMandator)
|
||||
Dim oFinalSqlResult = Await Winline.ExecuteFinalSQL(oDocument, CurrentTemplate, oMandator)
|
||||
|
||||
If oFinalSqlResult = False Then
|
||||
Throw New DatabaseException("FinalSQL was not executed successfully!")
|
||||
End If
|
||||
|
||||
oDocument.IsExported = True
|
||||
Next
|
||||
|
||||
MsgBox($"{oExportCount} Dateien wurde erfolgreich exportiert!", MsgBoxStyle.Information, Text)
|
||||
|
||||
Catch ex As MissingAttributeException
|
||||
FormHelper.ShowError(ex, "Exportieren der Daten")
|
||||
|
||||
Catch ex As Exception
|
||||
FormHelper.ShowError(ex, "Exportieren der Daten")
|
||||
|
||||
Reference in New Issue
Block a user