Improve Loading report, add TODOs

This commit is contained in:
Jonathan Jenne 2021-11-15 10:59:45 +01:00
parent 29960916a0
commit e764c310ea
6 changed files with 60 additions and 16 deletions

View File

@ -501,7 +501,7 @@ Partial Public Class OrderReport
'Detail1 'Detail1
' '
Me.Detail1.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {Me.XrLabel3, Me.table4}) Me.Detail1.Controls.AddRange(New DevExpress.XtraReports.UI.XRControl() {Me.XrLabel3, Me.table4})
Me.Detail1.HeightF = 47.45839! Me.Detail1.HeightF = 29.16666!
Me.Detail1.Name = "Detail1" Me.Detail1.Name = "Detail1"
' '
'XrLabel3 'XrLabel3

View File

@ -154,6 +154,15 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Erstellen der Berichtsvorschau ähnelt.
'''</summary>
Friend Shared ReadOnly Property Erstellen_der_Berichtsvorschau() As String
Get
Return ResourceManager.GetString("Erstellen der Berichtsvorschau", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Es konnte kein passender Mandant anhand der geladenen Daten ermittelt werden. Bitte wählen Sie einen aus der Liste. ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Es konnte kein passender Mandant anhand der geladenen Daten ermittelt werden. Bitte wählen Sie einen aus der Liste. ähnelt.
'''</summary> '''</summary>

View File

@ -141,6 +141,9 @@
<data name="Eingangsverzeichnis" xml:space="preserve"> <data name="Eingangsverzeichnis" xml:space="preserve">
<value>Eingangsverzeichnis</value> <value>Eingangsverzeichnis</value>
</data> </data>
<data name="Erstellen der Berichtsvorschau" xml:space="preserve">
<value>Erstellen der Berichtsvorschau</value>
</data>
<data name="Es konnte kein passender Mandant ermittelt werden" xml:space="preserve"> <data name="Es konnte kein passender Mandant ermittelt werden" xml:space="preserve">
<value>Es konnte kein passender Mandant anhand der geladenen Daten ermittelt werden. Bitte wählen Sie einen aus der Liste.</value> <value>Es konnte kein passender Mandant anhand der geladenen Daten ermittelt werden. Bitte wählen Sie einen aus der Liste.</value>
</data> </data>

View File

@ -169,28 +169,28 @@ Public Class frmImportMain
If oTableCounter = 0 Then If oTableCounter = 0 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl1, oTable) Dim oGrid = GridLoader.GetGridFromElement(GridControl1, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell AddHandler GridView1.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid) oGrids.Add(oGrid)
End If End If
If oTableCounter = 1 Then If oTableCounter = 1 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl2, oTable) Dim oGrid = GridLoader.GetGridFromElement(GridControl2, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell AddHandler GridView2.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid) oGrids.Add(oGrid)
End If End If
If oTableCounter = 2 Then If oTableCounter = 2 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl3, oTable) Dim oGrid = GridLoader.GetGridFromElement(GridControl3, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell AddHandler GridView3.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid) oGrids.Add(oGrid)
End If End If
If oTableCounter = 3 Then If oTableCounter = 3 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl4, oTable) Dim oGrid = GridLoader.GetGridFromElement(GridControl4, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
AddHandler DirectCast(oGrid.FocusedView, GridView).CustomDrawCell, AddressOf GridView_CustomDrawCell AddHandler GridView4.CustomDrawCell, AddressOf GridView_CustomDrawCell
oGrids.Add(oGrid) oGrids.Add(oGrid)
End If End If
@ -515,7 +515,37 @@ Public Class frmImportMain
End Sub End Sub
Private Sub btnOpenReport_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenReport.ItemClick Private Sub btnOpenReport_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenReport.ItemClick
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle) Try
SplashScreenManager.ShowWaitForm()
SplashScreenManager.SetWaitFormDescription(My.Resources.frmImportMainExtra.Erstellen_der_Berichtsvorschau)
SetDocumentButtonsEnabled(False)
GridControlFiles.Enabled = False
btnLoadFiles.Enabled = False
SplitContainerGrids.Enabled = False
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
Dim oPrintTool As ReportPrintTool = GenerateReport(oDocument)
oPrintTool.ShowPreview()
SplitContainerGrids.Enabled = True
btnLoadFiles.Enabled = True
GridControlFiles.Enabled = True
SetDocumentButtonsEnabled(True)
SplashScreenManager.CloseWaitForm()
Catch ex As Exception
FormHelper.ShowError(ex, My.Resources.frmImportMainExtra.Erstellen_der_Berichtsvorschau)
End Try
End Sub
Private Function GenerateReport(pDocument As Document) As ReportPrintTool
Dim oPrintTool As ReportPrintTool = Nothing
Dim oMapperConfig As New Mapper(LogConfig) Dim oMapperConfig As New Mapper(LogConfig)
Dim oHeadMapper = oMapperConfig.GetMapper(Of ReportHead)(New Dictionary(Of String, String) From { Dim oHeadMapper = oMapperConfig.GetMapper(Of ReportHead)(New Dictionary(Of String, String) From {
{"Fakt_Kontonummer[Final]", "Text2"}, {"Fakt_Kontonummer[Final]", "Text2"},
@ -534,11 +564,11 @@ Public Class frmImportMain
{"Umsatzsteuerprozent_Zeile", "Text9"} {"Umsatzsteuerprozent_Zeile", "Text9"}
}) })
Dim oHeadRow = oDocument.Rows. Dim oHeadRow = pDocument.Rows.
Where(Function(r) r.Name.EndsWith("T025")). Where(Function(r) r.Name.EndsWith("T025")).
Select(Function(r) r.Fields). Select(Function(r) r.Fields).
FirstOrDefault() FirstOrDefault()
Dim oPositionRows = oDocument.Rows. Dim oPositionRows = pDocument.Rows.
Where(Function(r) r.Name.EndsWith("T026")). Where(Function(r) r.Name.EndsWith("T026")).
ToList() ToList()
@ -570,10 +600,11 @@ Public Class frmImportMain
oDataSource.Fill() oDataSource.Fill()
oReport.DataSource = oDataSource oReport.DataSource = oDataSource
Dim printTool As New ReportPrintTool(oReport) oPrintTool = New ReportPrintTool(oReport)
printTool.Report.CreateDocument(False) oPrintTool.Report.CreateDocument(False)
printTool.ShowPreviewDialog()
End Sub Return oPrintTool
End Function
Private Sub GridViewFiles_CustomDrawCell(sender As Object, e As Views.Base.RowCellCustomDrawEventArgs) Handles GridViewFiles.CustomDrawCell Private Sub GridViewFiles_CustomDrawCell(sender As Object, e As Views.Base.RowCellCustomDrawEventArgs) Handles GridViewFiles.CustomDrawCell
Dim oDocument As Document = GridViewFiles.GetRow(e.RowHandle) Dim oDocument As Document = GridViewFiles.GetRow(e.RowHandle)

View File

@ -145,6 +145,10 @@ Namespace Documents
Where(Function(t) t.Name = oTopLevelElement.Name). Where(Function(t) t.Name = oTopLevelElement.Name).
FirstOrDefault() FirstOrDefault()
' TODO: All fields in the schema should be generated,
' only creating the ones with values leads to wrong visual cues when asking for
' docs/rows/fields with errors
For Each oSubElement As XElement In oSubElements For Each oSubElement As XElement In oSubElements
Dim oSchemaField = oTable.Columns. Dim oSchemaField = oTable.Columns.
Where(Function(c) c.Name = oSubElement.Name). Where(Function(c) c.Name = oSubElement.Name).

View File

@ -415,16 +415,13 @@ Namespace Winline
If p.Fields.ContainsKey("Artikelnummer") Then If p.Fields.ContainsKey("Artikelnummer") Then
Return p.Fields.Item("Artikelnummer").Original Return p.Fields.Item("Artikelnummer").Original
Else Else
' TODO: Throw or ignore?
Throw New Exceptions.MissingAttributeException("Artikelnummer") Throw New Exceptions.MissingAttributeException("Artikelnummer")
End If End If
End Function). End Function).
Distinct(). Distinct().
ToList() ToList()
'Dim oPositions As List(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items.
' Where(Function(i) TypeOf i Is Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026).
' Select(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
' ToList()
Dim oYear = GetWinLineYear() Dim oYear = GetWinLineYear()
Dim oMandatorId As String = String.Empty Dim oMandatorId As String = String.Empty
Dim oWhitelistedMandators = Mandators. Dim oWhitelistedMandators = Mandators.