WIP
This commit is contained in:
@@ -11,6 +11,8 @@ Imports DigitalData.GUIs.Common
|
||||
Imports EDIDocumentImport.DocumentInfo
|
||||
Imports EDIDocumentImport.DocumentPositions
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraReports.UI
|
||||
Imports EDIDocumentImport.WinLineInfo
|
||||
|
||||
Public Class frmMain
|
||||
Public LogConfig As LogConfig
|
||||
@@ -19,7 +21,9 @@ Public Class frmMain
|
||||
Public Database As MSSQLServer
|
||||
Public DocumentLoader As DocumentLoader
|
||||
Public GridBuilder As GridBuilder
|
||||
|
||||
Public Winline As WinLineInfo
|
||||
Public WebService As WinLineWebService
|
||||
|
||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Try
|
||||
@@ -46,6 +50,7 @@ Public Class frmMain
|
||||
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
|
||||
Database = New MSSQLServer(LogConfig, oConnectionString)
|
||||
Winline = New WinLineInfo(LogConfig, Database, ConfigManager.Config)
|
||||
WebService = New WinLineWebService(LogConfig, Database, ConfigManager.Config)
|
||||
|
||||
' Load WinLine Data
|
||||
Winline.Mandators.Clear()
|
||||
@@ -77,6 +82,11 @@ Public Class frmMain
|
||||
Private Sub btnLoadDocuments_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnLoadDocuments.ItemClick
|
||||
Try
|
||||
If DocumentLoader.LoadFiles() = True Then
|
||||
|
||||
RibbonGroupData.Enabled = True
|
||||
RibbonGroupDocument.Enabled = True
|
||||
RibbonGroupPositions.Enabled = True
|
||||
|
||||
GridControlFiles.DataSource = DocumentLoader.Files
|
||||
txtFilesLoaded.Caption = $"{DocumentLoader.Files.Count} Dokumente geladen"
|
||||
End If
|
||||
@@ -113,30 +123,19 @@ Public Class frmMain
|
||||
Logger.Error(ex)
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
|
||||
Dim oMessage As String = $"Unerwarteter Fehler beim Laden des Dokuments {oDocument.Name}:{vbNewLine}{ex.Message}"
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
Logger.Error(ex)
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub ShowDocument(pDocument As Document, pData As Orders.Input.MESOWebService, pDataOriginal As Orders.Input.MESOWebService)
|
||||
Dim oHead As Orders.Input.MESOWebServiceEXIMVRG_ordersT025 = pData.Items.
|
||||
Where(Function(i) TypeOf i Is Orders.Input.MESOWebServiceEXIMVRG_ordersT025).
|
||||
FirstOrDefault()
|
||||
Dim oHead = GetOrderHead(pData)
|
||||
Dim oHeadOriginal = GetOrderHead(pDataOriginal)
|
||||
|
||||
Dim oHeadOriginal As Orders.Input.MESOWebServiceEXIMVRG_ordersT025 = pDataOriginal.Items.
|
||||
Where(Function(i) TypeOf i Is Orders.Input.MESOWebServiceEXIMVRG_ordersT025).
|
||||
FirstOrDefault()
|
||||
|
||||
Dim oPositions As List(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items.
|
||||
Where(Function(i) TypeOf i Is Orders.Input.MESOWebServiceEXIMVRG_ordersT026).
|
||||
Select(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
|
||||
ToList()
|
||||
|
||||
Dim oPositionsOriginal As List(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026) = pDataOriginal.Items.
|
||||
Where(Function(i) TypeOf i Is Orders.Input.MESOWebServiceEXIMVRG_ordersT026).
|
||||
Select(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
|
||||
ToList()
|
||||
Dim oPositions = GetOrderPositions(pData)
|
||||
Dim oPositionsOriginal = GetOrderPositions(pDataOriginal)
|
||||
|
||||
' ====== Head Data ======
|
||||
|
||||
@@ -152,6 +151,9 @@ Public Class frmMain
|
||||
txtDocumentReference.Text = oHead.Auftragsreferenz
|
||||
dateOrderDate.EditValue = oHead.Datum_AuftragBestellung
|
||||
|
||||
|
||||
|
||||
|
||||
Dim oMandator = Winline.Mandators.
|
||||
Where(Function(m) m.Id = pDocument.Mandator.Id).
|
||||
SingleOrDefault()
|
||||
@@ -168,7 +170,10 @@ Public Class frmMain
|
||||
cmbCustomer.EditValue = Nothing
|
||||
Else
|
||||
cmbCustomer.EditValue = Winline.Accounts.
|
||||
Where(Function(oAccount) oAccount.Id = oHead.Fakt_Kontonummer And oAccount.Mandator = cmbMandator.EditValue).
|
||||
Where(Function(oAccount)
|
||||
Dim oSelectedMandator As Mandator = cmbMandator.EditValue
|
||||
Return oAccount.Id = oHead.Fakt_Kontonummer And oAccount.Mandator = oSelectedMandator.Id
|
||||
End Function).
|
||||
SingleOrDefault()
|
||||
End If
|
||||
|
||||
@@ -278,7 +283,12 @@ Public Class frmMain
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
||||
MsgBox("Mach et!")
|
||||
Dim oDocument As Document = GetFocusedDocument()
|
||||
If oDocument Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
WebService.TransferDocumentToWinLine(oDocument)
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem8_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem8.ItemClick
|
||||
@@ -300,4 +310,49 @@ Public Class frmMain
|
||||
MsgBox($"{pDisplayName} nicht konfiguriert oder nicht gefunden!", MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function GetOrderHead(pData As Orders.Input.MESOWebService) As Orders.Input.MESOWebServiceEXIMVRG_ordersT025
|
||||
Dim oHead As Orders.Input.MESOWebServiceEXIMVRG_ordersT025 = pData.Items.
|
||||
Where(Function(i) TypeOf i Is Orders.Input.MESOWebServiceEXIMVRG_ordersT025).
|
||||
FirstOrDefault()
|
||||
Return oHead
|
||||
End Function
|
||||
|
||||
Private Function GetOrderPositions(pData As Orders.Input.MESOWebService) As List(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)
|
||||
Dim oPositions As List(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items.
|
||||
Where(Function(i) TypeOf i Is Orders.Input.MESOWebServiceEXIMVRG_ordersT026).
|
||||
Select(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
|
||||
ToList()
|
||||
Return oPositions
|
||||
End Function
|
||||
|
||||
Private Function GetFocusedDocument() As DocumentInfo.Document
|
||||
Dim oRowHandles = GridViewFiles.GetSelectedRows().ToList()
|
||||
Dim oDocument As Document = GridViewFiles.GetRow(oRowHandles.First())
|
||||
Return oDocument
|
||||
End Function
|
||||
|
||||
Private Sub btnPreviewReport_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnPreviewReport.ItemClick
|
||||
Dim oDocument As Document = GetFocusedDocument()
|
||||
If oDocument Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oReport As New OrderReport()
|
||||
Dim oDataSource = New DevExpress.DataAccess.ObjectBinding.ObjectDataSource With {
|
||||
.DataSource = New Orders.ReportSource With {
|
||||
.Head = GetOrderHead(oDocument.Data),
|
||||
.Positions = GetOrderPositions(oDocument.Data)
|
||||
}
|
||||
}
|
||||
oDataSource.Fill()
|
||||
oReport.DataSource = oDataSource
|
||||
|
||||
Dim oReportPrintTool As New ReportPrintTool(oReport)
|
||||
oReportPrintTool.ShowPreview()
|
||||
End Sub
|
||||
|
||||
Private Sub btnReloadDocument_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnReloadDocument.ItemClick
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user