From f45540a2832c90f11245786a2626375d541ece9a Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 27 Aug 2021 15:20:35 +0200 Subject: [PATCH] First Testable Version --- EDIDocumentImport/ImporterForm.vbproj | 9 + EDIDocumentImport/Positions/PositionData.vb | 4 +- EDIDocumentImport/frmMain.Designer.vb | 184 ++++++++++---------- EDIDocumentImport/frmMain.vb | 129 +++++++++++--- EDIDocumentImport/frmWaitForm.Designer.vb | 83 +++++++++ EDIDocumentImport/frmWaitForm.resx | 120 +++++++++++++ EDIDocumentImport/frmWaitForm.vb | 24 +++ ImporterShared/Config.vb | 2 + ImporterShared/ImporterShared.vbproj | 1 + ImporterShared/Schemas/Orders/Helpers.vb | 24 ++- ImporterShared/Schemas/Response.vb | 30 +++- ImporterShared/Winline/Data.vb | 41 +++++ ImporterShared/Winline/Entities/Contact.vb | 12 ++ ImporterShared/Winline/WebService.vb | 90 ++++++++-- 14 files changed, 612 insertions(+), 141 deletions(-) create mode 100644 EDIDocumentImport/frmWaitForm.Designer.vb create mode 100644 EDIDocumentImport/frmWaitForm.resx create mode 100644 EDIDocumentImport/frmWaitForm.vb create mode 100644 ImporterShared/Winline/Entities/Contact.vb diff --git a/EDIDocumentImport/ImporterForm.vbproj b/EDIDocumentImport/ImporterForm.vbproj index 8197b73..3a860c0 100644 --- a/EDIDocumentImport/ImporterForm.vbproj +++ b/EDIDocumentImport/ImporterForm.vbproj @@ -187,6 +187,12 @@ Component + + frmWaitForm.vb + + + Form + @@ -205,6 +211,9 @@ OrderReport.vb + + frmWaitForm.vb + diff --git a/EDIDocumentImport/Positions/PositionData.vb b/EDIDocumentImport/Positions/PositionData.vb index c11b531..0480bbe 100644 --- a/EDIDocumentImport/Positions/PositionData.vb +++ b/EDIDocumentImport/Positions/PositionData.vb @@ -14,8 +14,8 @@ Public Class PositionData End Sub Public Function Load(pMandator As Mandator, pData As Orders.Input.MESOWebService, pDataOriginal As Orders.Input.MESOWebService) As List(Of Position) - Dim oPositions = Orders.Helpers.GetOrderPositions(pData) - Dim oPositionsOriginal = Orders.Helpers.GetOrderPositions(pDataOriginal) + Dim oPositions = Orders.Helpers.GetOrderPositions(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(pData) + Dim oPositionsOriginal = Orders.Helpers.GetOrderPositions(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT026)(pDataOriginal) Dim oPositionList As New List(Of Position) For Each oPosition In oPositions diff --git a/EDIDocumentImport/frmMain.Designer.vb b/EDIDocumentImport/frmMain.Designer.vb index bd5aa5c..5de9e0e 100644 --- a/EDIDocumentImport/frmMain.Designer.vb +++ b/EDIDocumentImport/frmMain.Designer.vb @@ -39,9 +39,9 @@ Partial Class frmMain Me.btnReportPreview = New DevExpress.XtraBars.BarButtonItem() Me.btnReloadDocument = New DevExpress.XtraBars.BarButtonItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() - Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonGroupDataLoading = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() - Me.RibbonGroupData = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonGroupDataTransmission = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonGroupDocument = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonGroupPositions = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonStatusBar = New DevExpress.XtraBars.Ribbon.RibbonStatusBar() @@ -53,8 +53,7 @@ Partial Class frmMain Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerControl2 = New DevExpress.XtraEditors.SplitContainerControl() Me.LayoutControlHead = New DevExpress.XtraLayout.LayoutControl() - Me.txtOrderIssuer = New DevExpress.XtraEditors.TextEdit() - Me.MemoEdit1 = New DevExpress.XtraEditors.MemoEdit() + Me.txtInfoText = New DevExpress.XtraEditors.MemoEdit() Me.txtOrderNumber = New DevExpress.XtraEditors.TextEdit() Me.txtStreetName = New DevExpress.XtraEditors.TextEdit() Me.txtPlace = New DevExpress.XtraEditors.TextEdit() @@ -70,12 +69,14 @@ Partial Class frmMain Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() Me.cmbDeliveryAddress = New DevExpress.XtraEditors.SearchLookUpEdit() Me.GridView2 = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.cmbYears = New DevExpress.XtraEditors.ComboBoxEdit() + Me.cmbYear = New DevExpress.XtraEditors.ComboBoxEdit() Me.txtCustomerGLN = New DevExpress.XtraEditors.TextEdit() Me.txtDeliveryAddressGLN = New DevExpress.XtraEditors.TextEdit() - Me.txtDocumentReference = New DevExpress.XtraEditors.MemoEdit() Me.txtName = New DevExpress.XtraEditors.TextEdit() Me.cmbDocumentKind = New DevExpress.XtraEditors.ComboBoxEdit() + Me.cmbOrderIssuer = New DevExpress.XtraEditors.SearchLookUpEdit() + Me.GridView3 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.colContactName = New DevExpress.XtraGrid.Columns.GridColumn() Me.Root = New DevExpress.XtraLayout.LayoutControlGroup() Me.TabbedControlGroup2 = New DevExpress.XtraLayout.TabbedControlGroup() Me.LayoutControlGroup2 = New DevExpress.XtraLayout.LayoutControlGroup() @@ -88,7 +89,6 @@ Partial Class frmMain Me.LayoutControlItem13 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem() - Me.LayoutControlItem14 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItemRunningNumber = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem11 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem3 = New DevExpress.XtraLayout.LayoutControlItem() @@ -102,6 +102,7 @@ Partial Class frmMain Me.GridViewPositions = New DevExpress.XtraGrid.Views.Grid.GridView() Me.SplitContainerControl3 = New DevExpress.XtraEditors.SplitContainerControl() Me.RichEditXml = New DevExpress.XtraRichEdit.RichEditControl() + Me.SplashScreenManager1 = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.ImporterForm.frmWaitForm), True, True) CType(Me.RibbonControl, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ApplicationMenu1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridControlFiles, System.ComponentModel.ISupportInitialize).BeginInit() @@ -112,8 +113,7 @@ Partial Class frmMain Me.SplitContainerControl2.SuspendLayout() CType(Me.LayoutControlHead, System.ComponentModel.ISupportInitialize).BeginInit() Me.LayoutControlHead.SuspendLayout() - CType(Me.txtOrderIssuer.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.MemoEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtInfoText.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtOrderNumber.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtStreetName.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtPlace.Properties, System.ComponentModel.ISupportInitialize).BeginInit() @@ -128,12 +128,13 @@ Partial Class frmMain CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.cmbDeliveryAddress.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridView2, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.cmbYears.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.cmbYear.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtCustomerGLN.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtDeliveryAddressGLN.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.txtDocumentReference.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtName.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.cmbDocumentKind.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.cmbOrderIssuer.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView3, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TabbedControlGroup2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlGroup2, System.ComponentModel.ISupportInitialize).BeginInit() @@ -146,7 +147,6 @@ Partial Class frmMain CType(Me.LayoutControlItem13, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.LayoutControlItem14, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItemRunningNumber, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem11, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).BeginInit() @@ -292,16 +292,16 @@ Partial Class frmMain ' 'RibbonPage1 ' - Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonGroupData, Me.RibbonGroupDocument, Me.RibbonGroupPositions}) + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonGroupDataLoading, Me.RibbonPageGroup2, Me.RibbonGroupDataTransmission, Me.RibbonGroupDocument, Me.RibbonGroupPositions}) Me.RibbonPage1.Name = "RibbonPage1" Me.RibbonPage1.Text = "Start" ' - 'RibbonPageGroup1 + 'RibbonGroupDataLoading ' - Me.RibbonPageGroup1.ItemLinks.Add(Me.btnLoadDocuments) - Me.RibbonPageGroup1.ItemLinks.Add(Me.btnReloadDocument) - Me.RibbonPageGroup1.Name = "RibbonPageGroup1" - Me.RibbonPageGroup1.Text = "Daten laden" + Me.RibbonGroupDataLoading.ItemLinks.Add(Me.btnLoadDocuments) + Me.RibbonGroupDataLoading.ItemLinks.Add(Me.btnReloadDocument) + Me.RibbonGroupDataLoading.Name = "RibbonGroupDataLoading" + Me.RibbonGroupDataLoading.Text = "Daten laden" ' 'RibbonPageGroup2 ' @@ -313,13 +313,13 @@ Partial Class frmMain Me.RibbonPageGroup2.Name = "RibbonPageGroup2" Me.RibbonPageGroup2.Text = "Konfiguration" ' - 'RibbonGroupData + 'RibbonGroupDataTransmission ' - Me.RibbonGroupData.Enabled = False - Me.RibbonGroupData.ItemLinks.Add(Me.BarButtonItem4) - Me.RibbonGroupData.ItemLinks.Add(Me.BarButtonItem5) - Me.RibbonGroupData.Name = "RibbonGroupData" - Me.RibbonGroupData.Text = "Daten übermitteln" + Me.RibbonGroupDataTransmission.Enabled = False + Me.RibbonGroupDataTransmission.ItemLinks.Add(Me.BarButtonItem4) + Me.RibbonGroupDataTransmission.ItemLinks.Add(Me.BarButtonItem5) + Me.RibbonGroupDataTransmission.Name = "RibbonGroupDataTransmission" + Me.RibbonGroupDataTransmission.Text = "Daten übermitteln" ' 'RibbonGroupDocument ' @@ -425,8 +425,7 @@ Partial Class frmMain ' 'LayoutControlHead ' - Me.LayoutControlHead.Controls.Add(Me.txtOrderIssuer) - Me.LayoutControlHead.Controls.Add(Me.MemoEdit1) + Me.LayoutControlHead.Controls.Add(Me.txtInfoText) Me.LayoutControlHead.Controls.Add(Me.txtOrderNumber) Me.LayoutControlHead.Controls.Add(Me.txtStreetName) Me.LayoutControlHead.Controls.Add(Me.txtPlace) @@ -437,12 +436,12 @@ Partial Class frmMain Me.LayoutControlHead.Controls.Add(Me.cmbMandator) Me.LayoutControlHead.Controls.Add(Me.cmbCustomer) Me.LayoutControlHead.Controls.Add(Me.cmbDeliveryAddress) - Me.LayoutControlHead.Controls.Add(Me.cmbYears) + Me.LayoutControlHead.Controls.Add(Me.cmbYear) Me.LayoutControlHead.Controls.Add(Me.txtCustomerGLN) Me.LayoutControlHead.Controls.Add(Me.txtDeliveryAddressGLN) - Me.LayoutControlHead.Controls.Add(Me.txtDocumentReference) Me.LayoutControlHead.Controls.Add(Me.txtName) Me.LayoutControlHead.Controls.Add(Me.cmbDocumentKind) + Me.LayoutControlHead.Controls.Add(Me.cmbOrderIssuer) Me.LayoutControlHead.Dock = System.Windows.Forms.DockStyle.Fill Me.LayoutControlHead.Enabled = False Me.LayoutControlHead.Location = New System.Drawing.Point(0, 0) @@ -453,23 +452,14 @@ Partial Class frmMain Me.LayoutControlHead.TabIndex = 0 Me.LayoutControlHead.Text = "LayoutControl1" ' - 'txtOrderIssuer + 'txtInfoText ' - Me.txtOrderIssuer.Location = New System.Drawing.Point(123, 170) - Me.txtOrderIssuer.MenuManager = Me.RibbonControl - Me.txtOrderIssuer.Name = "txtOrderIssuer" - Me.txtOrderIssuer.Size = New System.Drawing.Size(402, 20) - Me.txtOrderIssuer.StyleController = Me.LayoutControlHead - Me.txtOrderIssuer.TabIndex = 6 - ' - 'MemoEdit1 - ' - Me.MemoEdit1.Location = New System.Drawing.Point(631, 200) - Me.MemoEdit1.MenuManager = Me.RibbonControl - Me.MemoEdit1.Name = "MemoEdit1" - Me.MemoEdit1.Size = New System.Drawing.Size(404, 90) - Me.MemoEdit1.StyleController = Me.LayoutControlHead - Me.MemoEdit1.TabIndex = 12 + Me.txtInfoText.Location = New System.Drawing.Point(123, 200) + Me.txtInfoText.MenuManager = Me.RibbonControl + Me.txtInfoText.Name = "txtInfoText" + Me.txtInfoText.Size = New System.Drawing.Size(912, 90) + Me.txtInfoText.StyleController = Me.LayoutControlHead + Me.txtInfoText.TabIndex = 12 ' 'txtOrderNumber ' @@ -521,6 +511,7 @@ Partial Class frmMain Me.txtRunningNumber.Location = New System.Drawing.Point(123, 50) Me.txtRunningNumber.MenuManager = Me.RibbonControl Me.txtRunningNumber.Name = "txtRunningNumber" + Me.txtRunningNumber.Properties.ReadOnly = True Me.txtRunningNumber.Size = New System.Drawing.Size(402, 20) Me.txtRunningNumber.StyleController = Me.LayoutControlHead Me.txtRunningNumber.TabIndex = 2 @@ -612,15 +603,15 @@ Partial Class frmMain Me.GridView2.OptionsSelection.EnableAppearanceFocusedCell = False Me.GridView2.OptionsView.ShowGroupPanel = False ' - 'cmbYears + 'cmbYear ' - Me.cmbYears.Location = New System.Drawing.Point(631, 80) - Me.cmbYears.MenuManager = Me.RibbonControl - Me.cmbYears.Name = "cmbYears" - Me.cmbYears.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) - Me.cmbYears.Size = New System.Drawing.Size(404, 20) - Me.cmbYears.StyleController = Me.LayoutControlHead - Me.cmbYears.TabIndex = 15 + Me.cmbYear.Location = New System.Drawing.Point(631, 80) + Me.cmbYear.MenuManager = Me.RibbonControl + Me.cmbYear.Name = "cmbYear" + Me.cmbYear.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) + Me.cmbYear.Size = New System.Drawing.Size(404, 20) + Me.cmbYear.StyleController = Me.LayoutControlHead + Me.cmbYear.TabIndex = 15 ' 'txtCustomerGLN ' @@ -640,15 +631,6 @@ Partial Class frmMain Me.txtDeliveryAddressGLN.StyleController = Me.LayoutControlHead Me.txtDeliveryAddressGLN.TabIndex = 17 ' - 'txtDocumentReference - ' - Me.txtDocumentReference.Location = New System.Drawing.Point(123, 200) - Me.txtDocumentReference.MenuManager = Me.RibbonControl - Me.txtDocumentReference.Name = "txtDocumentReference" - Me.txtDocumentReference.Size = New System.Drawing.Size(402, 90) - Me.txtDocumentReference.StyleController = Me.LayoutControlHead - Me.txtDocumentReference.TabIndex = 19 - ' 'txtName ' Me.txtName.Location = New System.Drawing.Point(123, 50) @@ -669,6 +651,34 @@ Partial Class frmMain Me.cmbDocumentKind.StyleController = Me.LayoutControlHead Me.cmbDocumentKind.TabIndex = 18 ' + 'cmbOrderIssuer + ' + Me.cmbOrderIssuer.Location = New System.Drawing.Point(123, 170) + Me.cmbOrderIssuer.MenuManager = Me.RibbonControl + Me.cmbOrderIssuer.Name = "cmbOrderIssuer" + Me.cmbOrderIssuer.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) + Me.cmbOrderIssuer.Properties.NullText = "" + Me.cmbOrderIssuer.Properties.PopupView = Me.GridView3 + Me.cmbOrderIssuer.Size = New System.Drawing.Size(402, 20) + Me.cmbOrderIssuer.StyleController = Me.LayoutControlHead + Me.cmbOrderIssuer.TabIndex = 6 + ' + 'GridView3 + ' + Me.GridView3.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colContactName}) + Me.GridView3.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus + Me.GridView3.Name = "GridView3" + Me.GridView3.OptionsSelection.EnableAppearanceFocusedCell = False + Me.GridView3.OptionsView.ShowGroupPanel = False + ' + 'colContactName + ' + Me.colContactName.Caption = "Name" + Me.colContactName.FieldName = "Name" + Me.colContactName.Name = "colContactName" + Me.colContactName.Visible = True + Me.colContactName.VisibleIndex = 0 + ' 'Root ' Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] @@ -688,7 +698,7 @@ Partial Class frmMain ' 'LayoutControlGroup2 ' - Me.LayoutControlGroup2.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem5, Me.LayoutControlItem2, Me.LayoutItemOrderIssuer, Me.LayoutItemOrderNumber, Me.LayoutItemOrderDate, Me.LayoutControlItem12, Me.LayoutControlItem13, Me.LayoutControlItem1, Me.LayoutControlItem4, Me.LayoutControlItem14, Me.LayoutControlItemRunningNumber, Me.LayoutControlItem11, Me.LayoutControlItem3}) + Me.LayoutControlGroup2.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem5, Me.LayoutControlItem2, Me.LayoutItemOrderIssuer, Me.LayoutItemOrderNumber, Me.LayoutItemOrderDate, Me.LayoutControlItem12, Me.LayoutControlItem13, Me.LayoutControlItem1, Me.LayoutControlItem4, Me.LayoutControlItemRunningNumber, Me.LayoutControlItem11, Me.LayoutControlItem3}) Me.LayoutControlGroup2.Location = New System.Drawing.Point(0, 0) Me.LayoutControlGroup2.Name = "LayoutControlGroup2" Me.LayoutControlGroup2.Size = New System.Drawing.Size(1018, 250) @@ -716,12 +726,12 @@ Partial Class frmMain ' 'LayoutItemOrderIssuer ' - Me.LayoutItemOrderIssuer.Control = Me.txtOrderIssuer + Me.LayoutItemOrderIssuer.Control = Me.cmbOrderIssuer Me.LayoutItemOrderIssuer.Location = New System.Drawing.Point(0, 120) Me.LayoutItemOrderIssuer.Name = "LayoutItemOrderIssuer" Me.LayoutItemOrderIssuer.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) Me.LayoutItemOrderIssuer.Size = New System.Drawing.Size(508, 30) - Me.LayoutItemOrderIssuer.Text = "Besteller" + Me.LayoutItemOrderIssuer.Text = "Ansprechpartner" Me.LayoutItemOrderIssuer.TextSize = New System.Drawing.Size(93, 13) ' 'LayoutItemOrderNumber @@ -776,7 +786,7 @@ Partial Class frmMain ' 'LayoutControlItem4 ' - Me.LayoutControlItem4.Control = Me.cmbYears + Me.LayoutControlItem4.Control = Me.cmbYear Me.LayoutControlItem4.Location = New System.Drawing.Point(508, 30) Me.LayoutControlItem4.Name = "LayoutControlItem4" Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) @@ -784,16 +794,6 @@ Partial Class frmMain Me.LayoutControlItem4.Text = "Wirtschaftsjahr" Me.LayoutControlItem4.TextSize = New System.Drawing.Size(93, 13) ' - 'LayoutControlItem14 - ' - Me.LayoutControlItem14.Control = Me.txtDocumentReference - Me.LayoutControlItem14.Location = New System.Drawing.Point(0, 150) - Me.LayoutControlItem14.Name = "LayoutControlItem14" - Me.LayoutControlItem14.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem14.Size = New System.Drawing.Size(508, 100) - Me.LayoutControlItem14.Text = "Auftragsreferenz" - Me.LayoutControlItem14.TextSize = New System.Drawing.Size(93, 13) - ' 'LayoutControlItemRunningNumber ' Me.LayoutControlItemRunningNumber.Control = Me.txtRunningNumber @@ -816,11 +816,11 @@ Partial Class frmMain ' 'LayoutControlItem3 ' - Me.LayoutControlItem3.Control = Me.MemoEdit1 - Me.LayoutControlItem3.Location = New System.Drawing.Point(508, 150) + Me.LayoutControlItem3.Control = Me.txtInfoText + Me.LayoutControlItem3.Location = New System.Drawing.Point(0, 150) Me.LayoutControlItem3.Name = "LayoutControlItem3" Me.LayoutControlItem3.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) - Me.LayoutControlItem3.Size = New System.Drawing.Size(510, 100) + Me.LayoutControlItem3.Size = New System.Drawing.Size(1018, 100) Me.LayoutControlItem3.Text = "Freitext" Me.LayoutControlItem3.TextSize = New System.Drawing.Size(93, 13) ' @@ -927,6 +927,10 @@ Partial Class frmMain Me.RichEditXml.Size = New System.Drawing.Size(0, 0) Me.RichEditXml.TabIndex = 0 ' + 'SplashScreenManager1 + ' + Me.SplashScreenManager1.ClosingDelay = 500 + ' 'frmMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -950,8 +954,7 @@ Partial Class frmMain Me.SplitContainerControl2.ResumeLayout(False) CType(Me.LayoutControlHead, System.ComponentModel.ISupportInitialize).EndInit() Me.LayoutControlHead.ResumeLayout(False) - CType(Me.txtOrderIssuer.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.MemoEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtInfoText.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtOrderNumber.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtStreetName.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtPlace.Properties, System.ComponentModel.ISupportInitialize).EndInit() @@ -966,12 +969,13 @@ Partial Class frmMain CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.cmbDeliveryAddress.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView2, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.cmbYears.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.cmbYear.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtCustomerGLN.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtDeliveryAddressGLN.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.txtDocumentReference.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtName.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.cmbDocumentKind.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.cmbOrderIssuer.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView3, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TabbedControlGroup2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlGroup2, System.ComponentModel.ISupportInitialize).EndInit() @@ -984,7 +988,6 @@ Partial Class frmMain CType(Me.LayoutControlItem13, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.LayoutControlItem14, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItemRunningNumber, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem11, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).EndInit() @@ -1005,15 +1008,14 @@ Partial Class frmMain Friend WithEvents RibbonControl As DevExpress.XtraBars.Ribbon.RibbonControl Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage - Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonGroupDataLoading As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents RibbonStatusBar As DevExpress.XtraBars.Ribbon.RibbonStatusBar Friend WithEvents GridControlFiles As DevExpress.XtraGrid.GridControl Friend WithEvents GridViewFiles As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents SplitContainerControl1 As DevExpress.XtraEditors.SplitContainerControl Friend WithEvents SplitContainerControl2 As DevExpress.XtraEditors.SplitContainerControl Friend WithEvents LayoutControlHead As DevExpress.XtraLayout.LayoutControl - Friend WithEvents txtOrderIssuer As DevExpress.XtraEditors.TextEdit - Friend WithEvents MemoEdit1 As DevExpress.XtraEditors.MemoEdit + Friend WithEvents txtInfoText As DevExpress.XtraEditors.MemoEdit Friend WithEvents txtOrderNumber As DevExpress.XtraEditors.TextEdit Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup Friend WithEvents GridControlPositions As DevExpress.XtraGrid.GridControl @@ -1043,13 +1045,13 @@ Partial Class frmMain Friend WithEvents cmbDeliveryAddress As DevExpress.XtraEditors.SearchLookUpEdit Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents BarButtonItem5 As DevExpress.XtraBars.BarButtonItem - Friend WithEvents RibbonGroupData As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonGroupDataTransmission As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents txtVersion As DevExpress.XtraBars.BarStaticItem Friend WithEvents btnDeletePosition As DevExpress.XtraBars.BarButtonItem Friend WithEvents RibbonGroupPositions As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents BarButtonItem7 As DevExpress.XtraBars.BarButtonItem Friend WithEvents colSelected As DevExpress.XtraGrid.Columns.GridColumn - Friend WithEvents cmbYears As DevExpress.XtraEditors.ComboBoxEdit + Friend WithEvents cmbYear As DevExpress.XtraEditors.ComboBoxEdit Friend WithEvents TabbedControlGroup2 As DevExpress.XtraLayout.TabbedControlGroup Friend WithEvents LayoutControlGroup2 As DevExpress.XtraLayout.LayoutControlGroup Friend WithEvents LayoutControlItemRunningNumber As DevExpress.XtraLayout.LayoutControlItem @@ -1074,8 +1076,6 @@ Partial Class frmMain Friend WithEvents btnPreviewReport As DevExpress.XtraBars.BarButtonItem Friend WithEvents RibbonGroupDocument As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents LayoutControlItem11 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents txtDocumentReference As DevExpress.XtraEditors.MemoEdit - Friend WithEvents LayoutControlItem14 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents btnReportPreview As DevExpress.XtraBars.BarButtonItem Friend WithEvents btnReloadDocument As DevExpress.XtraBars.BarButtonItem Friend WithEvents colId As DevExpress.XtraGrid.Columns.GridColumn @@ -1084,4 +1084,8 @@ Partial Class frmMain Friend WithEvents LayoutControlItem15 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents cmbDocumentKind As DevExpress.XtraEditors.ComboBoxEdit Friend WithEvents ApplicationMenu1 As DevExpress.XtraBars.Ribbon.ApplicationMenu + Friend WithEvents cmbOrderIssuer As DevExpress.XtraEditors.SearchLookUpEdit + Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents colContactName As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents SplashScreenManager1 As DevExpress.XtraSplashScreen.SplashScreenManager End Class diff --git a/EDIDocumentImport/frmMain.vb b/EDIDocumentImport/frmMain.vb index fe4d53c..9d481be 100644 --- a/EDIDocumentImport/frmMain.vb +++ b/EDIDocumentImport/frmMain.vb @@ -74,8 +74,8 @@ Public Class frmMain cmbMandator.Properties.DataSource = Winline.Mandators - cmbYears.Properties.Items.AddRange(Winline.Years) - cmbYears.SelectedItem = ConfigManager.Config.GetYear() + cmbYear.Properties.Items.AddRange(Winline.Years) + cmbYear.SelectedItem = ConfigManager.Config.GetYear() ' Initialize Grids GridBuilder = New GridBuilder(New List(Of GridView) From {GridViewFiles, GridViewPositions}) @@ -127,7 +127,7 @@ Public Class frmMain Try If DocumentLoader.LoadFiles(ConfigManager.Config.InputDirectory) = True Then - RibbonGroupData.Enabled = True + RibbonGroupDataTransmission.Enabled = True RibbonGroupDocument.Enabled = True RibbonGroupPositions.Enabled = True @@ -210,8 +210,8 @@ Public Class frmMain Dim oData As Orders.Input.MESOWebService = DirectCast(pDocument.Data, Orders.Input.MESOWebService) Dim oDataOriginal As Orders.Input.MESOWebService = DirectCast(pDocument.DataOriginal, Orders.Input.MESOWebService) - Dim oHead = Orders.Helpers.GetOrderHead(oData) - Dim oHeadOriginal = Orders.Helpers.GetOrderHead(oDataOriginal) + Dim oHead = Orders.Helpers.GetOrderHead(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT025)(oData) + Dim oHeadOriginal = Orders.Helpers.GetOrderHead(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT025)(oDataOriginal) ' --- Head Data -------------------------------------------------------------------------------------- @@ -221,10 +221,9 @@ Public Class frmMain ' Regular Data from EDI txtRunningNumber.Text = oHead.Laufnummer - txtOrderIssuer.Text = oHead.Fakt_Ansprechpartner - txtOrderNumber.Text = oHead.AuftragsBestellnummer - - txtDocumentReference.Text = oHead.Auftragsreferenz + cmbOrderIssuer.Text = oHead.Fakt_Ansprechpartner + txtOrderNumber.Text = oHead.Auftragsreferenz + txtInfoText.Text = oHead.Infotext dateOrderDate.EditValue = oHead.Datum_AuftragBestellung ' --- Find Mandator -------------------------------------------------------------------------------------- @@ -245,7 +244,13 @@ Public Class frmMain cmbDocumentKind.Properties.Items.Clear() cmbDocumentKind.Properties.Items.AddRange(oMandatorKinds) - cmbDocumentKind.SelectedItem = oSelectedKind + + If oSelectedKind Is Nothing Then + cmbDocumentKind.ErrorText = "Es wurde keine passende Belegart gefunden." + cmbDocumentKind.SelectedItem = Nothing + Else + cmbDocumentKind.SelectedItem = oSelectedKind + End If ' --- Find Accounts -------------------------------------------------------------------------------------- @@ -275,6 +280,13 @@ Public Class frmMain End If End If + ' CONTACTS + If cmbCustomer.EditValue IsNot Nothing Then + Dim oContacts = Winline.GetContacts(oHead.Fakt_Kontonummer, oMandator) + cmbOrderIssuer.Properties.DataSource = oContacts + End If + + ' DEVLIERY If oHead.Lief_Kontonummer = oHeadOriginal.Lief_Kontonummer Then If oHeadOriginal.Lief_Kontonummer = String.Empty Then @@ -291,15 +303,14 @@ Public Class frmMain Where(Function(oAccount) oAccount.Id = oHead.Lief_Kontonummer) If oMatchingAccounts.Count() > 1 Then - cmbCustomer.EditValue = Nothing - cmbCustomer.ErrorText = "Für die Kontonummer wurden mehrere Konten gefunden." + cmbDeliveryAddress.EditValue = Nothing + cmbDeliveryAddress.ErrorText = "Für die Kontonummer wurden mehrere Konten gefunden." ElseIf oMatchingAccounts.Count() = 0 Then - cmbCustomer.EditValue = Nothing - cmbCustomer.ErrorText = "Für die Kontonummer wurde kein Konto gefunden." + cmbDeliveryAddress.EditValue = Nothing + cmbDeliveryAddress.ErrorText = "Für die Kontonummer wurde kein Konto gefunden." Else - cmbCustomer.EditValue = oMatchingAccounts.SingleOrDefault() + cmbDeliveryAddress.EditValue = oMatchingAccounts.SingleOrDefault() End If - End If ' --- Find Positions ------------------------------------------------------------------------------------ @@ -329,32 +340,106 @@ Public Class frmMain End Sub Private Async Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick + Dim oMessageText As String = "" + Dim oMessageStyle As MsgBoxStyle = MsgBoxStyle.Critical + Dim oDocument As Document = GetFocusedDocument() If oDocument Is Nothing Then Exit Sub End If + SplashScreenManager1.ShowWaitForm() + ChangeUIState(False) + Try Dim oFinalDocument As Document = TransferChangesToDocument(oDocument) Dim oResult = Await WebService.TransferDocumentToWinLine(oFinalDocument) + + oMessageText = "Beleg wurde erfolgreich übertragen!" + oMessageStyle = MsgBoxStyle.Information + Catch ex As Exception Logger.Error(ex) - Dim oMessage = $"Fehler beim Übertragen des Dokuments:{vbNewLine}{vbNewLine}{ex.Message}" - MsgBox(oMessage, MsgBoxStyle.Critical, Text) + + oMessageText = $"Fehler beim Übertragen des Dokuments:{vbNewLine}{vbNewLine}{ex.Message}" + oMessageStyle = MsgBoxStyle.Critical + + Finally + SplashScreenManager1.CloseWaitForm() + ChangeUIState(True) + + MsgBox(oMessageText, oMessageStyle, Text) End Try End Sub + Private Sub ChangeUIState(pEnabled As Boolean) + GridControlPositions.Enabled = pEnabled + GridControlFiles.Enabled = pEnabled + LayoutControlHead.Enabled = pEnabled + + RibbonGroupDataTransmission.Enabled = pEnabled + RibbonGroupDataLoading.Enabled = pEnabled + RibbonGroupDocument.Enabled = pEnabled + RibbonGroupPositions.Enabled = pEnabled + End Sub + Private Function TransferChangesToDocument(pDocument As Document) + Dim oData As Orders.Input.MESOWebService = pDocument.Data + + Try + Orders.Helpers.SetOrderHead(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT025)(oData, AddressOf UpdateOrderHead) + Catch ex As Exception + Logger.Error(ex) + + Throw ex + End Try + Return pDocument End Function + Private Function UpdateOrderHead(pObject As Orders.Input.MESOWebServiceEXIMVRG_ordersT025) As Orders.Input.MESOWebServiceEXIMVRG_ordersT025 + ' Update DocumentKind + If cmbDocumentKind.EditValue IsNot Nothing AndAlso TypeOf cmbDocumentKind.EditValue Is DocumentKind Then + pObject.Belegart = DirectCast(cmbDocumentKind.EditValue, DocumentKind).Id + End If + + ' Update Talking Person lol + If cmbOrderIssuer.EditValue IsNot Nothing AndAlso TypeOf cmbOrderIssuer.EditValue Is Contact Then + pObject.Fakt_Ansprechpartner = DirectCast(cmbOrderIssuer.EditValue, Contact).Id + End If + + ' Update Delivery Address + If cmbDeliveryAddress.EditValue IsNot Nothing AndAlso TypeOf cmbDeliveryAddress.EditValue Is Account Then + pObject.Lief_Kontonummer = DirectCast(cmbDeliveryAddress.EditValue, Account)?.Id + End If + + ' Update Order Number + If txtOrderNumber.EditValue IsNot Nothing AndAlso txtOrderNumber.EditValue <> String.Empty Then + pObject.Auftragsreferenz = txtOrderNumber.EditValue + + End If + + ' Update Order Date + If dateOrderDate IsNot Nothing Then + pObject.Datum_AuftragBestellung = DirectCast(dateOrderDate.EditValue, Date).ToString("yyyy-MM-dd") + End If + + ' Update Extra Address + pObject.Lief_Name = txtName.EditValue + pObject.Lief_Ort = txtPlace.EditValue + pObject.Lief_PLZ = txtZIP.EditValue + pObject.Lief_Strasse = txtStreetName.EditValue + + Return pObject + End Function + Private Sub BarButtonItem8_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem8.ItemClick TryOpenDirectory(LogConfig.LogDirectory, "Logverzeichnis") End Sub - Private Sub cmbAccount_Validating(sender As BaseEdit, e As System.ComponentModel.CancelEventArgs) Handles cmbCustomer.Validating, cmbDeliveryAddress.Validating + Private Sub cmbCustomer_Validating(sender As BaseEdit, e As System.ComponentModel.CancelEventArgs) Handles cmbCustomer.Validating, cmbDocumentKind.Validating, cmbMandator.Validating, cmbYear.Validating If sender.EditValue Is Nothing Then - sender.ErrorText = "Dieses Feld muss ausgefüllt werden!" + sender.ErrorText = "Dieses Feld muss ausgefüllt werden" Else sender.ErrorText = "" End If @@ -368,8 +453,8 @@ Public Class frmMain Dim oReport As New OrderReport() Dim oDataSource = New DevExpress.DataAccess.ObjectBinding.ObjectDataSource With { .DataSource = New Orders.ReportSource With { - .Head = Orders.Helpers.GetOrderHead(oDocument.Data), - .Positions = Orders.Helpers.GetOrderPositions(oDocument.Data) + .Head = Orders.Helpers.GetOrderHead(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT025)(oDocument.Data), + .Positions = Orders.Helpers.GetOrderPositions(Of Orders.Input.MESOWebServiceEXIMVRG_ordersT025)(oDocument.Data) } } oDataSource.Fill() diff --git a/EDIDocumentImport/frmWaitForm.Designer.vb b/EDIDocumentImport/frmWaitForm.Designer.vb new file mode 100644 index 0000000..1a20c4c --- /dev/null +++ b/EDIDocumentImport/frmWaitForm.Designer.vb @@ -0,0 +1,83 @@ + _ +Partial Class frmWaitForm + Inherits DevExpress.XtraWaitForm.WaitForm + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.progressPanel1 = New DevExpress.XtraWaitForm.ProgressPanel() + Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.tableLayoutPanel1.SuspendLayout() + Me.SuspendLayout() + ' + 'progressPanel1 + ' + Me.progressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent + Me.progressPanel1.Appearance.Options.UseBackColor = True + Me.progressPanel1.AppearanceCaption.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) + Me.progressPanel1.AppearanceCaption.Options.UseFont = True + Me.progressPanel1.AppearanceDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.progressPanel1.AppearanceDescription.Options.UseFont = True + Me.progressPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.progressPanel1.ImageHorzOffset = 20 + Me.progressPanel1.Location = New System.Drawing.Point(0, 17) + Me.progressPanel1.Margin = New System.Windows.Forms.Padding(0, 3, 0, 3) + Me.progressPanel1.Name = "progressPanel1" + Me.progressPanel1.Size = New System.Drawing.Size(246, 39) + Me.progressPanel1.TabIndex = 0 + Me.progressPanel1.Text = "progressPanel1" + ' + 'tableLayoutPanel1 + ' + Me.tableLayoutPanel1.AutoSize = True + Me.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent + Me.tableLayoutPanel1.ColumnCount = 1 + Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Controls.Add(Me.progressPanel1, 0, 0) + Me.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.tableLayoutPanel1.Location = New System.Drawing.Point(0, 0) + Me.tableLayoutPanel1.Name = "tableLayoutPanel1" + Me.tableLayoutPanel1.Padding = New System.Windows.Forms.Padding(0, 14, 0, 14) + Me.tableLayoutPanel1.RowCount = 1 + Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Size = New System.Drawing.Size(246, 73) + Me.tableLayoutPanel1.TabIndex = 1 + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.AutoSize = True + Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ClientSize = New System.Drawing.Size(246, 73) + Me.Controls.Add(Me.tableLayoutPanel1) + Me.DoubleBuffered = True + Me.Name = "Form1" + Me.StartPosition = FormStartPosition.Manual + Me.Text = "Form1" + Me.tableLayoutPanel1.ResumeLayout(false) + Me.ResumeLayout(False) + Me.PerformLayout() + End Sub + + Private WithEvents progressPanel1 As DevExpress.XtraWaitForm.ProgressPanel + Private WithEvents tableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel +End Class diff --git a/EDIDocumentImport/frmWaitForm.resx b/EDIDocumentImport/frmWaitForm.resx new file mode 100644 index 0000000..9d1fc38 --- /dev/null +++ b/EDIDocumentImport/frmWaitForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/EDIDocumentImport/frmWaitForm.vb b/EDIDocumentImport/frmWaitForm.vb new file mode 100644 index 0000000..04b65ef --- /dev/null +++ b/EDIDocumentImport/frmWaitForm.vb @@ -0,0 +1,24 @@ +Public Class frmWaitForm + Sub New + InitializeComponent() + Me.progressPanel1.AutoHeight = True + End Sub + + Public Overrides Sub SetCaption(ByVal caption As String) + MyBase.SetCaption(caption) + Me.progressPanel1.Caption = caption + End Sub + + Public Overrides Sub SetDescription(ByVal description As String) + MyBase.SetDescription(description) + Me.progressPanel1.Description = description + End Sub + + Public Overrides Sub ProcessCommand(ByVal cmd As System.Enum, ByVal arg As Object) + MyBase.ProcessCommand(cmd, arg) + End Sub + + Public Enum WaitFormCommand + SomeCommandId + End Enum +End Class diff --git a/ImporterShared/Config.vb b/ImporterShared/Config.vb index f23c1dd..ed39f1f 100644 --- a/ImporterShared/Config.vb +++ b/ImporterShared/Config.vb @@ -10,6 +10,8 @@ Public Property BaseUrl As String = "http://127.0.0.1/EWL" Public Property Username As String = "Username" Public Property Password As String = "Password" + Public Property ImportBasePath As String = "" + Public Property ImportRelativePath As String = "" End Class Public Class MandatorConfig diff --git a/ImporterShared/ImporterShared.vbproj b/ImporterShared/ImporterShared.vbproj index 45fe769..24e580b 100644 --- a/ImporterShared/ImporterShared.vbproj +++ b/ImporterShared/ImporterShared.vbproj @@ -121,6 +121,7 @@ + diff --git a/ImporterShared/Schemas/Orders/Helpers.vb b/ImporterShared/Schemas/Orders/Helpers.vb index 5aca00d..f01a74a 100644 --- a/ImporterShared/Schemas/Orders/Helpers.vb +++ b/ImporterShared/Schemas/Orders/Helpers.vb @@ -1,16 +1,26 @@ Namespace Schemas.Orders Public Class Helpers - Public Shared Function GetOrderHead(pData As Input.MESOWebService) As Input.MESOWebServiceEXIMVRG_ordersT025 - Dim oHead As Input.MESOWebServiceEXIMVRG_ordersT025 = pData.Items. - Where(Function(i) TypeOf i Is Input.MESOWebServiceEXIMVRG_ordersT025). + 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 Function GetOrderPositions(pData As Input.MESOWebService) As List(Of Input.MESOWebServiceEXIMVRG_ordersT026) - Dim oPositions As List(Of Input.MESOWebServiceEXIMVRG_ordersT026) = pData.Items. - Where(Function(i) TypeOf i Is Input.MESOWebServiceEXIMVRG_ordersT026). - Select(Of Input.MESOWebServiceEXIMVRG_ordersT026)(Function(i) i). + 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 + + 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 diff --git a/ImporterShared/Schemas/Response.vb b/ImporterShared/Schemas/Response.vb index fc8597d..f3e6ae5 100644 --- a/ImporterShared/Schemas/Response.vb +++ b/ImporterShared/Schemas/Response.vb @@ -29,7 +29,7 @@ Namespace Schemas Private overallSuccessField As Boolean - Private resultDetailsField As MESOWebServiceResultResultDetails + Private resultDetailsField As MESOWebServiceResultResultDetails() ''' @@ -44,7 +44,7 @@ Namespace Schemas ''' - Public Property ResultDetails() As MESOWebServiceResultResultDetails + Public Property ResultDetails() As MESOWebServiceResultResultDetails() Get Return Me.resultDetailsField End Get @@ -68,6 +68,10 @@ Namespace Schemas Private errorTextField As String + Private keyValueField As String + + Private voucherNumberField As String + ''' Public Property Success() As Boolean @@ -100,5 +104,27 @@ Namespace Schemas Me.errorTextField = value End Set End Property + + ''' + + Public Property KeyValue() As String + Get + Return Me.keyValueField + End Get + Set + Me.keyValueField = Value + End Set + End Property + + ''' + + Public Property VoucherNumber() As String + Get + Return Me.voucherNumberField + End Get + Set + Me.voucherNumberField = Value + End Set + End Property End Class End Namespace diff --git a/ImporterShared/Winline/Data.vb b/ImporterShared/Winline/Data.vb index 8168997..bff70b5 100644 --- a/ImporterShared/Winline/Data.vb +++ b/ImporterShared/Winline/Data.vb @@ -25,6 +25,10 @@ Namespace Winline Public Const V50_ACCOUNTNUMBER = "c002" Public Const V50_ACCOUNTNAME = "c003" + Public Const T45_KEY = "c000" + Public Const T45_NAME = "c001" + Public Const T45_CONTACTNUMBER = "c063" + Public Const V05_ACCOUNTID = "c002" Public Const V05_ACCOUNTNAME = "c003" @@ -258,6 +262,42 @@ Namespace Winline End Try End Function + Public Function GetContacts(pAccountNumber As String, pMandator As Mandator) As List(Of Contact) + Try + Dim oContacts As New List(Of Contact) + Dim oYear As Integer = GetWinLineYear() + Dim oSQL As String = $" + SELECT + [c000], -- Key + [c001], -- Name + [c063] -- Kontaktnummer + FROM [{pMandator.Database}].[dbo].[t045] + WHERE [c063] LIKE '{pAccountNumber}-%' + AND [mesocomp] = '{pMandator.Id}' AND [mesoyear] = {oYear}" + Dim oTable As DataTable = Database.GetDatatable(oSQL) + + ' Contact not found in this Mandator, continue to next one + If oTable.Rows.Count = 0 Then + Logger.Debug("Contact for Account [{0}] was not found in Mandator: [{1}]", pAccountNumber, pMandator.Id) + Return Nothing + + End If + + For Each oRow In oTable.Rows + oContacts.Add(New Contact With { + .Id = Utils.NotNull(oRow.Item(T45_KEY), Nothing), + .Name = Utils.NotNull(oRow.Item(T45_NAME), Nothing), + .Number = Utils.NotNull(oRow.Item(T45_CONTACTNUMBER), Nothing) + }) + Next + + Return oContacts + Catch ex As Exception + Logger.Error(ex) + Return Nothing + End Try + End Function + Public Function GetReplacementArticleNumber(pArticleNumber As String, pMandator As Mandator) Try Dim oYear As Integer = GetWinLineYear() @@ -295,6 +335,7 @@ Namespace Winline Return GetReplacementArticleNumber(oReplacementArticleNumber, pMandator) Catch ex As Exception + Logger.Error(ex) Return Nothing End Try End Function diff --git a/ImporterShared/Winline/Entities/Contact.vb b/ImporterShared/Winline/Entities/Contact.vb new file mode 100644 index 0000000..c72e09d --- /dev/null +++ b/ImporterShared/Winline/Entities/Contact.vb @@ -0,0 +1,12 @@ +Namespace Winline + Public Class Contact + Public Property Id As Integer + Public Property Number As String + Public Property Name As String + + Public Overrides Function ToString() As String + Return Name + End Function + End Class + +End Namespace diff --git a/ImporterShared/Winline/WebService.vb b/ImporterShared/Winline/WebService.vb index 2c4b62f..e36fcdc 100644 --- a/ImporterShared/Winline/WebService.vb +++ b/ImporterShared/Winline/WebService.vb @@ -38,26 +38,59 @@ Namespace Winline Dim oWS As Config.WebServiceConfig = Config.Webservice ' --- Get and create path for request/response files - Dim oBaseFileName As String = GetBaseFilenameForRequest() + Dim oPath As String = GetBaseWebServicePath() If IO.Directory.Exists(oPath) = False Then IO.Directory.CreateDirectory(oPath) End If + ' --- Build all teh filenamez and pathz + + 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) + + ' 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 - Dim oXmlString = SerializeOrder(oOrderOutput, oBaseFileName) - Dim oReplacedXmlString = oXmlString.Replace("&", "").Replace("ß", "ss") - 'Dim oEscapedString = Uri.EscapeUriString(oXmlString) + + Dim oOutputFilePath = SerializeOrder(oOrderOutput, oFileName) + + ' --- Copy file to Winline Import Directory + + Try + IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True) + Catch ex As Exception + Logger.Error(ex) + Throw ex + End Try ' --- Prepare URL and HTTP Client - 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=0&Data={oXmlString}" + Dim oTemplateType = 30 + Dim oTemplateName = "EXIM-VRG_orders" + + ' 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 + + 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) ' --- Bring the action! Try - Dim oResponse As HttpResponseMessage = Await oClient.PostAsync(New Uri(oURL), New StringContent(String.Empty)) + Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL) Await HandleResponse(oResponse, oPath, oBaseFileName) Return True @@ -83,12 +116,23 @@ Namespace Winline Using oStream As New IO.MemoryStream(oBytes) Dim oResponseObject As Schemas.MESOWebServiceResult = oSerializer.Deserialize(oStream) + For Each oDetails As Schemas.MESOWebServiceResultResultDetails In oResponseObject.ResultDetails + + If oDetails.Success = True Then + Logger.Info("KeyValue: [{0}]", oDetails.KeyValue) + Logger.Info("VoucherNumber: [{0}]", oDetails.VoucherNumber) + Else + Logger.Warn("ErrorCode: [{0}]", oDetails.ErrorCode) + Logger.Warn("ErrorText: [{0}]", oDetails.ErrorText) + End If + Next + If oResponseObject.OverallSuccess = False Then - Throw New ApplicationException(oResponseObject.ResultDetails.ErrorText) + Throw New ApplicationException("Request to Webservice was unsuccessful. Please check the logs.") End If End Using - Case "text/plain" + Case "text/html" WriteResponseFile(pPath, pBaseFileNAme, oResponseBody, "txt") Throw New ApplicationException(oResponseBody) @@ -129,23 +173,16 @@ Namespace Winline Return oResult End Function - Private Function SerializeOrder(pData As Schemas.Orders.Output.MESOWebService, pBaseFileName As String) As String + 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 oRequestFileName As String = GetXmlFilenameWithSuffix(pBaseFileName, "Request", "xml") - Dim oFilePath As String = IO.Path.Combine(oPath, oRequestFileName) + 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 oStringWriter As New IO.StringWriter() - Using oXmlWriter = XmlWriter.Create(oStringWriter, New XmlWriterSettings With {.Indent = False}) - oSerializer.Serialize(oXmlWriter, pData) - Return oStringWriter.ToString() - End Using - End Using + Return oFilePath End Function Private Function GetBaseWebServicePath() As String @@ -160,6 +197,23 @@ Namespace Winline Return $"{pBaseString}-{pSuffix}.{pExtension}" End Function + Private Function GetDateSubDirectoryPath(pBasePath As String) + Dim oDirectoryPath As String = Now.ToString("yyyy\\MM\\dd") + Dim oFullPath As String = IO.Path.Combine(pBasePath, oDirectoryPath) + + If IO.Directory.Exists(oFullPath) = False Then + Try + IO.Directory.CreateDirectory(oFullPath) + Return oFullPath + Catch ex As Exception + Logger.Error(ex) + Return Nothing + End Try + Else + Return oFullPath + End If + End Function + End Class End Namespace \ No newline at end of file