Refactor: Add ImporterShared Project
This commit is contained in:
parent
3abf4b6e87
commit
55e921eb21
@ -1,68 +0,0 @@
|
||||
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 Data As Object
|
||||
Public DataOriginal As Object
|
||||
Public DataOutput As Object
|
||||
Public DataString As String
|
||||
|
||||
Public Selected As Boolean = False
|
||||
|
||||
Public ReadOnly Property FullName As String
|
||||
Get
|
||||
Return File?.FullName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Name As String
|
||||
Get
|
||||
Return File?.Name
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
|
||||
Enum DocumentType
|
||||
Order ' Auftrag
|
||||
OrderResponse ' Bestellbestätigung
|
||||
DispatchNotification ' Lieferavis/ Eingangs Lieferschein
|
||||
Invoice ' Rechnung
|
||||
End Enum
|
||||
|
||||
Public Class SchemaTypes
|
||||
Public Property RootSchemaType As Type
|
||||
Public Property HeadSchemaType As Type
|
||||
Public Property PositionSchemaType As Type
|
||||
End Class
|
||||
|
||||
Public Shared Property TypeMatchingTable As New Dictionary(Of String, DocumentType) From {
|
||||
{"orders", DocumentType.Order},
|
||||
{"ordrsp", DocumentType.OrderResponse},
|
||||
{"desadv", DocumentType.DispatchNotification},
|
||||
{"invoic", DocumentType.Invoice}
|
||||
}
|
||||
|
||||
Public Shared Property SchemaMatchingTable As New Dictionary(Of DocumentType, Type) From {
|
||||
{DocumentType.Order, GetType(Orders.Input.MESOWebService)}
|
||||
}
|
||||
|
||||
Public Shared Function GetDocumentTypeFromTemplateName(pTemplateName As String) As DocumentType
|
||||
Return TypeMatchingTable.
|
||||
Where(Function(kv) pTemplateName.Contains(kv.Key)).
|
||||
Select(Function(kv) kv.Value).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
|
||||
Public Shared Function GetDocumentSchemaFromDocumentType(pDocumentType As DocumentType) As Type
|
||||
Return SchemaMatchingTable.
|
||||
Where(Function(kv) pDocumentType = kv.Key).
|
||||
Select(Function(kv) kv.Value).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
End Class
|
||||
@ -1,242 +0,0 @@
|
||||
Imports System.IO
|
||||
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
|
||||
|
||||
Private ReadOnly Config As Config
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly Winline As WinLineInfo
|
||||
Private ReadOnly Serializer As Serializer
|
||||
|
||||
Public Files As New List(Of Document)
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pConfig As Config, pDatabase As MSSQLServer, pWinline As WinLineInfo)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
Serializer = New Serializer(pLogConfig)
|
||||
Config = pConfig
|
||||
Database = pDatabase
|
||||
Winline = pWinline
|
||||
End Sub
|
||||
|
||||
Public Function LoadFiles() As Boolean
|
||||
If Config.InputDirectory = String.Empty Then
|
||||
Throw New ArgumentNullException("InputDirectory")
|
||||
End If
|
||||
|
||||
Logger.Info("Loading files from directory [{0}]", Config.InputDirectory)
|
||||
|
||||
Try
|
||||
Dim oDirectory As New DirectoryInfo(Config.InputDirectory)
|
||||
Dim oFiles = oDirectory.GetFiles()
|
||||
|
||||
Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory)
|
||||
|
||||
Files = oFiles.
|
||||
Select(AddressOf WrapFileInfo).
|
||||
Select(AddressOf LoadDocumentData).
|
||||
Select(Function(oDocument)
|
||||
Return MatchDataFromWinLine(oDocument, Winline.Mandators)
|
||||
End Function).
|
||||
ToList()
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw New IO.IOException($"Could not load files from directory {Config.InputDirectory}", ex)
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function FindMatchingMandatorFromOrder(pData As Orders.Input.MESOWebService) As Mandator
|
||||
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 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.Input.MESOWebService Then
|
||||
Dim oMandator = FindMatchingMandatorFromOrder(pDocument.Data)
|
||||
Dim oData As Orders.Input.MESOWebService = MatchOrderData(pDocument.Data, oMandator)
|
||||
|
||||
If oMandator Is Nothing Then
|
||||
Logger.Warn("Mandator not found for File [{0}]", pDocument.File.Name)
|
||||
End If
|
||||
|
||||
pDocument.Mandator = oMandator
|
||||
pDocument.Data = oData
|
||||
End If
|
||||
|
||||
Return pDocument
|
||||
End Function
|
||||
|
||||
Private Function MatchOrderData(pData As Orders.Input.MESOWebService, pMandator As WinLineInfo.Mandator) As Orders.Input.MESOWebService
|
||||
Dim oYear = Winline.GetWinLineYear()
|
||||
|
||||
If pMandator Is Nothing Then
|
||||
Return pData
|
||||
End If
|
||||
|
||||
Dim oHead As Orders.Input.MESOWebServiceEXIMVRG_ordersT025 = pData.Items.
|
||||
Where(Function(h) TypeOf h Is Orders.Input.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.Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items.
|
||||
Where(Function(p) TypeOf p Is Orders.Input.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.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
|
||||
ToList()
|
||||
|
||||
|
||||
pData.Items = New List(Of Object) From {oHead}.
|
||||
Concat(oPositions).
|
||||
ToArray()
|
||||
|
||||
Return pData
|
||||
End Function
|
||||
Private Function WrapFileInfo(pFileInfo As FileInfo) As Document
|
||||
Return New Document With {.File = pFileInfo}
|
||||
End Function
|
||||
Private Function LoadDocumentData(pDocument As Document) As Document
|
||||
Using oFileStream As New FileStream(pDocument.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)
|
||||
Try
|
||||
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 oSerializer = Serializer.GetSerializer(oSchemaType)
|
||||
pDocument.Data = oSerializer.Deserialize(oReader)
|
||||
|
||||
End Using
|
||||
|
||||
' Read data the second time, archive copy
|
||||
Using oReader = oNavigator.ReadSubtree()
|
||||
Dim oSerializer = Serializer.GetSerializer(oSchemaType)
|
||||
pDocument.DataOriginal = oSerializer.Deserialize(oReader)
|
||||
|
||||
End Using
|
||||
|
||||
pDocument.Type = oDocumentType
|
||||
Return pDocument
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
|
||||
Dim oException As Exception = ex
|
||||
If ex.InnerException IsNot Nothing Then
|
||||
oException = ex.InnerException
|
||||
End If
|
||||
|
||||
Throw oException
|
||||
End Try
|
||||
End Using
|
||||
End Function
|
||||
|
||||
Private Function GetTemplateName(pDocument As XPathNavigator) As String
|
||||
Dim oTemplateName = pDocument.
|
||||
SelectSingleNode("//MESOWebService").
|
||||
GetAttribute("Template", "")
|
||||
|
||||
Return oTemplateName
|
||||
End Function
|
||||
End Class
|
||||
9
EDIDocumentImport/Exceptions.vb
Normal file
9
EDIDocumentImport/Exceptions.vb
Normal file
@ -0,0 +1,9 @@
|
||||
Public Class Exceptions
|
||||
Public Class NoMandatorException
|
||||
Inherits ApplicationException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
End Class
|
||||
@ -6,9 +6,9 @@
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7AAEC958-955D-4F77-964C-38658684E424}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<StartupObject>EDIDocumentImport.My.MyApplication</StartupObject>
|
||||
<RootNamespace>EDIDocumentImport</RootNamespace>
|
||||
<AssemblyName>EDIDocumentImport</AssemblyName>
|
||||
<StartupObject>ImporterForm.My.MyApplication</StartupObject>
|
||||
<RootNamespace>ImporterForm</RootNamespace>
|
||||
<AssemblyName>ImporterForm</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
@ -22,7 +22,7 @@
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>EDIDocumentImport.xml</DocumentationFile>
|
||||
<DocumentationFile>ImporterForm.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
@ -32,7 +32,7 @@
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>EDIDocumentImport.xml</DocumentationFile>
|
||||
<DocumentationFile>ImporterForm.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
@ -148,18 +148,14 @@
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Base.vb" />
|
||||
<Compile Include="Config.vb" />
|
||||
<Compile Include="DocumentInfo.vb" />
|
||||
<Compile Include="DocumentPositions.vb" />
|
||||
<Compile Include="DocumentLoader.vb" />
|
||||
<Compile Include="Exceptions.vb" />
|
||||
<Compile Include="frmMain.Designer.vb">
|
||||
<DependentUpon>frmMain.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="frmMain.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IEnumerableEx.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
@ -182,12 +178,6 @@
|
||||
<Compile Include="Reports\OrderReport.vb">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Schemas\Orders\ReportSource.vb" />
|
||||
<Compile Include="Schemas\Orders\Input.vb" />
|
||||
<Compile Include="Schemas\Orders\Output.vb" />
|
||||
<Compile Include="Serializer.vb" />
|
||||
<Compile Include="WinLineInfo.vb" />
|
||||
<Compile Include="WinLineWebService.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="frmMain.resx">
|
||||
@ -237,7 +227,10 @@
|
||||
<None Include="Resources\import.svg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Document\" />
|
||||
<ProjectReference Include="..\ImporterShared\ImporterShared.vbproj">
|
||||
<Project>{dd1ac3b9-7595-4d3c-b9bb-97c46a480fa0}</Project>
|
||||
<Name>ImporterShared</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@ -32,7 +32,7 @@ Namespace My
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.EDIDocumentImport.frmMain
|
||||
Me.MainForm = Global.ImporterForm.frmMain
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
@ -39,7 +39,7 @@ Namespace My.Resources
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("EDIDocumentImport.Resources", GetType(Resources).Assembly)
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ImporterForm.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
|
||||
76
EDIDocumentImport/My Project/Settings.Designer.vb
generated
76
EDIDocumentImport/My Project/Settings.Designer.vb
generated
@ -1,10 +1,10 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
@ -13,42 +13,42 @@ Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
|
||||
|
||||
#Region "Automatische My.Settings-Speicherfunktion"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
@ -57,16 +57,16 @@ Namespace My
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.EDIDocumentImport.My.MySettings
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.ImporterForm.My.MySettings
|
||||
Get
|
||||
Return Global.EDIDocumentImport.My.MySettings.Default
|
||||
Return Global.ImporterForm.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
|
||||
@ -701,7 +701,7 @@ Partial Public Class OrderReport
|
||||
'
|
||||
'ObjectDataSource1
|
||||
'
|
||||
Me.ObjectDataSource1.DataSource = GetType(EDIDocumentImport.Orders.ReportSource)
|
||||
Me.ObjectDataSource1.DataSource = GetType(ImporterShared.Schemas.Orders.ReportSource)
|
||||
Me.ObjectDataSource1.Name = "ObjectDataSource1"
|
||||
'
|
||||
'OrderReport2
|
||||
|
||||
@ -1,201 +0,0 @@
|
||||
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
|
||||
Public Property Mandator As String
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{Name} ({Id})"
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Class Mandator
|
||||
Public Property Id As String
|
||||
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, 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)
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Accounts.Add(New Account With {
|
||||
.Id = oRow.Item("c002"),
|
||||
.Name = oRow.Item("c003"),
|
||||
.Mandator = pMandator.Id
|
||||
})
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Sub LoadMandators()
|
||||
Dim oSQL = "SELECT [c000], [c003], [c004] FROM [cwlsystem].[dbo].[T001SRV] (NOLOCK)"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
Mandators.Clear()
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oDbInfo = SplitConnectionInfo(oRow)
|
||||
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
|
||||
|
||||
Public Sub LoadEconomicYears()
|
||||
Dim oCurrentYear = Now.Year
|
||||
Dim oRange As IEnumerable(Of Integer) = Enumerable.Range(oCurrentYear - 10, 12).ToList()
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' Turns a database info like "CWLDATEN on SERVER\INSTANCE" into a Tuple of two strings
|
||||
''' </summary>
|
||||
''' <param name="pRow"></param>
|
||||
''' <returns></returns>
|
||||
Private Function SplitConnectionInfo(pRow As DataRow) As Tuple(Of String, String)
|
||||
Dim oDbInfo = pRow.Item("c004").ToString()
|
||||
Dim oSplittedInfo = SplitAtString(oDbInfo.ToUpper, "ON")
|
||||
Dim oServer = oSplittedInfo.Item(1).Trim()
|
||||
|
||||
Dim oDatabase = oSplittedInfo.Item(0).Trim()
|
||||
If oDatabase.StartsWith("SQL") Then
|
||||
oDatabase = oDatabase.Remove(0, 3)
|
||||
End If
|
||||
|
||||
Return New Tuple(Of String, String)(oDatabase, oServer)
|
||||
End Function
|
||||
|
||||
Private Function SplitAtString(pStringToSplit As String, pDelimiter As String) As List(Of String)
|
||||
Dim oDelimiter As String() = New String(0) {pDelimiter}
|
||||
Return pStringToSplit.
|
||||
Split(oDelimiter, StringSplitOptions.None).
|
||||
ToList()
|
||||
End Function
|
||||
End Class
|
||||
@ -1,139 +0,0 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports AutoMapper
|
||||
Imports AutoMapper.Configuration
|
||||
Imports System.Globalization
|
||||
Imports System.Xml.Serialization
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports System.Net
|
||||
|
||||
Public Class WinLineWebService
|
||||
Inherits Base
|
||||
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly Config As Config
|
||||
Private ReadOnly Serializer As Serializer
|
||||
Private ReadOnly Mapper As AutoMapper.Mapper
|
||||
Private ReadOnly MapperConfig As MapperConfiguration
|
||||
Private ReadOnly FileEx As DigitalData.Modules.Filesystem.File
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As Config)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
FileEx = New DigitalData.Modules.Filesystem.File(pLogConfig)
|
||||
Serializer = New Serializer(pLogConfig)
|
||||
Database = pDatabase
|
||||
Config = pConfig
|
||||
MapperConfig = New MapperConfiguration(CreateMapperConfig())
|
||||
MapperConfig.AssertConfigurationIsValid()
|
||||
Mapper = MapperConfig.CreateMapper()
|
||||
End Sub
|
||||
|
||||
Private Function CreateMapperConfig() As MapperConfigurationExpression
|
||||
Dim oConfig As New MapperConfigurationExpression()
|
||||
|
||||
oConfig.CreateMap(Of String, Integer)().ConvertUsing(New IntegerTypeConverter())
|
||||
oConfig.CreateMap(Of String, Decimal)().ConvertUsing(New DecimalTypeConverter())
|
||||
oConfig.CreateMap(Of String, DateTime)().ConvertUsing(New DateTimeTypeConverter())
|
||||
oConfig.CreateMap(Of Orders.Input.MESOWebService, Orders.Output.MESOWebService)()
|
||||
oConfig.CreateMap(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT025, Orders.Output.MESOWebServiceEXIMVRG_ordersT025)()
|
||||
oConfig.CreateMap(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026, Orders.Output.MESOWebServiceEXIMVRG_ordersT026)()
|
||||
|
||||
Return oConfig
|
||||
End Function
|
||||
|
||||
Public Function TransferDocumentToWinLine(pDocument As DocumentInfo.Document) As Boolean
|
||||
If TypeOf pDocument.Data Is Orders.Input.MESOWebService Then
|
||||
TransferOrderToWinline(pDocument)
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function TransferOrderToWinline(pDocument As DocumentInfo.Document)
|
||||
Dim oOrderOutput = TransformOrderToOutput(pDocument.Data)
|
||||
Dim oWS As Config.WebServiceConfig = Config.Webservice
|
||||
Dim oFilePath = SerializeOrder(oOrderOutput)
|
||||
Dim oXmlString = IO.File.ReadAllText(oFilePath)
|
||||
pDocument.DataOutput = oOrderOutput
|
||||
|
||||
Dim oURL As String = $"{oWS.BaseUrl}/ewlservice/import?User={oWS.Username}&Password={oWS.Password}&Company={pDocument.Mandator.Id}&Type=30&Vorlage=EXIM-VRG_orders&ActionCode=1&Byref=0Data={oXmlString}"
|
||||
Dim oRequest = WebRequest.Create(oURL)
|
||||
oRequest.Method = "POST"
|
||||
|
||||
Logger.Info("Creating HTTP Request to [{0}]", oWS.BaseUrl)
|
||||
|
||||
' TODO: Make better lol
|
||||
|
||||
Using oResponse = oRequest.GetResponse()
|
||||
Using oStream = oResponse.GetResponseStream()
|
||||
Using oReader As New StreamReader(oStream)
|
||||
Dim oData = oReader.ReadToEnd()
|
||||
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function TransformOrderToOutput(pData As Orders.Input.MESOWebService) As Orders.Output.MESOWebService
|
||||
Dim oData As Orders.Input.MESOWebService = pData
|
||||
Dim oResult As Orders.Output.MESOWebService = Mapper.Map(Of Orders.Output.MESOWebService)(oData)
|
||||
|
||||
Dim oItems = oData.Items.
|
||||
Select(Function(i)
|
||||
If TypeOf i Is Orders.Input.MESOWebServiceEXIMVRG_ordersT025 Then
|
||||
Return Mapper.Map(Of Orders.Output.MESOWebServiceEXIMVRG_ordersT025)(i)
|
||||
Else
|
||||
Return Mapper.Map(Of Orders.Output.MESOWebServiceEXIMVRG_ordersT026)(i)
|
||||
End If
|
||||
End Function).
|
||||
ToList()
|
||||
|
||||
oResult.Items = oItems.ToArray()
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Function SerializeOrder(pData As Orders.Output.MESOWebService) As String
|
||||
Dim oSerializer = Serializer.GetSerializer(GetType(Orders.Output.MESOWebService))
|
||||
Dim oSettings As New XmlWriterSettings With {
|
||||
.Indent = True
|
||||
}
|
||||
|
||||
Dim oPath As String = Path.Combine(FileEx.GetAppDataPath("Digital Data", "EDI Document Importer"), "WebService")
|
||||
Dim oFileName As String = $"{Now:yyyy-MM-dd-f}.xml"
|
||||
Dim oFilePath As String = Path.Combine(oPath, oFileName)
|
||||
|
||||
If Directory.Exists(oPath) = False Then
|
||||
Directory.CreateDirectory(oPath)
|
||||
End If
|
||||
|
||||
Using oWriter = XmlWriter.Create(oFilePath, oSettings)
|
||||
oSerializer.Serialize(oWriter, pData)
|
||||
End Using
|
||||
|
||||
Return oFilePath
|
||||
End Function
|
||||
|
||||
Private Class DateTimeTypeConverter
|
||||
Implements ITypeConverter(Of String, DateTime)
|
||||
|
||||
Public Function Convert(source As String, destination As Date, context As ResolutionContext) As Date Implements ITypeConverter(Of String, Date).Convert
|
||||
Return System.Convert.ToDateTime(source)
|
||||
End Function
|
||||
End Class
|
||||
Private Class IntegerTypeConverter
|
||||
Implements ITypeConverter(Of String, Integer)
|
||||
Public Function Convert(source As String, destination As Integer, context As ResolutionContext) As Integer Implements ITypeConverter(Of String, Integer).Convert
|
||||
Return System.Convert.ToInt32(source)
|
||||
End Function
|
||||
End Class
|
||||
Private Class DecimalTypeConverter
|
||||
Implements ITypeConverter(Of String, Decimal)
|
||||
Public Function Convert(source As String, destination As Decimal, context As ResolutionContext) As Decimal Implements ITypeConverter(Of String, Decimal).Convert
|
||||
Return System.Convert.ToDecimal(source, CultureInfo.InvariantCulture)
|
||||
End Function
|
||||
End Class
|
||||
End Class
|
||||
26
EDIDocumentImport/frmMain.Designer.vb
generated
26
EDIDocumentImport/frmMain.Designer.vb
generated
@ -177,7 +177,7 @@ Partial Class frmMain
|
||||
'
|
||||
Me.btnLoadDocuments.Caption = "Dokumente einlesen"
|
||||
Me.btnLoadDocuments.Id = 1
|
||||
Me.btnLoadDocuments.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.import
|
||||
Me.btnLoadDocuments.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.import
|
||||
Me.btnLoadDocuments.Name = "btnLoadDocuments"
|
||||
'
|
||||
'txtFilesLoaded
|
||||
@ -190,42 +190,42 @@ Partial Class frmMain
|
||||
'
|
||||
Me.BarButtonItem1.Caption = "Eingangsverzeichnis öffnen"
|
||||
Me.BarButtonItem1.Id = 5
|
||||
Me.BarButtonItem1.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.open2
|
||||
Me.BarButtonItem1.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.open2
|
||||
Me.BarButtonItem1.Name = "BarButtonItem1"
|
||||
'
|
||||
'BarButtonItem2
|
||||
'
|
||||
Me.BarButtonItem2.Caption = "Ausgangsverzeichnis öffnen"
|
||||
Me.BarButtonItem2.Id = 6
|
||||
Me.BarButtonItem2.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.open
|
||||
Me.BarButtonItem2.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.open
|
||||
Me.BarButtonItem2.Name = "BarButtonItem2"
|
||||
'
|
||||
'BarButtonItem3
|
||||
'
|
||||
Me.BarButtonItem3.Caption = "Konfigurationsverzeichnis öffnen"
|
||||
Me.BarButtonItem3.Id = 7
|
||||
Me.BarButtonItem3.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.pagesetup
|
||||
Me.BarButtonItem3.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.pagesetup
|
||||
Me.BarButtonItem3.Name = "BarButtonItem3"
|
||||
'
|
||||
'checkShowXml
|
||||
'
|
||||
Me.checkShowXml.Caption = "XML Datei anzeigen"
|
||||
Me.checkShowXml.Id = 9
|
||||
Me.checkShowXml.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.showallfieldcodes
|
||||
Me.checkShowXml.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.showallfieldcodes
|
||||
Me.checkShowXml.Name = "checkShowXml"
|
||||
'
|
||||
'BarButtonItem4
|
||||
'
|
||||
Me.BarButtonItem4.Caption = "Aktuelle Zeile übermitteln"
|
||||
Me.BarButtonItem4.Id = 10
|
||||
Me.BarButtonItem4.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.bo_validation
|
||||
Me.BarButtonItem4.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.bo_validation
|
||||
Me.BarButtonItem4.Name = "BarButtonItem4"
|
||||
'
|
||||
'BarButtonItem5
|
||||
'
|
||||
Me.BarButtonItem5.Caption = "Markierte Zeilen übermitteln"
|
||||
Me.BarButtonItem5.Id = 11
|
||||
Me.BarButtonItem5.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.itemtypechecked
|
||||
Me.BarButtonItem5.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.itemtypechecked
|
||||
Me.BarButtonItem5.Name = "BarButtonItem5"
|
||||
'
|
||||
'txtVersion
|
||||
@ -239,28 +239,28 @@ Partial Class frmMain
|
||||
'
|
||||
Me.BarButtonItem6.Caption = "Zeile löschen"
|
||||
Me.BarButtonItem6.Id = 13
|
||||
Me.BarButtonItem6.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.deletetablerows
|
||||
Me.BarButtonItem6.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.deletetablerows
|
||||
Me.BarButtonItem6.Name = "BarButtonItem6"
|
||||
'
|
||||
'BarButtonItem7
|
||||
'
|
||||
Me.BarButtonItem7.Caption = "Artikel ersetzen"
|
||||
Me.BarButtonItem7.Id = 14
|
||||
Me.BarButtonItem7.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.tableproperties
|
||||
Me.BarButtonItem7.ImageOptions.SvgImage = Global.ImporterForm.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.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.singlepageview
|
||||
Me.BarButtonItem8.Name = "BarButtonItem8"
|
||||
'
|
||||
'btnPreviewReport
|
||||
'
|
||||
Me.btnPreviewReport.Caption = "Belegvorschau für aktuelle Zeile öffnen"
|
||||
Me.btnPreviewReport.Id = 16
|
||||
Me.btnPreviewReport.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.preview
|
||||
Me.btnPreviewReport.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.preview
|
||||
Me.btnPreviewReport.Name = "btnPreviewReport"
|
||||
'
|
||||
'btnReportPreview
|
||||
@ -273,7 +273,7 @@ Partial Class frmMain
|
||||
'
|
||||
Me.btnReloadDocument.Caption = "Aktuelles Dokument erneut laden"
|
||||
Me.btnReloadDocument.Id = 18
|
||||
Me.btnReloadDocument.ImageOptions.SvgImage = Global.EDIDocumentImport.My.Resources.Resources.paymentrefund
|
||||
Me.btnReloadDocument.ImageOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.paymentrefund
|
||||
Me.btnReloadDocument.Name = "btnReloadDocument"
|
||||
'
|
||||
'RibbonPage1
|
||||
@ -907,7 +907,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.IconOptions.SvgImage = Global.ImporterForm.My.Resources.Resources.tilelabels
|
||||
Me.Name = "frmMain"
|
||||
Me.Ribbon = Me.RibbonControl
|
||||
Me.StatusBar = Me.RibbonStatusBar
|
||||
|
||||
@ -1,36 +1,39 @@
|
||||
Imports System.IO
|
||||
Imports System.Globalization
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraGrid.Columns
|
||||
Imports DevExpress.XtraRichEdit
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraReports.UI
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Controls.SQLConfig
|
||||
Imports DigitalData.GUIs.Common
|
||||
Imports EDIDocumentImport.DocumentInfo
|
||||
Imports EDIDocumentImport.DocumentPositions
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DevExpress.XtraReports.UI
|
||||
Imports EDIDocumentImport.WinLineInfo
|
||||
Imports ImporterShared.Documents
|
||||
Imports ImporterShared.Winline
|
||||
Imports ImporterShared.Schemas
|
||||
Imports ImporterForm.DocumentPositions
|
||||
|
||||
Public Class frmMain
|
||||
Public LogConfig As LogConfig
|
||||
Public Logger As Logger
|
||||
Public ConfigManager As ConfigManager(Of Config)
|
||||
Public ConfigManager As ConfigManager(Of ImporterShared.Config)
|
||||
Public Database As MSSQLServer
|
||||
Public DocumentLoader As DocumentLoader
|
||||
Public GridBuilder As GridBuilder
|
||||
|
||||
Public Winline As WinLineInfo
|
||||
Public WebService As WinLineWebService
|
||||
Public Winline As Data
|
||||
Public WebService As WebService
|
||||
|
||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Try
|
||||
txtVersion.Caption = String.Format(txtVersion.Caption, Application.ProductVersion)
|
||||
|
||||
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 = New ConfigManager(Of ImporterShared.Config)(LogConfig,
|
||||
Application.UserAppDataPath,
|
||||
Application.CommonAppDataPath,
|
||||
Application.StartupPath)
|
||||
Logger = LogConfig.GetLogger()
|
||||
|
||||
' If ConnectionString does not exist, show SQL Config Form
|
||||
@ -49,8 +52,8 @@ Public Class frmMain
|
||||
' Initialize Database
|
||||
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)
|
||||
Winline = New Data(LogConfig, Database, ConfigManager.Config)
|
||||
WebService = New WebService(LogConfig, ConfigManager.Config)
|
||||
|
||||
' Load WinLine Data
|
||||
Winline.Mandators.Clear()
|
||||
@ -72,7 +75,7 @@ Public Class frmMain
|
||||
GridBuilder.WithDefaults()
|
||||
|
||||
' Construct classes related to the xml data
|
||||
DocumentLoader = New DocumentLoader(LogConfig, ConfigManager.Config, Database, Winline)
|
||||
DocumentLoader = New DocumentLoader(LogConfig, Winline)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
|
||||
@ -81,7 +84,7 @@ Public Class frmMain
|
||||
|
||||
Private Sub btnLoadDocuments_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnLoadDocuments.ItemClick
|
||||
Try
|
||||
If DocumentLoader.LoadFiles() = True Then
|
||||
If DocumentLoader.LoadFiles(ConfigManager.Config.InputDirectory) = True Then
|
||||
|
||||
RibbonGroupData.Enabled = True
|
||||
RibbonGroupDocument.Enabled = True
|
||||
@ -118,7 +121,12 @@ Public Class frmMain
|
||||
End Select
|
||||
|
||||
Catch ex As Xml.XmlException
|
||||
Dim oMessage As String = $"Fehler beim Verarbeiten des Dokuments {oDocument.Name}:{vbNewLine}{ex.Message}"
|
||||
Dim oMessage As String = $"Fehler beim Laden des Dokuments {oDocument.Name}:{vbNewLine}{ex.Message}"
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
Logger.Error(ex)
|
||||
|
||||
Catch ex As Exceptions.NoMandatorException
|
||||
Dim oMessage As String = $"Fehler beim Laden des Dokuments {oDocument.Name}:{vbNewLine}{ex.Message}"
|
||||
MsgBox(oMessage, MsgBoxStyle.Critical, Text)
|
||||
Logger.Error(ex)
|
||||
|
||||
@ -131,12 +139,13 @@ Public Class frmMain
|
||||
End Sub
|
||||
|
||||
Private Sub ShowDocument(pDocument As Document, pData As Orders.Input.MESOWebService, pDataOriginal As Orders.Input.MESOWebService)
|
||||
If pDocument.Mandator Is Nothing Then
|
||||
Throw New Exceptions.NoMandatorException("Es konnte kein Mandant gefunden werden")
|
||||
End If
|
||||
|
||||
Dim oHead = GetOrderHead(pData)
|
||||
Dim oHeadOriginal = GetOrderHead(pDataOriginal)
|
||||
|
||||
Dim oPositions = GetOrderPositions(pData)
|
||||
Dim oPositionsOriginal = GetOrderPositions(pDataOriginal)
|
||||
|
||||
' ====== Head Data ======
|
||||
|
||||
' Original, Unreplaced Data
|
||||
@ -151,11 +160,8 @@ Public Class frmMain
|
||||
txtDocumentReference.Text = oHead.Auftragsreferenz
|
||||
dateOrderDate.EditValue = oHead.Datum_AuftragBestellung
|
||||
|
||||
|
||||
|
||||
|
||||
Dim oMandator = Winline.Mandators.
|
||||
Where(Function(m) m.Id = pDocument.Mandator.Id).
|
||||
Where(Function(m) m.Id = pDocument.Mandator).
|
||||
SingleOrDefault()
|
||||
|
||||
If oMandator Is Nothing Then
|
||||
@ -194,9 +200,17 @@ Public Class frmMain
|
||||
' Where(Function(oAccount) oAccount.Id = oHead.Fakt_Kontonummer And oAccount.Mandator = cmbMandator.EditValue).
|
||||
' SingleOrDefault()
|
||||
|
||||
' ====== Position Data ======
|
||||
|
||||
LoadPositionViewAndColumns(GridViewPositions, DocumentType.Order)
|
||||
LoadPositionData(pData, pDataOriginal)
|
||||
GridViewPositions.BestFitColumns()
|
||||
End Sub
|
||||
|
||||
Public Sub LoadPositionData(pData As Orders.Input.MESOWebService, pDataOriginal As Orders.Input.MESOWebService)
|
||||
Dim oPositions = GetOrderPositions(pData)
|
||||
Dim oPositionsOriginal = GetOrderPositions(pDataOriginal)
|
||||
Dim oPositionList As New List(Of OrderPosition)
|
||||
|
||||
For Each oPosition In oPositions
|
||||
Dim oPositionOriginal = oPositionsOriginal.
|
||||
Where(Function(p) p.Zeilennummer = oPosition.Zeilennummer).
|
||||
@ -215,13 +229,10 @@ Public Class frmMain
|
||||
})
|
||||
Next
|
||||
|
||||
LoadViewAndColumns(GridViewPositions, DocumentType.Order)
|
||||
GridControlPositions.DataSource = oPositionList
|
||||
GridViewPositions.BestFitColumns()
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub LoadViewAndColumns(pView As GridView, pDocumentType As DocumentType)
|
||||
Public Sub LoadPositionViewAndColumns(pView As GridView, pDocumentType As DocumentType)
|
||||
Dim oColumns As List(Of GridColumn)
|
||||
|
||||
' Create columns list depending on DocumentType
|
||||
@ -326,7 +337,7 @@ Public Class frmMain
|
||||
Return oPositions
|
||||
End Function
|
||||
|
||||
Private Function GetFocusedDocument() As DocumentInfo.Document
|
||||
Private Function GetFocusedDocument() As Document
|
||||
Dim oRowHandles = GridViewFiles.GetSelectedRows().ToList()
|
||||
Dim oDocument As Document = GridViewFiles.GetRow(oRowHandles.First())
|
||||
Return oDocument
|
||||
|
||||
@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31005.135
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EDIDocumentImporter", "EDIDocumentImport\EDIDocumentImporter.vbproj", "{7AAEC958-955D-4F77-964C-38658684E424}"
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImporterForm", "EDIDocumentImport\ImporterForm.vbproj", "{7AAEC958-955D-4F77-964C-38658684E424}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImporterShared", "ImporterShared\ImporterShared.vbproj", "{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -15,6 +17,10 @@ Global
|
||||
{7AAEC958-955D-4F77-964C-38658684E424}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7AAEC958-955D-4F77-964C-38658684E424}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7AAEC958-955D-4F77-964C-38658684E424}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Base
|
||||
Public Class BaseClass
|
||||
Public ReadOnly LogConfig As LogConfig
|
||||
Public ReadOnly Logger As Logger
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Public Class Config
|
||||
Public Property ConnectionString As String = ""
|
||||
Public Property Mandators As New List(Of Mandator)
|
||||
Public Property Mandators As New List(Of MandatorConfig)
|
||||
Public Property InputDirectory As String = ""
|
||||
Public Property OutputDirectory As String = ""
|
||||
Public Property Webservice As New WebServiceConfig()
|
||||
@ -12,7 +12,7 @@
|
||||
Public Property Password As String = "Password"
|
||||
End Class
|
||||
|
||||
Public Class Mandator
|
||||
Public Class MandatorConfig
|
||||
Public Property Order As Integer
|
||||
Public Property Name As String
|
||||
Public Property ArticleRegex As String
|
||||
44
ImporterShared/Documents/Document.vb
Normal file
44
ImporterShared/Documents/Document.vb
Normal file
@ -0,0 +1,44 @@
|
||||
Imports System.IO
|
||||
Imports EDIDocumentImport.Data
|
||||
|
||||
Namespace Documents
|
||||
Public Class Document
|
||||
Public File As FileInfo
|
||||
Public Type As DocumentType
|
||||
Public Mandator As String
|
||||
|
||||
Public Data As Object
|
||||
Public DataOriginal As Object
|
||||
Public DataOutput As Object
|
||||
Public DataString As String
|
||||
|
||||
Public Selected As Boolean = False
|
||||
|
||||
Public ReadOnly Property FullName As String
|
||||
Get
|
||||
Return File?.FullName
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Name As String
|
||||
Get
|
||||
Return File?.Name
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Shared Function GetDocumentTypeFromTemplateName(pTemplateName As String) As DocumentType
|
||||
Return DocumentMatch.TypeMatchingTable.
|
||||
Where(Function(kv) pTemplateName.Contains(kv.Key)).
|
||||
Select(Function(kv) kv.Value).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
|
||||
Public Shared Function GetDocumentSchemaFromDocumentType(pDocumentType As DocumentType) As Type
|
||||
Return DocumentMatch.SchemaMatchingTable.
|
||||
Where(Function(kv) pDocumentType = kv.Key).
|
||||
Select(Function(kv) kv.Value).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
166
ImporterShared/Documents/DocumentLoader.vb
Normal file
166
ImporterShared/Documents/DocumentLoader.vb
Normal file
@ -0,0 +1,166 @@
|
||||
Imports System.IO
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Xml.Serialization
|
||||
Imports System.Xml.XPath
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports ImporterShared.Documents
|
||||
|
||||
Namespace Documents
|
||||
Public Class DocumentLoader
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Winline As Winline.Data
|
||||
Private ReadOnly Serializer As Serializer
|
||||
|
||||
Public Files As New List(Of Document)
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pWinline As Winline.Data)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
Winline = pWinline
|
||||
Serializer = New Serializer(pLogConfig)
|
||||
End Sub
|
||||
|
||||
Public Function LoadFiles(pInputDirectory) As Boolean
|
||||
If pInputDirectory = String.Empty Then
|
||||
Throw New ArgumentNullException("InputDirectory")
|
||||
End If
|
||||
|
||||
Logger.Info("Loading files from directory [{0}]", pInputDirectory)
|
||||
|
||||
Try
|
||||
Dim oDirectory As New DirectoryInfo(pInputDirectory)
|
||||
Dim oFiles = oDirectory.GetFiles()
|
||||
|
||||
Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory)
|
||||
|
||||
Files = oFiles.
|
||||
Select(AddressOf WrapFileInfo).
|
||||
Select(AddressOf LoadDocumentData).
|
||||
Select(Function(oDocument)
|
||||
Return MatchDataFromWinLine(oDocument, Winline.Mandators)
|
||||
End Function).
|
||||
ToList()
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw New IO.IOException($"Could not load files from directory {pInputDirectory}", ex)
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
Private Function MatchDataFromWinLine(pDocument As Document, pMandators As List(Of Winline.Mandator)) As Document
|
||||
Dim oMandators As List(Of Winline.Mandator) = pMandators.
|
||||
Where(Function(m) m.IsWhitelisted = True).
|
||||
OrderBy(Function(m) m.Order).
|
||||
ToList()
|
||||
|
||||
If TypeOf pDocument.Data Is Schemas.Orders.Input.MESOWebService Then
|
||||
Dim oMandator = Winline.FindMatchingMandatorFromOrder(pDocument.Data)
|
||||
Dim oData As Schemas.Orders.Input.MESOWebService = MatchOrderData(pDocument.Data, oMandator)
|
||||
|
||||
If oMandator Is Nothing Then
|
||||
Logger.Warn("Mandator not found for File [{0}]", pDocument.File.Name)
|
||||
End If
|
||||
|
||||
pDocument.Mandator = oMandator.Id
|
||||
pDocument.Data = oData
|
||||
End If
|
||||
|
||||
Return pDocument
|
||||
End Function
|
||||
|
||||
Private Function MatchOrderData(pData As Schemas.Orders.Input.MESOWebService, pMandator As Winline.Mandator) As Schemas.Orders.Input.MESOWebService
|
||||
Dim oYear = Winline.GetWinLineYear()
|
||||
|
||||
If pMandator Is Nothing Then
|
||||
Return pData
|
||||
End If
|
||||
|
||||
Dim oHead As Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT025 = pData.Items.
|
||||
Where(Function(h) TypeOf h Is Schemas.Orders.Input.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 Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items.
|
||||
Where(Function(p) TypeOf p Is Schemas.Orders.Input.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 Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i).
|
||||
ToList()
|
||||
|
||||
|
||||
pData.Items = New List(Of Object) From {oHead}.
|
||||
Concat(oPositions).
|
||||
ToArray()
|
||||
|
||||
Return pData
|
||||
End Function
|
||||
Private Function WrapFileInfo(pFileInfo As FileInfo) As Document
|
||||
Return New Document With {.File = pFileInfo}
|
||||
End Function
|
||||
Private Function LoadDocumentData(pDocument As Document) As Document
|
||||
Using oFileStream As New FileStream(pDocument.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)
|
||||
Try
|
||||
Dim oXmlDocument = New XPathDocument(oFileStream)
|
||||
Dim oNavigator = oXmlDocument.CreateNavigator()
|
||||
Dim oTemplateName = GetTemplateName(oNavigator)
|
||||
Dim oDocumentType = DocumentMatch.GetDocumentTypeFromTemplateName(oTemplateName)
|
||||
Dim oSchemaType = DocumentMatch.GetDocumentSchemaFromDocumentType(oDocumentType)
|
||||
|
||||
' Read data the first time, working copy
|
||||
Using oReader = oNavigator.ReadSubtree()
|
||||
Dim oSerializer = Serializer.GetSerializer(oSchemaType)
|
||||
pDocument.Data = oSerializer.Deserialize(oReader)
|
||||
|
||||
End Using
|
||||
|
||||
' Read data the second time, archive copy
|
||||
Using oReader = oNavigator.ReadSubtree()
|
||||
Dim oSerializer = Serializer.GetSerializer(oSchemaType)
|
||||
pDocument.DataOriginal = oSerializer.Deserialize(oReader)
|
||||
|
||||
End Using
|
||||
|
||||
pDocument.Type = oDocumentType
|
||||
Return pDocument
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
|
||||
Dim oException As Exception = ex
|
||||
If ex.InnerException IsNot Nothing Then
|
||||
oException = ex.InnerException
|
||||
End If
|
||||
|
||||
Throw oException
|
||||
End Try
|
||||
End Using
|
||||
End Function
|
||||
|
||||
Private Function GetTemplateName(pDocument As XPathNavigator) As String
|
||||
Dim oTemplateName = pDocument.
|
||||
SelectSingleNode("//MESOWebService").
|
||||
GetAttribute("Template", "")
|
||||
|
||||
Return oTemplateName
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
28
ImporterShared/Documents/DocumentMatch.vb
Normal file
28
ImporterShared/Documents/DocumentMatch.vb
Normal file
@ -0,0 +1,28 @@
|
||||
Namespace Documents
|
||||
Public Class DocumentMatch
|
||||
Public Shared Property TypeMatchingTable As New Dictionary(Of String, DocumentType) From {
|
||||
{"orders", DocumentType.Order},
|
||||
{"ordrsp", DocumentType.OrderResponse},
|
||||
{"desadv", DocumentType.DispatchNotification},
|
||||
{"invoic", DocumentType.Invoice}
|
||||
}
|
||||
|
||||
Public Shared Property SchemaMatchingTable As New Dictionary(Of DocumentType, Type) From {
|
||||
{DocumentType.Order, GetType(Schemas.Orders.Input.MESOWebService)}
|
||||
}
|
||||
|
||||
Public Shared Function GetDocumentTypeFromTemplateName(pTemplateName As String) As DocumentType
|
||||
Return TypeMatchingTable.
|
||||
Where(Function(kv) pTemplateName.Contains(kv.Key)).
|
||||
Select(Function(kv) kv.Value).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
|
||||
Public Shared Function GetDocumentSchemaFromDocumentType(pDocumentType As DocumentType) As Type
|
||||
Return SchemaMatchingTable.
|
||||
Where(Function(kv) pDocumentType = kv.Key).
|
||||
Select(Function(kv) kv.Value).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
8
ImporterShared/Documents/DocumentType.vb
Normal file
8
ImporterShared/Documents/DocumentType.vb
Normal file
@ -0,0 +1,8 @@
|
||||
Namespace Documents
|
||||
Public Enum DocumentType
|
||||
Order ' Auftrag
|
||||
OrderResponse ' Bestellbestätigung
|
||||
DispatchNotification ' Lieferavis/ Eingangs Lieferschein
|
||||
Invoice ' Rechnung
|
||||
End Enum
|
||||
End Namespace
|
||||
146
ImporterShared/ImporterShared.vbproj
Normal file
146
ImporterShared/ImporterShared.vbproj
Normal file
@ -0,0 +1,146 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DD1AC3B9-7595-4D3C-B9BB-97C46A480FA0}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>ImporterShared</RootNamespace>
|
||||
<AssemblyName>ImporterShared</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>ImporterShared.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>ImporterShared.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AutoMapper, Version=10.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.10.1.1\lib\net461\AutoMapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.DataAccess.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Filesystem">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Language">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Language\bin\Release\DigitalData.Modules.Language.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Release\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseClass.vb" />
|
||||
<Compile Include="Config.vb" />
|
||||
<Compile Include="Documents\Document.vb" />
|
||||
<Compile Include="Documents\DocumentMatch.vb" />
|
||||
<Compile Include="Documents\DocumentType.vb" />
|
||||
<Compile Include="Documents\DocumentLoader.vb" />
|
||||
<Compile Include="IEnumerableEx.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Mapper.vb" />
|
||||
<Compile Include="Schemas\Orders\Input.vb" />
|
||||
<Compile Include="Schemas\Orders\Output.vb" />
|
||||
<Compile Include="Schemas\Orders\ReportSource.vb" />
|
||||
<Compile Include="Serializer.vb" />
|
||||
<Compile Include="Winline\Account.vb" />
|
||||
<Compile Include="Winline\Data.vb" />
|
||||
<Compile Include="Winline\Mandator.vb" />
|
||||
<Compile Include="Winline\WebService.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
47
ImporterShared/Mapper.vb
Normal file
47
ImporterShared/Mapper.vb
Normal file
@ -0,0 +1,47 @@
|
||||
Imports System.Globalization
|
||||
Imports AutoMapper
|
||||
Imports AutoMapper.Configuration
|
||||
|
||||
Public Class Mapper
|
||||
Private Shared MapperConfig As Object
|
||||
|
||||
Public Shared Function GetMapper()
|
||||
MapperConfig = New MapperConfiguration(CreateMapperConfig())
|
||||
MapperConfig.AssertConfigurationIsValid()
|
||||
Return MapperConfig.CreateMapper()
|
||||
End Function
|
||||
|
||||
Private Shared Function CreateMapperConfig() As MapperConfigurationExpression
|
||||
Dim oConfig As New MapperConfigurationExpression()
|
||||
|
||||
oConfig.CreateMap(Of String, Integer)().ConvertUsing(New IntegerTypeConverter())
|
||||
oConfig.CreateMap(Of String, Decimal)().ConvertUsing(New DecimalTypeConverter())
|
||||
oConfig.CreateMap(Of String, DateTime)().ConvertUsing(New DateTimeTypeConverter())
|
||||
oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebService, Schemas.Orders.Output.MESOWebService)()
|
||||
oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT025, Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT025)()
|
||||
oConfig.CreateMap(Of Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT026, Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT026)()
|
||||
|
||||
Return oConfig
|
||||
End Function
|
||||
|
||||
Private Class DateTimeTypeConverter
|
||||
Implements ITypeConverter(Of String, DateTime)
|
||||
|
||||
Public Function Convert(source As String, destination As Date, context As ResolutionContext) As Date Implements ITypeConverter(Of String, Date).Convert
|
||||
Return System.Convert.ToDateTime(source)
|
||||
End Function
|
||||
End Class
|
||||
Private Class IntegerTypeConverter
|
||||
Implements ITypeConverter(Of String, Integer)
|
||||
Public Function Convert(source As String, destination As Integer, context As ResolutionContext) As Integer Implements ITypeConverter(Of String, Integer).Convert
|
||||
Return System.Convert.ToInt32(source)
|
||||
End Function
|
||||
End Class
|
||||
Private Class DecimalTypeConverter
|
||||
Implements ITypeConverter(Of String, Decimal)
|
||||
Public Function Convert(source As String, destination As Decimal, context As ResolutionContext) As Decimal Implements ITypeConverter(Of String, Decimal).Convert
|
||||
Return System.Convert.ToDecimal(source, CultureInfo.InvariantCulture)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Class
|
||||
13
ImporterShared/My Project/Application.Designer.vb
generated
Normal file
13
ImporterShared/My Project/Application.Designer.vb
generated
Normal file
@ -0,0 +1,13 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
10
ImporterShared/My Project/Application.myapp
Normal file
10
ImporterShared/My Project/Application.myapp
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>false</MySubMain>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
<AuthenticationMode>0</AuthenticationMode>
|
||||
<ApplicationType>1</ApplicationType>
|
||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
||||
</MyApplicationData>
|
||||
35
ImporterShared/My Project/AssemblyInfo.vb
Normal file
35
ImporterShared/My Project/AssemblyInfo.vb
Normal file
@ -0,0 +1,35 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
' die einer Assembly zugeordnet sind.
|
||||
|
||||
' Werte der Assemblyattribute überprüfen
|
||||
|
||||
<Assembly: AssemblyTitle("ImporterShared")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("ImporterShared")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2021")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'Die folgende GUID wird für die typelib-ID verwendet, wenn dieses Projekt für COM verfügbar gemacht wird.
|
||||
<Assembly: Guid("c3902aa5-4b44-4ae2-8a57-b3c8e031d076")>
|
||||
|
||||
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
'
|
||||
' Hauptversion
|
||||
' Nebenversion
|
||||
' Buildnummer
|
||||
' Revision
|
||||
'
|
||||
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
|
||||
' indem Sie "*" wie unten gezeigt eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
62
ImporterShared/My Project/Resources.Designer.vb
generated
Normal file
62
ImporterShared/My Project/Resources.Designer.vb
generated
Normal file
@ -0,0 +1,62 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
'class via a tool like ResGen or Visual Studio.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
'''<summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
'''<summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ImporterShared.Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'''<summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
'''</summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As Global.System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
117
ImporterShared/My Project/Resources.resx
Normal file
117
ImporterShared/My Project/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
73
ImporterShared/My Project/Settings.Designer.vb
generated
Normal file
73
ImporterShared/My Project/Settings.Designer.vb
generated
Normal file
@ -0,0 +1,73 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.30319.42000
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict On
|
||||
Option Explicit On
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
|
||||
|
||||
#Region "My.Settings Auto-Save Functionality"
|
||||
#If _MyType = "WindowsForms" Then
|
||||
Private Shared addedHandler As Boolean
|
||||
|
||||
Private Shared addedHandlerLockObject As New Object
|
||||
|
||||
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
|
||||
If My.Application.SaveMySettingsOnExit Then
|
||||
My.Settings.Save()
|
||||
End If
|
||||
End Sub
|
||||
#End If
|
||||
#End Region
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As MySettings
|
||||
Get
|
||||
|
||||
#If _MyType = "WindowsForms" Then
|
||||
If Not addedHandler Then
|
||||
SyncLock addedHandlerLockObject
|
||||
If Not addedHandler Then
|
||||
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
|
||||
addedHandler = True
|
||||
End If
|
||||
End SyncLock
|
||||
End If
|
||||
#End If
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
Namespace My
|
||||
|
||||
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
|
||||
Friend Module MySettingsProperty
|
||||
|
||||
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
|
||||
Friend ReadOnly Property Settings() As Global.ImporterShared.My.MySettings
|
||||
Get
|
||||
Return Global.ImporterShared.My.MySettings.Default
|
||||
End Get
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
7
ImporterShared/My Project/Settings.settings
Normal file
7
ImporterShared/My Project/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@ -16,696 +16,696 @@ Imports System.Xml.Serialization
|
||||
'
|
||||
'This source code was auto-generated by xsd, Version=4.8.3928.0.
|
||||
'
|
||||
Namespace Orders.Input
|
||||
|
||||
Namespace Schemas.Orders.Input
|
||||
|
||||
'''<remarks/>
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
|
||||
System.SerializableAttribute(), _
|
||||
System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.ComponentModel.DesignerCategoryAttribute("code"), _
|
||||
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true), _
|
||||
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=false)> _
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"),
|
||||
System.SerializableAttribute(),
|
||||
System.Diagnostics.DebuggerStepThroughAttribute(),
|
||||
System.ComponentModel.DesignerCategoryAttribute("code"),
|
||||
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True),
|
||||
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
||||
Partial Public Class MESOWebService
|
||||
|
||||
|
||||
Private itemsField() As Object
|
||||
|
||||
|
||||
Private templateTypeField As String
|
||||
|
||||
|
||||
Private templateField As String
|
||||
|
||||
|
||||
Private optionField As String
|
||||
|
||||
|
||||
Private amountField As String
|
||||
|
||||
|
||||
Private extEntryField As String
|
||||
|
||||
|
||||
Private printVoucherField As String
|
||||
|
||||
|
||||
Private extInsertField As String
|
||||
|
||||
|
||||
Private changeLotSizeField As String
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute("EXIM-VRG_ordersT025", GetType(MESOWebServiceEXIMVRG_ordersT025), Form:=System.Xml.Schema.XmlSchemaForm.Unqualified), _
|
||||
System.Xml.Serialization.XmlElementAttribute("EXIM-VRG_ordersT026", GetType(MESOWebServiceEXIMVRG_ordersT026), Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute("EXIM-VRG_ordersT025", GetType(MESOWebServiceEXIMVRG_ordersT025), Form:=System.Xml.Schema.XmlSchemaForm.Unqualified),
|
||||
System.Xml.Serialization.XmlElementAttribute("EXIM-VRG_ordersT026", GetType(MESOWebServiceEXIMVRG_ordersT026), Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Items() As Object()
|
||||
Get
|
||||
Return Me.itemsField
|
||||
End Get
|
||||
Set
|
||||
Me.itemsField = value
|
||||
Me.itemsField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
|
||||
Public Property TemplateType() As String
|
||||
Get
|
||||
Return Me.templateTypeField
|
||||
End Get
|
||||
Set
|
||||
Me.templateTypeField = value
|
||||
Me.templateTypeField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute()> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute()>
|
||||
Public Property Template() As String
|
||||
Get
|
||||
Return Me.templateField
|
||||
End Get
|
||||
Set
|
||||
Me.templateField = value
|
||||
Me.templateField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
|
||||
Public Property [option]() As String
|
||||
Get
|
||||
Return Me.optionField
|
||||
End Get
|
||||
Set
|
||||
Me.optionField = value
|
||||
Me.optionField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
|
||||
Public Property amount() As String
|
||||
Get
|
||||
Return Me.amountField
|
||||
End Get
|
||||
Set
|
||||
Me.amountField = value
|
||||
Me.amountField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
|
||||
Public Property extEntry() As String
|
||||
Get
|
||||
Return Me.extEntryField
|
||||
End Get
|
||||
Set
|
||||
Me.extEntryField = value
|
||||
Me.extEntryField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
|
||||
Public Property printVoucher() As String
|
||||
Get
|
||||
Return Me.printVoucherField
|
||||
End Get
|
||||
Set
|
||||
Me.printVoucherField = value
|
||||
Me.printVoucherField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
|
||||
Public Property extInsert() As String
|
||||
Get
|
||||
Return Me.extInsertField
|
||||
End Get
|
||||
Set
|
||||
Me.extInsertField = value
|
||||
Me.extInsertField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="string")>
|
||||
Public Property ChangeLotSize() As String
|
||||
Get
|
||||
Return Me.changeLotSizeField
|
||||
End Get
|
||||
Set
|
||||
Me.changeLotSizeField = value
|
||||
Me.changeLotSizeField = Value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
|
||||
System.SerializableAttribute(), _
|
||||
System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.ComponentModel.DesignerCategoryAttribute("code"), _
|
||||
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true)> _
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"),
|
||||
System.SerializableAttribute(),
|
||||
System.Diagnostics.DebuggerStepThroughAttribute(),
|
||||
System.ComponentModel.DesignerCategoryAttribute("code"),
|
||||
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)>
|
||||
Partial Public Class MESOWebServiceEXIMVRG_ordersT025
|
||||
|
||||
|
||||
Private bELEGKEYField As String
|
||||
|
||||
|
||||
Private fakt_KontonummerField As String
|
||||
|
||||
|
||||
Private laufnummerField As String
|
||||
|
||||
|
||||
Private fakt_NameField As String
|
||||
|
||||
|
||||
Private fakt_StrasseField As String
|
||||
|
||||
|
||||
Private fakt_PLZField As String
|
||||
|
||||
|
||||
Private fakt_OrtField As String
|
||||
|
||||
|
||||
Private fakt_AnsprechpartnerField As String
|
||||
|
||||
|
||||
Private lief_KontonummerField As String
|
||||
|
||||
|
||||
Private lief_NameField As String
|
||||
|
||||
|
||||
Private lief_StrasseField As String
|
||||
|
||||
|
||||
Private lief_PLZField As String
|
||||
|
||||
|
||||
Private lief_OrtField As String
|
||||
|
||||
|
||||
Private belegartField As String
|
||||
|
||||
|
||||
Private datum_AuftragBestellungField As String
|
||||
|
||||
|
||||
Private datum_AuftragBestellungFieldSpecified As Boolean
|
||||
|
||||
|
||||
Private auftragsBestellnummerField As String
|
||||
|
||||
|
||||
Private leistungsdatumField As String
|
||||
|
||||
|
||||
Private leistungsdatumFieldSpecified As Boolean
|
||||
|
||||
|
||||
Private auftragsreferenzField As String
|
||||
|
||||
|
||||
Private infotextField As String
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")>
|
||||
Public Property BELEGKEY() As String
|
||||
Get
|
||||
Return Me.bELEGKEYField
|
||||
End Get
|
||||
Set
|
||||
Me.bELEGKEYField = value
|
||||
Me.bELEGKEYField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Fakt_Kontonummer() As String
|
||||
Get
|
||||
Return Me.fakt_KontonummerField
|
||||
End Get
|
||||
Set
|
||||
Me.fakt_KontonummerField = value
|
||||
Me.fakt_KontonummerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Laufnummer() As String
|
||||
Get
|
||||
Return Me.laufnummerField
|
||||
End Get
|
||||
Set
|
||||
Me.laufnummerField = value
|
||||
Me.laufnummerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Fakt_Name() As String
|
||||
Get
|
||||
Return Me.fakt_NameField
|
||||
End Get
|
||||
Set
|
||||
Me.fakt_NameField = value
|
||||
Me.fakt_NameField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Fakt_Strasse() As String
|
||||
Get
|
||||
Return Me.fakt_StrasseField
|
||||
End Get
|
||||
Set
|
||||
Me.fakt_StrasseField = value
|
||||
Me.fakt_StrasseField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Fakt_PLZ() As String
|
||||
Get
|
||||
Return Me.fakt_PLZField
|
||||
End Get
|
||||
Set
|
||||
Me.fakt_PLZField = value
|
||||
Me.fakt_PLZField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Fakt_Ort() As String
|
||||
Get
|
||||
Return Me.fakt_OrtField
|
||||
End Get
|
||||
Set
|
||||
Me.fakt_OrtField = value
|
||||
Me.fakt_OrtField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Fakt_Ansprechpartner() As String
|
||||
Get
|
||||
Return Me.fakt_AnsprechpartnerField
|
||||
End Get
|
||||
Set
|
||||
Me.fakt_AnsprechpartnerField = value
|
||||
Me.fakt_AnsprechpartnerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Lief_Kontonummer() As String
|
||||
Get
|
||||
Return Me.lief_KontonummerField
|
||||
End Get
|
||||
Set
|
||||
Me.lief_KontonummerField = value
|
||||
Me.lief_KontonummerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Lief_Name() As String
|
||||
Get
|
||||
Return Me.lief_NameField
|
||||
End Get
|
||||
Set
|
||||
Me.lief_NameField = value
|
||||
Me.lief_NameField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Lief_Strasse() As String
|
||||
Get
|
||||
Return Me.lief_StrasseField
|
||||
End Get
|
||||
Set
|
||||
Me.lief_StrasseField = value
|
||||
Me.lief_StrasseField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Lief_PLZ() As String
|
||||
Get
|
||||
Return Me.lief_PLZField
|
||||
End Get
|
||||
Set
|
||||
Me.lief_PLZField = value
|
||||
Me.lief_PLZField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Lief_Ort() As String
|
||||
Get
|
||||
Return Me.lief_OrtField
|
||||
End Get
|
||||
Set
|
||||
Me.lief_OrtField = value
|
||||
Me.lief_OrtField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Belegart() As String
|
||||
Get
|
||||
Return Me.belegartField
|
||||
End Get
|
||||
Set
|
||||
Me.belegartField = value
|
||||
Me.belegartField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute("Datum_Auftrag-Bestellung", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlElementAttribute("Datum_Auftrag-Bestellung", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")>
|
||||
Public Property Datum_AuftragBestellung() As String
|
||||
Get
|
||||
Return Me.datum_AuftragBestellungField
|
||||
End Get
|
||||
Set
|
||||
Me.datum_AuftragBestellungField = value
|
||||
Me.datum_AuftragBestellungField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property Datum_AuftragBestellungSpecified() As Boolean
|
||||
Get
|
||||
Return Me.datum_AuftragBestellungFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.datum_AuftragBestellungFieldSpecified = value
|
||||
Me.datum_AuftragBestellungFieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute("Auftrags-Bestellnummer", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute("Auftrags-Bestellnummer", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property AuftragsBestellnummer() As String
|
||||
Get
|
||||
Return Me.auftragsBestellnummerField
|
||||
End Get
|
||||
Set
|
||||
Me.auftragsBestellnummerField = value
|
||||
Me.auftragsBestellnummerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")>
|
||||
Public Property Leistungsdatum() As String
|
||||
Get
|
||||
Return Me.leistungsdatumField
|
||||
End Get
|
||||
Set
|
||||
Me.leistungsdatumField = value
|
||||
Me.leistungsdatumField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property LeistungsdatumSpecified() As Boolean
|
||||
Get
|
||||
Return Me.leistungsdatumFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.leistungsdatumFieldSpecified = value
|
||||
Me.leistungsdatumFieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Auftragsreferenz() As String
|
||||
Get
|
||||
Return Me.auftragsreferenzField
|
||||
End Get
|
||||
Set
|
||||
Me.auftragsreferenzField = value
|
||||
Me.auftragsreferenzField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Infotext() As String
|
||||
Get
|
||||
Return Me.infotextField
|
||||
End Get
|
||||
Set
|
||||
Me.infotextField = value
|
||||
Me.infotextField = Value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
|
||||
System.SerializableAttribute(), _
|
||||
System.Diagnostics.DebuggerStepThroughAttribute(), _
|
||||
System.ComponentModel.DesignerCategoryAttribute("code"), _
|
||||
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true)> _
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"),
|
||||
System.SerializableAttribute(),
|
||||
System.Diagnostics.DebuggerStepThroughAttribute(),
|
||||
System.ComponentModel.DesignerCategoryAttribute("code"),
|
||||
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True)>
|
||||
Partial Public Class MESOWebServiceEXIMVRG_ordersT026
|
||||
|
||||
|
||||
Private bELEGKEYField As String
|
||||
|
||||
|
||||
Private zeilennummerField As String
|
||||
|
||||
|
||||
Private datentypField As String
|
||||
|
||||
|
||||
Private artikelnummerField As String
|
||||
|
||||
|
||||
Private bezeichnungField As String
|
||||
|
||||
|
||||
Private notizblockField As String
|
||||
|
||||
|
||||
Private lieferantenartikelnummerField As String
|
||||
|
||||
|
||||
Private menge_bestelltField As String
|
||||
|
||||
|
||||
Private menge_bestelltFieldSpecified As Boolean
|
||||
|
||||
|
||||
Private menge_geliefertField As String
|
||||
|
||||
|
||||
Private colliField As String
|
||||
|
||||
|
||||
Private einzelpreisField As String
|
||||
|
||||
|
||||
Private einzelpreisFieldSpecified As Boolean
|
||||
|
||||
|
||||
Private zeilenrabatt1Field As String
|
||||
|
||||
|
||||
Private zeilenrabatt1FieldSpecified As Boolean
|
||||
|
||||
|
||||
Private zeilenrabatt2Field As String
|
||||
|
||||
|
||||
Private zeilenrabatt2FieldSpecified As Boolean
|
||||
|
||||
|
||||
Private zeilenrabatt3Field As String
|
||||
|
||||
|
||||
Private zeilenrabatt3FieldSpecified As Boolean
|
||||
|
||||
|
||||
Private zeilenrabatt4Field As String
|
||||
|
||||
|
||||
Private zeilenrabatt4FieldSpecified As Boolean
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")>
|
||||
Public Property BELEGKEY() As String
|
||||
Get
|
||||
Return Me.bELEGKEYField
|
||||
End Get
|
||||
Set
|
||||
Me.bELEGKEYField = value
|
||||
Me.bELEGKEYField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="string")>
|
||||
Public Property Zeilennummer() As String
|
||||
Get
|
||||
Return Me.zeilennummerField
|
||||
End Get
|
||||
Set
|
||||
Me.zeilennummerField = value
|
||||
Me.zeilennummerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Datentyp() As String
|
||||
Get
|
||||
Return Me.datentypField
|
||||
End Get
|
||||
Set
|
||||
Me.datentypField = value
|
||||
Me.datentypField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Artikelnummer() As String
|
||||
Get
|
||||
Return Me.artikelnummerField
|
||||
End Get
|
||||
Set
|
||||
Me.artikelnummerField = value
|
||||
Me.artikelnummerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Bezeichnung() As String
|
||||
Get
|
||||
Return Me.bezeichnungField
|
||||
End Get
|
||||
Set
|
||||
Me.bezeichnungField = value
|
||||
Me.bezeichnungField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Notizblock() As String
|
||||
Get
|
||||
Return Me.notizblockField
|
||||
End Get
|
||||
Set
|
||||
Me.notizblockField = value
|
||||
Me.notizblockField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Lieferantenartikelnummer() As String
|
||||
Get
|
||||
Return Me.lieferantenartikelnummerField
|
||||
End Get
|
||||
Set
|
||||
Me.lieferantenartikelnummerField = value
|
||||
Me.lieferantenartikelnummerField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Menge_bestellt() As String
|
||||
Get
|
||||
Return Me.menge_bestelltField
|
||||
End Get
|
||||
Set
|
||||
Me.menge_bestelltField = value
|
||||
Me.menge_bestelltField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property Menge_bestelltSpecified() As Boolean
|
||||
Get
|
||||
Return Me.menge_bestelltFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.menge_bestelltFieldSpecified = value
|
||||
Me.menge_bestelltFieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Menge_geliefert() As String
|
||||
Get
|
||||
Return Me.menge_geliefertField
|
||||
End Get
|
||||
Set
|
||||
Me.menge_geliefertField = value
|
||||
Me.menge_geliefertField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Colli() As String
|
||||
Get
|
||||
Return Me.colliField
|
||||
End Get
|
||||
Set
|
||||
Me.colliField = value
|
||||
Me.colliField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Einzelpreis() As String
|
||||
Get
|
||||
Return Me.einzelpreisField
|
||||
End Get
|
||||
Set
|
||||
Me.einzelpreisField = value
|
||||
Me.einzelpreisField = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property EinzelpreisSpecified() As Boolean
|
||||
Get
|
||||
Return Me.einzelpreisFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.einzelpreisFieldSpecified = value
|
||||
Me.einzelpreisFieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Zeilenrabatt1() As String
|
||||
Get
|
||||
Return Me.zeilenrabatt1Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt1Field = value
|
||||
Me.zeilenrabatt1Field = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property Zeilenrabatt1Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt1FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt1FieldSpecified = value
|
||||
Me.zeilenrabatt1FieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Zeilenrabatt2() As String
|
||||
Get
|
||||
Return Me.zeilenrabatt2Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt2Field = value
|
||||
Me.zeilenrabatt2Field = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property Zeilenrabatt2Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt2FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt2FieldSpecified = value
|
||||
Me.zeilenrabatt2FieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Zeilenrabatt3() As String
|
||||
Get
|
||||
Return Me.zeilenrabatt3Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt3Field = value
|
||||
Me.zeilenrabatt3Field = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property Zeilenrabatt3Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt3FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt3FieldSpecified = value
|
||||
Me.zeilenrabatt3FieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)>
|
||||
Public Property Zeilenrabatt4() As String
|
||||
Get
|
||||
Return Me.zeilenrabatt4Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt4Field = value
|
||||
Me.zeilenrabatt4Field = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
||||
Public Property Zeilenrabatt4Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt4FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt4FieldSpecified = value
|
||||
Me.zeilenrabatt4FieldSpecified = Value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
@ -16,7 +16,7 @@ Imports System.Xml.Serialization
|
||||
'
|
||||
'This source code was auto-generated by xsd, Version=4.8.3928.0.
|
||||
'
|
||||
Namespace Orders.Output
|
||||
Namespace Schemas.Orders.Output
|
||||
|
||||
'''<remarks/>
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
|
||||
@ -2,7 +2,7 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.ComponentModel
|
||||
|
||||
Namespace Orders
|
||||
Namespace Schemas.Orders
|
||||
<DisplayName("OrdersReport"), HighlightedClass>
|
||||
Public Class ReportSource
|
||||
<HighlightedMember>
|
||||
@ -2,7 +2,7 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Serializer
|
||||
Inherits Base
|
||||
Inherits BaseClass
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
End Sub
|
||||
10
ImporterShared/Winline/Account.vb
Normal file
10
ImporterShared/Winline/Account.vb
Normal file
@ -0,0 +1,10 @@
|
||||
Namespace Winline
|
||||
Public Class Account
|
||||
Public Property Id As String
|
||||
Public Property Name As String
|
||||
Public Property Mandator As String
|
||||
Public Overrides Function ToString() As String
|
||||
Return $"{Name} ({Id})"
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
261
ImporterShared/Winline/Data.vb
Normal file
261
ImporterShared/Winline/Data.vb
Normal file
@ -0,0 +1,261 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports ImporterShared
|
||||
Imports System.Text.RegularExpressions
|
||||
|
||||
|
||||
Namespace Winline
|
||||
Public Class Data
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
Private ReadOnly 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 Const V05_ACCOUNTID = "c002"
|
||||
Public Const V05_ACCOUNTNAME = "c003"
|
||||
Public Const T01_DATABASEINFO = "c004"
|
||||
Public Const T01_MANDATORID = "c000"
|
||||
Public Const T01_MANDATORNAME = "c003"
|
||||
|
||||
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)
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Accounts.Add(New Account With {
|
||||
.Id = oRow.Item(V05_ACCOUNTID),
|
||||
.Name = oRow.Item(V05_ACCOUNTNAME),
|
||||
.Mandator = pMandator.Id
|
||||
})
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Public Sub LoadMandators()
|
||||
Dim oSQL = "SELECT [c000], [c003], [c004] FROM [cwlsystem].[dbo].[T001SRV] (NOLOCK)"
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
Mandators.Clear()
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oDbInfo = SplitConnectionInfo(oRow)
|
||||
Dim oMandator = New Mandator With {
|
||||
.Id = oRow.Item(T01_MANDATORID),
|
||||
.Name = oRow.Item(T01_MANDATORNAME),
|
||||
.Database = oDbInfo.Item1,
|
||||
.Server = oDbInfo.Item2
|
||||
}
|
||||
|
||||
Dim oMandatorConfig As Config.MandatorConfig = 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
|
||||
|
||||
Public Sub LoadEconomicYears()
|
||||
Dim oCurrentYear = Now.Year
|
||||
Dim oRange As IEnumerable(Of Integer) = Enumerable.Range(oCurrentYear - 10, 12).ToList()
|
||||
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
|
||||
|
||||
Public Function FindMatchingMandatorFromOrder(pData As Schemas.Orders.Input.MESOWebService) As Mandator
|
||||
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 oMandatorId As String = String.Empty
|
||||
Dim oWhitelistedMandators = 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(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
|
||||
|
||||
''' <summary>
|
||||
''' Turns a database info like "SQLCWLDATEN on SERVER\INSTANCE" into a Tuple of two strings
|
||||
''' </summary>
|
||||
''' <param name="pRow"></param>
|
||||
''' <returns></returns>
|
||||
Private Function SplitConnectionInfo(pRow As DataRow) As Tuple(Of String, String)
|
||||
Dim oDbInfo = pRow.Item(T01_DATABASEINFO).ToString()
|
||||
Dim oSplittedInfo = SplitAtString(oDbInfo.ToUpper, "ON")
|
||||
Dim oServer = oSplittedInfo.Item(1).Trim()
|
||||
|
||||
Dim oDatabase = oSplittedInfo.Item(0).Trim()
|
||||
If oDatabase.StartsWith("SQL") Then
|
||||
oDatabase = oDatabase.Remove(0, 3)
|
||||
End If
|
||||
|
||||
Return New Tuple(Of String, String)(oDatabase, oServer)
|
||||
End Function
|
||||
|
||||
Private Function SplitAtString(pStringToSplit As String, pDelimiter As String) As List(Of String)
|
||||
Dim oDelimiter As String() = New String(0) {pDelimiter}
|
||||
Return pStringToSplit.
|
||||
Split(oDelimiter, StringSplitOptions.None).
|
||||
ToList()
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
15
ImporterShared/Winline/Mandator.vb
Normal file
15
ImporterShared/Winline/Mandator.vb
Normal file
@ -0,0 +1,15 @@
|
||||
Namespace Winline
|
||||
Public Class Mandator
|
||||
Public Property Id As String
|
||||
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
|
||||
End Namespace
|
||||
100
ImporterShared/Winline/WebService.vb
Normal file
100
ImporterShared/Winline/WebService.vb
Normal file
@ -0,0 +1,100 @@
|
||||
Imports System.Xml
|
||||
Imports System.Net
|
||||
Imports System.Globalization
|
||||
Imports AutoMapper
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports ImporterShared.Documents
|
||||
|
||||
Namespace Winline
|
||||
Public Class WebService
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Config As Config
|
||||
Private ReadOnly Serializer As Serializer
|
||||
Private ReadOnly Mapper As AutoMapper.Mapper
|
||||
Private ReadOnly FileEx As File
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pConfig As Config)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
FileEx = New File(pLogConfig)
|
||||
Serializer = New Serializer(pLogConfig)
|
||||
Config = pConfig
|
||||
End Sub
|
||||
|
||||
Public Function TransferDocumentToWinLine(pDocument As Document) As Boolean
|
||||
If TypeOf pDocument.Data Is Schemas.Orders.Input.MESOWebService Then
|
||||
TransferOrderToWinline(pDocument)
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function TransferOrderToWinline(pDocument As Document)
|
||||
Dim oOrderOutput = TransformOrderToOutput(pDocument.Data)
|
||||
Dim oWS As Config.WebServiceConfig = Config.Webservice
|
||||
Dim oFilePath = SerializeOrder(oOrderOutput)
|
||||
Dim oXmlString = IO.File.ReadAllText(oFilePath)
|
||||
pDocument.DataOutput = oOrderOutput
|
||||
|
||||
Dim oURL As String = $"{oWS.BaseUrl}/ewlservice/import?User={oWS.Username}&Password={oWS.Password}&Company={pDocument.Mandator}&Type=30&Vorlage=EXIM-VRG_orders&ActionCode=1&Byref=0Data={oXmlString}"
|
||||
Dim oRequest = WebRequest.Create(oURL)
|
||||
oRequest.Method = "POST"
|
||||
|
||||
Logger.Info("Creating HTTP Request to [{0}]", oWS.BaseUrl)
|
||||
|
||||
' TODO: Make better lol
|
||||
|
||||
Using oResponse = oRequest.GetResponse()
|
||||
Using oStream = oResponse.GetResponseStream()
|
||||
Using oReader As New IO.StreamReader(oStream)
|
||||
Dim oData = oReader.ReadToEnd()
|
||||
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function TransformOrderToOutput(pData As Schemas.Orders.Input.MESOWebService) As Schemas.Orders.Output.MESOWebService
|
||||
Dim oData As Schemas.Orders.Input.MESOWebService = pData
|
||||
Dim oResult As Schemas.Orders.Output.MESOWebService = Mapper.Map(Of Schemas.Orders.Output.MESOWebService)(oData)
|
||||
|
||||
Dim oItems = oData.Items.
|
||||
Select(Function(i)
|
||||
If TypeOf i Is Schemas.Orders.Input.MESOWebServiceEXIMVRG_ordersT025 Then
|
||||
Return Mapper.Map(Of Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT025)(i)
|
||||
Else
|
||||
Return Mapper.Map(Of Schemas.Orders.Output.MESOWebServiceEXIMVRG_ordersT026)(i)
|
||||
End If
|
||||
End Function).
|
||||
ToList()
|
||||
|
||||
oResult.Items = oItems.ToArray()
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Function SerializeOrder(pData As Schemas.Orders.Output.MESOWebService) As String
|
||||
Dim oSerializer = Serializer.GetSerializer(GetType(Schemas.Orders.Output.MESOWebService))
|
||||
Dim oSettings As New XmlWriterSettings With {.Indent = True}
|
||||
|
||||
Dim oPath As String = IO.Path.Combine(FileEx.GetAppDataPath("Digital Data", "EDI Document Importer"), "WebService")
|
||||
Dim oFileName As String = $"{Now:yyyy-MM-dd-ffff}.xml"
|
||||
Dim oFilePath As String = IO.Path.Combine(oPath, oFileName)
|
||||
|
||||
If IO.Directory.Exists(oPath) = False Then
|
||||
IO.Directory.CreateDirectory(oPath)
|
||||
End If
|
||||
|
||||
Using oWriter = XmlWriter.Create(oFilePath, oSettings)
|
||||
oSerializer.Serialize(oWriter, pData)
|
||||
End Using
|
||||
|
||||
Return oFilePath
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
5
ImporterShared/packages.config
Normal file
5
ImporterShared/packages.config
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AutoMapper" version="10.1.1" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.10" targetFramework="net461" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user