Add year combobox, fix filenames
This commit is contained in:
@@ -55,7 +55,7 @@ Namespace Winline
|
||||
|
||||
' --- Build all teh filenamez and pathz
|
||||
Dim oBaseFileName As String = FileEx.GetDateTimeString()
|
||||
Dim oFileName = FileEx.GetFilenameWithPrefix(oBaseFileName, pTemplate.Name, "xml")
|
||||
Dim oFileName = $"{pTemplate.Name}-{oBaseFileName}-Request.xml"
|
||||
|
||||
' --- Get and create path for request/response files
|
||||
Dim oOutputDirectory = FileEx.CreateDateDirectory(pTemplate.OutputWebserviceDirectory)
|
||||
@@ -124,18 +124,18 @@ Namespace Winline
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Async Function HandleImportResponse(pResponse As HttpResponseMessage, pTemplate As Template, pBaseFileNAme As String) As Task
|
||||
Private Async Function HandleImportResponse(pResponse As HttpResponseMessage, pTemplate As Template, pBaseFileName As String) As Task
|
||||
pResponse.EnsureSuccessStatusCode()
|
||||
Dim oResponseBody As String = Await pResponse.Content.ReadAsStringAsync()
|
||||
Dim oContentType = pResponse.Content.Headers.ContentType.MediaType
|
||||
Dim oSerializer = Serializer.GetSerializer(GetType(Templates.Entities.MESOWebServiceResult))
|
||||
Dim oOutputDirectory = FileEx.CreateDateDirectory(pTemplate.OutputWebserviceDirectory)
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Antwort verarbeiten")
|
||||
|
||||
Select Case oContentType
|
||||
Case "text/xml"
|
||||
Dim oOutputDirectory = FileEx.CreateDateDirectory(pTemplate.OutputWebserviceDirectory)
|
||||
WriteResponseFileWithSuffix(oOutputDirectory, pBaseFileNAme, oResponseBody, "xml", $"{pTemplate.Name}-Response")
|
||||
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
|
||||
|
||||
Dim oBytes As Byte() = Encoding.UTF8.GetBytes(oResponseBody)
|
||||
Using oStream As New IO.MemoryStream(oBytes)
|
||||
@@ -164,7 +164,7 @@ Namespace Winline
|
||||
End Using
|
||||
|
||||
Case "text/html"
|
||||
WriteResponseFileWithSuffix(pTemplate.OutputWebserviceDirectory, pBaseFileNAme, oResponseBody, "txt", $"{pTemplate.Name}-Response")
|
||||
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
|
||||
|
||||
Throw New WebServiceException(oResponseBody)
|
||||
|
||||
@@ -221,15 +221,12 @@ Namespace Winline
|
||||
|
||||
' --- Build all teh filenamez and pathz
|
||||
Dim oBaseFileName As String = FileEx.GetDateTimeString()
|
||||
Dim oFileName = FileEx.GetFilenameWithPrefix(oBaseFileName, pTemplate.Name, "xml")
|
||||
Dim oFileName = $"{pTemplate.Name}-{oBaseFileName}.xml"
|
||||
'Dim oFileName = FileEx.GetFilenameWithPrefix(oBaseFileName, pTemplate.Name, "xml")
|
||||
|
||||
' Save the filename to the document
|
||||
pDocument.FilenameExport = oFileName
|
||||
|
||||
' Absolute Path to copy Request file
|
||||
Dim oImportAbsolutePath = IO.Path.Combine(oWS.ImportBasePath, oWS.ImportRelativePath)
|
||||
Dim oImportAbsoluteFilePath = IO.Path.Combine(FileEx.GetDateDirectory(oImportAbsolutePath), oFileName)
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Dateien schreiben")
|
||||
|
||||
' --- Prepare URL and HTTP Client
|
||||
@@ -282,14 +279,14 @@ Namespace Winline
|
||||
Select Case oContentType
|
||||
Case "text/xml"
|
||||
' Webservice
|
||||
WriteResponseFileWithSuffix(pTemplate.OutputWebserviceDirectory, pBaseFileName, oResponseBody, "xml", pTemplate.Name)
|
||||
WriteResponseFile(pTemplate.OutputWebserviceDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
|
||||
' XML
|
||||
WriteResponseFileWithSuffix(pTemplate.OutputXmlFileDirectory, pBaseFileName, oResponseBody, "xml", pTemplate.Name)
|
||||
WriteResponseFile(pTemplate.OutputXmlFileDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}.xml")
|
||||
' Archive
|
||||
WriteResponseFileWithSuffix(FileEx.CreateDateDirectory(pTemplate.ArchiveDirectory), pBaseFileName, oResponseBody, "xml", pTemplate.Name)
|
||||
WriteResponseFile(FileEx.CreateDateDirectory(pTemplate.ArchiveDirectory), oResponseBody, $"{pTemplate.Name}-{pBaseFileName}.xml")
|
||||
|
||||
Case "text/html"
|
||||
WriteResponseFileWithSuffix(pTemplate.OutputWebserviceDirectory, pBaseFileName, oResponseBody, "txt", pTemplate.Name)
|
||||
WriteResponseFile(pTemplate.OutputWebserviceDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.txt")
|
||||
|
||||
Throw New ApplicationException(oResponseBody)
|
||||
|
||||
@@ -388,6 +385,18 @@ Namespace Winline
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function WriteResponseFile(pPath As String, pResponseBody As String, pFileName As String) As Boolean
|
||||
Try
|
||||
Dim oFilePath As String = IO.Path.Combine(pPath, pFileName)
|
||||
IO.File.WriteAllText(oFilePath, pResponseBody)
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -20,7 +20,7 @@ Namespace Winline
|
||||
Public Property Mandators As New List(Of Mandator)
|
||||
Public Property DocumentKinds As New List(Of DocumentKind)
|
||||
|
||||
Public Years As List(Of Integer)
|
||||
Public Property Years As List(Of Integer)
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As GeneralConfig, pMappingConfig As MappingConfig, pMandatorConfig As MandatorConfig)
|
||||
MyBase.New(pLogConfig, pDatabase)
|
||||
@@ -50,6 +50,7 @@ Namespace Winline
|
||||
Public Property DocNumberFrom As String
|
||||
Public Property DocNumberTo As String
|
||||
Public Property ShowExported As Boolean
|
||||
Public Property Year As Integer
|
||||
End Class
|
||||
|
||||
|
||||
@@ -594,12 +595,16 @@ Namespace Winline
|
||||
Try
|
||||
Dim oYear As Integer = Config.GetWinLineYear()
|
||||
|
||||
If pOptions.Year > 0 Then
|
||||
oYear = Config.GetWinLineYear(pOptions.Year)
|
||||
End If
|
||||
|
||||
Dim oTypeConstraint
|
||||
Select Case pDocumentType
|
||||
Case DocumentType.OutgoingOffer
|
||||
oTypeConstraint = $"T.c137 = 2 AND c139 = 1 AND "
|
||||
|
||||
Case DocumentType.OutgoingOffer
|
||||
Case DocumentType.OutgoingOrder
|
||||
oTypeConstraint = $"T.c137 = 2 AND c139 = 2 AND "
|
||||
|
||||
Case DocumentType.OutgoingDeliveryNote
|
||||
|
||||
Reference in New Issue
Block a user