From cbc16d5dd22217a88ac435ceef5513e34fe9e980 Mon Sep 17 00:00:00 2001 From: Developer01 Date: Mon, 6 Jul 2026 16:30:56 +0200 Subject: [PATCH] Aktualisierung SQL View, GDPicture Referenzen etc --- app/SetupVS19/Product.wxs | 13 ++- app/TaskFlow/App.config | 14 ++- app/TaskFlow/ClassInit.vb | 4 + app/TaskFlow/My Project/AssemblyInfo.vb | 2 +- app/TaskFlow/TaskFlow.vbproj | 25 +++- app/TaskFlow/frmMain.vb | 149 +++++++++++++++++------- app/TaskFlow/frmValidator.resx | 2 +- app/TaskFlow/frmValidator.vb | 12 ++ app/TaskFlow/packages.config | 9 +- 9 files changed, 182 insertions(+), 48 deletions(-) diff --git a/app/SetupVS19/Product.wxs b/app/SetupVS19/Product.wxs index d3b1f8c..488218a 100644 --- a/app/SetupVS19/Product.wxs +++ b/app/SetupVS19/Product.wxs @@ -191,14 +191,16 @@ + + + - @@ -215,13 +217,18 @@ - - + + + + + + + diff --git a/app/TaskFlow/App.config b/app/TaskFlow/App.config index 6167992..7bb25bf 100644 --- a/app/TaskFlow/App.config +++ b/app/TaskFlow/App.config @@ -192,7 +192,7 @@ - + @@ -202,6 +202,18 @@ + + + + + + + + + + + + diff --git a/app/TaskFlow/ClassInit.vb b/app/TaskFlow/ClassInit.vb index 35a6d37..bfc4896 100644 --- a/app/TaskFlow/ClassInit.vb +++ b/app/TaskFlow/ClassInit.vb @@ -406,18 +406,22 @@ Public Class ClassInit Try USER_RIGHT_VIEW_ONLY = DT_CHECKUSER_MODULE.Rows(0).Item("USER_RIGHT2") + LOGGER.Debug("USER_RIGHT_VIEW_ONLY: " & USER_RIGHT_VIEW_ONLY.ToString) Catch ex As Exception USER_RIGHT_VIEW_ONLY = False + LOGGER.Info("⚠️ Error in USER_RIGHT_VIEW_ONLY: " & ex.Message) End Try Try USER_RIGHT3 = DT_CHECKUSER_MODULE.Rows(0).Item("USER_RIGHT3") Catch ex As Exception USER_RIGHT3 = False + LOGGER.Info("⚠️ Error in USER_RIGHT3: " & ex.Message) End Try Try USER_RIGHT4 = DT_CHECKUSER_MODULE.Rows(0).Item("USER_RIGHT4") Catch ex As Exception USER_RIGHT4 = False + LOGGER.Info("⚠️ Error in USER_RIGHT4: " & ex.Message) End Try LOGGER.Debug("User exists....") diff --git a/app/TaskFlow/My Project/AssemblyInfo.vb b/app/TaskFlow/My Project/AssemblyInfo.vb index 7c34732..8035686 100644 --- a/app/TaskFlow/My Project/AssemblyInfo.vb +++ b/app/TaskFlow/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/app/TaskFlow/TaskFlow.vbproj b/app/TaskFlow/TaskFlow.vbproj index a2b82c5..a6ee759 100644 --- a/app/TaskFlow/TaskFlow.vbproj +++ b/app/TaskFlow/TaskFlow.vbproj @@ -316,8 +316,8 @@ M:\Bibliotheken\3rdParty\Limilabs\Mail.dll - - ..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.5\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.9\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll ..\packages\Microsoft.Bcl.Cryptography.10.0.5\lib\net462\Microsoft.Bcl.Cryptography.dll @@ -326,6 +326,24 @@ ..\packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.10.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.dll + + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + + ..\packages\Microsoft.Extensions.Logging.10.0.0\lib\net462\Microsoft.Extensions.Logging.dll + + + ..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll + + + ..\packages\Microsoft.Extensions.Options.10.0.0\lib\net462\Microsoft.Extensions.Options.dll + + + ..\packages\Microsoft.Extensions.Primitives.10.0.0\lib\net462\Microsoft.Extensions.Primitives.dll + ..\packages\Microsoft.Identity.Client.4.55.0\lib\net461\Microsoft.Identity.Client.dll @@ -385,6 +403,9 @@ + + ..\packages\System.Diagnostics.DiagnosticSource.10.0.9\lib\net462\System.Diagnostics.DiagnosticSource.dll + diff --git a/app/TaskFlow/frmMain.vb b/app/TaskFlow/frmMain.vb index ea2f1bb..00b0747 100644 --- a/app/TaskFlow/frmMain.vb +++ b/app/TaskFlow/frmMain.vb @@ -25,6 +25,7 @@ Imports DigitalData.Modules.EDMI.API.DatabaseWithFallback Imports DigitalData.Modules.Windream Imports DigitalData.Modules.ZooFlow Imports GdPicture.Internal.CAD.DWG.Entities +Imports System.Runtime.InteropServices Public Class frmMain Private Property FormHelper As FormHelper @@ -1957,7 +1958,7 @@ Public Class frmMain Dim foundRow As DataRow = CURRENT_DT_PROFILES.Select(expression).FirstOrDefault() If foundRow Is Nothing Then - LOGGER.Warn($"LoadProfileData for Profile-ID [{CURRENT_CLICKED_PROFILE_ID}] - Title [{CURRENT_CLICKED_PROFILE_TITLE}] not found - exiting Decide_Load") + LOGGER.Warn($"LoadProfileData for Profile-ID [{CURRENT_CLICKED_PROFILE_ID}] - Title [{CURRENT_CLICKED_PROFILE_TITLE}] not found - exiting") Return False End If @@ -1968,25 +1969,45 @@ Public Class frmMain viewUpdateStarted = True End If - ' ========== 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) + ' ===== PRIORISIERUNG: TreeList-SQL (COCKPIT_PROFILE_SQL) VOR Datenbank-SQL (SQL_VIEW) ===== + Dim oSQL As String = String.Empty + ' 1️⃣ ERSTE PRIORITÄT: SQL aus TreeList-Knoten + If Not String.IsNullOrWhiteSpace(COCKPIT_PROFILE_SQL) Then + oSQL = COCKPIT_PROFILE_SQL + LOGGER.Debug($"LoadProfileData: Using COCKPIT_PROFILE_SQL from TreeList node") + + ' 2️⃣ FALLBACK: SQL aus Datenbank-Tabelle (nur wenn TreeList-SQL fehlt) + Else + oSQL = foundRow.Item("SQL_VIEW")?.ToString() + LOGGER.Debug($"LoadProfileData: SQL_VIEW from foundRow = [{oSQL}]") + + ' Prüfen ob SQL leer oder "select 'NONE'" ist + If String.IsNullOrWhiteSpace(oSQL) OrElse oSQL.Trim().ToUpper() = "SELECT 'NONE'" Then + LOGGER.Warn($"⚠️ LoadProfileData: Both COCKPIT_PROFILE_SQL and SQL_VIEW are empty/invalid for Profile-ID [{CURRENT_CLICKED_PROFILE_ID}]") + NO_WORKFLOW_ITEMS = True + GridControlWorkflows.Visible = False + bindsourcegrid.DataSource = Nothing + GridControlWorkflows.DataSource = Nothing + Return False + End If + LOGGER.Debug($"LoadProfileData: COCKPIT_PROFILE_SQL empty - using SQL_VIEW from database as fallback") + End If + + ' ===== SQL NACH allen Ersetzungen loggen ===== + LOGGER.Debug($"LoadProfileData: Final SQL BEFORE PrepareSQLWithReplacements: [{oSQL}]") + oSQL = PrepareSQLWithReplacements(oSQL, CURRENT_CLICKED_PROFILE_ID) + LOGGER.Debug($"LoadProfileData: Final SQL AFTER PrepareSQLWithReplacements: [{oSQL}]") + + ' ===== DATEN ABRUFEN ===== DT_CURR_WF_ITEMS = Await DatabaseFallback.GetDatatableECMAsync(oSQL) If IsNothing(DT_CURR_WF_ITEMS) Then - LOGGER.Warn($"LoadProfileData for Profile-ID [{CURRENT_CLICKED_PROFILE_ID}] - Title [{CURRENT_CLICKED_PROFILE_TITLE}] failed - exiting Decide_Load") + LOGGER.Warn($"LoadProfileData for Profile-ID [{CURRENT_CLICKED_PROFILE_ID}] - Title [{CURRENT_CLICKED_PROFILE_TITLE}] failed - exiting") Return False End If - ' ========== DATEN VERARBEITEN ========== + ' ===== DATEN VERARBEITEN ===== NO_WORKFLOW_ITEMS = (DT_CURR_WF_ITEMS.Rows.Count = 0) UpdateGridCaption() @@ -1997,8 +2018,10 @@ Public Class frmMain LOGGER.Info("Keine Workflow-Items für Profil: " & CURRENT_CLICKED_PROFILE_TITLE) Return False End If + GridControlWorkflows_Visible() - ' ========== BASIC VIEW ERSTELLEN ========== + + ' ===== BASIC VIEW ERSTELLEN ===== Await CreateBasicViewForProfile() LOGGER.Debug("Basic View für Profil erstellt: " & CURRENT_CLICKED_PROFILE_TITLE) Return True @@ -2162,6 +2185,7 @@ Public Class frmMain End Sub Private Async Function CreateBasicViewForProfile() As Task + ' ===== GRID DATASOURCE ZURÜCKSETZEN ===== GridControlWorkflows.DataSource = Nothing Try GridViewWorkflows.Columns.Clear() @@ -2170,31 +2194,50 @@ Public Class frmMain LOGGER.Warn("⚠️ Could not clear GridViewWorkflows.Columns") End Try + ' ===== ICON-SPALTE VORBEREITEN ===== Await Task.Run(Sub() PrepareIconColumn()) + ' ===== DATASOURCE ZUWEISEN ===== bindsourcegrid.DataSource = DT_CURR_WF_ITEMS GridControlWorkflows.DataSource = bindsourcegrid + ' ✅ KRITISCH: Grid zwingen, Columns zu erstellen BEVOR RestoreLayout + GridControlWorkflows.ForceInitialize() + + ' ✅ Wenn kein gespeichertes Layout existiert → Columns manuell populieren + Dim oXmlPath As String = GetLayoutName_GridMain() + If Not System.IO.File.Exists(oXmlPath) Then + LOGGER.Debug($"CreateBasicViewForProfile: No layout file found at [{oXmlPath}] - populating columns") + GridViewWorkflows.PopulateColumns() + End If + + ' ===== LAYOUT WIEDERHERSTELLEN ===== RestoreLayout() COLUMNS_INVISIBLE() ' ===== GRUPPIERUNG FÜR PROFIL-ANSICHT ENTFERNEN ===== - ' Profil-Ansichten dürfen nicht gruppiert sein - Gruppierung ggf. aus gespeichertem Layout entfernen If GridViewWorkflows.GroupCount > 0 Then LOGGER.Debug($"CreateBasicViewForProfile: Clearing [{GridViewWorkflows.GroupCount}] group(s) from restored layout for profile view") GridViewWorkflows.ClearGrouping() End If - ' Icon-Spalte konfigurieren + ' ===== ICON-SPALTE KONFIGURIEREN ===== If TL_ICON = True Then Try - GridViewWorkflows.Columns.Item("ICON").MaxWidth = 24 - GridViewWorkflows.Columns.Item("ICON").MinWidth = 24 - GridViewWorkflows.Columns.Item("ICON").AppearanceCell.BackColor = Color.White - GridViewWorkflows.Columns.Item("ICON").Fixed = FixedStyle.Left + If GridViewWorkflows.Columns.ColumnByFieldName("ICON") IsNot Nothing Then + GridViewWorkflows.Columns.Item("ICON").MaxWidth = 24 + GridViewWorkflows.Columns.Item("ICON").MinWidth = 24 + GridViewWorkflows.Columns.Item("ICON").AppearanceCell.BackColor = Color.White + GridViewWorkflows.Columns.Item("ICON").Fixed = FixedStyle.Left + GridViewWorkflows.Columns.Item("ICON").VisibleIndex = 0 ' ✅ Ganz links + End If Catch ex As Exception + LOGGER.Warn($"Could not configure ICON column: {ex.Message}") End Try End If + + ' ✅ DEBUG: Spalten-Info loggen + LOGGER.Debug($"CreateBasicViewForProfile: Grid has [{GridViewWorkflows.Columns.Count}] columns, DataSource has [{DT_CURR_WF_ITEMS.Rows.Count}] rows") End Function Private Sub ApplyPostLoadSettings() @@ -2341,7 +2384,8 @@ Public Class frmMain MsgBox("Could not get a Profile - Check Your log!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE) Exit Sub End If - + LOGGER.Debug($"Load_Profil_from_Grid: Loaded profile [{CURRENT_ProfilName}] with GUID [{CURRENT_ProfilGUID}]") + LOGGER.Debug($"Load_Profil_from_Grid: PROFILE_SHOW_DOCUMENT = [{PROFILE_SHOW_DOCUMENT}]") ' ========== SEARCH DOCUMENTS PREPARATION ========== oExpression = $"PROFILE_ID = {CURRENT_ProfilGUID} " DT_FILTERED_PROFILE_SEARCHES_DOC = Nothing @@ -2395,7 +2439,7 @@ Public Class frmMain End If Next Catch ex As Exception - LOGGER.Warn("⚠️ Unexpected Error in Removing Row after Loading Record from Grid: " & ex.Message) + LOGGER.Warn("⚠️ Unexpected Error In Removing Row after Loading Record from Grid: " & ex.Message) End Try ' ========== TIMER RE-ENABLE ========== @@ -3470,7 +3514,7 @@ Public Class frmMain FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_GET_ACTIVE_PROFILES_USER] ({USER_ID}))" End If - + LOGGER.Debug($"VWPM_PROFILE_ACTIVE-SELECT: {oSQL}") CURR_DT_VWPM_PROFILE_ACTIVE = DatabaseFallback.GetDatatableECM(oSQL) CURR_DT_VWPM_PROFILE_AH_WORKFLOW = CURR_DT_VWPM_PROFILE_ACTIVE.Copy CURR_DT_VWPM_PROFILE_AH_WORKFLOW.Clear() @@ -4613,6 +4657,9 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G Else LOGGER.Debug($"TreeList_Cockpit: Overview SQL query to be used: [{oSqlQuery}]") End If + ' ✅ NEU: Verifizieren Sie die Zuweisung + LOGGER.Debug($"TreeList_Cockpit: COCKPIT_PROFILE_SQL after assignment: [{COCKPIT_PROFILE_SQL}]") + LOGGER.Debug($"TreeList_Cockpit: COCKPIT_PROFILE_SQL.Length = [{COCKPIT_PROFILE_SQL.Length}]") CURRENT_CLICKED_PROFILE_ID = 0 CUSTOM_OVERVIEW_SQL = oSqlQuery.ToString() _lastUsedOverviewSQL = CUSTOM_OVERVIEW_SQL ' ← SQL merken BEVOR es gelöscht wird @@ -4730,28 +4777,40 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G End If COCKPIT_CHART_ID = oCHART_ID - Dim oHandleChart As Object = Nothing - Dim overlayChart As Boolean = False - If Not _overlayActive Then - oHandleChart = SplashScreenManager.ShowOverlayForm(Me) - _overlayActive = True - overlayChart = True - End If + ' ✅ KEIN Overlay bei Dashboard (verhindert Fokus-Raub) Me.Cursor = Cursors.WaitCursor Try - If Not Application.OpenForms().OfType(Of frmInvDashboard).Any Then - frmInvDashboard.Show() + ' ===== SCHRITT 1: Dashboard öffnen/referenzieren ===== + Dim dashboardForm As frmInvDashboard + + If Application.OpenForms().OfType(Of frmInvDashboard).Any Then + ' Dashboard ist bereits offen + dashboardForm = Application.OpenForms().OfType(Of frmInvDashboard).First() + LOGGER.Debug("TreeList_Cockpit: Dashboard already open - reusing existing instance") + Else + ' Dashboard neu öffnen + dashboardForm = New frmInvDashboard() + dashboardForm.Show() + LOGGER.Debug("TreeList_Cockpit: Dashboard opened new instance") End If + + ' ===== SCHRITT 2: Garantierte Vordergrund-Aktivierung ===== + ' TopMost temporär setzen (wird sofort wieder entfernt) + dashboardForm.TopMost = True + dashboardForm.TopMost = False + + ' Aktivieren und Fokus setzen + dashboardForm.Activate() + dashboardForm.BringToFront() + dashboardForm.Focus() + + ' ===== SCHRITT 3: Windows-API als Fallback (optional) ===== + ' Falls DevExpress hartnäckig ist + NativeMethods.SetForegroundWindow(dashboardForm.Handle) + Finally Me.Cursor = Cursors.Default - If overlayChart Then - _overlayActive = False - SplashScreenManager.CloseOverlayForm(oHandleChart) - End If End Try - ' ✅ BeginInvoke stellt Activate() ans Ende der Message-Queue – - ' nach DevExpress' internem Fokus-Restore - Me.BeginInvoke(Sub() frmInvDashboard.Activate()) Case Else LOGGER.Warn($"ProcessTreeListNodeAsync: Unhandled TYPE_ID [{oTypeIdInt}] - PK_CFG_COCKPIT_DEFINITION_ID:[{oCockpitConfigID}]") @@ -5007,5 +5066,17 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G End Try End Sub + ' ===== AM ENDE DER DATEI (vor "End Class") ===== + Friend NotInheritable Class NativeMethods + + Public Shared Function SetForegroundWindow(hWnd As IntPtr) As Boolean + End Function + + + Public Shared Function ShowWindow(hWnd As IntPtr, nCmdShow As Integer) As Boolean + End Function + + Public Const SW_RESTORE As Integer = 9 + End Class End Class \ No newline at end of file diff --git a/app/TaskFlow/frmValidator.resx b/app/TaskFlow/frmValidator.resx index 3a841e3..2e48354 100644 --- a/app/TaskFlow/frmValidator.resx +++ b/app/TaskFlow/frmValidator.resx @@ -616,7 +616,7 @@ DocumentViewer1 - DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null + DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=2.7.3.0, Culture=neutral, PublicKeyToken=null SplitContainer1.Panel2 diff --git a/app/TaskFlow/frmValidator.vb b/app/TaskFlow/frmValidator.vb index 1e09543..5005b52 100644 --- a/app/TaskFlow/frmValidator.vb +++ b/app/TaskFlow/frmValidator.vb @@ -4643,6 +4643,7 @@ Public Class frmValidator If USER_RIGHT_VIEW_ONLY = True Then RibbonPageFile.Visible = False + LOGGER.Debug("User has view-only rights, hiding RibbonPageFile.") Else RibbonPageFile.Visible = True End If @@ -8810,4 +8811,15 @@ Public Class frmValidator CONFIG.Config.NOTES_ONCLICK = bchkitmNotes.Checked CONFIG.Save() End Sub + + Private Sub BarButtonItemFileView_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemFileView.ItemClick + If DocPathWindows <> "" Then + Try + Process.Start(DocPathWindows) + Catch ex As Exception + LOGGER.Error(ex) + End Try + + End If + End Sub End Class \ No newline at end of file diff --git a/app/TaskFlow/packages.config b/app/TaskFlow/packages.config index 201f53c..5171c60 100644 --- a/app/TaskFlow/packages.config +++ b/app/TaskFlow/packages.config @@ -9,10 +9,16 @@ - + + + + + + + @@ -29,6 +35,7 @@ +