First Working Version with New parser
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
Public Class Config
|
||||
Public Property ConnectionString As String = ""
|
||||
Public Property Mandators As New List(Of MandatorConfig)
|
||||
|
||||
Public Property InputDirectory As String = ""
|
||||
Public Property OutputDirectory As String = ""
|
||||
|
||||
Public Property SchemaDirectory As String = ""
|
||||
|
||||
Public Property Webservice As New WebServiceConfig()
|
||||
Public Property DefaultYearOverride As Integer = 0
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
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 Type As DocumentType
|
||||
Public Selected As Boolean = False
|
||||
|
||||
Public TemplateName As String
|
||||
Public TemplateType As Integer
|
||||
Public [Option] As Integer
|
||||
Public PrintVoucher As Integer
|
||||
|
||||
Public ReadOnly Property FullName As String
|
||||
Get
|
||||
Return File?.FullName
|
||||
@@ -26,19 +24,30 @@ Namespace Documents
|
||||
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 Rows As New List(Of DocumentRow)
|
||||
|
||||
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
|
||||
' Public Type As DocumentType
|
||||
' Public Data As Object
|
||||
' Public DataOriginal As Object
|
||||
' Public DataOutput As Object
|
||||
' Public DataString As String
|
||||
|
||||
' Public Selected As Boolean = False
|
||||
|
||||
|
||||
' 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
|
||||
@@ -1,4 +1,6 @@
|
||||
Imports System.IO
|
||||
Imports System.ComponentModel
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Xml.Serialization
|
||||
Imports System.Xml.XPath
|
||||
@@ -36,12 +38,9 @@ Namespace Documents
|
||||
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()
|
||||
Select(AddressOf WrapFileInfo).
|
||||
Select(AddressOf LoadDocumentData2).
|
||||
ToList()
|
||||
|
||||
Return True
|
||||
|
||||
@@ -52,26 +51,66 @@ Namespace Documents
|
||||
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()
|
||||
Private Function LoadDocumentData2(pDocument As Document) As Document
|
||||
Dim oText As String = IO.File.ReadAllText(pDocument.FullName)
|
||||
Dim oDoc = XDocument.Parse(oText)
|
||||
Dim oRootElement As XElement = XmlData.GetElement(oDoc, "MESOWebService")
|
||||
|
||||
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)
|
||||
Dim oTemplateName = XmlData.GetElementAttribute(oRootElement, "Template")
|
||||
Dim oTemplateType = XmlData.GetElementAttribute(oRootElement, "TemplateType")
|
||||
Dim oOption = XmlData.GetElementAttribute(oRootElement, "option")
|
||||
Dim oPrintVoucher = XmlData.GetElementAttribute(oRootElement, "printVoucher")
|
||||
|
||||
If oMandator Is Nothing Then
|
||||
Logger.Warn("Mandator not found for File [{0}]", pDocument.File.Name)
|
||||
End If
|
||||
Dim oRowElements As List(Of XElement) = oRootElement.Elements.ToList
|
||||
|
||||
pDocument.Mandator = oMandator.Id
|
||||
pDocument.Data = oData
|
||||
End If
|
||||
|
||||
Dim oRows As New List(Of DocumentRow)
|
||||
|
||||
For Each oElement As XElement In oRowElements
|
||||
Dim oFields As New Dictionary(Of String, String)
|
||||
|
||||
Dim oSubElements = oElement.Descendants().ToList()
|
||||
|
||||
For Each oSubElement As XElement In oSubElements
|
||||
oFields.Add(oSubElement.Name.ToString, oSubElement.Value)
|
||||
Next
|
||||
|
||||
Dim oRow = New DocumentRow With {
|
||||
.Name = oElement.Name.ToString,
|
||||
.Fields = oFields
|
||||
}
|
||||
|
||||
oRows.Add(oRow)
|
||||
Next
|
||||
|
||||
pDocument.TemplateName = oTemplateName
|
||||
pDocument.TemplateType = oTemplateType
|
||||
pDocument.Rows = oRows
|
||||
pDocument.Option = oOption
|
||||
pDocument.PrintVoucher = oPrintVoucher
|
||||
|
||||
Return pDocument
|
||||
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 Input.MESOWebService, pMandator As Winline.Mandator) As Input.MESOWebService
|
||||
Dim oYear = Winline.GetWinLineYear()
|
||||
@@ -115,51 +154,77 @@ Namespace Documents
|
||||
|
||||
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)
|
||||
'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 oDocument = oXmlDocument.CreateNavigator()
|
||||
' Dim oTemplateName = GetTemplateName(oDocument)
|
||||
' Dim oDocumentType = DocumentMatch.GetDocumentTypeFromTemplateName(oTemplateName)
|
||||
' Dim oSchemaType As Type = DocumentMatch.GetDocumentSchemaFromDocumentType(oDocumentType)
|
||||
|
||||
End Using
|
||||
' ' Read data the first time, working copy
|
||||
' 'Using oReader = oNavigator.ReadSubtree()
|
||||
' ' Dim oSerializer = Serializer.GetSerializer(oSchemaType)
|
||||
' ' pDocument.Data = oSerializer.Deserialize(oReader)
|
||||
|
||||
' Read data the second time, archive copy
|
||||
Using oReader = oNavigator.ReadSubtree()
|
||||
Dim oSerializer = Serializer.GetSerializer(oSchemaType)
|
||||
pDocument.DataOriginal = oSerializer.Deserialize(oReader)
|
||||
' 'End Using
|
||||
|
||||
End Using
|
||||
' ' Read data the second time, archive copy
|
||||
' 'Using oReader = oNavigator.ReadSubtree()
|
||||
' ' Dim oSerializer = Serializer.GetSerializer(oSchemaType)
|
||||
' ' pDocument.DataOriginal = oSerializer.Deserialize(oReader)
|
||||
|
||||
pDocument.Type = oDocumentType
|
||||
Return pDocument
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
' 'End Using
|
||||
|
||||
Dim oException As Exception = ex
|
||||
If ex.InnerException IsNot Nothing Then
|
||||
oException = ex.InnerException
|
||||
End If
|
||||
' 'Dim oInstance As Object = Activator.CreateInstance(oSchemaType)
|
||||
' 'Dim oProps = oSchemaType.GetProperties()
|
||||
|
||||
Throw oException
|
||||
End Try
|
||||
End Using
|
||||
End Function
|
||||
' 'Dim oHead = oProps.
|
||||
' ' Where(Function(p) p.Name = "Head").
|
||||
' ' SingleOrDefault()
|
||||
' 'Dim oDescriptionHead As CustomAttributeData = oHead.CustomAttributes.
|
||||
' ' Where(Function(d) d.AttributeType.Equals(GetType(DescriptionAttribute))).
|
||||
' ' SingleOrDefault()
|
||||
' 'Dim oDescriptionHeadValue = oDescriptionHead.ConstructorArguments.First().Value
|
||||
' 'Dim oHeadXml = oDocument.Select($"//MESOWebService/{oDescriptionHeadValue}")
|
||||
|
||||
' 'Dim oPositions As PropertyInfo = oProps.
|
||||
' ' Where(Function(p) p.Name = "Positions").
|
||||
' ' SingleOrDefault()
|
||||
' 'Dim oDescriptionPos As CustomAttributeData = oPositions.CustomAttributes.
|
||||
' ' Where(Function(d) d.AttributeType.Equals(GetType(DescriptionAttribute))).
|
||||
' ' SingleOrDefault()
|
||||
' 'Dim oDescriptionPosValue = oDescriptionPos.ConstructorArguments.First().Value
|
||||
' 'Dim oPosXml = oDocument.Select($"//MESOWebService/{oDescriptionPosValue}")
|
||||
|
||||
|
||||
|
||||
|
||||
' 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", "")
|
||||
SelectSingleNode("//MESOWebService").
|
||||
GetAttribute("Template", "")
|
||||
|
||||
Return oTemplateName
|
||||
End Function
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
|
||||
Public Shared Property SchemaMatchingTable As New Dictionary(Of DocumentType, Type) From {
|
||||
{DocumentType.Order, GetType(Schemas.Orders.Input.MESOWebService)}
|
||||
{DocumentType.Order, GetType(Schemas.OrderSchema)}
|
||||
}
|
||||
|
||||
Public Shared Function GetDocumentTypeFromTemplateName(pTemplateName As String) As DocumentType
|
||||
|
||||
4
ImporterShared/Documents/DocumentRow.vb
Normal file
4
ImporterShared/Documents/DocumentRow.vb
Normal file
@@ -0,0 +1,4 @@
|
||||
Public Class DocumentRow
|
||||
Public Name As String
|
||||
Public Fields As Dictionary(Of String, String)
|
||||
End Class
|
||||
@@ -54,6 +54,9 @@
|
||||
<Reference Include="DigitalData.Modules.Filesystem">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Interfaces">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Interfaces\bin\Debug\DigitalData.Modules.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Language">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Language\bin\Release\DigitalData.Modules.Language.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -93,6 +96,7 @@
|
||||
<Compile Include="Config.vb" />
|
||||
<Compile Include="Documents\Document.vb" />
|
||||
<Compile Include="Documents\DocumentMatch.vb" />
|
||||
<Compile Include="Documents\DocumentRow.vb" />
|
||||
<Compile Include="Documents\DocumentType.vb" />
|
||||
<Compile Include="Documents\DocumentLoader.vb" />
|
||||
<Compile Include="IEnumerableEx.vb" />
|
||||
@@ -112,19 +116,23 @@
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Mapper.vb" />
|
||||
<Compile Include="Schemas\IMesoWebService.vb" />
|
||||
<Compile Include="Schemas\BaseSchema.vb" />
|
||||
<Compile Include="Schemas\Orders\Helpers.vb" />
|
||||
<Compile Include="Schemas\Orders\Input.vb" />
|
||||
<Compile Include="Schemas\Orders\Output.vb" />
|
||||
<Compile Include="Schemas\Orders\OrderSchema.vb" />
|
||||
<Compile Include="Schemas\Orders\ReportSource.vb" />
|
||||
<Compile Include="Schemas\Response.vb" />
|
||||
<Compile Include="Schemas\Schema.vb" />
|
||||
<Compile Include="Schemas\SchemaLoader.vb" />
|
||||
<Compile Include="Serializer.vb" />
|
||||
<Compile Include="Winline\Entities\Account.vb" />
|
||||
<Compile Include="Winline\Data.vb" />
|
||||
<Compile Include="Winline\Entities\Contact.vb" />
|
||||
<Compile Include="Winline\Entities\DocumentKind.vb" />
|
||||
<Compile Include="Winline\Entities\Mandator.vb" />
|
||||
<Compile Include="Winline\Entities\XmlItem.vb" />
|
||||
<Compile Include="Winline\WebService.vb" />
|
||||
<Compile Include="XmlData.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
|
||||
@@ -5,24 +5,24 @@ Imports AutoMapper.Configuration
|
||||
Public Class MapperFactory
|
||||
Private Shared MapperConfig As Object
|
||||
|
||||
Public Shared Function GetMapper() As Mapper
|
||||
MapperConfig = New MapperConfiguration(CreateMapperConfig())
|
||||
MapperConfig.AssertConfigurationIsValid()
|
||||
Return MapperConfig.CreateMapper()
|
||||
End Function
|
||||
'Public Shared Function GetMapper() As Mapper
|
||||
' MapperConfig = New MapperConfiguration(CreateMapperConfig())
|
||||
' MapperConfig.AssertConfigurationIsValid()
|
||||
' Return MapperConfig.CreateMapper()
|
||||
'End Function
|
||||
|
||||
Private Shared Function CreateMapperConfig() As MapperConfigurationExpression
|
||||
Dim oConfig As New MapperConfigurationExpression()
|
||||
'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)()
|
||||
' 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
|
||||
' Return oConfig
|
||||
'End Function
|
||||
|
||||
Private Class DateTimeTypeConverter
|
||||
Implements ITypeConverter(Of String, DateTime)
|
||||
|
||||
8
ImporterShared/Schemas/BaseSchema.vb
Normal file
8
ImporterShared/Schemas/BaseSchema.vb
Normal file
@@ -0,0 +1,8 @@
|
||||
Namespace Schemas
|
||||
Public Class BaseSchema
|
||||
Public Property Template As String
|
||||
Public Property TemplateType As Integer
|
||||
Public Property [Option] As Integer
|
||||
Public Property PrintVoucher As Integer
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -1,6 +0,0 @@
|
||||
Namespace Schemas
|
||||
Public Interface IMesoWebservice
|
||||
Property Items As Object()
|
||||
End Interface
|
||||
|
||||
End Namespace
|
||||
@@ -1,28 +1,28 @@
|
||||
Namespace Schemas.Orders
|
||||
Public Class Helpers
|
||||
Public Shared Function GetOrderHead(Of T)(pData As IMesoWebservice) As T
|
||||
Dim oHead As T = pData.Items.
|
||||
Where(Function(i) TypeOf i Is T).
|
||||
FirstOrDefault()
|
||||
Return oHead
|
||||
End Function
|
||||
'Public Class Helpers
|
||||
' Public Shared Function GetOrderHead(Of T)(pData As IMesoWebservice) As T
|
||||
' Dim oHead As T = pData.Items.
|
||||
' Where(Function(i) TypeOf i Is T).
|
||||
' FirstOrDefault()
|
||||
' Return oHead
|
||||
' End Function
|
||||
|
||||
Public Shared Sub SetOrderHead(Of T)(pData As IMesoWebservice, pUpdateFunction As Action(Of T))
|
||||
Dim oHead As T = pData.Items.
|
||||
Where(Function(i) TypeOf i Is T).
|
||||
SetValue(Sub(pObject As T)
|
||||
pUpdateFunction(pObject)
|
||||
End Sub).
|
||||
FirstOrDefault()
|
||||
' Public Shared Sub SetOrderHead(Of T)(pData As IMesoWebservice, pUpdateFunction As Action(Of T))
|
||||
' Dim oHead As T = pData.Items.
|
||||
' Where(Function(i) TypeOf i Is T).
|
||||
' SetValue(Sub(pObject As T)
|
||||
' pUpdateFunction(pObject)
|
||||
' End Sub).
|
||||
' FirstOrDefault()
|
||||
|
||||
End Sub
|
||||
' End Sub
|
||||
|
||||
Public Shared Function GetOrderPositions(Of T)(pData As IMesoWebservice) As List(Of T)
|
||||
Dim oPositions As List(Of T) = pData.Items.
|
||||
Where(Function(i) TypeOf i Is T).
|
||||
Select(Of T)(Function(i) i).
|
||||
ToList()
|
||||
Return oPositions
|
||||
End Function
|
||||
End Class
|
||||
' Public Shared Function GetOrderPositions(Of T)(pData As IMesoWebservice) As List(Of T)
|
||||
' Dim oPositions As List(Of T) = pData.Items.
|
||||
' Where(Function(i) TypeOf i Is T).
|
||||
' Select(Of T)(Function(i) i).
|
||||
' ToList()
|
||||
' Return oPositions
|
||||
' End Function
|
||||
'End Class
|
||||
End Namespace
|
||||
|
||||
@@ -27,8 +27,6 @@ Namespace Schemas.Orders.Input
|
||||
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)>
|
||||
Partial Public Class MESOWebService
|
||||
|
||||
Implements Schemas.IMesoWebservice
|
||||
|
||||
Private itemsField() As Object
|
||||
|
||||
Private templateTypeField As String
|
||||
@@ -50,7 +48,7 @@ Namespace Schemas.Orders.Input
|
||||
'''<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)>
|
||||
Public Property Items() As Object() Implements Schemas.IMesoWebservice.Items
|
||||
Public Property Items() As Object()
|
||||
Get
|
||||
Return Me.itemsField
|
||||
End Get
|
||||
|
||||
55
ImporterShared/Schemas/Orders/OrderSchema.vb
Normal file
55
ImporterShared/Schemas/Orders/OrderSchema.vb
Normal file
@@ -0,0 +1,55 @@
|
||||
Imports System.ComponentModel
|
||||
|
||||
|
||||
Namespace Schemas
|
||||
|
||||
''' <summary>
|
||||
''' XML Schema to import the Data-Files
|
||||
''' </summary>
|
||||
Public Class OrderSchema
|
||||
Inherits BaseSchema
|
||||
|
||||
<Description("EXIM-VRG_ordersT025")>
|
||||
Public Property Head As New OrderHead
|
||||
|
||||
<Description("EXIM-VRG_ordersT026")>
|
||||
Public Property Positions As New List(Of OrderPosition)
|
||||
|
||||
|
||||
Public Class OrderHead
|
||||
<Description("BELEGKEY")>
|
||||
Public Property DocumentKey As String
|
||||
<Description("Fakt_Kontonummer")>
|
||||
Public Property AccountNumber As String
|
||||
<Description("Laufnummer")>
|
||||
Public Property RunningNumber As String
|
||||
<Description("Bestellt_von")>
|
||||
Public Property OrderedBy As String
|
||||
<Description("Lief_Kontonummer")>
|
||||
Public Property AccountNumber2 As String
|
||||
<Description("Belegart")>
|
||||
Public Property DocumentType As Integer
|
||||
<Description("Datum_Auftrag-Bestellung")>
|
||||
Public Property OrderDate As Date
|
||||
<Description("Auftrags-Bestellnummer")>
|
||||
Public Property OrderNumber As String
|
||||
<Description("Infotext")>
|
||||
Public Property InfoText As String
|
||||
End Class
|
||||
|
||||
|
||||
Public Class OrderPosition
|
||||
<Description("BELEGKEY")>
|
||||
Public Property DocumentKey As String
|
||||
<Description("Zeilennummer")>
|
||||
Public Property LineNumber As String
|
||||
<Description("Artikelnummer")>
|
||||
Public Property ArticleNumber As String
|
||||
<Description("Bezeichnung")>
|
||||
Public Property ArticleDescription As String
|
||||
<Description("Lieferantenartikelnummer")>
|
||||
Public Property VendorNumber As String
|
||||
End Class
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -1,712 +0,0 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' Dieser Code wurde von einem Tool generiert.
|
||||
' Laufzeitversion:4.0.30319.42000
|
||||
'
|
||||
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
' der Code erneut generiert wird.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
Imports System.Xml.Serialization
|
||||
|
||||
'
|
||||
'This source code was auto-generated by xsd, Version=4.8.3928.0.
|
||||
'
|
||||
Namespace Schemas.Orders.Output
|
||||
|
||||
'''<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)> _
|
||||
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)> _
|
||||
Public Property Items() As Object()
|
||||
Get
|
||||
Return Me.itemsField
|
||||
End Get
|
||||
Set
|
||||
Me.itemsField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="integer")> _
|
||||
Public Property TemplateType() As String
|
||||
Get
|
||||
Return Me.templateTypeField
|
||||
End Get
|
||||
Set
|
||||
Me.templateTypeField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute()> _
|
||||
Public Property Template() As String
|
||||
Get
|
||||
Return Me.templateField
|
||||
End Get
|
||||
Set
|
||||
Me.templateField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="integer")> _
|
||||
Public Property [option]() As String
|
||||
Get
|
||||
Return Me.optionField
|
||||
End Get
|
||||
Set
|
||||
Me.optionField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="integer")> _
|
||||
Public Property amount() As String
|
||||
Get
|
||||
Return Me.amountField
|
||||
End Get
|
||||
Set
|
||||
Me.amountField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="integer")> _
|
||||
Public Property extEntry() As String
|
||||
Get
|
||||
Return Me.extEntryField
|
||||
End Get
|
||||
Set
|
||||
Me.extEntryField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="integer")> _
|
||||
Public Property printVoucher() As String
|
||||
Get
|
||||
Return Me.printVoucherField
|
||||
End Get
|
||||
Set
|
||||
Me.printVoucherField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="integer")> _
|
||||
Public Property extInsert() As String
|
||||
Get
|
||||
Return Me.extInsertField
|
||||
End Get
|
||||
Set
|
||||
Me.extInsertField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlAttributeAttribute(DataType:="integer")> _
|
||||
Public Property ChangeLotSize() As String
|
||||
Get
|
||||
Return Me.changeLotSizeField
|
||||
End Get
|
||||
Set
|
||||
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)> _
|
||||
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 Date
|
||||
|
||||
Private datum_AuftragBestellungFieldSpecified As Boolean
|
||||
|
||||
Private auftragsBestellnummerField As String
|
||||
|
||||
Private leistungsdatumField As Date
|
||||
|
||||
Private leistungsdatumFieldSpecified As Boolean
|
||||
|
||||
Private auftragsreferenzField As String
|
||||
|
||||
Private infotextField As String
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer")> _
|
||||
Public Property BELEGKEY() As String
|
||||
Get
|
||||
Return Me.bELEGKEYField
|
||||
End Get
|
||||
Set
|
||||
Me.bELEGKEYField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute("Datum_Auftrag-Bestellung", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="date")> _
|
||||
Public Property Datum_AuftragBestellung() As Date
|
||||
Get
|
||||
Return Me.datum_AuftragBestellungField
|
||||
End Get
|
||||
Set
|
||||
Me.datum_AuftragBestellungField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property Datum_AuftragBestellungSpecified() As Boolean
|
||||
Get
|
||||
Return Me.datum_AuftragBestellungFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.datum_AuftragBestellungFieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="date")> _
|
||||
Public Property Leistungsdatum() As Date
|
||||
Get
|
||||
Return Me.leistungsdatumField
|
||||
End Get
|
||||
Set
|
||||
Me.leistungsdatumField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property LeistungsdatumSpecified() As Boolean
|
||||
Get
|
||||
Return Me.leistungsdatumFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.leistungsdatumFieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
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)> _
|
||||
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 Decimal
|
||||
|
||||
Private menge_bestelltFieldSpecified As Boolean
|
||||
|
||||
Private menge_geliefertField As Decimal
|
||||
|
||||
Private colliField As String
|
||||
|
||||
Private einzelpreisField As Decimal
|
||||
|
||||
Private einzelpreisFieldSpecified As Boolean
|
||||
|
||||
Private zeilenrabatt1Field As Decimal
|
||||
|
||||
Private zeilenrabatt1FieldSpecified As Boolean
|
||||
|
||||
Private zeilenrabatt2Field As Decimal
|
||||
|
||||
Private zeilenrabatt2FieldSpecified As Boolean
|
||||
|
||||
Private zeilenrabatt3Field As Decimal
|
||||
|
||||
Private zeilenrabatt3FieldSpecified As Boolean
|
||||
|
||||
Private zeilenrabatt4Field As Decimal
|
||||
|
||||
Private zeilenrabatt4FieldSpecified As Boolean
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer")> _
|
||||
Public Property BELEGKEY() As String
|
||||
Get
|
||||
Return Me.bELEGKEYField
|
||||
End Get
|
||||
Set
|
||||
Me.bELEGKEYField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer")> _
|
||||
Public Property Zeilennummer() As String
|
||||
Get
|
||||
Return Me.zeilennummerField
|
||||
End Get
|
||||
Set
|
||||
Me.zeilennummerField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
Public Property Menge_bestellt() As Decimal
|
||||
Get
|
||||
Return Me.menge_bestelltField
|
||||
End Get
|
||||
Set
|
||||
Me.menge_bestelltField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property Menge_bestelltSpecified() As Boolean
|
||||
Get
|
||||
Return Me.menge_bestelltFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.menge_bestelltFieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
Public Property Menge_geliefert() As Decimal
|
||||
Get
|
||||
Return Me.menge_geliefertField
|
||||
End Get
|
||||
Set
|
||||
Me.menge_geliefertField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<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
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
Public Property Einzelpreis() As Decimal
|
||||
Get
|
||||
Return Me.einzelpreisField
|
||||
End Get
|
||||
Set
|
||||
Me.einzelpreisField = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property EinzelpreisSpecified() As Boolean
|
||||
Get
|
||||
Return Me.einzelpreisFieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.einzelpreisFieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
Public Property Zeilenrabatt1() As Decimal
|
||||
Get
|
||||
Return Me.zeilenrabatt1Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt1Field = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property Zeilenrabatt1Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt1FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt1FieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
Public Property Zeilenrabatt2() As Decimal
|
||||
Get
|
||||
Return Me.zeilenrabatt2Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt2Field = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property Zeilenrabatt2Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt2FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt2FieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
Public Property Zeilenrabatt3() As Decimal
|
||||
Get
|
||||
Return Me.zeilenrabatt3Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt3Field = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property Zeilenrabatt3Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt3FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt3FieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified)> _
|
||||
Public Property Zeilenrabatt4() As Decimal
|
||||
Get
|
||||
Return Me.zeilenrabatt4Field
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt4Field = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlIgnoreAttribute()> _
|
||||
Public Property Zeilenrabatt4Specified() As Boolean
|
||||
Get
|
||||
Return Me.zeilenrabatt4FieldSpecified
|
||||
End Get
|
||||
Set
|
||||
Me.zeilenrabatt4FieldSpecified = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
28
ImporterShared/Schemas/Schema.vb
Normal file
28
ImporterShared/Schemas/Schema.vb
Normal file
@@ -0,0 +1,28 @@
|
||||
Namespace Schemas
|
||||
Public Class Schema
|
||||
|
||||
Public Enum ColumnType As Integer
|
||||
[String]
|
||||
[Integer]
|
||||
[Date]
|
||||
[Boolean]
|
||||
[Decimal]
|
||||
End Enum
|
||||
|
||||
Public Property Tables As New List(Of Table)
|
||||
Public Property Name As String
|
||||
|
||||
Class Table
|
||||
Public Property Name As String
|
||||
Public Property Columns As New List(Of Column)
|
||||
End Class
|
||||
|
||||
Class Column
|
||||
Public Property Name As String
|
||||
Public Property Required As String
|
||||
Public Property DataType As ColumnType
|
||||
End Class
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
116
ImporterShared/Schemas/SchemaLoader.vb
Normal file
116
ImporterShared/Schemas/SchemaLoader.vb
Normal file
@@ -0,0 +1,116 @@
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports System.Xml.XPath
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Namespace Schemas
|
||||
Public Class SchemaLoader
|
||||
Inherits BaseClass
|
||||
|
||||
Private ns As XNamespace = "http://www.w3.org/2001/XMLSchema"
|
||||
|
||||
Public SchemaList As List(Of FileInfo)
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger)
|
||||
End Sub
|
||||
|
||||
Public Function LoadFiles(pSchemaDirectory) As Boolean
|
||||
If pSchemaDirectory = String.Empty Then
|
||||
Throw New ArgumentNullException("SchemaDirectory")
|
||||
End If
|
||||
|
||||
Logger.Info("Loading files from directory [{0}]", pSchemaDirectory)
|
||||
|
||||
Try
|
||||
Dim oDirectory As New DirectoryInfo(pSchemaDirectory)
|
||||
Dim oFiles = oDirectory.GetFiles()
|
||||
|
||||
Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory)
|
||||
|
||||
SchemaList = oFiles.ToList()
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw New IO.IOException($"Could not load files from directory {pSchemaDirectory}", ex)
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetSchemaFromFile(pSchemaFilePath As String) As Schema
|
||||
Dim oSchema As New Schema
|
||||
Dim oElements = GetSchemaElements(pSchemaFilePath)
|
||||
|
||||
For Each oElement In oElements
|
||||
Dim oColumns = GetElementColumns(oElement)
|
||||
Dim oSchemaColumns As New List(Of Schema.Column)
|
||||
|
||||
For Each oColumn As XElement In oColumns
|
||||
Dim oName = XmlData.GetElementAttribute(oColumn, "name")
|
||||
Dim oMinOccurs = XmlData.GetElementAttribute(oColumn, "minOccurs")
|
||||
Dim oMaxOccurs = XmlData.GetElementAttribute(oColumn, "maxOccurs")
|
||||
Dim oType = GetElementType(oColumn)
|
||||
Dim oRequired = False
|
||||
|
||||
If oMinOccurs = 1 And oMaxOccurs = 1 Then
|
||||
oRequired = True
|
||||
End If
|
||||
|
||||
Dim oSchemaColumn As New Schema.Column With {
|
||||
.Name = oName,
|
||||
.Required = oRequired,
|
||||
.DataType = oType
|
||||
}
|
||||
oSchemaColumns.Add(oSchemaColumn)
|
||||
Next
|
||||
|
||||
oSchema.Tables.Add(New Schema.Table With {
|
||||
.Name = XmlData.GetElementAttribute(oElement, "name"),
|
||||
.Columns = oSchemaColumns
|
||||
})
|
||||
|
||||
Next
|
||||
|
||||
Return oSchema
|
||||
End Function
|
||||
|
||||
Public Function GetElementType(pElement As XElement) As Schema.ColumnType
|
||||
Dim oTypeString = XmlData.GetElementAttribute(pElement, "type")
|
||||
|
||||
If oTypeString Is Nothing Then
|
||||
Dim oRestrictionElement As XElement = pElement.
|
||||
Descendants(ns + "restriction").
|
||||
FirstOrDefault()
|
||||
|
||||
oTypeString = XmlData.GetElementAttribute(oRestrictionElement, "base")
|
||||
End If
|
||||
|
||||
Select Case oTypeString
|
||||
Case "xs:date"
|
||||
Return Schema.ColumnType.Date
|
||||
Case "xs:integer"
|
||||
Return Schema.ColumnType.Integer
|
||||
Case "xs:decimal"
|
||||
Return Schema.ColumnType.Decimal
|
||||
Case "xs:boolean"
|
||||
Return Schema.ColumnType.Boolean
|
||||
Case Else
|
||||
Return Schema.ColumnType.String
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Function GetSchemaElements(pSchemaFilePath As String) As List(Of XElement)
|
||||
Dim oText As String = IO.File.ReadAllText(pSchemaFilePath)
|
||||
Dim oDoc = XDocument.Parse(oText)
|
||||
|
||||
Return XmlData.GetElementsFromElement(oDoc, "choice", ns)
|
||||
End Function
|
||||
|
||||
Public Function GetElementColumns(pElement As XElement) As List(Of XElement)
|
||||
Return XmlData.GetElementsFromElement(pElement, "sequence", ns)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -16,6 +16,8 @@ Namespace Winline
|
||||
Public Mandators As New List(Of Mandator)
|
||||
Public DocumentKinds As New List(Of DocumentKind)
|
||||
Public Years As List(Of Integer)
|
||||
Public XmlConfigHead As List(Of XmlItem)
|
||||
Public XmlConfigPositions As List(Of XmlItem)
|
||||
|
||||
Public Const ALL_MESOCOMP = "mesocomp"
|
||||
|
||||
@@ -134,8 +136,6 @@ Namespace Winline
|
||||
Dim oDocumentKinds As New List(Of DocumentKind)
|
||||
Dim oMandatorString = String.Join(",", pMandators.Select(Function(m) $"'{m.Id}'").ToArray)
|
||||
Dim oYear As Integer = GetWinLineYear()
|
||||
|
||||
|
||||
DocumentKinds.Clear()
|
||||
|
||||
For Each oMandator As Mandator In pMandators
|
||||
@@ -348,8 +348,8 @@ Namespace Winline
|
||||
Dim oYear = GetWinLineYear()
|
||||
Dim oMandatorId As String = String.Empty
|
||||
Dim oWhitelistedMandators = Mandators.
|
||||
Where(Function(m) m.IsWhitelisted = True).
|
||||
ToList()
|
||||
Where(Function(m) m.IsWhitelisted = True).
|
||||
ToList()
|
||||
|
||||
For Each oPos In oPositions
|
||||
For Each oMandator In oWhitelistedMandators
|
||||
@@ -413,6 +413,24 @@ Namespace Winline
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Sub GetXmlConfiguration()
|
||||
Try
|
||||
Dim oSql = $"SELECT XML_NAME, XML_ROOT, DATA_TYPE, IS_HEAD FROM [DD_ECM].[dbo].[VWEDI_XML_ITEMS]"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oSql)
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oXmlItem As New XmlItem With {
|
||||
.Name = oRow.Item("XML_NAME"),
|
||||
.Root = oRow.Item("XML_ROOT"),
|
||||
.Type = oRow.Item("XML_TYPE")
|
||||
}
|
||||
Next
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Turns a database info like "SQLCWLDATEN on SERVER\INSTANCE" into a Tuple of two strings
|
||||
''' </summary>
|
||||
@@ -437,5 +455,7 @@ Namespace Winline
|
||||
Split(oDelimiter, StringSplitOptions.None).
|
||||
ToList()
|
||||
End Function
|
||||
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
9
ImporterShared/Winline/Entities/XmlItem.vb
Normal file
9
ImporterShared/Winline/Entities/XmlItem.vb
Normal file
@@ -0,0 +1,9 @@
|
||||
Namespace Winline
|
||||
Public Class XmlItem
|
||||
Public Name As String
|
||||
Public Root As String
|
||||
Public Type As String
|
||||
Public IsHead As Boolean
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -22,85 +22,85 @@ Namespace Winline
|
||||
FileEx = New File(pLogConfig)
|
||||
Serializer = New Serializer(pLogConfig)
|
||||
Config = pConfig
|
||||
Mapper = MapperFactory.GetMapper()
|
||||
'Mapper = MapperFactory.GetMapper()
|
||||
End Sub
|
||||
|
||||
Public Async Function TransferDocumentToWinLine(pDocument As Document) As Task(Of Boolean)
|
||||
If TypeOf pDocument.Data Is Schemas.Orders.Input.MESOWebService Then
|
||||
Return Await TransferOrderToWinline(pDocument)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
'Public Async Function TransferDocumentToWinLine(pDocument As Document) As Task(Of Boolean)
|
||||
' If TypeOf pDocument.Data Is Schemas.Orders.Input.MESOWebService Then
|
||||
' Return Await TransferOrderToWinline(pDocument)
|
||||
' Else
|
||||
' Return False
|
||||
' End If
|
||||
'End Function
|
||||
|
||||
Private Async Function TransferOrderToWinline(pDocument As Document) As Task(Of Boolean)
|
||||
Dim oOrderOutput = TransformOrderToOutput(pDocument.Data)
|
||||
Dim oWS As Config.WebServiceConfig = Config.Webservice
|
||||
'Private Async Function TransferOrderToWinline(pDocument As Document) As Task(Of Boolean)
|
||||
' Dim oOrderOutput = TransformOrderToOutput(pDocument.Data)
|
||||
' Dim oWS As Config.WebServiceConfig = Config.Webservice
|
||||
|
||||
' --- Get and create path for request/response files
|
||||
' ' --- Get and create path for request/response files
|
||||
|
||||
Dim oPath As String = GetBaseWebServicePath()
|
||||
If IO.Directory.Exists(oPath) = False Then
|
||||
IO.Directory.CreateDirectory(oPath)
|
||||
End If
|
||||
' Dim oPath As String = GetBaseWebServicePath()
|
||||
' If IO.Directory.Exists(oPath) = False Then
|
||||
' IO.Directory.CreateDirectory(oPath)
|
||||
' End If
|
||||
|
||||
' --- Build all teh filenamez and pathz
|
||||
' ' --- Build all teh filenamez and pathz
|
||||
|
||||
Dim oBaseFileName As String = GetBaseFilenameForRequest()
|
||||
Dim oFileName = GetXmlFilenameWithSuffix(oBaseFileName, "Request", "xml")
|
||||
' Dim oBaseFileName As String = GetBaseFilenameForRequest()
|
||||
' Dim oFileName = GetXmlFilenameWithSuffix(oBaseFileName, "Request", "xml")
|
||||
|
||||
' Relative Path for Webservice Call
|
||||
Dim oImportRelativeFilePath = IO.Path.Combine(GetDateSubDirectoryPath(Config.Webservice.ImportRelativePath), oFileName)
|
||||
' ' Relative Path for Webservice Call
|
||||
' Dim oImportRelativeFilePath = IO.Path.Combine(GetDateSubDirectoryPath(Config.Webservice.ImportRelativePath), oFileName)
|
||||
|
||||
' Absolute Path to copy Request file
|
||||
Dim oImportAbsolutePath = IO.Path.Combine(Config.Webservice.ImportBasePath, Config.Webservice.ImportRelativePath)
|
||||
Dim oImportAbsoluteFilePath = IO.Path.Combine(GetDateSubDirectoryPath(oImportAbsolutePath), oFileName)
|
||||
' ' Absolute Path to copy Request file
|
||||
' Dim oImportAbsolutePath = IO.Path.Combine(Config.Webservice.ImportBasePath, Config.Webservice.ImportRelativePath)
|
||||
' Dim oImportAbsoluteFilePath = IO.Path.Combine(GetDateSubDirectoryPath(oImportAbsolutePath), oFileName)
|
||||
|
||||
' --- Serialize Data into XML string
|
||||
' ' --- Serialize Data into XML string
|
||||
|
||||
Dim oOutputFilePath = SerializeOrder(oOrderOutput, oFileName)
|
||||
' Dim oOutputFilePath = SerializeOrder(oOrderOutput, oFileName)
|
||||
|
||||
' --- Copy file to Winline Import Directory
|
||||
' ' --- Copy file to Winline Import Directory
|
||||
|
||||
Try
|
||||
IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
' Try
|
||||
' IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True)
|
||||
' Catch ex As Exception
|
||||
' Logger.Error(ex)
|
||||
' Throw ex
|
||||
' End Try
|
||||
|
||||
' --- Prepare URL and HTTP Client
|
||||
Dim oTemplateType = 30
|
||||
Dim oTemplateName = "EXIM-VRG_orders"
|
||||
' ' --- Prepare URL and HTTP Client
|
||||
' Dim oTemplateType = 30
|
||||
' Dim oTemplateName = "EXIM-VRG_orders"
|
||||
|
||||
' ActionCode: Should this be a test or not?
|
||||
' 0 = Testcall
|
||||
' 1 = Real call
|
||||
Dim oActionCode = 1
|
||||
' ' ActionCode: Should this be a test or not?
|
||||
' ' 0 = Testcall
|
||||
' ' 1 = Real call
|
||||
' Dim oActionCode = 1
|
||||
|
||||
' Byref: Should data be supplied as file or as string?
|
||||
' 0 = As String
|
||||
' 1 = As File (relative to Winline Server directory)
|
||||
Dim oByref = 1
|
||||
' ' Byref: Should data be supplied as file or as string?
|
||||
' ' 0 = As String
|
||||
' ' 1 = As File (relative to Winline Server directory)
|
||||
' Dim oByref = 1
|
||||
|
||||
Dim oURL As String = $"{oWS.BaseUrl}/ewlservice/import?User={oWS.Username}&Password={oWS.Password}&Company={pDocument.Mandator}&Type={oTemplateType}&Vorlage={oTemplateName}&ActionCode={oActionCode}&Byref={oByref}&Data={oImportRelativeFilePath}"
|
||||
Dim oClient As New HttpClient()
|
||||
' Dim oURL As String = $"{oWS.BaseUrl}/ewlservice/import?User={oWS.Username}&Password={oWS.Password}&Company={pDocument.Mandator}&Type={oTemplateType}&Vorlage={oTemplateName}&ActionCode={oActionCode}&Byref={oByref}&Data={oImportRelativeFilePath}"
|
||||
' Dim oClient As New HttpClient()
|
||||
|
||||
Logger.Info("Creating HTTP Request to [{0}]", oWS.BaseUrl)
|
||||
' Logger.Info("Creating HTTP Request to [{0}]", oWS.BaseUrl)
|
||||
|
||||
' --- Bring the action!
|
||||
Try
|
||||
Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL)
|
||||
Await HandleResponse(oResponse, oPath, oBaseFileName)
|
||||
' ' --- Bring the action!
|
||||
' Try
|
||||
' Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL)
|
||||
' Await HandleResponse(oResponse, oPath, oBaseFileName)
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
Finally
|
||||
oClient.Dispose()
|
||||
End Try
|
||||
End Function
|
||||
' Return True
|
||||
' Catch ex As Exception
|
||||
' Logger.Error(ex)
|
||||
' Throw ex
|
||||
' Finally
|
||||
' oClient.Dispose()
|
||||
' End Try
|
||||
'End Function
|
||||
|
||||
Private Async Function HandleResponse(pResponse As HttpResponseMessage, pPath As String, pBaseFileNAme As String) As Task
|
||||
pResponse.EnsureSuccessStatusCode()
|
||||
@@ -155,35 +155,35 @@ Namespace Winline
|
||||
End Try
|
||||
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)
|
||||
'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()
|
||||
' 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
|
||||
' oResult.Items = oItems.ToArray()
|
||||
' Return oResult
|
||||
'End Function
|
||||
|
||||
Private Function SerializeOrder(pData As Schemas.Orders.Output.MESOWebService, pFileName As String) As String
|
||||
Dim oSerializer = Serializer.GetSerializer(GetType(Schemas.Orders.Output.MESOWebService))
|
||||
Dim oPath As String = GetBaseWebServicePath()
|
||||
Dim oFilePath As String = IO.Path.Combine(oPath, pFileName)
|
||||
'Private Function SerializeOrder(pData As Schemas.Orders.Output.MESOWebService, pFileName As String) As String
|
||||
' Dim oSerializer = Serializer.GetSerializer(GetType(Schemas.Orders.Output.MESOWebService))
|
||||
' Dim oPath As String = GetBaseWebServicePath()
|
||||
' Dim oFilePath As String = IO.Path.Combine(oPath, pFileName)
|
||||
|
||||
Using oWriter = XmlWriter.Create(oFilePath, New XmlWriterSettings With {.Indent = True})
|
||||
oSerializer.Serialize(oWriter, pData)
|
||||
End Using
|
||||
' Using oWriter = XmlWriter.Create(oFilePath, New XmlWriterSettings With {.Indent = True})
|
||||
' oSerializer.Serialize(oWriter, pData)
|
||||
' End Using
|
||||
|
||||
Return oFilePath
|
||||
End Function
|
||||
' Return oFilePath
|
||||
'End Function
|
||||
|
||||
Private Function GetBaseWebServicePath() As String
|
||||
Return IO.Path.Combine(FileEx.GetAppDataPath("Digital Data", "EDI Document Importer"), "WebService")
|
||||
|
||||
43
ImporterShared/XmlData.vb
Normal file
43
ImporterShared/XmlData.vb
Normal file
@@ -0,0 +1,43 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class XmlData
|
||||
|
||||
'<DebuggerStepThrough>
|
||||
Public Shared Function GetElementAttribute(pElement As XElement, pName As String) As String
|
||||
Try
|
||||
Dim oAttribute As XAttribute = pElement.Attribute(pName)
|
||||
Return oAttribute?.Value
|
||||
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function GetElementsFromElement(pElement As XContainer, pElementName As String) As List(Of XElement)
|
||||
Return pElement.Descendants(pElementName).
|
||||
Elements().
|
||||
ToList()
|
||||
End Function
|
||||
|
||||
Public Shared Function GetElementsFromElement(pElement As XContainer, pElementName As String, pNamespace As XNamespace) As List(Of XElement)
|
||||
Return pElement.Descendants(pNamespace + pElementName).
|
||||
Elements().
|
||||
ToList()
|
||||
End Function
|
||||
|
||||
Public Shared Function GetElement(pContainer As XContainer, pElementName As String, pNamespace As XNamespace) As XElement
|
||||
Return pContainer.Descendants(pNamespace + pElementName).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
|
||||
Public Shared Function GetElement(pContainer As XContainer, pElementName As String) As XElement
|
||||
Return pContainer.Descendants(pElementName).
|
||||
FirstOrDefault()
|
||||
End Function
|
||||
|
||||
Public Shared Function GetElementValue(pElement As XElement) As String
|
||||
Return pElement.Value
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user