From 8f1bb45e42aa0bd0a943eb97f4cd25f175ab1924 Mon Sep 17 00:00:00 2001 From: mschill Date: Fri, 15 May 2026 07:09:21 -0400 Subject: [PATCH] C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --Fix for Blank popup box when completes updating ROs through Admin Tool & fix for updating ROs when fails part way through (if network error, etc…) --- .../VEPROMS User Interface/frmBatchRefresh.cs | 22 ++++++++- .../frmVersionsProperties.cs | 21 ++++++++- .../Config/AssocConfig.cs | 23 ++++++++-- .../Extension/ROFSTExt.cs | 46 +++++++++++++++---- .../Volian.Controls.Library/StepTabRibbon.cs | 20 ++++++++ PROMS/Volian.Controls.Library/vlnTreeView.cs | 22 ++++++++- 6 files changed, 139 insertions(+), 15 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs index 3a039660..89d1bc48 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs @@ -1066,7 +1066,27 @@ namespace VEPROMS ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); roFstInfo = dq.DocVersionAssociations[0].MyROFst; } - roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); + else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID) + { + //Handle issue where load failed without completing update + //previous RO FST did not load, get last loaded ID + //if none, use -1 which will check all ROs in the Working Draft + string cfg = dv.DocVersionAssociations[0].Config; + AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "" : cfg); + if (dv.DocVersionAssociations[0]?.MyROFst != null) + { + if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid)) + { + origfstid = -1; + } + } + else + { + origfstid = -1; + } + } + + roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, txtProcess, roFstInfo, origfstid, roFstInfo.ROFstID); roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); } diff --git a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs index b4d28658..3f8617e9 100644 --- a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs +++ b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs @@ -1539,8 +1539,27 @@ namespace VEPROMS ROFstInfo.UpdateRoFst(SelectedROFst.MyRODb, dv, SelectedROFst, DoProgressBarRefresh); SelectedROFst = null; // set to null to force getting the updated ROfst } + else if (!dv.ROfstLastCompleted && origfstid == SelectedROFst.ROFstID) + { + //Handle issue where load failed without completing update + //previous RO FST did not load, get last loaded ID + //if none, use -1 which will check all ROs in the Working Draft + string cfg = dv.DocVersionAssociations[0].Config; + AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "" : cfg); + if (dv.DocVersionAssociations[0]?.MyROFst != null) + { + if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid)) + { + origfstid = -1; + } + } + else + { + origfstid = -1; + } + } - ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file + ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file SelectedROFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, SelectedROFst, origfstid, SelectedROFst.ROFstID); diff --git a/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs index c5d20bd2..97f03639 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs @@ -124,9 +124,26 @@ namespace VEPROMS.CSLA.Library _Xp["ROUpdate", "LoadingFigures"] = value; // save selected value } } - #endregion // ROUpdate - #region ToString - public override string ToString() + + [Category("RO Update")] + [DisplayName("Previous ROFSTID")] + [RefreshProperties(RefreshProperties.All)] + [Description("Previous ROFSTID")] + public string ROUpdate_PrevROFSTID + { + get + { + string s = _Xp["ROUpdate", "PrevROFSTID"];// get the saved value + return s; + } + set + { + _Xp["ROUpdate", "PrevROFSTID"] = value; // save selected value + } + } + #endregion // ROUpdate + #region ToString + public override string ToString() { string s = _Xp.ToString(); if (s == "" || s == "") return string.Empty; diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs index e8e980ad..0098d346 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs @@ -267,6 +267,14 @@ namespace VEPROMS.CSLA.Library } } + // pop up a message window telling the user the RO Update has completed and how many ROs were updated + // If we are updating RO from the Admin Tools (from the V button) and we are updating more than on procedure set, then just append the "RO Update Complete" text + // To the MessageList. Once completed will all procedure sets, Admin Tools will display one message box with all the results in it. + if (MessageList == null) + FlexibleMessageBox.Show(fixedROs == 0 ? "No ROs Required Updating" : string.Format("{0} ROs Updated for {1}", fixedROs, dvi.MyFolder.Name), "RO Update Complete"); + else + MessageList.AppendLine((fixedROs == 0 ? "No ROs Required Updating for " : string.Format("{0} ROs Updated for ", fixedROs)) + dvi.MyFolder.Name); + return fixedROs; } @@ -320,7 +328,9 @@ namespace VEPROMS.CSLA.Library { if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update"); - DirectoryInfo di = new DirectoryInfo(rdi.FolderPath); + int origFSTid = origROFst.ROFstID; + + DirectoryInfo di = new DirectoryInfo(rdi.FolderPath); string rofstfilepath = rdi.FolderPath + @"\ro.fst"; FileStream fsIn = new FileStream(rofstfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); FileInfo rofstFI = new FileInfo(rofstfilepath); @@ -346,8 +356,9 @@ namespace VEPROMS.CSLA.Library docver.DocVersionAssociations[0].MyROFst = rofst; SetAssociationLastCompleted(docver, string.Empty); + SetPrevFSTID(docver, origFSTid); // //C2026-008 Re-Architect RO.FST to include RO Modification date/time - return rofst; + return rofst; } // Read in the rofst & make the rofst record. @@ -369,7 +380,10 @@ namespace VEPROMS.CSLA.Library // Keep a list of ROIDs for Images that have changed. List MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, rodb, myLookup, docver); - return rofst; + //C2026-008 Re-Architect RO.FST to include RO Modification date/time + SetPrevFSTID(docver, origFSTid); + + return rofst; } } @@ -469,8 +483,22 @@ namespace VEPROMS.CSLA.Library docver.Save(); } - // Place the status of loading the RO Figures when updating RO Values - private static void SetAssociationROFiguresLoading(DocVersion docver, string value) + //C2026-008 Re-Architect RO.FST to include RO Modification date/time + // Place the previous ROFSTID in the config in case network error or computer crashes while updating RO Values + private static void SetPrevFSTID(DocVersion docver, int value) + { + if (docver.DocVersionAssociations[0]?.MyROFst != null && value != -1) + { + string cfg = docver.DocVersionAssociations[0].Config; + AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "" : cfg); + ac.ROUpdate_PrevROFSTID = value.ToString(); + docver.DocVersionAssociations[0].Config = ac.ToString(); + docver.Save(); + } + } + + // Place the status of loading the RO Figures when updating RO Values + private static void SetAssociationROFiguresLoading(DocVersion docver, string value) { string cfg = docver.DocVersionAssociations[0].Config; @@ -903,10 +931,10 @@ namespace VEPROMS.CSLA.Library } } - #endregion - } + #endregion + } - public class ROFstInfoROTableUpdateEventArgs + public class ROFstInfoROTableUpdateEventArgs { private string _ROText; public string ROText @@ -1056,5 +1084,5 @@ namespace VEPROMS.CSLA.Library this.RaiseListChangedEvents = true; } - } + } } diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 261a08b8..ff56d745 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -3567,6 +3567,26 @@ namespace Volian.Controls.Library ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst; } + else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID) + { + //Handle issue where load failed without completing update + //previous RO FST did not load, get last loaded ID + //if none, use -1 which will check all ROs in the Working Draft + string cfg = dv.DocVersionAssociations[0].Config; + AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "" : cfg); + if (dv.DocVersionAssociations[0]?.MyROFst != null) + { + if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid)) + { + origfstid = -1; + } + } + else + { + origfstid = -1; + } + } + roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID); diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs index 4868032b..97f03838 100644 --- a/PROMS/Volian.Controls.Library/vlnTreeView.cs +++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs @@ -2479,7 +2479,27 @@ namespace Volian.Controls.Library ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst; } - roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); + else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID) + { + //Handle issue where load failed without completing update + //previous RO FST did not load, get last loaded ID + //if none, use -1 which will check all ROs in the Working Draft + string cfg = dv.DocVersionAssociations[0].Config; + AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "" : cfg); + if (dv.DocVersionAssociations[0]?.MyROFst != null) + { + if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid)) + { + origfstid = -1; + } + } + else + { + origfstid = -1; + } + } + + roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID); swROUpdate.Close();