diff --git a/EDIDocumentImport/Config.vb b/EDIDocumentImport/Config.vb index 22e5c0a..2a1d32e 100644 --- a/EDIDocumentImport/Config.vb +++ b/EDIDocumentImport/Config.vb @@ -1,13 +1,28 @@ Public Class Config Public Property ConnectionString As String = "" - Public Property Mandators As New List(Of String) + Public Property Mandators As New List(Of Mandator) Public Property InputDirectory As String = "" Public Property OutputDirectory As String = "" Public Property Webservice As New WebServiceConfig() + Public Property DefaultYearOverride As Integer = 0 Public Class WebServiceConfig Public Property BaseUrl As String = "http://127.0.0.1/EWL" Public Property Username As String = "Username" Public Property Password As String = "Password" End Class + + Public Class Mandator + Public Property Order As Integer + Public Property Name As String + Public Property ArticleRegex As String + End Class + + Public Function GetYear() As Integer + If DefaultYearOverride > 0 Then + Return DefaultYearOverride + End If + + Return Now.Year + End Function End Class diff --git a/EDIDocumentImport/DocumentInfo.vb b/EDIDocumentImport/DocumentInfo.vb index 6711a64..55ca700 100644 --- a/EDIDocumentImport/DocumentInfo.vb +++ b/EDIDocumentImport/DocumentInfo.vb @@ -1,11 +1,16 @@ Imports System.IO +Imports EDIDocumentImport.WinLineInfo Public Class DocumentInfo Public Class Document Public File As FileInfo Public Type As DocumentType + Public Mandator As Mandator + + Public DataOriginal As Object Public Data As Object + Public Selected As Boolean = False Public ReadOnly Property FullName As String diff --git a/EDIDocumentImport/DocumentLoader.vb b/EDIDocumentImport/DocumentLoader.vb index 997a299..85dac8b 100644 --- a/EDIDocumentImport/DocumentLoader.vb +++ b/EDIDocumentImport/DocumentLoader.vb @@ -2,18 +2,27 @@ Imports System.Xml Imports System.Xml.Serialization Imports System.Xml.XPath +Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Language Imports EDIDocumentImport.DocumentInfo +Imports System.Text.RegularExpressions +Imports EDIDocumentImport.WinLineInfo Public Class DocumentLoader Inherits Base Public Config As Config + Private Database As MSSQLServer + Private Winline As WinLineInfo + Public Files As New List(Of Document) - Public Sub New(pLogConfig As LogConfig, pConfig As Config) + Public Sub New(pLogConfig As LogConfig, pConfig As Config, pDatabase As MSSQLServer, pWinline As WinLineInfo) MyBase.New(pLogConfig, pLogConfig.GetLogger()) Config = pConfig + Database = pDatabase + Winline = pWinline End Sub Public Function LoadFiles() As Boolean @@ -32,6 +41,9 @@ Public Class DocumentLoader Files = oFiles. Select(AddressOf WrapFileInfo). Select(AddressOf LoadDocumentData). + Select(Function(oDocument) + Return MatchDataFromWinLine(oDocument, Winline.Mandators) + End Function). ToList() Return True @@ -43,30 +55,190 @@ Public Class DocumentLoader End Try End Function + Private Function FindMatchingMandatorFromOrder(pData As Orders.MESOWebService) As Mandator + Dim oPositions As List(Of Orders.MESOWebServiceEXIMVRG_ordersT026) = pData.Items. + Where(Function(i) TypeOf i Is Orders.MESOWebServiceEXIMVRG_ordersT026). + Select(Of Orders.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i). + ToList() + Dim oYear = Winline.GetWinLineYear() + Dim oMandatorId As String = String.Empty + Dim oWhitelistedMandators = Winline.Mandators. + Where(Function(m) m.IsWhitelisted = True). + ToList() + + For Each oPos In oPositions + For Each oMandator In oWhitelistedMandators + Dim oSQL As String = $" + SELECT + [c011], -- Artikelnummer + [c003], -- Artikelbezeichnung + [c075], -- EAN-Nummer + [c123] -- Ersatzartikelnummer + FROM [{oMandator.Database}].[dbo].[v021] + WHERE [c075] = '{oPos.Artikelnummer}' + AND [mesocomp] = '{oMandator.Id}' AND [mesoyear] = {oYear}" + Dim oTable As DataTable = Database.GetDatatable(oSQL) + + ' EAN not found in this Mandator, continue to next one + If oTable.Rows.Count = 0 Then + Logger.Debug("EAN [{0}] was not found in Mandator: [{1}]", oPos.Artikelnummer, oMandator.Id) + Continue For + End If + + ' Duplicate EAN, exit and do nothing about this manda + If oTable.Rows.Count > 1 Then + Logger.Warn("EAN [{0}] was found more than once. Skipping Mandator [{1}]", oPos.Artikelnummer, oMandator.Id) + Exit For + End If + + Dim oRow As DataRow = oTable.Rows.Item(0) + Dim oArticleNumber As String = Utils.NotNull(oRow.Item(WinLineInfo.V21_ARTICLENUMBER), String.Empty) + + ' EAN was found, now we need to check it against the Regex of the current Mandantor, if one exists + If oMandator.Regex <> String.Empty Then + Try + Dim oRegex As New Regex(oMandator.Regex) + Dim oMatch = oRegex.Match(oArticleNumber) + + ' If ArticleNumber matches the regex, we assign it and exit + If oMatch.Success Then + oMandatorId = oMandator.Id + Exit For + Else + ' If it does not match, continue to the next mandator + End If + Catch ex As Exception + Logger.Error(ex) + Logger.Warn("Regex [{0}] could not be parsed. Skipping.", oMandator.Regex) + End Try + Else + ' If no regex was found, we assume the number matches + oMandatorId = oMandator.Id + End If + Next + Next + + If oMandatorId = String.Empty Then + Return Nothing + Else + Return oWhitelistedMandators. + Where(Function(m) m.Id = oMandatorId). + Take(1). + SingleOrDefault() + End If + End Function + + Private Function MatchDataFromWinLine(pDocument As DocumentInfo.Document, pMandators As List(Of WinLineInfo.Mandator)) As DocumentInfo.Document + Dim oMandators As List(Of WinLineInfo.Mandator) = pMandators. + Where(Function(m) m.IsWhitelisted = True). + OrderBy(Function(m) m.Order). + ToList() + + If TypeOf pDocument.Data Is Orders.MESOWebService Then + Dim oMandator = FindMatchingMandatorFromOrder(pDocument.Data) + Dim oData As Orders.MESOWebService = MatchOrderData(pDocument.Data, oMandator) + + pDocument.Mandator = oMandator + pDocument.Data = oData + End If + + Return pDocument + End Function + + Private Function MatchOrderData(pData As Orders.MESOWebService, pMandator As WinLineInfo.Mandator) As Orders.MESOWebService + Dim oYear = Winline.GetWinLineYear() + + If pMandator Is Nothing Then + Return pData + End If + + Dim oHead As Orders.MESOWebServiceEXIMVRG_ordersT025 = pData.Items. + Where(Function(h) TypeOf h Is Orders.MESOWebServiceEXIMVRG_ordersT025). + SetValue(Sub(h) + Dim oAccountNumber = Winline.TryGetAccountNumber(h.Fakt_Kontonummer, pMandator) + If oAccountNumber IsNot Nothing Then + h.Fakt_Kontonummer = oAccountNumber + End If + + Dim oAccountNumber2 = Winline.TryGetAccountNumber(h.Lief_Kontonummer, pMandator) + If oAccountNumber2 IsNot Nothing Then + h.Lief_Kontonummer = oAccountNumber2 + End If + End Sub). + FirstOrDefault() + + Dim oPositions As List(Of Orders.MESOWebServiceEXIMVRG_ordersT026) = pData.Items. + Where(Function(p) TypeOf p Is Orders.MESOWebServiceEXIMVRG_ordersT026). + SetValue(Sub(p) + Dim oArticleNumber = Winline.TryGetArticleNumber(p.Artikelnummer, pMandator) + If oArticleNumber IsNot Nothing Then + p.Artikelnummer = oArticleNumber + End If + End Sub). + Select(Of Orders.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i). + ToList() + + + pData.Items = New List(Of Object) From {oHead}. + Concat(oPositions). + ToArray() + + + 'Dim oAccountNumber = Winline.TryGetAccountNumber(oHead.Fakt_Kontonummer, oMandator) + 'If oAccountNumber IsNot Nothing Then + ' oHead.Fakt_Kontonummer = oAccountNumber + 'End If + + 'Dim oAccountNumber2 = Winline.TryGetAccountNumber(oHead.Lief_Kontonummer, oMandator) + 'If oAccountNumber2 IsNot Nothing Then + ' oHead.Lief_Kontonummer = oAccountNumber2 + 'End If + + 'For Each oPos In oPositions + ' Dim oArticleNumber = Winline.TryGetArticleNumber(oPos.Artikelnummer, oMandator) + ' If oArticleNumber Then + ' oPos.Artikelnummer = oArticleNumber + ' End If + + + 'Next + + Return pData + End Function + + + + Private Function WrapFileInfo(pFileInfo As FileInfo) As Document Return New Document With {.File = pFileInfo} End Function - - Public Function LoadDocumentData(pDocument As Document) As Document + Private Function LoadDocumentData(pDocument As Document) As Document Using oFileStream As New FileStream(pDocument.FullName, FileMode.Open, FileAccess.Read, FileShare.Read) Dim oXmlDocument = New XPathDocument(oFileStream) Dim oNavigator = oXmlDocument.CreateNavigator() + Dim oTemplateName = GetTemplateName(oNavigator) + Dim oDocumentType = GetDocumentTypeFromTemplateName(oTemplateName) + Dim oSchemaType = GetDocumentSchemaFromDocumentType(oDocumentType) + ' Read data the first time, working copy Using oReader = oNavigator.ReadSubtree() - Dim oTemplateName = GetTemplateName(oNavigator) - Dim oDocumentType = GetDocumentTypeFromTemplateName(oTemplateName) - Dim oSchemaType = GetDocumentSchemaFromDocumentType(oDocumentType) Dim oSerializer As New XmlSerializer(oSchemaType) - Dim oObject = oSerializer.Deserialize(oReader) + pDocument.Data = oSerializer.Deserialize(oReader) - pDocument.Data = oObject - pDocument.Type = oDocumentType - Return pDocument End Using + + ' Read data the second time, archive copy + Using oReader = oNavigator.ReadSubtree() + Dim oSerializer As New XmlSerializer(oSchemaType) + pDocument.DataOriginal = oSerializer.Deserialize(oReader) + + End Using + + pDocument.Type = oDocumentType + Return pDocument End Using End Function - - Public Function GetTemplateName(pDocument As XPathNavigator) As String + Private Function GetTemplateName(pDocument As XPathNavigator) As String Dim oTemplateName = pDocument. SelectSingleNode("//MESOWebService"). GetAttribute("Template", "") diff --git a/EDIDocumentImport/DocumentPositions.vb b/EDIDocumentImport/DocumentPositions.vb index efda40c..0cc5d11 100644 --- a/EDIDocumentImport/DocumentPositions.vb +++ b/EDIDocumentImport/DocumentPositions.vb @@ -3,6 +3,7 @@ Public Class DocumentPositions Public Class OrderPosition Public Property RowNumber As Integer + Public Property EuropeanArticleNumber As String Public Property ArticleNumber As String Public Property ArticleNumberVendor As String Public Property ArticleDescription As String @@ -23,34 +24,43 @@ Public Class DocumentPositions .Caption = "Artikelnummer", .VisibleIndex = 1 } + Public Shared Property ColumnEuropeanArticleNumber As New GridColumn With { + .FieldName = "EuropeanArticleNumber", + .Caption = "EAN", + .VisibleIndex = 2 + } Public Shared Property ColumnArticleNumberVendor As New GridColumn With { .FieldName = "ArticleNumberVendor", .Caption = "Artikel Lieferant", - .VisibleIndex = 2 + .VisibleIndex = 3 } Public Shared Property ColumnArticleDescription As New GridColumn With { .FieldName = "ArticleDescription", .Caption = "Artikel Beschreibung", - .VisibleIndex = 3 + .VisibleIndex = 4 } Public Shared Property ColumnAmount As New GridColumn With { .FieldName = "Amount", .Caption = "Menge", - .VisibleIndex = 4 + .VisibleIndex = 5 } Public Shared Property ColumnEDIPrice As New GridColumn With { .FieldName = "EDIPrice", .Caption = "Einzelpreis EDI", - .VisibleIndex = 5 + .VisibleIndex = 6 } Public Shared Property ColumnWinLinePrice As New GridColumn With { .FieldName = "WinLinePrice", .Caption = "Einzelpreis WinLine", - .VisibleIndex = 6 + .VisibleIndex = 7 } Public Shared Property ColumnPrice As New GridColumn With { .FieldName = "Price", .Caption = "Einzelpreis", - .VisibleIndex = 7 + .VisibleIndex = 8 + } + + Public Shared Property WritableColumns As New List(Of GridColumn) From { + ColumnPrice } End Class diff --git a/EDIDocumentImport/EDIDocumentImporter.vbproj b/EDIDocumentImport/EDIDocumentImporter.vbproj index c05ed64..cb98272 100644 --- a/EDIDocumentImport/EDIDocumentImporter.vbproj +++ b/EDIDocumentImport/EDIDocumentImporter.vbproj @@ -89,6 +89,10 @@ ..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll + + False + ..\..\DDMonorepo\Modules.Language\bin\Release\DigitalData.Modules.Language.dll + ..\..\DDMonorepo\Modules.Logging\bin\Release\DigitalData.Modules.Logging.dll @@ -137,6 +141,7 @@ Form + True @@ -194,6 +199,9 @@ + + + diff --git a/EDIDocumentImport/IEnumerableEx.vb b/EDIDocumentImport/IEnumerableEx.vb new file mode 100644 index 0000000..ba81d67 --- /dev/null +++ b/EDIDocumentImport/IEnumerableEx.vb @@ -0,0 +1,12 @@ +Imports System.Runtime.CompilerServices + +Module IEnumerableEx + + Function SetValue(Of T)(ByVal items As IEnumerable(Of T), ByVal updateMethod As Action(Of T)) As IEnumerable(Of T) + For Each item As T In items + updateMethod(item) + Next + + Return items + End Function +End Module diff --git a/EDIDocumentImport/My Project/Resources.Designer.vb b/EDIDocumentImport/My Project/Resources.Designer.vb index 4259e93..8b5bcf8 100644 --- a/EDIDocumentImport/My Project/Resources.Designer.vb +++ b/EDIDocumentImport/My Project/Resources.Designer.vb @@ -140,6 +140,16 @@ Namespace My.Resources End Get End Property + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property singlepageview() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("singlepageview", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property + ''' ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. ''' @@ -149,5 +159,25 @@ Namespace My.Resources Return CType(obj,DevExpress.Utils.Svg.SvgImage) End Get End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property tilelabels() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("tilelabels", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property wraptext() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("wraptext", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property End Module End Namespace diff --git a/EDIDocumentImport/My Project/Resources.resx b/EDIDocumentImport/My Project/Resources.resx index 7c0d9a0..2936ab2 100644 --- a/EDIDocumentImport/My Project/Resources.resx +++ b/EDIDocumentImport/My Project/Resources.resx @@ -118,31 +118,40 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\wraptext.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ..\Resources\open2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ..\Resources\bo_validation.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ..\Resources\pagesetup.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ..\Resources\tableproperties.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ..\Resources\showallfieldcodes.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + ..\Resources\import.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\deletetablerows.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\bo_validation.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - - ..\Resources\showallfieldcodes.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\tilelabels.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a ..\Resources\open.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\pagesetup.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\itemtypechecked.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\open2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - - ..\Resources\tableproperties.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\singlepageview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a \ No newline at end of file diff --git a/EDIDocumentImport/Resources/singlepageview.svg b/EDIDocumentImport/Resources/singlepageview.svg new file mode 100644 index 0000000..9664a18 --- /dev/null +++ b/EDIDocumentImport/Resources/singlepageview.svg @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/EDIDocumentImport/Resources/tilelabels.svg b/EDIDocumentImport/Resources/tilelabels.svg new file mode 100644 index 0000000..3f5150f --- /dev/null +++ b/EDIDocumentImport/Resources/tilelabels.svg @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/EDIDocumentImport/Resources/wraptext.svg b/EDIDocumentImport/Resources/wraptext.svg new file mode 100644 index 0000000..7159884 --- /dev/null +++ b/EDIDocumentImport/Resources/wraptext.svg @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/EDIDocumentImport/WinLineInfo.vb b/EDIDocumentImport/WinLineInfo.vb index 83a0eb6..bc8751a 100644 --- a/EDIDocumentImport/WinLineInfo.vb +++ b/EDIDocumentImport/WinLineInfo.vb @@ -1,15 +1,20 @@ Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Language Public Class WinLineInfo Inherits Base Private Database As MSSQLServer + Private Config As Config Public Accounts As New List(Of Account) Public Mandators As New List(Of Mandator) Public Years As List(Of Integer) + Public Const V21_ARTICLENUMBER = "c011" + Public Const V50_ACCOUNTNUMBER = "c002" + Public Class Account Public Property Id As String Public Property Name As String @@ -24,17 +29,29 @@ Public Class WinLineInfo Public Property Name As String Public Property Database As String Public Property Server As String + Public Property Regex As String + Public Property Order As Integer + Public Property IsWhitelisted As Boolean Public Overrides Function ToString() As String Return $"{Name} ({Id})" End Function End Class - Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer) + Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config) MyBase.New(pLogConfig, pLogConfig.GetLogger()) Database = pDatabase + Config = pConfig End Sub + Public Function GetWinLineYear(pYear As Integer) + Return (pYear - 1900) * 12 + End Function + + Public Function GetWinLineYear() + Return GetWinLineYear(Config.GetYear) + End Function + Public Sub LoadAccounts(pMandator As Mandator) Dim oSQL = $"SELECT [c002], [c003] FROM [{pMandator.Server}].[{pMandator.Database}].[dbo].[v005] WHERE c139 IS NULL" Dim oTable = Database.GetDatatable(oSQL) @@ -55,13 +72,24 @@ Public Class WinLineInfo Mandators.Clear() For Each oRow As DataRow In oTable.Rows Dim oDbInfo = SplitConnectionInfo(oRow) - - Mandators.Add(New Mandator With { + Dim oMandator = New Mandator With { .Id = oRow.Item("c000"), .Name = oRow.Item("c003"), .Database = oDbInfo.Item1, .Server = oDbInfo.Item2 - }) + } + + Dim oMandatorConfig As Config.Mandator = Config.Mandators. + Where(Function(m) oMandator.Id = m.Name). + SingleOrDefault() + + If oMandatorConfig IsNot Nothing Then + oMandator.IsWhitelisted = True + oMandator.Regex = oMandatorConfig.ArticleRegex + oMandator.Order = oMandatorConfig.Order + End If + + Mandators.Add(oMandator) Next End Sub @@ -71,6 +99,81 @@ Public Class WinLineInfo Years = oRange End Sub + Public Function TryGetAccountNumber(pGLN As String, pMandator As Mandator) As String + Try + Dim oYear As Integer = GetWinLineYear() + Dim oSQL = $" + SELECT + [c002], -- Kundennummer + [c003] -- Kundenname + FROM [{pMandator.Database}].[dbo].[v050] + WHERE [c004] = 2 -- Was für ein Konto?? + AND [c260] = {pGLN} + AND [mesocomp] = '{pMandator.Id}' and [mesoyear] = {oYear}" + Dim oTable As DataTable = Database.GetDatatable(oSQL) + + ' GLN not found in this Mandator, continue to next one + If oTable.Rows.Count = 0 Then + Logger.Debug("GLN [{0}] was not found in Mandator: [{1}]", pGLN, pMandator.Id) + Return Nothing + + End If + + ' Duplicate GLN, exit and do nothing about this number + If oTable.Rows.Count > 1 Then + Logger.Warn("GLN [{0}] was found more than once in Mandator: [{1}]", pGLN, pMandator.Id) + Return Nothing + + End If + + Dim oRow As DataRow = oTable.Rows.Item(0) + Dim oArticleNumber As String = Utils.NotNull(oRow.Item(V50_ACCOUNTNUMBER), String.Empty) + Return oArticleNumber + Catch ex As Exception + Logger.Error(ex) + Return Nothing + End Try + End Function + + Public Function TryGetArticleNumber(pEAN As String, pMandator As Mandator) As String + Try + Dim oYear As Integer = GetWinLineYear() + Dim oSQL As String = $" + SELECT + [c011], -- Artikelnummer + [c003], -- Artikelbezeichnung + [c075], -- EAN-Nummer + [c123] -- Ersatzartikelnummer + FROM [{pMandator.Database}].[dbo].[v021] + WHERE [c075] = '{pEAN}' + AND [mesocomp] = '{pMandator.Id}' AND [mesoyear] = {oYear}" + Dim oTable As DataTable = Database.GetDatatable(oSQL) + + ' EAN not found in this Mandator, continue to next one + If oTable.Rows.Count = 0 Then + Logger.Debug("EAN [{0}] was not found in Mandator: [{1}]", pEAN, pMandator.Id) + Return Nothing + + End If + + ' Duplicate EAN, exit and do nothing about this number + If oTable.Rows.Count > 1 Then + Logger.Warn("EAN [{0}] was found more than once", pEAN) + Return Nothing + + End If + + Dim oRow As DataRow = oTable.Rows.Item(0) + Dim oArticleNumber As String = Utils.NotNull(oRow.Item(V21_ARTICLENUMBER), String.Empty) + Return oArticleNumber + + Catch ex As Exception + Logger.Error(ex) + Return Nothing + + End Try + End Function + ''' ''' Turns a database info like "CWLDATEN on SERVER\INSTANCE" into a Tuple of two strings ''' diff --git a/EDIDocumentImport/frmMain.Designer.vb b/EDIDocumentImport/frmMain.Designer.vb index 7c698b7..0a9532a 100644 --- a/EDIDocumentImport/frmMain.Designer.vb +++ b/EDIDocumentImport/frmMain.Designer.vb @@ -32,6 +32,7 @@ Partial Class frmMain Me.txtVersion = New DevExpress.XtraBars.BarStaticItem() Me.BarButtonItem6 = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem7 = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonItem8 = New DevExpress.XtraBars.BarButtonItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() @@ -64,28 +65,34 @@ Partial Class frmMain Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() Me.cmbDeliveryAddress = New DevExpress.XtraEditors.SearchLookUpEdit() Me.GridView2 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.cmbYears = New DevExpress.XtraEditors.ComboBoxEdit() + Me.txtCustomerGLN = New DevExpress.XtraEditors.TextEdit() + Me.txtDeliveryAddressGLN = New DevExpress.XtraEditors.TextEdit() Me.Root = New DevExpress.XtraLayout.LayoutControlGroup() + Me.TabbedControlGroup2 = New DevExpress.XtraLayout.TabbedControlGroup() + Me.LayoutControlGroup2 = New DevExpress.XtraLayout.LayoutControlGroup() + Me.LayoutControlItemRunningNumber = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem11 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem5 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutItemOrderIssuer = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem3 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutItemOrderNumber = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem6 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem9 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem10 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem11 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItemRunningNumber = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutItemOrderDate = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem12 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem13 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlGroup1 = New DevExpress.XtraLayout.LayoutControlGroup() + Me.LayoutControlItem10 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem8 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem9 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem7 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem() - Me.SimpleSeparator1 = New DevExpress.XtraLayout.SimpleSeparator() - Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem5 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem6 = New DevExpress.XtraLayout.LayoutControlItem() Me.GridControlPositions = New DevExpress.XtraGrid.GridControl() Me.GridViewPositions = New DevExpress.XtraGrid.Views.Grid.GridView() Me.SplitContainerControl3 = New DevExpress.XtraEditors.SplitContainerControl() Me.RichEditXml = New DevExpress.XtraRichEdit.RichEditControl() - Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem() - Me.cmbYears = New DevExpress.XtraEditors.ComboBoxEdit() CType(Me.RibbonControl, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridControlFiles, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridViewFiles, System.ComponentModel.ISupportInitialize).BeginInit() @@ -113,40 +120,50 @@ Partial Class frmMain CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.cmbDeliveryAddress.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridView2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.cmbYears.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtCustomerGLN.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtDeliveryAddressGLN.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.TabbedControlGroup2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlGroup2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItemRunningNumber, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem11, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutItemOrderIssuer, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutItemOrderNumber, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem11, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItemRunningNumber, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutItemOrderDate, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem12, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem13, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.SimpleSeparator1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridControlPositions, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridViewPositions, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl3, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainerControl3.SuspendLayout() - CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.cmbYears.Properties, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'RibbonControl ' Me.RibbonControl.ExpandCollapseItem.Id = 0 - Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.btnLoadDocuments, Me.txtFilesLoaded, Me.BarButtonItem1, Me.BarButtonItem2, Me.BarButtonItem3, Me.checkShowXml, Me.BarButtonItem4, Me.BarButtonItem5, Me.txtVersion, Me.BarButtonItem6, Me.BarButtonItem7}) + Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.btnLoadDocuments, Me.txtFilesLoaded, Me.BarButtonItem1, Me.BarButtonItem2, Me.BarButtonItem3, Me.checkShowXml, Me.BarButtonItem4, Me.BarButtonItem5, Me.txtVersion, Me.BarButtonItem6, Me.BarButtonItem7, Me.BarButtonItem8}) Me.RibbonControl.Location = New System.Drawing.Point(0, 0) - Me.RibbonControl.MaxItemId = 15 + Me.RibbonControl.MaxItemId = 16 Me.RibbonControl.Name = "RibbonControl" Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) - Me.RibbonControl.Size = New System.Drawing.Size(1406, 158) + Me.RibbonControl.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False] + Me.RibbonControl.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide + Me.RibbonControl.ShowToolbarCustomizeItem = False + Me.RibbonControl.Size = New System.Drawing.Size(1406, 132) Me.RibbonControl.StatusBar = Me.RibbonStatusBar + Me.RibbonControl.Toolbar.ShowCustomizeItem = False ' 'btnLoadDocuments ' @@ -224,6 +241,13 @@ Partial Class frmMain Me.BarButtonItem7.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.tableproperties Me.BarButtonItem7.Name = "BarButtonItem7" ' + 'BarButtonItem8 + ' + Me.BarButtonItem8.Caption = "Logverzeichnis öffnen" + Me.BarButtonItem8.Id = 15 + Me.BarButtonItem8.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.singlepageview + Me.BarButtonItem8.Name = "BarButtonItem8" + ' 'RibbonPage1 ' Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroup3, Me.RibbonPageGroup4, Me.RibbonPageGroup5}) @@ -242,6 +266,7 @@ Partial Class frmMain Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItem1) Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItem2) Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItem3) + Me.RibbonPageGroup2.ItemLinks.Add(Me.BarButtonItem8) Me.RibbonPageGroup2.Name = "RibbonPageGroup2" Me.RibbonPageGroup2.Text = "Konfiguration" ' @@ -282,7 +307,7 @@ Partial Class frmMain Me.GridControlFiles.MainView = Me.GridViewFiles Me.GridControlFiles.MenuManager = Me.RibbonControl Me.GridControlFiles.Name = "GridControlFiles" - Me.GridControlFiles.Size = New System.Drawing.Size(324, 594) + Me.GridControlFiles.Size = New System.Drawing.Size(324, 620) Me.GridControlFiles.TabIndex = 2 Me.GridControlFiles.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewFiles}) ' @@ -294,7 +319,7 @@ Partial Class frmMain ' 'colSelected ' - Me.colSelected.FieldName = "colSelected" + Me.colSelected.FieldName = "Selected" Me.colSelected.ImageOptions.SvgImage = CType(resources.GetObject("colSelected.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.colSelected.ImageOptions.SvgImageSize = New System.Drawing.Size(16, 16) Me.colSelected.Name = "colSelected" @@ -308,6 +333,8 @@ Partial Class frmMain Me.colFileName.Caption = "Dateiname" Me.colFileName.FieldName = "Name" Me.colFileName.Name = "colFileName" + Me.colFileName.OptionsColumn.AllowEdit = False + Me.colFileName.OptionsColumn.ReadOnly = True Me.colFileName.Visible = True Me.colFileName.VisibleIndex = 1 Me.colFileName.Width = 99 @@ -317,6 +344,8 @@ Partial Class frmMain Me.colFilePath.Caption = "Dateipfad" Me.colFilePath.FieldName = "FullName" Me.colFilePath.Name = "colFilePath" + Me.colFilePath.OptionsColumn.AllowEdit = False + Me.colFilePath.OptionsColumn.ReadOnly = True Me.colFilePath.Visible = True Me.colFilePath.VisibleIndex = 2 Me.colFilePath.Width = 99 @@ -330,7 +359,7 @@ Partial Class frmMain Me.SplitContainerControl1.Panel1.Text = "Panel1" Me.SplitContainerControl1.Panel2.Controls.Add(Me.SplitContainerControl2) Me.SplitContainerControl1.Panel2.Text = "Panel2" - Me.SplitContainerControl1.Size = New System.Drawing.Size(1396, 594) + Me.SplitContainerControl1.Size = New System.Drawing.Size(1396, 620) Me.SplitContainerControl1.SplitterPosition = 324 Me.SplitContainerControl1.TabIndex = 3 ' @@ -344,7 +373,7 @@ Partial Class frmMain Me.SplitContainerControl2.Panel1.Text = "Panel1" Me.SplitContainerControl2.Panel2.Controls.Add(Me.GridControlPositions) Me.SplitContainerControl2.Panel2.Text = "Panel2" - Me.SplitContainerControl2.Size = New System.Drawing.Size(1062, 594) + Me.SplitContainerControl2.Size = New System.Drawing.Size(1062, 620) Me.SplitContainerControl2.SplitterPosition = 275 Me.SplitContainerControl2.TabIndex = 0 ' @@ -365,6 +394,8 @@ Partial Class frmMain Me.LayoutControl1.Controls.Add(Me.cmbCustomer) Me.LayoutControl1.Controls.Add(Me.cmbDeliveryAddress) Me.LayoutControl1.Controls.Add(Me.cmbYears) + Me.LayoutControl1.Controls.Add(Me.txtCustomerGLN) + Me.LayoutControl1.Controls.Add(Me.txtDeliveryAddressGLN) Me.LayoutControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.LayoutControl1.Location = New System.Drawing.Point(0, 0) Me.LayoutControl1.Name = "LayoutControl1" @@ -376,115 +407,115 @@ Partial Class frmMain ' 'txtOrderIssuer ' - Me.txtOrderIssuer.Location = New System.Drawing.Point(92, 135) + Me.txtOrderIssuer.Location = New System.Drawing.Point(123, 170) Me.txtOrderIssuer.MenuManager = Me.RibbonControl Me.txtOrderIssuer.Name = "txtOrderIssuer" - Me.txtOrderIssuer.Size = New System.Drawing.Size(123, 20) + Me.txtOrderIssuer.Size = New System.Drawing.Size(264, 20) Me.txtOrderIssuer.StyleController = Me.LayoutControl1 Me.txtOrderIssuer.TabIndex = 6 ' 'MemoEdit1 ' - Me.MemoEdit1.Location = New System.Drawing.Point(92, 165) + Me.MemoEdit1.Location = New System.Drawing.Point(123, 200) Me.MemoEdit1.MenuManager = Me.RibbonControl Me.MemoEdit1.Name = "MemoEdit1" - Me.MemoEdit1.Size = New System.Drawing.Size(490, 95) + Me.MemoEdit1.Size = New System.Drawing.Size(912, 48) Me.MemoEdit1.StyleController = Me.LayoutControl1 Me.MemoEdit1.TabIndex = 12 ' 'txtOrderNumber ' - Me.txtOrderNumber.Location = New System.Drawing.Point(302, 135) + Me.txtOrderNumber.Location = New System.Drawing.Point(493, 170) Me.txtOrderNumber.MenuManager = Me.RibbonControl Me.txtOrderNumber.Name = "txtOrderNumber" - Me.txtOrderNumber.Size = New System.Drawing.Size(97, 20) + Me.txtOrderNumber.Size = New System.Drawing.Size(218, 20) Me.txtOrderNumber.StyleController = Me.LayoutControl1 Me.txtOrderNumber.TabIndex = 7 ' 'TextEdit5 ' - Me.TextEdit5.Location = New System.Drawing.Point(670, 15) + Me.TextEdit5.Location = New System.Drawing.Point(123, 50) Me.TextEdit5.MenuManager = Me.RibbonControl Me.TextEdit5.Name = "TextEdit5" - Me.TextEdit5.Size = New System.Drawing.Size(377, 20) + Me.TextEdit5.Size = New System.Drawing.Size(912, 20) Me.TextEdit5.StyleController = Me.LayoutControl1 Me.TextEdit5.TabIndex = 3 ' 'TextEdit6 ' - Me.TextEdit6.Location = New System.Drawing.Point(670, 45) + Me.TextEdit6.Location = New System.Drawing.Point(123, 80) Me.TextEdit6.MenuManager = Me.RibbonControl Me.TextEdit6.Name = "TextEdit6" - Me.TextEdit6.Size = New System.Drawing.Size(377, 20) + Me.TextEdit6.Size = New System.Drawing.Size(912, 20) Me.TextEdit6.StyleController = Me.LayoutControl1 Me.TextEdit6.TabIndex = 5 ' 'TextEdit7 ' - Me.TextEdit7.Location = New System.Drawing.Point(670, 105) + Me.TextEdit7.Location = New System.Drawing.Point(123, 140) Me.TextEdit7.MenuManager = Me.RibbonControl Me.TextEdit7.Name = "TextEdit7" - Me.TextEdit7.Size = New System.Drawing.Size(377, 20) + Me.TextEdit7.Size = New System.Drawing.Size(912, 20) Me.TextEdit7.StyleController = Me.LayoutControl1 Me.TextEdit7.TabIndex = 11 ' 'TextEdit8 ' - Me.TextEdit8.Location = New System.Drawing.Point(670, 75) + Me.TextEdit8.Location = New System.Drawing.Point(123, 110) Me.TextEdit8.MenuManager = Me.RibbonControl Me.TextEdit8.Name = "TextEdit8" - Me.TextEdit8.Size = New System.Drawing.Size(377, 20) + Me.TextEdit8.Size = New System.Drawing.Size(912, 20) Me.TextEdit8.StyleController = Me.LayoutControl1 Me.TextEdit8.TabIndex = 9 ' 'TextEdit9 ' - Me.TextEdit9.Location = New System.Drawing.Point(670, 135) + Me.TextEdit9.Location = New System.Drawing.Point(123, 170) Me.TextEdit9.MenuManager = Me.RibbonControl Me.TextEdit9.Name = "TextEdit9" - Me.TextEdit9.Size = New System.Drawing.Size(377, 20) + Me.TextEdit9.Size = New System.Drawing.Size(912, 20) Me.TextEdit9.StyleController = Me.LayoutControl1 Me.TextEdit9.TabIndex = 13 ' 'txtBELEGKEY ' - Me.txtBELEGKEY.Location = New System.Drawing.Point(453, 15) + Me.txtBELEGKEY.Location = New System.Drawing.Point(760, 50) Me.txtBELEGKEY.MenuManager = Me.RibbonControl Me.txtBELEGKEY.Name = "txtBELEGKEY" - Me.txtBELEGKEY.Size = New System.Drawing.Size(129, 20) + Me.txtBELEGKEY.Size = New System.Drawing.Size(275, 20) Me.txtBELEGKEY.StyleController = Me.LayoutControl1 Me.txtBELEGKEY.TabIndex = 0 ' 'txtRunningNumber ' - Me.txtRunningNumber.Location = New System.Drawing.Point(92, 15) + Me.txtRunningNumber.Location = New System.Drawing.Point(123, 50) Me.txtRunningNumber.MenuManager = Me.RibbonControl Me.txtRunningNumber.Name = "txtRunningNumber" - Me.txtRunningNumber.Size = New System.Drawing.Size(274, 20) + Me.txtRunningNumber.Size = New System.Drawing.Size(531, 20) Me.txtRunningNumber.StyleController = Me.LayoutControl1 Me.txtRunningNumber.TabIndex = 2 ' 'dateOrderDate ' Me.dateOrderDate.EditValue = Nothing - Me.dateOrderDate.Location = New System.Drawing.Point(486, 135) + Me.dateOrderDate.Location = New System.Drawing.Point(817, 170) Me.dateOrderDate.MenuManager = Me.RibbonControl Me.dateOrderDate.Name = "dateOrderDate" Me.dateOrderDate.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.dateOrderDate.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) - Me.dateOrderDate.Size = New System.Drawing.Size(96, 20) + Me.dateOrderDate.Size = New System.Drawing.Size(218, 20) Me.dateOrderDate.StyleController = Me.LayoutControl1 Me.dateOrderDate.TabIndex = 8 ' 'cmbMandator ' - Me.cmbMandator.Location = New System.Drawing.Point(92, 45) + Me.cmbMandator.Location = New System.Drawing.Point(123, 80) Me.cmbMandator.MenuManager = Me.RibbonControl Me.cmbMandator.Name = "cmbMandator" Me.cmbMandator.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.cmbMandator.Properties.NullText = "" Me.cmbMandator.Properties.PopupView = Me.SearchLookUpEdit1View - Me.cmbMandator.Size = New System.Drawing.Size(274, 20) + Me.cmbMandator.Size = New System.Drawing.Size(531, 20) Me.cmbMandator.StyleController = Me.LayoutControl1 Me.cmbMandator.TabIndex = 4 ' @@ -497,14 +528,14 @@ Partial Class frmMain ' 'cmbCustomer ' - Me.cmbCustomer.Location = New System.Drawing.Point(92, 75) + Me.cmbCustomer.Location = New System.Drawing.Point(123, 110) Me.cmbCustomer.MenuManager = Me.RibbonControl Me.cmbCustomer.Name = "cmbCustomer" Me.cmbCustomer.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.cmbCustomer.Properties.DisplayMember = "Name" Me.cmbCustomer.Properties.NullText = "" Me.cmbCustomer.Properties.PopupView = Me.GridView1 - Me.cmbCustomer.Size = New System.Drawing.Size(490, 20) + Me.cmbCustomer.Size = New System.Drawing.Size(403, 20) Me.cmbCustomer.StyleController = Me.LayoutControl1 Me.cmbCustomer.TabIndex = 10 ' @@ -517,14 +548,14 @@ Partial Class frmMain ' 'cmbDeliveryAddress ' - Me.cmbDeliveryAddress.Location = New System.Drawing.Point(92, 105) + Me.cmbDeliveryAddress.Location = New System.Drawing.Point(123, 140) Me.cmbDeliveryAddress.MenuManager = Me.RibbonControl Me.cmbDeliveryAddress.Name = "cmbDeliveryAddress" Me.cmbDeliveryAddress.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.cmbDeliveryAddress.Properties.NullText = "" Me.cmbDeliveryAddress.Properties.PopupSizeable = False Me.cmbDeliveryAddress.Properties.PopupView = Me.GridView2 - Me.cmbDeliveryAddress.Size = New System.Drawing.Size(490, 20) + Me.cmbDeliveryAddress.Size = New System.Drawing.Size(403, 20) Me.cmbDeliveryAddress.StyleController = Me.LayoutControl1 Me.cmbDeliveryAddress.TabIndex = 14 ' @@ -535,84 +566,58 @@ Partial Class frmMain Me.GridView2.OptionsSelection.EnableAppearanceFocusedCell = False Me.GridView2.OptionsView.ShowGroupPanel = False ' + 'cmbYears + ' + Me.cmbYears.Location = New System.Drawing.Point(760, 80) + Me.cmbYears.MenuManager = Me.RibbonControl + Me.cmbYears.Name = "cmbYears" + Me.cmbYears.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) + Me.cmbYears.Size = New System.Drawing.Size(275, 20) + Me.cmbYears.StyleController = Me.LayoutControl1 + Me.cmbYears.TabIndex = 15 + ' + 'txtCustomerGLN + ' + Me.txtCustomerGLN.Location = New System.Drawing.Point(632, 110) + Me.txtCustomerGLN.MenuManager = Me.RibbonControl + Me.txtCustomerGLN.Name = "txtCustomerGLN" + Me.txtCustomerGLN.Size = New System.Drawing.Size(403, 20) + Me.txtCustomerGLN.StyleController = Me.LayoutControl1 + Me.txtCustomerGLN.TabIndex = 16 + ' + 'txtDeliveryAddressGLN + ' + Me.txtDeliveryAddressGLN.Location = New System.Drawing.Point(632, 140) + Me.txtDeliveryAddressGLN.MenuManager = Me.RibbonControl + Me.txtDeliveryAddressGLN.Name = "txtDeliveryAddressGLN" + Me.txtDeliveryAddressGLN.Size = New System.Drawing.Size(403, 20) + Me.txtDeliveryAddressGLN.StyleController = Me.LayoutControl1 + Me.txtDeliveryAddressGLN.TabIndex = 17 + ' 'Root ' Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] Me.Root.GroupBordersVisible = False - Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutItemOrderIssuer, Me.LayoutControlItem3, Me.LayoutItemOrderNumber, Me.LayoutControlItem6, Me.LayoutControlItem9, Me.LayoutControlItem10, Me.LayoutControlItem11, Me.LayoutItemOrderDate, Me.LayoutControlItem8, Me.LayoutControlItem7, Me.LayoutControlItem1, Me.SimpleSeparator1, Me.LayoutControlItem2, Me.LayoutControlItem5, Me.LayoutControlItemRunningNumber, Me.LayoutControlItem4}) + Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.TabbedControlGroup2}) Me.Root.Name = "Root" Me.Root.Size = New System.Drawing.Size(1062, 275) Me.Root.TextVisible = False ' - 'LayoutItemOrderIssuer + 'TabbedControlGroup2 ' - Me.LayoutItemOrderIssuer.Control = Me.txtOrderIssuer - Me.LayoutItemOrderIssuer.Location = New System.Drawing.Point(0, 120) - Me.LayoutItemOrderIssuer.Name = "LayoutItemOrderIssuer" - Me.LayoutItemOrderIssuer.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutItemOrderIssuer.Size = New System.Drawing.Size(210, 30) - Me.LayoutItemOrderIssuer.Text = "Besteller" - Me.LayoutItemOrderIssuer.TextSize = New System.Drawing.Size(74, 13) + Me.TabbedControlGroup2.Location = New System.Drawing.Point(0, 0) + Me.TabbedControlGroup2.Name = "TabbedControlGroup2" + Me.TabbedControlGroup2.SelectedTabPage = Me.LayoutControlGroup2 + Me.TabbedControlGroup2.Size = New System.Drawing.Size(1042, 255) + Me.TabbedControlGroup2.TabPages.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlGroup2, Me.LayoutControlGroup1}) ' - 'LayoutControlItem3 + 'LayoutControlGroup2 ' - Me.LayoutControlItem3.Control = Me.MemoEdit1 - Me.LayoutControlItem3.Location = New System.Drawing.Point(0, 150) - Me.LayoutControlItem3.Name = "LayoutControlItem3" - Me.LayoutControlItem3.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem3.Size = New System.Drawing.Size(577, 105) - Me.LayoutControlItem3.Text = "Freitext" - Me.LayoutControlItem3.TextSize = New System.Drawing.Size(74, 13) - ' - 'LayoutItemOrderNumber - ' - Me.LayoutItemOrderNumber.Control = Me.txtOrderNumber - Me.LayoutItemOrderNumber.Location = New System.Drawing.Point(210, 120) - Me.LayoutItemOrderNumber.Name = "LayoutItemOrderNumber" - Me.LayoutItemOrderNumber.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutItemOrderNumber.Size = New System.Drawing.Size(184, 30) - Me.LayoutItemOrderNumber.Text = "Bestellnummer" - Me.LayoutItemOrderNumber.TextSize = New System.Drawing.Size(74, 13) - ' - 'LayoutControlItem6 - ' - Me.LayoutControlItem6.Control = Me.TextEdit5 - Me.LayoutControlItem6.Location = New System.Drawing.Point(578, 0) - Me.LayoutControlItem6.Name = "LayoutControlItem6" - Me.LayoutControlItem6.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem6.Size = New System.Drawing.Size(464, 30) - Me.LayoutControlItem6.Text = "Straße" - Me.LayoutControlItem6.TextSize = New System.Drawing.Size(74, 13) - ' - 'LayoutControlItem9 - ' - Me.LayoutControlItem9.Control = Me.TextEdit8 - Me.LayoutControlItem9.Location = New System.Drawing.Point(578, 60) - Me.LayoutControlItem9.Name = "LayoutControlItem9" - Me.LayoutControlItem9.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem9.Size = New System.Drawing.Size(464, 30) - Me.LayoutControlItem9.Text = "PLZ" - Me.LayoutControlItem9.TextSize = New System.Drawing.Size(74, 13) - ' - 'LayoutControlItem10 - ' - Me.LayoutControlItem10.Control = Me.TextEdit9 - Me.LayoutControlItem10.Location = New System.Drawing.Point(578, 120) - Me.LayoutControlItem10.Name = "LayoutControlItem10" - Me.LayoutControlItem10.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem10.Size = New System.Drawing.Size(464, 135) - Me.LayoutControlItem10.Text = "Kontakt" - Me.LayoutControlItem10.TextSize = New System.Drawing.Size(74, 13) - ' - 'LayoutControlItem11 - ' - Me.LayoutControlItem11.Control = Me.txtBELEGKEY - Me.LayoutControlItem11.Location = New System.Drawing.Point(361, 0) - Me.LayoutControlItem11.Name = "LayoutControlItem11" - Me.LayoutControlItem11.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem11.Size = New System.Drawing.Size(216, 30) - Me.LayoutControlItem11.Text = "BELEGKEY" - Me.LayoutControlItem11.TextSize = New System.Drawing.Size(74, 13) + Me.LayoutControlGroup2.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItemRunningNumber, Me.LayoutControlItem11, Me.LayoutControlItem4, Me.LayoutControlItem1, Me.LayoutControlItem5, Me.LayoutControlItem2, Me.LayoutItemOrderIssuer, Me.LayoutControlItem3, Me.LayoutItemOrderNumber, Me.LayoutItemOrderDate, Me.LayoutControlItem12, Me.LayoutControlItem13}) + Me.LayoutControlGroup2.Location = New System.Drawing.Point(0, 0) + Me.LayoutControlGroup2.Name = "LayoutControlGroup2" + Me.LayoutControlGroup2.Size = New System.Drawing.Size(1018, 208) + Me.LayoutControlGroup2.Text = "Basisdaten" ' 'LayoutControlItemRunningNumber ' @@ -620,39 +625,29 @@ Partial Class frmMain Me.LayoutControlItemRunningNumber.Location = New System.Drawing.Point(0, 0) Me.LayoutControlItemRunningNumber.Name = "LayoutControlItemRunningNumber" Me.LayoutControlItemRunningNumber.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItemRunningNumber.Size = New System.Drawing.Size(361, 30) + Me.LayoutControlItemRunningNumber.Size = New System.Drawing.Size(637, 30) Me.LayoutControlItemRunningNumber.Text = "Laufnummer" - Me.LayoutControlItemRunningNumber.TextSize = New System.Drawing.Size(74, 13) + Me.LayoutControlItemRunningNumber.TextSize = New System.Drawing.Size(93, 13) ' - 'LayoutItemOrderDate + 'LayoutControlItem11 ' - Me.LayoutItemOrderDate.Control = Me.dateOrderDate - Me.LayoutItemOrderDate.Location = New System.Drawing.Point(394, 120) - Me.LayoutItemOrderDate.Name = "LayoutItemOrderDate" - Me.LayoutItemOrderDate.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutItemOrderDate.Size = New System.Drawing.Size(183, 30) - Me.LayoutItemOrderDate.Text = "Bestelldatum" - Me.LayoutItemOrderDate.TextSize = New System.Drawing.Size(74, 13) + Me.LayoutControlItem11.Control = Me.txtBELEGKEY + Me.LayoutControlItem11.Location = New System.Drawing.Point(637, 0) + Me.LayoutControlItem11.Name = "LayoutControlItem11" + Me.LayoutControlItem11.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem11.Size = New System.Drawing.Size(381, 30) + Me.LayoutControlItem11.Text = "BELEGKEY" + Me.LayoutControlItem11.TextSize = New System.Drawing.Size(93, 13) ' - 'LayoutControlItem8 + 'LayoutControlItem4 ' - Me.LayoutControlItem8.Control = Me.TextEdit7 - Me.LayoutControlItem8.Location = New System.Drawing.Point(578, 90) - Me.LayoutControlItem8.Name = "LayoutControlItem8" - Me.LayoutControlItem8.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem8.Size = New System.Drawing.Size(464, 30) - Me.LayoutControlItem8.Text = "Ort" - Me.LayoutControlItem8.TextSize = New System.Drawing.Size(74, 13) - ' - 'LayoutControlItem7 - ' - Me.LayoutControlItem7.Control = Me.TextEdit6 - Me.LayoutControlItem7.Location = New System.Drawing.Point(578, 30) - Me.LayoutControlItem7.Name = "LayoutControlItem7" - Me.LayoutControlItem7.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem7.Size = New System.Drawing.Size(464, 30) - Me.LayoutControlItem7.Text = "Hausnummer" - Me.LayoutControlItem7.TextSize = New System.Drawing.Size(74, 13) + Me.LayoutControlItem4.Control = Me.cmbYears + Me.LayoutControlItem4.Location = New System.Drawing.Point(637, 30) + Me.LayoutControlItem4.Name = "LayoutControlItem4" + Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem4.Size = New System.Drawing.Size(381, 30) + Me.LayoutControlItem4.Text = "Wirtschaftsjahr" + Me.LayoutControlItem4.TextSize = New System.Drawing.Size(93, 13) ' 'LayoutControlItem1 ' @@ -660,26 +655,9 @@ Partial Class frmMain Me.LayoutControlItem1.Location = New System.Drawing.Point(0, 30) Me.LayoutControlItem1.Name = "LayoutControlItem1" Me.LayoutControlItem1.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem1.Size = New System.Drawing.Size(361, 30) + Me.LayoutControlItem1.Size = New System.Drawing.Size(637, 30) Me.LayoutControlItem1.Text = "Mandant" - Me.LayoutControlItem1.TextSize = New System.Drawing.Size(74, 13) - ' - 'SimpleSeparator1 - ' - Me.SimpleSeparator1.AllowHotTrack = False - Me.SimpleSeparator1.Location = New System.Drawing.Point(577, 0) - Me.SimpleSeparator1.Name = "SimpleSeparator1" - Me.SimpleSeparator1.Size = New System.Drawing.Size(1, 255) - ' - 'LayoutControlItem2 - ' - Me.LayoutControlItem2.Control = Me.cmbDeliveryAddress - Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 90) - Me.LayoutControlItem2.Name = "LayoutControlItem2" - Me.LayoutControlItem2.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem2.Size = New System.Drawing.Size(577, 30) - Me.LayoutControlItem2.Text = "Lieferadresse" - Me.LayoutControlItem2.TextSize = New System.Drawing.Size(74, 13) + Me.LayoutControlItem1.TextSize = New System.Drawing.Size(93, 13) ' 'LayoutControlItem5 ' @@ -687,9 +665,137 @@ Partial Class frmMain Me.LayoutControlItem5.Location = New System.Drawing.Point(0, 60) Me.LayoutControlItem5.Name = "LayoutControlItem5" Me.LayoutControlItem5.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem5.Size = New System.Drawing.Size(577, 30) + Me.LayoutControlItem5.Size = New System.Drawing.Size(509, 30) Me.LayoutControlItem5.Text = "Kunde" - Me.LayoutControlItem5.TextSize = New System.Drawing.Size(74, 13) + Me.LayoutControlItem5.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem2 + ' + Me.LayoutControlItem2.Control = Me.cmbDeliveryAddress + Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 90) + Me.LayoutControlItem2.Name = "LayoutControlItem2" + Me.LayoutControlItem2.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem2.Size = New System.Drawing.Size(509, 30) + Me.LayoutControlItem2.Text = "Lieferadresse" + Me.LayoutControlItem2.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutItemOrderIssuer + ' + Me.LayoutItemOrderIssuer.Control = Me.txtOrderIssuer + Me.LayoutItemOrderIssuer.Location = New System.Drawing.Point(0, 120) + Me.LayoutItemOrderIssuer.Name = "LayoutItemOrderIssuer" + Me.LayoutItemOrderIssuer.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutItemOrderIssuer.Size = New System.Drawing.Size(370, 30) + Me.LayoutItemOrderIssuer.Text = "Besteller" + Me.LayoutItemOrderIssuer.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem3 + ' + Me.LayoutControlItem3.Control = Me.MemoEdit1 + Me.LayoutControlItem3.Location = New System.Drawing.Point(0, 150) + Me.LayoutControlItem3.Name = "LayoutControlItem3" + Me.LayoutControlItem3.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem3.Size = New System.Drawing.Size(1018, 58) + Me.LayoutControlItem3.Text = "Freitext" + Me.LayoutControlItem3.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutItemOrderNumber + ' + Me.LayoutItemOrderNumber.Control = Me.txtOrderNumber + Me.LayoutItemOrderNumber.Location = New System.Drawing.Point(370, 120) + Me.LayoutItemOrderNumber.Name = "LayoutItemOrderNumber" + Me.LayoutItemOrderNumber.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutItemOrderNumber.Size = New System.Drawing.Size(324, 30) + Me.LayoutItemOrderNumber.Text = "Bestellnummer" + Me.LayoutItemOrderNumber.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutItemOrderDate + ' + Me.LayoutItemOrderDate.Control = Me.dateOrderDate + Me.LayoutItemOrderDate.Location = New System.Drawing.Point(694, 120) + Me.LayoutItemOrderDate.Name = "LayoutItemOrderDate" + Me.LayoutItemOrderDate.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutItemOrderDate.Size = New System.Drawing.Size(324, 30) + Me.LayoutItemOrderDate.Text = "Bestelldatum" + Me.LayoutItemOrderDate.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem12 + ' + Me.LayoutControlItem12.Control = Me.txtCustomerGLN + Me.LayoutControlItem12.Location = New System.Drawing.Point(509, 60) + Me.LayoutControlItem12.Name = "LayoutControlItem12" + Me.LayoutControlItem12.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem12.Size = New System.Drawing.Size(509, 30) + Me.LayoutControlItem12.Text = "Kunde GLN" + Me.LayoutControlItem12.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem13 + ' + Me.LayoutControlItem13.Control = Me.txtDeliveryAddressGLN + Me.LayoutControlItem13.Location = New System.Drawing.Point(509, 90) + Me.LayoutControlItem13.Name = "LayoutControlItem13" + Me.LayoutControlItem13.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem13.Size = New System.Drawing.Size(509, 30) + Me.LayoutControlItem13.Text = "Lieferaddresse GLN" + Me.LayoutControlItem13.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlGroup1 + ' + Me.LayoutControlGroup1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem10, Me.LayoutControlItem8, Me.LayoutControlItem9, Me.LayoutControlItem7, Me.LayoutControlItem6}) + Me.LayoutControlGroup1.Location = New System.Drawing.Point(0, 0) + Me.LayoutControlGroup1.Name = "LayoutControlGroup1" + Me.LayoutControlGroup1.Size = New System.Drawing.Size(1018, 208) + Me.LayoutControlGroup1.Text = "Diverse Adresse" + ' + 'LayoutControlItem10 + ' + Me.LayoutControlItem10.Control = Me.TextEdit9 + Me.LayoutControlItem10.Location = New System.Drawing.Point(0, 120) + Me.LayoutControlItem10.Name = "LayoutControlItem10" + Me.LayoutControlItem10.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem10.Size = New System.Drawing.Size(1018, 88) + Me.LayoutControlItem10.Text = "Kontakt" + Me.LayoutControlItem10.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem8 + ' + Me.LayoutControlItem8.Control = Me.TextEdit7 + Me.LayoutControlItem8.Location = New System.Drawing.Point(0, 90) + Me.LayoutControlItem8.Name = "LayoutControlItem8" + Me.LayoutControlItem8.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem8.Size = New System.Drawing.Size(1018, 30) + Me.LayoutControlItem8.Text = "Ort" + Me.LayoutControlItem8.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem9 + ' + Me.LayoutControlItem9.Control = Me.TextEdit8 + Me.LayoutControlItem9.Location = New System.Drawing.Point(0, 60) + Me.LayoutControlItem9.Name = "LayoutControlItem9" + Me.LayoutControlItem9.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem9.Size = New System.Drawing.Size(1018, 30) + Me.LayoutControlItem9.Text = "PLZ" + Me.LayoutControlItem9.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem7 + ' + Me.LayoutControlItem7.Control = Me.TextEdit6 + Me.LayoutControlItem7.Location = New System.Drawing.Point(0, 30) + Me.LayoutControlItem7.Name = "LayoutControlItem7" + Me.LayoutControlItem7.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem7.Size = New System.Drawing.Size(1018, 30) + Me.LayoutControlItem7.Text = "Hausnummer" + Me.LayoutControlItem7.TextSize = New System.Drawing.Size(93, 13) + ' + 'LayoutControlItem6 + ' + Me.LayoutControlItem6.Control = Me.TextEdit5 + Me.LayoutControlItem6.Location = New System.Drawing.Point(0, 0) + Me.LayoutControlItem6.Name = "LayoutControlItem6" + Me.LayoutControlItem6.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem6.Size = New System.Drawing.Size(1018, 30) + Me.LayoutControlItem6.Text = "Straße" + Me.LayoutControlItem6.TextSize = New System.Drawing.Size(93, 13) ' 'GridControlPositions ' @@ -698,7 +804,7 @@ Partial Class frmMain Me.GridControlPositions.MainView = Me.GridViewPositions Me.GridControlPositions.MenuManager = Me.RibbonControl Me.GridControlPositions.Name = "GridControlPositions" - Me.GridControlPositions.Size = New System.Drawing.Size(1062, 309) + Me.GridControlPositions.Size = New System.Drawing.Size(1062, 335) Me.GridControlPositions.TabIndex = 0 Me.GridControlPositions.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewPositions}) ' @@ -713,13 +819,13 @@ Partial Class frmMain Me.SplitContainerControl3.Collapsed = True Me.SplitContainerControl3.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2 Me.SplitContainerControl3.Dock = System.Windows.Forms.DockStyle.Fill - Me.SplitContainerControl3.Location = New System.Drawing.Point(0, 158) + Me.SplitContainerControl3.Location = New System.Drawing.Point(0, 132) Me.SplitContainerControl3.Name = "SplitContainerControl3" Me.SplitContainerControl3.Panel1.Controls.Add(Me.SplitContainerControl1) Me.SplitContainerControl3.Panel1.Text = "Panel1" Me.SplitContainerControl3.Panel2.Controls.Add(Me.RichEditXml) Me.SplitContainerControl3.Panel2.Text = "Panel2" - Me.SplitContainerControl3.Size = New System.Drawing.Size(1406, 594) + Me.SplitContainerControl3.Size = New System.Drawing.Size(1406, 620) Me.SplitContainerControl3.SplitterPosition = 1114 Me.SplitContainerControl3.TabIndex = 6 ' @@ -736,26 +842,6 @@ Partial Class frmMain Me.RichEditXml.Size = New System.Drawing.Size(0, 0) Me.RichEditXml.TabIndex = 0 ' - 'LayoutControlItem4 - ' - Me.LayoutControlItem4.Control = Me.cmbYears - Me.LayoutControlItem4.Location = New System.Drawing.Point(361, 30) - Me.LayoutControlItem4.Name = "LayoutControlItem4" - Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem4.Size = New System.Drawing.Size(216, 30) - Me.LayoutControlItem4.Text = "Wirtschaftsjahr" - Me.LayoutControlItem4.TextSize = New System.Drawing.Size(74, 13) - ' - 'cmbYears - ' - Me.cmbYears.Location = New System.Drawing.Point(453, 45) - Me.cmbYears.MenuManager = Me.RibbonControl - Me.cmbYears.Name = "cmbYears" - Me.cmbYears.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) - Me.cmbYears.Size = New System.Drawing.Size(129, 20) - Me.cmbYears.StyleController = Me.LayoutControl1 - Me.cmbYears.TabIndex = 15 - ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -764,6 +850,7 @@ Partial Class frmMain Me.Controls.Add(Me.SplitContainerControl3) Me.Controls.Add(Me.RibbonStatusBar) Me.Controls.Add(Me.RibbonControl) + Me.IconOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.tilelabels Me.Name = "frmMain" Me.Ribbon = Me.RibbonControl Me.StatusBar = Me.RibbonStatusBar @@ -795,28 +882,34 @@ Partial Class frmMain CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.cmbDeliveryAddress.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.cmbYears.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtCustomerGLN.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtDeliveryAddressGLN.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.TabbedControlGroup2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlGroup2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItemRunningNumber, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem11, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutItemOrderIssuer, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutItemOrderNumber, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem11, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItemRunningNumber, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutItemOrderDate, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem12, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem13, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.SimpleSeparator1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridControlPositions, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridViewPositions, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.SplitContainerControl3, System.ComponentModel.ISupportInitialize).EndInit() Me.SplitContainerControl3.ResumeLayout(False) - CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.cmbYears.Properties, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -835,34 +928,20 @@ Partial Class frmMain Friend WithEvents MemoEdit1 As DevExpress.XtraEditors.MemoEdit Friend WithEvents txtOrderNumber As DevExpress.XtraEditors.TextEdit Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup - Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents LayoutItemOrderIssuer As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents LayoutControlItem3 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents LayoutControlItem5 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents LayoutItemOrderNumber As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents GridControlPositions As DevExpress.XtraGrid.GridControl Friend WithEvents GridViewPositions As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents colFileName As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents colFilePath As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents TextEdit5 As DevExpress.XtraEditors.TextEdit - Friend WithEvents LayoutControlItem6 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents btnLoadDocuments As DevExpress.XtraBars.BarButtonItem Friend WithEvents TextEdit6 As DevExpress.XtraEditors.TextEdit Friend WithEvents TextEdit7 As DevExpress.XtraEditors.TextEdit Friend WithEvents TextEdit8 As DevExpress.XtraEditors.TextEdit - Friend WithEvents LayoutControlItem7 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents LayoutControlItem8 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents LayoutControlItem9 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents SimpleSeparator1 As DevExpress.XtraLayout.SimpleSeparator Friend WithEvents TextEdit9 As DevExpress.XtraEditors.TextEdit - Friend WithEvents LayoutControlItem10 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents txtBELEGKEY As DevExpress.XtraEditors.TextEdit - Friend WithEvents LayoutControlItem11 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents txtRunningNumber As DevExpress.XtraEditors.TextEdit - Friend WithEvents LayoutControlItemRunningNumber As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents dateOrderDate As DevExpress.XtraEditors.DateEdit - Friend WithEvents LayoutItemOrderDate As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents txtFilesLoaded As DevExpress.XtraBars.BarHeaderItem Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem @@ -878,7 +957,6 @@ Partial Class frmMain Friend WithEvents BarButtonItem4 As DevExpress.XtraBars.BarButtonItem Friend WithEvents cmbDeliveryAddress As DevExpress.XtraEditors.SearchLookUpEdit Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.Grid.GridView - Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents BarButtonItem5 As DevExpress.XtraBars.BarButtonItem Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents txtVersion As DevExpress.XtraBars.BarStaticItem @@ -887,5 +965,27 @@ Partial Class frmMain Friend WithEvents BarButtonItem7 As DevExpress.XtraBars.BarButtonItem Friend WithEvents colSelected As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents cmbYears As DevExpress.XtraEditors.ComboBoxEdit + Friend WithEvents TabbedControlGroup2 As DevExpress.XtraLayout.TabbedControlGroup + Friend WithEvents LayoutControlGroup2 As DevExpress.XtraLayout.LayoutControlGroup + Friend WithEvents LayoutControlItemRunningNumber As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem11 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents LayoutControlItem4 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem5 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutItemOrderIssuer As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem3 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutItemOrderNumber As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutItemOrderDate As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlGroup1 As DevExpress.XtraLayout.LayoutControlGroup + Friend WithEvents LayoutControlItem10 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem8 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem9 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem7 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem6 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents BarButtonItem8 As DevExpress.XtraBars.BarButtonItem + Friend WithEvents txtCustomerGLN As DevExpress.XtraEditors.TextEdit + Friend WithEvents txtDeliveryAddressGLN As DevExpress.XtraEditors.TextEdit + Friend WithEvents LayoutControlItem12 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem13 As DevExpress.XtraLayout.LayoutControlItem End Class diff --git a/EDIDocumentImport/frmMain.vb b/EDIDocumentImport/frmMain.vb index ef9edb3..3de139d 100644 --- a/EDIDocumentImport/frmMain.vb +++ b/EDIDocumentImport/frmMain.vb @@ -10,6 +10,7 @@ Imports DigitalData.Controls.SQLConfig Imports DigitalData.GUIs.Common Imports EDIDocumentImport.DocumentInfo Imports EDIDocumentImport.DocumentPositions +Imports DevExpress.XtraEditors Public Class frmMain Public LogConfig As LogConfig @@ -26,7 +27,6 @@ Public Class frmMain LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, "Digital Data", "EDI Document Importer") ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath, Application.CommonAppDataPath, Application.StartupPath) - ConfigManager.Save() Logger = LogConfig.GetLogger() ' If ConnectionString does not exist, show SQL Config Form @@ -45,7 +45,7 @@ Public Class frmMain ' Initialize Database Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString) Database = New MSSQLServer(LogConfig, oConnectionString) - Winline = New WinLineInfo(LogConfig, Database) + Winline = New WinLineInfo(LogConfig, Database, ConfigManager.Config) ' Load WinLine Data Winline.Mandators.Clear() @@ -64,12 +64,10 @@ Public Class frmMain ' Initialize Grids GridBuilder = New GridBuilder(New List(Of GridView) From {GridViewFiles, GridViewPositions}) - GridBuilder. - WithDefaults(). - WithReadOnlyOptions(GridViewFiles) + GridBuilder.WithDefaults() ' Construct classes related to the xml data - DocumentLoader = New DocumentLoader(LogConfig, ConfigManager.Config) + DocumentLoader = New DocumentLoader(LogConfig, ConfigManager.Config, Database, Winline) Catch ex As Exception Logger.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, Text) @@ -83,28 +81,34 @@ Public Class frmMain txtFilesLoaded.Caption = $"{DocumentLoader.Files.Count} Dokumente geladen" End If Catch ex As Exception - MsgBox(ex.Message, MsgBoxStyle.Critical, Text) + Dim oMessage = ex.Message + + If ex.InnerException IsNot Nothing Then + oMessage &= vbNewLine & vbNewLine & ex.InnerException.Message + End If + + MsgBox(oMessage, MsgBoxStyle.Critical, Text) End Try End Sub Private Sub GridViewFiles_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewFiles.FocusedRowChanged - Dim oFile As Document = GridViewFiles.GetRow(e.FocusedRowHandle) + Dim oDocument As Document = GridViewFiles.GetRow(e.FocusedRowHandle) - If oFile Is Nothing Then + If oDocument Is Nothing Then Exit Sub End If - RichEditXml.LoadDocument(oFile.FullName, DocumentFormat.PlainText) + RichEditXml.LoadDocument(oDocument.FullName, DocumentFormat.PlainText) Try - Select Case oFile.Type + Select Case oDocument.Type Case DocumentType.Order - 'ShowDocument(oFile.Data) + ShowDocument(oDocument, oDocument.Data, oDocument.DataOriginal) End Select Catch ex As Xml.XmlException - Dim oMessage As String = $"Fehler beim Verarbeiten des Dokuments {oFile.Name}:{vbNewLine}{ex.Message}" + Dim oMessage As String = $"Fehler beim Verarbeiten des Dokuments {oDocument.Name}:{vbNewLine}{ex.Message}" MsgBox(oMessage, MsgBoxStyle.Critical, Text) Logger.Error(ex) @@ -115,34 +119,83 @@ Public Class frmMain End Try End Sub - Private Sub ShowDocument(pDocument As Orders.MESOWebService) - ' ====== Head Data ====== - - Dim oHead As Orders.MESOWebServiceEXIMVRG_ordersT025 = pDocument.Items. + Private Sub ShowDocument(pDocument As Document, pData As Orders.MESOWebService, pDataOriginal As Orders.MESOWebService) + Dim oHead As Orders.MESOWebServiceEXIMVRG_ordersT025 = pData.Items. Where(Function(i) TypeOf i Is Orders.MESOWebServiceEXIMVRG_ordersT025). FirstOrDefault() + Dim oHeadOriginal As Orders.MESOWebServiceEXIMVRG_ordersT025 = pDataOriginal.Items. + Where(Function(i) TypeOf i Is Orders.MESOWebServiceEXIMVRG_ordersT025). + FirstOrDefault() + + Dim oPositions As List(Of Orders.MESOWebServiceEXIMVRG_ordersT026) = pData.Items. + Where(Function(i) TypeOf i Is Orders.MESOWebServiceEXIMVRG_ordersT026). + Select(Of Orders.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i). + ToList() + + Dim oPositionsOriginal As List(Of Orders.MESOWebServiceEXIMVRG_ordersT026) = pDataOriginal.Items. + Where(Function(i) TypeOf i Is Orders.MESOWebServiceEXIMVRG_ordersT026). + Select(Of Orders.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i). + ToList() + + ' ====== Head Data ====== + + ' Original, Unreplaced Data + txtCustomerGLN.Text = oHeadOriginal.Fakt_Kontonummer + txtDeliveryAddressGLN.Text = oHeadOriginal.Lief_Kontonummer + + ' Regular Data from EDI txtBELEGKEY.Text = oHead.BELEGKEY txtRunningNumber.Text = oHead.Laufnummer txtOrderIssuer.Text = oHead.Fakt_Ansprechpartner txtOrderNumber.Text = oHead.AuftragsBestellnummer dateOrderDate.EditValue = oHead.Datum_AuftragBestellung - cmbMandator.EditValue = Winline.Mandators. - Where(Function(m) m.Id = "SIVT"). - SingleOrDefault() - cmbCustomer.EditValue = Winline.Accounts. - Where(Function(m) m.Id = oHead.Fakt_Kontonummer). + + Dim oMandator = Winline.Mandators. + Where(Function(m) m.Id = pDocument.Mandator.Id). SingleOrDefault() + If oMandator Is Nothing Then + cmbMandator.ErrorText = "Dieses Feld muss ausgefüllt werden!" + cmbMandator.EditValue = Nothing + Else + cmbMandator.EditValue = oMandator + End If + + If oHead.Fakt_Kontonummer = oHeadOriginal.Fakt_Kontonummer Then + cmbCustomer.ErrorText = "Dieses Feld muss ausgefüllt werden!" + cmbCustomer.EditValue = Nothing + Else + cmbCustomer.EditValue = Winline.Accounts. + Where(Function(oAccount) oAccount.Id = oHead.Fakt_Kontonummer And oAccount.Mandator = cmbMandator.EditValue). + SingleOrDefault() + End If + + If oHead.Lief_Kontonummer = oHeadOriginal.Lief_Kontonummer Then + cmbDeliveryAddress.ErrorText = "Dieses Feld muss ausgefüllt werden!" + cmbDeliveryAddress.EditValue = Nothing + Else + cmbDeliveryAddress.EditValue = Winline.Accounts. + Where(Function(oAccount) oAccount.Id = oHead.Lief_Kontonummer And oAccount.Mandator = cmbMandator.EditValue). + SingleOrDefault() + End If + + ' TODO + 'cmbMandator.EditValue = Winline.Mandators. + ' Where(Function(m) m.Id = "SIVT"). + ' SingleOrDefault() + 'cmbCustomer.EditValue = Winline.Accounts. + ' Where(Function(oAccount) oAccount.Id = oHead.Fakt_Kontonummer And oAccount.Mandator = cmbMandator.EditValue). + ' SingleOrDefault() + ' ====== Position Data ====== - Dim oPositions As List(Of Orders.MESOWebServiceEXIMVRG_ordersT026) = pDocument.Items. - Where(Function(i) TypeOf i Is Orders.MESOWebServiceEXIMVRG_ordersT026). - Select(Of Orders.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i). - ToList() - Dim oPositionList As New List(Of OrderPosition) For Each oPosition In oPositions + Dim oPositionOriginal = oPositionsOriginal. + Where(Function(p) p.Zeilennummer = oPosition.Zeilennummer). + SingleOrDefault() + oPositionList.Add(New OrderPosition With { .ArticleNumber = oPosition.Artikelnummer, .RowNumber = oPosition.Zeilennummer, @@ -151,24 +204,28 @@ Public Class frmMain .EDIPrice = oPosition.Einzelpreis, .WinLinePrice = 0, .Price = 0, - .Amount = oPosition.Menge_bestellt + .Amount = oPosition.Menge_bestellt, + .EuropeanArticleNumber = oPositionOriginal.Artikelnummer }) Next LoadViewAndColumns(GridViewPositions, DocumentType.Order) GridControlPositions.DataSource = oPositionList - End Sub + GridViewPositions.BestFitColumns() + End Sub Public Sub LoadViewAndColumns(pView As GridView, pDocumentType As DocumentType) Dim oColumns As List(Of GridColumn) + ' Create columns list depending on DocumentType Select Case pDocumentType Case DocumentType.Order oColumns = New List(Of GridColumn) From { ColumnRowNumber, ColumnArticleNumber, ColumnArticleNumberVendor, + ColumnEuropeanArticleNumber, ColumnArticleDescription, ColumnEDIPrice, ColumnWinLinePrice, @@ -179,15 +236,29 @@ Public Class frmMain oColumns = New List(Of GridColumn) End Select + ' Reset the grid pView.GridControl.DataSource = Nothing pView.GridControl.ForceInitialize() + ' Add and adjust columns pView.Columns.AddRange(oColumns.ToArray()) pView.BestFitColumns() + + ' Set columns readonly that need it + Dim oReadOnlyColumns = oColumns. + Except(DocumentPositions.WritableColumns). + ToList() + + For Each oColumn As GridColumn In GridViewPositions.Columns + If oReadOnlyColumns.Contains(oColumn) Then + oColumn.OptionsColumn.ReadOnly = True + oColumn.OptionsColumn.AllowEdit = False + Else + oColumn.Caption &= " *" + End If + Next End Sub - - Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick Process.Start(ConfigManager.Config.InputDirectory) End Sub @@ -208,4 +279,16 @@ Public Class frmMain Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick MsgBox("Mach et!") End Sub + + Private Sub BarButtonItem8_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem8.ItemClick + Process.Start(LogConfig.LogDirectory) + End Sub + + Private Sub cmbAccount_Validating(sender As BaseEdit, e As System.ComponentModel.CancelEventArgs) Handles cmbCustomer.Validating, cmbDeliveryAddress.Validating + If sender.EditValue Is Nothing Then + sender.ErrorText = "Dieses Feld muss ausgefüllt werden!" + Else + sender.ErrorText = "" + End If + End Sub End Class \ No newline at end of file