Compare commits

..

9 Commits

Author SHA1 Message Date
Jonathan Jenne
6fe97d474c Version 1.3.0.0 2021-03-18 14:02:30 +01:00
Jonathan Jenne
10e90507e1 merge 2021-03-18 14:01:44 +01:00
Jonathan Jenne
a143aaf09e support custom windows for article window 2021-03-18 14:00:54 +01:00
Jonathan Jenne
83ad9db4b2 Version 1.2.0.0 2021-02-01 14:31:18 +01:00
Jonathan Jenne
9db382aead clean up 2021-02-01 14:30:42 +01:00
Jonathan Jenne
def3cdac1e Improve User Feedback for errors, fix TestArticleExists 2021-02-01 14:30:38 +01:00
Jonathan Jenne
248162732f clean up licenses 2021-02-01 14:28:12 +01:00
Jonathan Jenne
a020fbc480 Version 1.1.0.7 2021-01-21 11:15:56 +01:00
Jonathan Jenne
2c87374775 Handle NULL in Group Name 2021-01-21 11:15:29 +01:00
7 changed files with 65 additions and 31 deletions

View File

@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain> <MySubMain>true</MySubMain>
<MainForm>Form1</MainForm> <MainForm>frmMain</MainForm>
<SingleInstance>false</SingleInstance> <SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode> <ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles> <EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode> <AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit> <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData> </MyApplicationData>

View File

@@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("")> <Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("WinLineProductNumberGenerator")> <Assembly: AssemblyProduct("WinLineProductNumberGenerator")>
<Assembly: AssemblyCopyright("Copyright © 2020")> <Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")> <Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' indem Sie "*" wie unten gezeigt eingeben: ' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.1.0.6")> <Assembly: AssemblyVersion("1.3.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@@ -22,7 +22,7 @@ Namespace My.Resources
'''<summary> '''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary> '''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _

View File

@@ -15,7 +15,7 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase

View File

@@ -1,2 +1 @@
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -12,6 +12,9 @@ Public Class Winline
Public ReadOnly Property ARTICLE_ALREADY_EXISTS = "ARTICLE_ALREADY_EXISTS" Public ReadOnly Property ARTICLE_ALREADY_EXISTS = "ARTICLE_ALREADY_EXISTS"
Public ReadOnly Property UNKNOWN_ERROR = "UNKNOWN_ERROR" Public ReadOnly Property UNKNOWN_ERROR = "UNKNOWN_ERROR"
Private Const ACTIONCODE_CHECK = 0
Private Const ACTIONCODE_IMPORT = 1
Public Sub New(LogConfig As LogConfig, EximDatabase As Database, WinlineDatabase As Database, Config As Config) Public Sub New(LogConfig As LogConfig, EximDatabase As Database, WinlineDatabase As Database, Config As Config)
_Logger = LogConfig.GetLogger() _Logger = LogConfig.GetLogger()
_EXIM = EximDatabase _EXIM = EximDatabase
@@ -70,6 +73,14 @@ Public Class Winline
End Try End Try
End Function End Function
Private Function NotNull(Of T)(ByVal value As T, ByVal defaultValue As T) As T
If IsNothing(value) OrElse String.IsNullOrEmpty(value.ToString) OrElse IsDBNull(value) Then
Return defaultValue
Else
Return value
End If
End Function
Public Function GetGroupsByVendor(VendorCode As String) As List(Of ProductGroup) Public Function GetGroupsByVendor(VendorCode As String) As List(Of ProductGroup)
Try Try
Dim oDatatable = _EXIM.GetDatatable($"SELECT * FROM TBDD_ARTICLE_GENERATOR_GROUPS WHERE CODE = '{VendorCode}'") Dim oDatatable = _EXIM.GetDatatable($"SELECT * FROM TBDD_ARTICLE_GENERATOR_GROUPS WHERE CODE = '{VendorCode}'")
@@ -77,10 +88,10 @@ Public Class Winline
For Each oRow As DataRow In oDatatable.Rows For Each oRow As DataRow In oDatatable.Rows
Dim oGroup As New ProductGroup() With { Dim oGroup As New ProductGroup() With {
.Guid = oRow.Item("GUID"), .Guid = NotNull(oRow.Item("GUID"), 0),
.Name = oRow.Item("NAME"), .Name = NotNull(oRow.Item("NAME"), "(Kein Name)"),
.GroupId = oRow.Item("GROUP"), .GroupId = NotNull(oRow.Item("GROUP"), 0),
.Code = oRow.Item("CODE") .Code = NotNull(oRow.Item("CODE"), "(Kein Code)")
} }
oGroups.Add(oGroup) oGroups.Add(oGroup)
@@ -100,11 +111,11 @@ Public Class Winline
For Each oRow As DataRow In oDatatable.Rows For Each oRow As DataRow In oDatatable.Rows
Dim oVersion As New ProductVersion() With { Dim oVersion As New ProductVersion() With {
.Guid = oRow.Item("GUID"), .Guid = NotNull(oRow.Item("GUID"), 0),
.VersionId = oRow.Item("VERSION"), .VersionId = NotNull(oRow.Item("VERSION"), 0),
.GroupId = oRow.Item("GROUP_ID"), .GroupId = NotNull(oRow.Item("GROUP_ID"), 0),
.Name = oRow.Item("NAME"), .Name = NotNull(oRow.Item("NAME"), "(Kein Name)"),
.Code = oRow.Item("CODE") .Code = NotNull(oRow.Item("CODE"), "(Kein Code)")
} }
oVersions.Add(oVersion) oVersions.Add(oVersion)
@@ -168,15 +179,33 @@ Public Class Winline
_Logger.Info("WebService Response: {0}", oXmlResponse) _Logger.Info("WebService Response: {0}", oXmlResponse)
Dim oDocument As New XmlDocument Dim oDocument As New XmlDocument
oDocument.LoadXml(oXmlResponse)
oDocument.Save(Console.Out) Try
oDocument.LoadXml(oXmlResponse)
oDocument.Save(Console.Out)
Catch ex As Exception
_Logger.Error(ex)
Return False
End Try
Dim oSuccess As XmlNode = oDocument.DocumentElement.SelectSingleNode("OverallSuccess") Dim oSuccess As XmlNode = oDocument.DocumentElement.SelectSingleNode("OverallSuccess")
Dim oInnerSuccess = True
If oSuccess.InnerText.ToUpper = "TRUE" Then If oSuccess.InnerText.ToUpper = "TRUE" Then
Dim oSuccessNodes = oDocument.DocumentElement.SelectNodes("//Success")
For Each oNode As XmlNode In oSuccessNodes
If oNode.InnerText.ToUpper <> "TRUE" Then
oInnerSuccess = False
End If
Next
_Logger.Info("Request was SUCCESSFUL!") _Logger.Info("Request was SUCCESSFUL!")
Return True If oInnerSuccess = False Then
Return False
Else
Return True
End If
Else Else
_Logger.Info("Request FAILED!") _Logger.Info("Request FAILED!")
Return False Return False
@@ -189,7 +218,7 @@ Public Class Winline
Public Function TestArticleExists(ArticleNumber As String) As Boolean Public Function TestArticleExists(ArticleNumber As String) As Boolean
Try Try
Dim oResult = _Winline.GetScalarValue($"SELECT c000 FROM v021 WHERE c002 = '{ArticleNumber}'") Dim oResult = _Winline.GetScalarValue($"SELECT c002 FROM v021 WHERE c002 = '{ArticleNumber}'")
If IsNothing(oResult) Or IsDBNull(oResult) Then If IsNothing(oResult) Or IsDBNull(oResult) Then
Return False Return False
@@ -214,6 +243,7 @@ Public Class Winline
Dim oUseShape As String Dim oUseShape As String
Dim oDefaultShape As String Dim oDefaultShape As String
Dim oMultipleShapes As String Dim oMultipleShapes As String
Dim oActionCode As Integer = ACTIONCODE_IMPORT
If IsSerialnumberArticle = True Then If IsSerialnumberArticle = True Then
oArticleType = 0 oArticleType = 0
@@ -260,8 +290,7 @@ Public Class Winline
oXmlData &= $"</MESOWebService>" oXmlData &= $"</MESOWebService>"
Try Try
My.Application.Winline.SendWebserviceRequest(oTemplateType, oTemplateName, oXmlData) Return My.Application.Winline.SendWebserviceRequest(oTemplateType, oTemplateName, oXmlData)
Return True
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
Return False Return False
@@ -286,25 +315,28 @@ Public Class Winline
oXmlData &= $"</MESOWebService>" oXmlData &= $"</MESOWebService>"
Try Try
My.Application.Winline.SendWebserviceRequest(oTemplateType, oTemplateName, oXmlData) Return My.Application.Winline.SendWebserviceRequest(oTemplateType, oTemplateName, oXmlData)
Return True
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
Return False Return False
End Try End Try
End Function End Function
Public Sub RunWinlineMacro(MacroName As String, ParamArray Parameters As Object()) Public Function RunWinlineMacro(MacroName As String, ParamArray Parameters As Object()) As Boolean
Try Try
Dim oCWLObject Dim oCWLObject
Dim oParamArray As Object = New Runtime.InteropServices.VariantWrapper(Parameters) Dim oParamArray As Object = New Runtime.InteropServices.VariantWrapper(Parameters)
oCWLObject = CreateObject("cwlstart.application") oCWLObject = CreateObject("cwlstart.application")
oCWLObject.MacroCommands.MRunMacro(MacroName, oParamArray) oCWLObject.MacroCommands.MRunMacro(MacroName, oParamArray)
Return True
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
MsgBox($"Das WinLine-Makro [{MacroName}] konnte nicht gestartet werden. Mehr Informationen im Log.", MsgBoxStyle.Critical, "WinLine") _Logger.Warn($"Das WinLine-Makro [{MacroName}] konnte nicht gestartet werden.")
Return False
End Try End Try
End Sub End Function
End Class End Class

View File

@@ -8,6 +8,10 @@
Private ReadOnly Config As Config = My.Application.ConfigManager.Config Private ReadOnly Config As Config = My.Application.ConfigManager.Config
Private ReadOnly Logger As Logger = My.Application.LogConfig.GetLogger Private ReadOnly Logger As Logger = My.Application.LogConfig.GetLogger
Private Const TEMPLATE_NUMBER_NORMAL_ARTICLE = 45
Private Const TEMPLATE_NUMBER_SERIAL_ARTICLE = 46
Private Const CUSTOM_WINDOW_ID = 529
Private Sub frmCreateArticle_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub frmCreateArticle_Load(sender As Object, e As EventArgs) Handles MyBase.Load
txtRunningNumber.Text = RunningNumber txtRunningNumber.Text = RunningNumber
txtArticleNumber.Text = ArticleNumber txtArticleNumber.Text = ArticleNumber
@@ -57,7 +61,7 @@
Dim oArticle = StartArticleCreation(True) Dim oArticle = StartArticleCreation(True)
If oArticle IsNot Nothing Then If oArticle IsNot Nothing Then
My.Computer.Clipboard.SetText(oArticle) My.Computer.Clipboard.SetText(oArticle)
My.Application.Winline.RunWinlineMacro(My.Application.ConfigManager.Config.CompletionMacro, oArticle) My.Application.Winline.RunWinlineMacro(My.Application.ConfigManager.Config.CompletionMacro, oArticle, CUSTOM_WINDOW_ID, TEMPLATE_NUMBER_SERIAL_ARTICLE)
End If End If
End If End If
End Sub End Sub
@@ -66,7 +70,7 @@
Dim oArticle = StartArticleCreation(False) Dim oArticle = StartArticleCreation(False)
If oArticle IsNot Nothing Then If oArticle IsNot Nothing Then
My.Computer.Clipboard.SetText(oArticle) My.Computer.Clipboard.SetText(oArticle)
My.Application.Winline.RunWinlineMacro(My.Application.ConfigManager.Config.CompletionMacro, oArticle) My.Application.Winline.RunWinlineMacro(My.Application.ConfigManager.Config.CompletionMacro, oArticle, CUSTOM_WINDOW_ID, TEMPLATE_NUMBER_NORMAL_ARTICLE)
End If End If
End Sub End Sub
End Class End Class