Compare commits
4 Commits
a5c2b93bfe
...
e168c65ca9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e168c65ca9 | ||
|
|
bc8289e1b7 | ||
|
|
cd1cdfe19a | ||
|
|
ddaacfe75c |
@@ -398,6 +398,10 @@ Namespace Documents
|
||||
Dim oFunctionName = oColumn.Config.FunctionName
|
||||
Dim oFunctionParams = oColumn.Config.FunctionParams
|
||||
|
||||
If oFunctionName = String.Empty Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Logger.Debug("Running Function: [{0}]", oFunctionName)
|
||||
Logger.Debug("With Parameters: [{0}]", oFunctionParams)
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ Namespace Winline
|
||||
Dim oWS = Config
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Einstellungen laden")
|
||||
Logger.Debug("Loading setting and creating directories")
|
||||
|
||||
' --- Build all teh filenamez and pathz
|
||||
Dim oBaseFileName As String = FileEx.GetDateTimeString()
|
||||
@@ -72,12 +73,14 @@ Namespace Winline
|
||||
Dim oImportRelativeFilePath = IO.Path.Combine(oRelativePath, oFileName)
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Dateien schreiben")
|
||||
Logger.Debug("Writing request file to [{oOutputFilePath}]")
|
||||
|
||||
' --- Serialize Data into XML string
|
||||
IO.File.WriteAllBytes(oOutputFilePath, oBytes)
|
||||
|
||||
' --- Copy file to Winline Import Directory
|
||||
Try
|
||||
Logger.Debug("Copying request file to [{oImportAbsoluteFilePath}]")
|
||||
IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
@@ -87,6 +90,7 @@ Namespace Winline
|
||||
' --- Prepare URL and HTTP Client
|
||||
Dim oTemplateType = pDocument.TemplateType
|
||||
Dim oTemplateName = pDocument.TemplateName
|
||||
Logger.Debug("Using Template [{0}/{1}]", oTemplateName, oTemplateType)
|
||||
|
||||
' ActionCode: Should this be a test or not?
|
||||
' 0 = Test call
|
||||
@@ -95,6 +99,7 @@ Namespace Winline
|
||||
If pIsTest = True Then
|
||||
oActionCode = 0
|
||||
End If
|
||||
Logger.Debug("Using ActionCode [{0}]", oActionCode)
|
||||
|
||||
' Byref: Should data be supplied as file or as string?
|
||||
' 0 = As String
|
||||
@@ -113,6 +118,8 @@ Namespace Winline
|
||||
' --- Bring the action!
|
||||
Try
|
||||
Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL)
|
||||
Logger.Debug("HTTP Response recevied!")
|
||||
|
||||
Await HandleImportResponse(oResponse, pTemplate, oBaseFileName)
|
||||
|
||||
Return True
|
||||
@@ -133,8 +140,12 @@ Namespace Winline
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Antwort verarbeiten")
|
||||
|
||||
Logger.Debug("Response ContentType: [{0}]", oContentType)
|
||||
|
||||
Select Case oContentType
|
||||
Case "text/xml"
|
||||
Logger.Debug("Got XML Response. Checking.")
|
||||
|
||||
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
|
||||
|
||||
Dim oBytes As Byte() = Encoding.UTF8.GetBytes(oResponseBody)
|
||||
@@ -146,8 +157,8 @@ Namespace Winline
|
||||
For Each oDetails As Templates.Entities.MESOWebServiceResultResultDetails In oResponseObject.ResultDetails
|
||||
|
||||
If oDetails.Success = True Then
|
||||
Logger.Info("KeyValue: [{0}]", oDetails.KeyValue)
|
||||
Logger.Info("VoucherNumber: [{0}]", oDetails.VoucherNumber)
|
||||
Logger.Debug("KeyValue: [{0}]", oDetails.KeyValue)
|
||||
Logger.Debug("VoucherNumber: [{0}]", oDetails.VoucherNumber)
|
||||
Else
|
||||
Logger.Warn("ErrorCode: [{0}]", oDetails.ErrorCode)
|
||||
Logger.Warn("ErrorText: [{0}]", oDetails.ErrorText)
|
||||
@@ -159,17 +170,23 @@ Namespace Winline
|
||||
If oResponseObject.OverallSuccess = False Then
|
||||
Dim oMessage = $"Request to Webservice was unsuccessful:{vbNewLine}{vbNewLine}{String.Join(vbNewLine, oErrorStrings.ToArray)}"
|
||||
|
||||
Logger.Warn("Overall Success was [false]")
|
||||
|
||||
Throw New WebServiceException(oMessage)
|
||||
End If
|
||||
End Using
|
||||
|
||||
Case "text/html"
|
||||
Logger.Debug("Got TEXT/HTML Response. Throwing.")
|
||||
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
|
||||
|
||||
Throw New WebServiceException(oResponseBody)
|
||||
|
||||
Case Else
|
||||
Logger.Debug("Unknown Response ContentType: [{0}]", oContentType)
|
||||
|
||||
Throw New WebServiceException(oResponseBody)
|
||||
|
||||
End Select
|
||||
End Function
|
||||
|
||||
@@ -216,7 +233,7 @@ Namespace Winline
|
||||
#End Region
|
||||
|
||||
#Region "Export"
|
||||
Async Function ExportDocumentFromWinline(pDocument As Entities.ExportDocument, pTemplate As Template, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean)
|
||||
Async Function ExportDocumentFromWinline(pDocument As ExportDocument, pTemplate As Template, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean)
|
||||
Dim oWS = Config
|
||||
|
||||
Logger.Info("Exporting document from Winline")
|
||||
|
||||
@@ -433,7 +433,8 @@ Namespace Winline
|
||||
@pPrintDebug = 0,
|
||||
@pLog2DB = {oDebug},
|
||||
@pComment = 'Multitool/{pTemplate.Name}',
|
||||
@pResultType = 'CalcPricing'
|
||||
@pResultType = 'CalcPricing';
|
||||
SET NOCOUNT OFF;
|
||||
"
|
||||
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSQL)
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ Public Class FormHelper
|
||||
MsgBox(oMessage, MsgBoxStyle.Exclamation, Form.Text)
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub TryOpenDirectory(pPath As String, pDisplayName As String)
|
||||
If IO.Directory.Exists(pPath) Then
|
||||
Process.Start(pPath)
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("WebService Multitool")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.3.3.0")>
|
||||
<Assembly: AssemblyTrademark("1.3.4.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' indem Sie "*" wie unten gezeigt eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.3.3.0")>
|
||||
<Assembly: AssemblyVersion("1.3.4.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@@ -44,13 +44,7 @@ Public Class frmExportMain
|
||||
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
|
||||
Database = New MSSQLServer(LogConfig, oConnectionString)
|
||||
|
||||
Dim oViews As New List(Of GridView) From {
|
||||
GridViewDocuments,
|
||||
lookupMandator.Properties.View,
|
||||
lookupAccount.Properties.View
|
||||
}
|
||||
GridBuilder = New GridBuilder(oViews)
|
||||
GridBuilder.
|
||||
GridBuilder = New GridBuilder(GridViewDocuments, lookupMandator.Properties.View, lookupAccount.Properties.View).
|
||||
WithDefaults().
|
||||
WithReadOnlyOptions().
|
||||
WithClipboardHandler()
|
||||
|
||||
@@ -64,8 +64,10 @@ Public Class frmImportMain
|
||||
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
|
||||
Database = New MSSQLServer(LogConfig, oConnectionString)
|
||||
|
||||
GridBuilder = New GridBuilder(GridViewFiles)
|
||||
GridBuilder.WithDefaults.WithReadOnlyOptions.WithClipboardHandler()
|
||||
GridBuilder = New GridBuilder(GridViewFiles, GridView1, GridView2, GridView3, GridView4).
|
||||
WithDefaults().
|
||||
WithReadOnlyOptions().
|
||||
WithClipboardHandler()
|
||||
GridViewFiles.OptionsView.ShowAutoFilterRow = False
|
||||
|
||||
Winline = My.Winline
|
||||
@@ -413,7 +415,8 @@ Public Class frmImportMain
|
||||
|
||||
If oFailedDocuments.Count > 0 Then
|
||||
Dim oErrorMessages = String.Join(vbNewLine, oFailedDocuments)
|
||||
Dim oMessage = String.Format("Für {0} Dateien ist die Übertragung in die Winline fehlgeschlagen. Folgende Fehler sind aufgetreten: {2}{1}", oFailedDocuments.Count, oErrorMessages, vbNewLine)
|
||||
Dim oFailedCount = oFailedDocuments.Count
|
||||
Dim oMessage = $"Für {oFailedCount} Dateien ist die Übertragung in die Winline fehlgeschlagen. Folgende Fehler sind aufgetreten: {oErrorMessages}{vbNewLine}"
|
||||
MsgBox(oMessage, MsgBoxStyle.Exclamation, Text)
|
||||
End If
|
||||
|
||||
@@ -441,8 +444,6 @@ Public Class frmImportMain
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Async Function btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Task Handles btnLoadFiles.ItemClick
|
||||
Await LoadFiles()
|
||||
End Function
|
||||
@@ -753,24 +754,31 @@ Public Class frmImportMain
|
||||
Return False
|
||||
End If
|
||||
|
||||
Logger.Info("Transferring file [{0}] to Winline", pDocument.FileName)
|
||||
Dim oResult = Await WebService.TransferDocumentToWinline(pDocument, CurrentTemplate, lookupMandator.EditValue, pIsTest)
|
||||
|
||||
Logger.Debug("Transfer successful: [{0}]", oResult)
|
||||
|
||||
If oResult = True Then
|
||||
|
||||
' If this was only a test, we are done.
|
||||
If pIsTest = True Then
|
||||
Logger.Debug("This was a Test Transfer. Exiting.")
|
||||
Return True
|
||||
End If
|
||||
|
||||
' Generate the report
|
||||
WebService.RaiseWebServiceProgress("Bericht erzeugen")
|
||||
Logger.Debug("Creating report for file [{0}]", pDocument.FileName)
|
||||
Dim oReportResult = ReportGenerator.GenerateReport(pDocument, CurrentTemplate)
|
||||
|
||||
' Export it to pdf
|
||||
WebService.RaiseWebServiceProgress("Bericht exportieren")
|
||||
Logger.Debug("Exporting report to [{0}]", oReportResult.FileName)
|
||||
oReportResult.Report.ExportToPdf(oReportResult.FileName)
|
||||
|
||||
' Mark Document as Imported, will be moved on Form Close or File Reload
|
||||
Logger.Debug("Setting file [{0}] to Imported", pDocument.FileName)
|
||||
pDocument.Imported = True
|
||||
|
||||
Return True
|
||||
|
||||
Reference in New Issue
Block a user