C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST
This commit is contained in:
@@ -59,11 +59,11 @@ namespace Volian.Controls.Library
|
||||
private DisplayTags displayTags;
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
#region Properties
|
||||
|
||||
public ProgressBarItem ProgressBar
|
||||
public ProgressBarItem ProgressBar
|
||||
{
|
||||
get { return _progressBar; }
|
||||
set { _progressBar = value; }
|
||||
@@ -89,7 +89,10 @@ namespace Volian.Controls.Library
|
||||
(_myRTB != null && (_myRTB.IsRoTable != lastRTBwasROTable || _myRTB.IsRoFigure != lastRTBwasROFigure)); }
|
||||
}
|
||||
|
||||
public ROFstInfo MyROFST
|
||||
//This flag will be set when the docversion gets updated to let it know that the full tree needs a refresh
|
||||
private bool changedDocVersion = false;
|
||||
|
||||
public ROFstInfo MyROFST
|
||||
{
|
||||
get { return _myROFST; }
|
||||
set
|
||||
@@ -128,16 +131,22 @@ namespace Volian.Controls.Library
|
||||
// B2022-135 Submitted for Admin Tools (Check RO Links tool)
|
||||
if (_docVersionInfo == null || _docVersionInfo != value || _docVersionInfo.VersionID != value.VersionID)
|
||||
{
|
||||
_docVersionInfo = value;
|
||||
//Set flag for modified the docversion - should check for new ROs
|
||||
if (_docVersionInfo?.VersionID != value?.VersionID)
|
||||
{
|
||||
changedDocVersion = true;
|
||||
}
|
||||
|
||||
_docVersionInfo = value;
|
||||
|
||||
if (_myRTB != null && (_docVersionInfo == null || _docVersionInfo.VersionID != _myRTB.MyDVI.VersionID))
|
||||
{
|
||||
_docVersionInfo = _myRTB.MyDVI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures.
|
||||
_currDocVersionID = (_docVersionInfo != null) ? (int?)_docVersionInfo.VersionID : null;
|
||||
// B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures.
|
||||
_currDocVersionID = (_docVersionInfo != null) ? (int?)_docVersionInfo.VersionID : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +210,11 @@ namespace Volian.Controls.Library
|
||||
// B2022-098: [JPR] ROs not being resolved in Word Sections
|
||||
CurROLink = null;
|
||||
_savCurROLink = null;
|
||||
}
|
||||
|
||||
//Clear flag for modified the docversion (if should check for new ROs)
|
||||
//clearing this flag here prevents it from checking twice
|
||||
changedDocVersion = false;
|
||||
}
|
||||
else if(_myRTB != value)
|
||||
{
|
||||
if (_myRTB != null)
|
||||
@@ -221,9 +234,9 @@ namespace Volian.Controls.Library
|
||||
CurROLink = null;
|
||||
_savCurROLink = null;
|
||||
}
|
||||
// B2023-004 assign the doc version info associated with the current RTB (rich text box)
|
||||
// this fixes an issue where unit designators could not be linked in the step edit (BNPP data)
|
||||
MyDvi = _myRTB.MyItemInfo.MyDocVersion;
|
||||
// B2023-004 assign the doc version info associated with the current RTB (rich text box)
|
||||
// this fixes an issue where unit designators could not be linked in the step edit (BNPP data)
|
||||
MyDvi = _myRTB.MyItemInfo.MyDocVersion;
|
||||
|
||||
MyROFST = (_myRTB.MyItemInfo.MyDocVersion.DocVersionAssociationCount > 0) ? _myRTB.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst : null;
|
||||
}
|
||||
@@ -251,11 +264,13 @@ namespace Volian.Controls.Library
|
||||
set { _myUserInfo = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
public SessionInfo MySessionInfo { get; set; }
|
||||
|
||||
#region Constructors
|
||||
#endregion
|
||||
|
||||
public DisplayRO()
|
||||
#region Constructors
|
||||
|
||||
public DisplayRO()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -277,48 +292,62 @@ namespace Volian.Controls.Library
|
||||
// Initialize the DisplayTags object
|
||||
displayTags = new DisplayTags();
|
||||
|
||||
_progressBar = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
#region Event Handlers
|
||||
#region (Progress Bar)
|
||||
|
||||
#region Event Handlers
|
||||
private string InitialProgressBarMessage
|
||||
{
|
||||
set
|
||||
{
|
||||
if (ProgressBar == null) return;
|
||||
ProgressBar.Value = 0;
|
||||
ProgressBar.Maximum = 100;
|
||||
ProgressBar.Text = value;
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
private string FinalProgressBarMessage
|
||||
{
|
||||
set
|
||||
{
|
||||
if (ProgressBar == null) return;
|
||||
ProgressBar.Value = 100;
|
||||
ProgressBar.Maximum = 100;
|
||||
ProgressBar.Text = value;
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
private void DoProgressBarRefresh(int value, int max, string text)
|
||||
{
|
||||
if (ProgressBar == null) return;
|
||||
ProgressBar.Maximum = max;
|
||||
ProgressBar.Value = value;
|
||||
ProgressBar.Text = text;
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
||||
#region (Progress Bar)
|
||||
#endregion
|
||||
|
||||
private void ProgressBar_Initialize(int max, string desc)
|
||||
{
|
||||
if (_progressBar != null)
|
||||
{
|
||||
_progressBar.Maximum = max;
|
||||
_progressBar.Text = desc;
|
||||
_progressBar.TextVisible = true;
|
||||
}
|
||||
}
|
||||
#region (RTB)
|
||||
|
||||
private void ProgressBar_SetValue(int curval)
|
||||
{
|
||||
if (_progressBar != null)
|
||||
{
|
||||
_progressBar.Value = curval;
|
||||
}
|
||||
}
|
||||
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
|
||||
// DisplayTab was changed
|
||||
// need to clear the RTB selected
|
||||
// without resetting the DVI or FST
|
||||
// (those will be set manually / individually)
|
||||
// this will prevent DVI and FST from changing to null then back again
|
||||
// which will trigger reloads
|
||||
public void ClearRTB()
|
||||
{
|
||||
_myRTB = null;
|
||||
CurROLink = null;
|
||||
_savCurROLink = null;
|
||||
}
|
||||
|
||||
private void ProgressBar_Clear()
|
||||
{
|
||||
if (_progressBar != null)
|
||||
{
|
||||
_progressBar.Text = string.Empty;
|
||||
_progressBar.Maximum = 0;
|
||||
_progressBar.Value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region (RTB)
|
||||
|
||||
public void MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
|
||||
public void MyRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
CurROLink = null;
|
||||
if (MyRTB.MyLinkText != null) CurROLink = args.MyLinkText.MyRoUsageInfo;
|
||||
@@ -565,55 +594,102 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
|
||||
private void lbFound_SelectedValueChanged(object sender, EventArgs e)
|
||||
private void lbFound_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (lbFound.Visible && lbFound.SelectedIndex >= 0 && lbFound.SelectedValue != null)
|
||||
{
|
||||
ExpandNode(Convert.ToString(lbFound.SelectedValue));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region (ROUpdate)
|
||||
public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
|
||||
{
|
||||
return VlnFlexGrid.ROTableUpdate(sender, args);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
|
||||
// changed to return true if the RO FST got updated
|
||||
public bool LoadTree(bool forceReload = false)
|
||||
{
|
||||
if (lbFound.Visible && lbFound.SelectedIndex >= 0 && lbFound.SelectedValue != null)
|
||||
{
|
||||
ExpandNode(Convert.ToString(lbFound.SelectedValue));
|
||||
}
|
||||
}
|
||||
bool updatedROs = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void LoadTree(bool forceReload = false)
|
||||
{
|
||||
if (MyROFST == null)
|
||||
{
|
||||
tvROFST.Nodes.Clear();
|
||||
lbFound.Visible = false;
|
||||
return;
|
||||
return updatedROs;
|
||||
}
|
||||
|
||||
if (forceReload || RoTreeNeedsReloaded || tvROFST.Nodes == null || tvROFST.Nodes.Count <= 0)
|
||||
if (changedDocVersion || forceReload || RoTreeNeedsReloaded || tvROFST.Nodes == null || tvROFST.Nodes.Count <= 0)
|
||||
{
|
||||
//B2025-008
|
||||
//in cases where a RO table is clicked on
|
||||
//it will refresh the list
|
||||
//temp store what the ROID was before the list refreshes
|
||||
//so can go to it after the refresh
|
||||
string tmpROID = CurROLink?.ROID;
|
||||
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
|
||||
//check if newer data - if there is, check if user wants to update data
|
||||
int fstid = MyROFSTLookup.GetNewerFSTID();
|
||||
int origfstid = MyROFSTLookup.RofstID;
|
||||
|
||||
ROFSTLookup.rodbi[] dbs = MyROFSTLookup.GetRODatabaseList(true);
|
||||
if (_docVersionInfo != null && fstid != -1 && fstid != MyROFSTLookup.RofstID)
|
||||
{
|
||||
string message = string.Empty;
|
||||
if (!MySessionInfo.CanCheckOutItem(_docVersionInfo.VersionID, CheckOutType.DocVersion, ref message))
|
||||
{
|
||||
FlexibleMessageBox.Show(this, message, "Working Draft Has Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
FinalProgressBarMessage = "Cannot check-out Working Draft";
|
||||
}
|
||||
else if (changedDocVersion && 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)
|
||||
{
|
||||
|
||||
InitialProgressBarMessage = "Updating ROs";
|
||||
|
||||
ROFstInfo roFstInfo = ROFstInfo.Get(fstid);
|
||||
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
ROFstInfo.RefreshROFstAtItemLevel(_docVersionInfo, DoProgressBarRefresh, null, roFstInfo, origfstid, fstid);
|
||||
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
|
||||
Application.DoEvents();
|
||||
|
||||
FinalProgressBarMessage = "ROs values updated";
|
||||
MyROFST = roFstInfo;
|
||||
|
||||
updatedROs = true;
|
||||
}
|
||||
}
|
||||
|
||||
//B2025-008
|
||||
//in cases where a RO table is clicked on
|
||||
//it will refresh the list
|
||||
//temp store what the ROID was before the list refreshes
|
||||
//so can go to it after the refresh
|
||||
string tmpROID = CurROLink?.ROID;
|
||||
|
||||
ROFSTLookup.rodbi[] dbs = MyROFSTLookup?.GetRODatabaseList(true);
|
||||
|
||||
// B2022-123: RO Tab Treeview not showing correct RO values when switching between procedures.
|
||||
// Added optional parameter "forceReload" and cleared out any existing nodes before reloading the tree
|
||||
// the clear nodes code below has to be after the GetRODatabaseList database call because of races conditions in the code
|
||||
tvROFST.Nodes.Clear();
|
||||
ResetSearch(); //B2023-050 need to reset the SaveRO, and any RO info that was selected last time the tree was loaded
|
||||
for (int i = 0; i < dbs.Length; i++)
|
||||
if (dbs != null)
|
||||
{
|
||||
ROFSTLookup.rodbi db = dbs[i];
|
||||
for (int i = 0; i < dbs.Length; i++)
|
||||
{
|
||||
ROFSTLookup.rodbi db = dbs[i];
|
||||
|
||||
TreeNode tn = new TreeNode(db.dbiTitle);
|
||||
tn.Tag = db;
|
||||
tvROFST.Nodes.Add(tn);
|
||||
TreeNode tn = new TreeNode(db.dbiTitle);
|
||||
tn.Tag = db;
|
||||
tvROFST.Nodes.Add(tn);
|
||||
|
||||
AddDummyGroup(db, tn);
|
||||
}
|
||||
AddDummyGroup(db, tn);
|
||||
}
|
||||
}
|
||||
|
||||
_currRofstID = (IsRofstValid) ? (int?)_myROFST.ROFstID : null;
|
||||
_currDocVersionID = null;
|
||||
@@ -621,7 +697,13 @@ namespace Volian.Controls.Library
|
||||
if(_docVersionInfo != null) _currDocVersionID = (int?)_docVersionInfo.VersionID;
|
||||
|
||||
if (tmpROID != null) ExpandNode(ROFSTLookup.FormatRoidKey(tmpROID, true));
|
||||
}
|
||||
|
||||
//doc version would have updated (if needed) so reset flag
|
||||
if (_progressBar?.Text != "Cannot check-out Working Draft")
|
||||
{
|
||||
changedDocVersion = false;
|
||||
}
|
||||
}
|
||||
|
||||
var unitInfoNode = tvROFST.Nodes.Cast<TreeNode>().Where(x => x.Text == "Unit Information").FirstOrDefault();
|
||||
|
||||
@@ -672,7 +754,9 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
|
||||
_curROTypeFilter = _roTypeFilter;
|
||||
}
|
||||
|
||||
return updatedROs;
|
||||
}
|
||||
|
||||
public void SetFindDocROButton(bool enabled)
|
||||
{
|
||||
|
||||
@@ -3556,7 +3556,10 @@ namespace Volian.Controls.Library
|
||||
MyEditItem.SaveContents();
|
||||
using (DocVersion dv = DocVersion.Get(Mydvi.VersionID))
|
||||
{
|
||||
swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(Mydvi));
|
||||
//must get id before ROFST gets updated so know what to refresh later
|
||||
int origfstid = roFstInfo.ROFstID;
|
||||
|
||||
swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(Mydvi));
|
||||
// B2022-026 RO Memory Reduction code - first load the new ro.fst so that we can assign the ROTableUpdate event to the correct roFstInfo
|
||||
if (dv.ROfstLoadingFigures || dv.NewerRoFst) // B2017-125 see if loading figures was completed
|
||||
{
|
||||
@@ -3566,8 +3569,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
|
||||
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, null);
|
||||
swROUpdate.Close();
|
||||
ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID);
|
||||
swROUpdate.Close();
|
||||
ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange;
|
||||
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST");
|
||||
|
||||
@@ -2465,7 +2465,11 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
Cursor = Cursors.WaitCursor; // C2023-002: move wait cursor after check out error
|
||||
int ownerid = MySessionInfo.CheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion);
|
||||
using (DocVersion dv = DocVersion.Get(MyDVI.VersionID))
|
||||
|
||||
//must get id before ROFST gets updated so know what to refresh later
|
||||
int origfstid = roFstInfo.ROFstID;
|
||||
|
||||
using (DocVersion dv = DocVersion.Get(MyDVI.VersionID))
|
||||
{
|
||||
swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(MyDVI)); // RO changes placed in file in the Documents\VEPROMS folder
|
||||
// B2022-026 RO Memory Reduction code - first load the new ro.fst so that we can assign the ROTableUpdate event to the correct roFstInfo
|
||||
@@ -2477,8 +2481,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
|
||||
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, null);
|
||||
swROUpdate.Close();
|
||||
ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID);
|
||||
swROUpdate.Close();
|
||||
ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange;
|
||||
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
OnTabDisplay(this, new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST"));
|
||||
|
||||
Reference in New Issue
Block a user