Compare commits

..

8 Commits

7 changed files with 57 additions and 16 deletions
Binary file not shown.
Binary file not shown.
+31 -14
View File
@@ -5547,6 +5547,12 @@ ELSE PRINT 'Function: ve_GetItemDerivedApplicability Error on Creation'
GO GO
------- -------
-- =============================================
-- Author: Matthew Schill
-- Modify date: 07/14/2026
-- Description: Reworked ve_GetParentItem for Performance improvement
-- =============================================
/****** Object: UserDefinedFunction [dbo].[vefn_GetParentItem] Script Date: 03/28/2012 17:58:48 ******/ /****** Object: UserDefinedFunction [dbo].[vefn_GetParentItem] Script Date: 03/28/2012 17:58:48 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetParentItem]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[ve_GetParentItem]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
DROP FUNCTION [ve_GetParentItem]; DROP FUNCTION [ve_GetParentItem];
@@ -5555,35 +5561,46 @@ GO
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved. Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/ *****************************************************************************/
CREATE FUNCTION [dbo].[ve_GetParentItem] (@ItemID int) RETURNS int CREATE OR ALTER FUNCTION [dbo].[ve_GetParentItem] (@ItemID int) RETURNS int
WITH EXECUTE AS OWNER WITH EXECUTE AS OWNER
AS AS
BEGIN BEGIN
DECLARE @ParentID int; DECLARE @ParentID int;
WITH Itemz([ItemID],[IsFound]) as WITH Itemz([ItemID]) as
( (
select ii.itemid,0 from items ii where ii.itemid = @ItemID select ii.itemid from items ii WITH (NOLOCK) where ii.itemid = @ItemID
union all union all
select ii.previousid,0 from items ii select ii.previousid from items ii WITH (NOLOCK)
join itemz zz on ii.itemid = zz.itemid join itemz zz on ii.itemid = zz.itemid
where ii.previousid is not null where ii.previousid is not null
and zz.isfound = 0
union all
select ii.itemid,1
from parts pp
join itemz zz on pp.itemid = zz.itemid
join items ii on ii.contentid = pp.contentid
) )
select top 1 @ParentID = itemid from itemz select top 1 @ParentID = ii.itemid
where isfound = 1 OPTION (MAXRECURSION 10000) from itemz
inner join parts pp WITH (NOLOCK) on pp.itemid = itemz.itemid
inner join items ii WITH (NOLOCK) on ii.contentid = pp.contentid
OPTION (MAXRECURSION 10000)
RETURN @ParentID RETURN @ParentID
END END
GO GO
IF (@@Error = 0) PRINT 'ScalerFunction [vefn_GetParentItem] Succeeded' IF (@@Error = 0) PRINT 'ScalerFunction [vefn_GetParentItem] Succeeded'
ELSE PRINT 'ScalerFunction [vefn_GetParentItem] Error on Creation' ELSE PRINT 'ScalerFunction [vefn_GetParentItem] Error on Creation'
go go
IF EXISTS (SELECT * FROM dbo.sysIndexes WHERE name like 'IX_PartsItemID')
DROP INDEX [IX_PartsItemID] ON [dbo].[tblParts];
GO
CREATE NONCLUSTERED INDEX IX_PartsItemID
ON [dbo].[tblParts] ([ItemID] ASC)
INCLUDE([ContentID],[DeleteStatus],[FromType]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
PRINT 'Added IX_PartsItemID Index. Speeds up Getting Parent Items'
GO
/****** Object: UserDefinedFunction [dbo].[vefn_CanTransitionBeCreated] Script Date: 10/14/2012 02:03:30 ******/ /****** Object: UserDefinedFunction [dbo].[vefn_CanTransitionBeCreated] Script Date: 10/14/2012 02:03:30 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_CanTransitionBeCreated]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1) IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_CanTransitionBeCreated]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
DROP FUNCTION [vefn_CanTransitionBeCreated]; DROP FUNCTION [vefn_CanTransitionBeCreated];
@@ -25051,8 +25068,8 @@ BEGIN TRY -- Try Block
DECLARE @RevDate varchar(255) DECLARE @RevDate varchar(255)
DECLARE @RevDescription varchar(255) DECLARE @RevDescription varchar(255)
set @RevDate = '06/29/2026 7:00 AM' set @RevDate = '07/16/2026 8:30 AM'
set @RevDescription = 'Update to Grid Deletion Audits' set @RevDescription = 'Reworked ve_GetParentItem for Performance improvement'
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
@@ -326,7 +326,9 @@ namespace VEPROMS.CSLA.Library
// all of the calls aways set the flags to not update the RO values // all of the calls aways set the flags to not update the RO values
public static ROFst UpdateRoFst(RODbInfo rdi, DocVersion docver, ROFstInfo origROFst, ROFstInfoProgressBarRefresh myProgressBarRefresh) public static ROFst UpdateRoFst(RODbInfo rdi, DocVersion docver, ROFstInfo origROFst, ROFstInfoProgressBarRefresh myProgressBarRefresh)
{ {
if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update"); ROWorkingDraftAsk.ClearWorkingDrafts();
if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update");
int origFSTid = origROFst.ROFstID; int origFSTid = origROFst.ROFstID;
@@ -0,0 +1,18 @@
using System.Collections.Generic;
namespace VEPROMS.CSLA.Library
{
public static class ROWorkingDraftAsk
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private static List<int> WorkingDrafts = new List<int>();
public static void AddWorkingDrafts(int wd) => WorkingDrafts.Add(wd);
public static void ClearWorkingDrafts() => WorkingDrafts.Clear();
public static bool ContainsWorkingDraft(int wd) => WorkingDrafts.Contains(wd);
}
}
@@ -396,6 +396,7 @@
<Compile Include="Minimal\UserReports.cs" /> <Compile Include="Minimal\UserReports.cs" />
<Compile Include="Minimal\UserSettings.cs" /> <Compile Include="Minimal\UserSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Session\ROWorkingDraftAsk.cs" />
<Compile Include="VEObjects\VEDrillDown.cs" /> <Compile Include="VEObjects\VEDrillDown.cs" />
<Compile Include="VEObjects\VETreeNode.cs" /> <Compile Include="VEObjects\VETreeNode.cs" />
</ItemGroup> </ItemGroup>
+4 -1
View File
@@ -652,7 +652,7 @@ namespace Volian.Controls.Library
{ {
//do nothing - is still checked out //do nothing - is still checked out
} }
else if (changedDocVersion && !askedAboutchangedDocVersion) else if (changedDocVersion && !askedAboutchangedDocVersion && !ROWorkingDraftAsk.ContainsWorkingDraft(_docVersionInfo.VersionID))
{ {
if (MessageBox.Show($"There exists a newer ROFST for this RO database that was loaded for other sets.\r\n\r\nDo you want to update this set's ROs to be consistent/use the latest loaded ROFST?", "Load ROs", MessageBoxButtons.YesNo) == DialogResult.Yes) if (MessageBox.Show($"There exists a newer ROFST for this RO database that was loaded for other sets.\r\n\r\nDo you want to update this set's ROs to be consistent/use the latest loaded ROFST?", "Load ROs", MessageBoxButtons.YesNo) == DialogResult.Yes)
{ {
@@ -671,10 +671,13 @@ namespace Volian.Controls.Library
updatedROs = true; updatedROs = true;
askedAboutchangedDocVersion = false; askedAboutchangedDocVersion = false;
ROWorkingDraftAsk.ClearWorkingDrafts();
} }
else else
{ {
askedAboutchangedDocVersion = true; askedAboutchangedDocVersion = true;
if (!ROWorkingDraftAsk.ContainsWorkingDraft(_docVersionInfo.VersionID))
ROWorkingDraftAsk.AddWorkingDrafts(_docVersionInfo.VersionID);
} }
} }