Verbesserung der SQL-Logik und Datenbindung

In `frmColumn_Detail` wurde die `SQLConnection`-Eigenschaft auf `1` gesetzt und neue Eigenschaften wie `PlaceholdersManualPrefix`, `PlaceholdersManualTitle` und `PlaceholdersManual` hinzugefügt. Eine Bedingung für `ATTRIBUTE_STORE` wurde basierend auf `IDB_ACTIVE` eingeführt. Die Behandlung von SQL-Befehlen wurde erweitert.

In `frmFormDesigner.Designer.vb` und `frmFormDesigner.resx` wurden Bindings für `TBPM_CONTROL_TABLEBindingSource` und `DD_DMSLiteDataSet` entfernt und wieder hinzugefügt, um die Datenbindung zu aktualisieren.

In `frmMain` wurde die Variable `COCKPIT_PROFILE_SQL` eingeführt, um SQL-Befehle für Cockpit-Profile zu speichern. Zusätzliche Debugging-Logs und Prüfungen wurden hinzugefügt, um SQL-Befehle zu überwachen und Fehler zu protokollieren. Die Methode `PrepareIconColumn` wurde erweitert, um sicherzustellen, dass die Spalte `TL_STATE` vorhanden ist, bevor sie verwendet wird. Fehlerbehandlungen wurden verbessert.
This commit is contained in:
Developer01
2026-06-05 10:50:31 +02:00
parent 3c3f883b66
commit bc61e8960d
5 changed files with 110 additions and 49 deletions

View File

@@ -137,8 +137,17 @@ Public Class frmColumn_Detail
CURRENT_INDEX_ID = GUIDTextBox.Text
Dim oForm2 As New frmSQLEditor(LOGCONFIG, DatabaseECM) With {
.SQLCommand = SQL_COMMANDTextBox.Text,
.SQLConnection = 0
.SQLConnection = 1,
.PlaceholdersManualPrefix = "CTRL",
.PlaceholdersManualTitle = "Controls",
.PlaceholdersManual = CURRENT_CONTROL_NAME_LIST.ToDictionary(Function(name) name, Function(name) name)
}
If IDB_ACTIVE = False Then
oForm2.ATTRIBUTE_STORE = "WM"
oForm2.PlaceholdersWindream = MVSource_AllIndicies
Else
oForm2.ATTRIBUTE_STORE = "IDB"
End If
oForm2.ShowDialog()
If oForm2.DialogResult = DialogResult.OK Then
@@ -186,8 +195,18 @@ Public Class frmColumn_Detail
CURRENT_INDEX_ID = GUIDTextBox.Text
Dim oForm2 As New frmSQLEditor(LOGCONFIG, DatabaseECM) With {
.SQLCommand = SQL_COMMANDTextBox.Text,
.SQLConnection = 0
.SQLConnection = 1,
.PlaceholdersManualPrefix = "CTRL",
.PlaceholdersManualTitle = "Controls",
.PlaceholdersManual = CURRENT_CONTROL_NAME_LIST.ToDictionary(Function(name) name, Function(name) name)
}
If IDB_ACTIVE = False Then
oForm2.ATTRIBUTE_STORE = "WM"
oForm2.PlaceholdersWindream = MVSource_AllIndicies
Else
oForm2.ATTRIBUTE_STORE = "IDB"
End If
oForm2.ShowDialog()
If oForm2.DialogResult = DialogResult.OK Then
@@ -232,8 +251,17 @@ Public Class frmColumn_Detail
CURRENT_INDEX_ID = GUIDTextBox.Text
Dim oForm2 As New frmSQLEditor(LOGCONFIG, DatabaseECM) With {
.SQLCommand = FORMULA_SQLTextBox.Text,
.SQLConnection = 0
.SQLConnection = 1,
.PlaceholdersManualPrefix = "CTRL",
.PlaceholdersManualTitle = "Controls",
.PlaceholdersManual = CURRENT_CONTROL_NAME_LIST.ToDictionary(Function(name) name, Function(name) name)
}
If IDB_ACTIVE = False Then
oForm2.ATTRIBUTE_STORE = "WM"
oForm2.PlaceholdersWindream = MVSource_AllIndicies
Else
oForm2.ATTRIBUTE_STORE = "IDB"
End If
oForm2.ShowDialog()
If oForm2.DialogResult = DialogResult.OK Then

View File

@@ -25,8 +25,6 @@ Partial Class frmFormDesigner
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmFormDesigner))
Me.SplitContainerDesigner = New System.Windows.Forms.SplitContainer()
Me.TBPM_CONTROL_TABLEBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.DD_DMSLiteDataSet = New taskFLOW.DD_DMSLiteDataSet()
Me.pnldesigner = New DigitalData.Controls.SnapPanel.ClassSnapPanel()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.pgControlsNew = New DevExpress.XtraVerticalGrid.PropertyGridControl()
@@ -60,6 +58,8 @@ Partial Class frmFormDesigner
Me.RibPGCtrlWidth = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibPGCtrlheight = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
Me.TBPM_CONTROL_TABLEBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.DD_DMSLiteDataSet = New taskFLOW.DD_DMSLiteDataSet()
Me.TBPM_PROFILE_CONTROLSBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TBDD_CONNECTIONBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
@@ -79,11 +79,11 @@ Partial Class frmFormDesigner
Me.SplitContainerDesigner.Panel1.SuspendLayout()
Me.SplitContainerDesigner.Panel2.SuspendLayout()
Me.SplitContainerDesigner.SuspendLayout()
CType(Me.TBPM_CONTROL_TABLEBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DD_DMSLiteDataSet, System.ComponentModel.ISupportInitialize).BeginInit()
Me.Panel1.SuspendLayout()
CType(Me.pgControlsNew, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TBPM_CONTROL_TABLEBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DD_DMSLiteDataSet, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TBPM_PROFILE_CONTROLSBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TBDD_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GridControlContextMenu.SuspendLayout()
@@ -104,16 +104,6 @@ Partial Class frmFormDesigner
'
Me.SplitContainerDesigner.Panel2.Controls.Add(Me.Panel1)
'
'TBPM_CONTROL_TABLEBindingSource
'
Me.TBPM_CONTROL_TABLEBindingSource.DataMember = "TBPM_CONTROL_TABLE"
Me.TBPM_CONTROL_TABLEBindingSource.DataSource = Me.DD_DMSLiteDataSet
'
'DD_DMSLiteDataSet
'
Me.DD_DMSLiteDataSet.DataSetName = "DD_DMSLiteDataSet"
Me.DD_DMSLiteDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'pnldesigner
'
resources.ApplyResources(Me.pnldesigner, "pnldesigner")
@@ -365,6 +355,16 @@ Partial Class frmFormDesigner
Me.RibbonStatusBar1.Name = "RibbonStatusBar1"
Me.RibbonStatusBar1.Ribbon = Me.RibbonControl1
'
'TBPM_CONTROL_TABLEBindingSource
'
Me.TBPM_CONTROL_TABLEBindingSource.DataMember = "TBPM_CONTROL_TABLE"
Me.TBPM_CONTROL_TABLEBindingSource.DataSource = Me.DD_DMSLiteDataSet
'
'DD_DMSLiteDataSet
'
Me.DD_DMSLiteDataSet.DataSetName = "DD_DMSLiteDataSet"
Me.DD_DMSLiteDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'TBPM_PROFILE_CONTROLSBindingSource
'
Me.TBPM_PROFILE_CONTROLSBindingSource.DataMember = "TBPM_PROFILE_CONTROLS"
@@ -464,11 +464,11 @@ Partial Class frmFormDesigner
Me.SplitContainerDesigner.Panel2.ResumeLayout(False)
CType(Me.SplitContainerDesigner, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerDesigner.ResumeLayout(False)
CType(Me.TBPM_CONTROL_TABLEBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DD_DMSLiteDataSet, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel1.ResumeLayout(False)
CType(Me.pgControlsNew, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TBPM_CONTROL_TABLEBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DD_DMSLiteDataSet, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TBPM_PROFILE_CONTROLSBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TBDD_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
Me.GridControlContextMenu.ResumeLayout(False)

View File

@@ -1071,18 +1071,6 @@
<data name="$this.Text" xml:space="preserve">
<value>Formular Designer</value>
</data>
<data name="&gt;&gt;TBPM_CONTROL_TABLEBindingSource.Name" xml:space="preserve">
<value>TBPM_CONTROL_TABLEBindingSource</value>
</data>
<data name="&gt;&gt;TBPM_CONTROL_TABLEBindingSource.Type" xml:space="preserve">
<value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;DD_DMSLiteDataSet.Name" xml:space="preserve">
<value>DD_DMSLiteDataSet</value>
</data>
<data name="&gt;&gt;DD_DMSLiteDataSet.Type" xml:space="preserve">
<value>taskFLOW.DD_DMSLiteDataSet, DD_DMSLiteDataSet.Designer.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;bbtnItemFinishSQL.Name" xml:space="preserve">
<value>bbtnItemFinishSQL</value>
</data>
@@ -1251,6 +1239,18 @@
<data name="&gt;&gt;RibPGCtrlheight.Type" xml:space="preserve">
<value>DevExpress.XtraBars.Ribbon.RibbonPageGroup, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;TBPM_CONTROL_TABLEBindingSource.Name" xml:space="preserve">
<value>TBPM_CONTROL_TABLEBindingSource</value>
</data>
<data name="&gt;&gt;TBPM_CONTROL_TABLEBindingSource.Type" xml:space="preserve">
<value>System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;DD_DMSLiteDataSet.Name" xml:space="preserve">
<value>DD_DMSLiteDataSet</value>
</data>
<data name="&gt;&gt;DD_DMSLiteDataSet.Type" xml:space="preserve">
<value>taskFLOW.DD_DMSLiteDataSet, DD_DMSLiteDataSet.Designer.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;TBPM_PROFILE_CONTROLSBindingSource.Name" xml:space="preserve">
<value>TBPM_PROFILE_CONTROLSBindingSource</value>
</data>

View File

@@ -1027,6 +1027,13 @@ Public Class frmFormDesigner
.PlaceholdersManualTitle = "Controls",
.PlaceholdersManual = CURRENT_CONTROL_NAME_LIST.ToDictionary(Function(name) name, Function(name) name)
}
If IDB_ACTIVE = False Then
oForm.ATTRIBUTE_STORE = "WM"
oForm.PlaceholdersWindream = MVSource_AllIndicies
Else
oForm.ATTRIBUTE_STORE = "IDB"
End If
oForm.ShowDialog()
If oForm.DialogResult = DialogResult.OK Then

View File

@@ -77,6 +77,7 @@ Public Class frmMain
Private CUSTOM_OVERVIEW_SQL As String = String.Empty
Private _lastUsedOverviewSQL As String = String.Empty ' ← NEU: persistente Kopie
Private COCKPIT_PROFILE_SQL As String = String.Empty
Private COCKPIT_CONFIG_ID As Integer = 0
@@ -1968,6 +1969,13 @@ Public Class frmMain
' ========== SQL VORBEREITEN UND AUSFÜHREN ==========
Dim oSQL = foundRow.Item("SQL_VIEW")
If Len(oSQL) = 0 Then
LOGGER.Debug($"LoadProfileData for Profile-ID [{CURRENT_CLICKED_PROFILE_ID}] - Title [{CURRENT_CLICKED_PROFILE_TITLE}] has empty SQL_VIEW ...")
If Len(COCKPIT_PROFILE_SQL) > 0 Then
oSQL = COCKPIT_PROFILE_SQL
LOGGER.Debug($"Using COCKPIT_PROFILE_SQL for Profile-ID [{CURRENT_CLICKED_PROFILE_ID}] - Title [{CURRENT_CLICKED_PROFILE_TITLE}]")
End If
End If
oSQL = PrepareSQLWithReplacements(oSQL, CURRENT_CLICKED_PROFILE_ID)
DT_CURR_WF_ITEMS = Await DatabaseFallback.GetDatatableECMAsync(oSQL)
@@ -2040,6 +2048,12 @@ Public Class frmMain
End Function
Private Sub PrepareIconColumn()
' Prüfen, ob TL_STATE-Spalte vorhanden ist
Dim hasTLStateColumn As Boolean = False
If DT_CURR_WF_ITEMS IsNot Nothing Then
hasTLStateColumn = DT_CURR_WF_ITEMS.Columns.Contains("TL_STATE")
End If
If TL_ICON = True AndAlso DT_CURR_WF_ITEMS IsNot Nothing AndAlso DT_CURR_WF_ITEMS.Columns.Contains("ICON") = False Then
Dim columnStateIcon As New DataColumn() With {
.DataType = GetType(Image),
@@ -2053,21 +2067,28 @@ Public Class frmMain
YellowDocuments = 0
GreenDocuments = 0
If TL_ICON = True AndAlso DT_CURR_WF_ITEMS IsNot Nothing Then
If TL_ICON = True AndAlso hasTLStateColumn AndAlso DT_CURR_WF_ITEMS IsNot Nothing Then
For Each row As DataRow In DT_CURR_WF_ITEMS.Rows
Dim State As Integer = CInt(row.Item("TL_STATE"))
Select Case State
Case 1
RedDocuments += 1
row.Item("ICON") = My.Resources.bullet_red
Case 2
YellowDocuments += 1
row.Item("ICON") = My.Resources.bullet_orange
Case 3
GreenDocuments += 1
row.Item("ICON") = My.Resources.bullet_green
End Select
Try
Dim State As Integer = CInt(row.Item("TL_STATE"))
Select Case State
Case 1
RedDocuments += 1
row.Item("ICON") = My.Resources.bullet_red
Case 2
YellowDocuments += 1
row.Item("ICON") = My.Resources.bullet_orange
Case 3
GreenDocuments += 1
row.Item("ICON") = My.Resources.bullet_green
End Select
Catch ex As Exception
LOGGER.Warn($"Could not set ICON value: {ex.Message}")
End Try
Next
ElseIf TL_ICON = True AndAlso Not hasTLStateColumn Then
LOGGER.Warn("⚠️ TL_ICON is enabled but TL_STATE column is missing in DT_CURR_WF_ITEMS")
End If
End Sub
@@ -4536,7 +4557,7 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G
FRONTEND_ACTION = NAVBAR_CLICKED
Timer_Inactivity_Reset_Disable("TreeList1_FocusedNodeChanged")
COCKPIT_CONFIG_ID = oCockpitConfigID
COCKPIT_PROFILE_SQL = String.Empty
Dim oTypeIdInt As Integer = CInt(oTypeId)
Select Case oTypeIdInt
@@ -4555,6 +4576,8 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G
If IsDBNull(oSqlQuery) OrElse String.IsNullOrWhiteSpace(oSqlQuery?.ToString()) Then
LOGGER.Warn($"TreeList_Cockpit: SQL_QUERY for ProfileID {oFkProfileId} is DBNull or empty for overview node - this should not happen, check data integrity of TreeList's DataSource")
Exit Function
Else
LOGGER.Debug($"TreeList_Cockpit: Overview SQL query to be used: [{oSqlQuery}]")
End If
CURRENT_CLICKED_PROFILE_ID = 0
CUSTOM_OVERVIEW_SQL = oSqlQuery.ToString()
@@ -4593,10 +4616,6 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G
Dim oProfileId As Integer = CInt(oFkProfileId)
LOGGER.Debug($"TreeList_Cockpit: Profile node clicked - FK_PROFILE_ID:[{oProfileId}]")
If CURRENT_CLICKED_PROFILE_ID = oProfileId Then
LOGGER.Debug($"TreeList_Cockpit: Profile [{oProfileId}] is already active - ignoring click")
Exit Function
@@ -4604,6 +4623,13 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G
LOGGER.Debug($"TreeList_Cockpit: Loading profile with ID [{oProfileId}]...")
If IsDBNull(oSqlQuery) OrElse String.IsNullOrWhiteSpace(oSqlQuery?.ToString()) Then
LOGGER.Warn($"TreeList_Cockpit: SQL_QUERY for ProfileID {oFkProfileId} is DBNull or empty for Profile-Node - this should not happen, check data integrity of TreeList's DataSource")
Exit Function
Else
LOGGER.Debug($"TreeList_Cockpit: Profile-SQL query to be used: [{oSqlQuery}]")
End If
COCKPIT_PROFILE_SQL = oSqlQuery.ToString()
' ===== ANZAHL-SUFFIX ENTFERNEN (von AppendCountsToTreeAsync angehängt: "Titel (42)" → "Titel") =====
Dim oCleanProfileTitle As String = oProfileTitle?.ToString()
Dim oSuffixMatch = System.Text.RegularExpressions.Regex.Match(oCleanProfileTitle, "^(.*)\s+\(\d+\)$")