C2022-028 Added a switch to the user interface to call the functions that check the RO Link information in the step text
This commit is contained in:
@@ -274,6 +274,157 @@ namespace VEPROMS
|
||||
}
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
//C2022-028 check for Bad RO Links - we will check all of the RO links found in procedure step text
|
||||
private void CheckROLinks()
|
||||
{
|
||||
bool badLinksFound = false;
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
List<DocVersionInfo> dvil = new List<DocVersionInfo>();
|
||||
foreach (TreeNode tn in myDocVersions.Keys)
|
||||
if (tn.Checked)
|
||||
dvil.Add(myDocVersions[tn]);
|
||||
DateTime pStart = DateTime.Now;
|
||||
txtProcess.AppendText("Check RO Links");
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(pStart.ToString("MM/dd/yyyy @ HH:mm"));
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
Application.DoEvents();
|
||||
pbProcess.Minimum = 0;
|
||||
pbProcess.Maximum = dvil.Count;
|
||||
pbProcess.Step = 1;
|
||||
while (dvil.Count > 0)
|
||||
{
|
||||
StringBuilder sbDocVersions = new StringBuilder();
|
||||
Queue<DocVersionInfo> dviq = new Queue<DocVersionInfo>();
|
||||
foreach (DocVersionInfo dvi in dvil)
|
||||
dviq.Enqueue(dvi);
|
||||
dvil.Clear();
|
||||
// if we are processing more than one procedure set, use MessageList to hold the summary results for each set
|
||||
if (dviq.Count > 1)
|
||||
ROFstInfo.MessageList = new StringBuilder();
|
||||
while (dviq.Count > 0)
|
||||
{
|
||||
string msg = string.Empty;
|
||||
DocVersionInfo dq = dviq.Dequeue();
|
||||
if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg))
|
||||
{
|
||||
dvil.Add(dq);
|
||||
sbDocVersions.AppendLine(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
|
||||
badLinksFound |= ProcessCheckROLinks(dq);
|
||||
ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
|
||||
pbProcess.PerformStep();
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
DateTime pEnd = DateTime.Now;
|
||||
txtProcess.AppendText(string.Format("Completed: {0} {1} Seconds Elapsed", pEnd.ToString("MM/dd/yyyy @ HH:mm"), TimeSpan.FromTicks(pEnd.Ticks - pStart.Ticks).TotalSeconds));
|
||||
Application.DoEvents();
|
||||
// display a completed message after all are processed
|
||||
if (badLinksFound)
|
||||
FlexibleMessageBox.Show("Bad RO links were detected.\n\nSearch for the Annotation type 'Bad RO Link'\nto locate and fix the bad RO links", "Check RO Links Complete");
|
||||
else
|
||||
FlexibleMessageBox.Show("No Bad RO links were detected.", "Check RO Links Complete");
|
||||
ROFstInfo.MessageList = null;
|
||||
|
||||
if (dvil.Count > 0)
|
||||
{
|
||||
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut();
|
||||
frmCO.MySessionInfo = MySessionInfo;
|
||||
frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
|
||||
frmCO.Show(this);
|
||||
while (!this.Visible)
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
private bool ProcessCheckROLinks(DocVersionInfo dq)
|
||||
{
|
||||
bool badLinksFound = false;
|
||||
string statmsg = string.Format("Checking ROs for {0}", dq.MyFolder.Name);
|
||||
InitialProgressBarMessage = statmsg;
|
||||
txtProcess.AppendText(statmsg);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(statmsg);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
Application.DoEvents();
|
||||
|
||||
//if (dq.DocVersionAssociationCount < 1)
|
||||
//{
|
||||
// ProgressBar.ColorTable = eProgressBarItemColor.Error;
|
||||
// FinalProgressBarMessage = "No ROs associated";
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtProcess.AppendText("Error Updating ro.fst. No associated ro.fst");
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtResults.AppendText("Error Updating ro.fst. No associated ro.fst");
|
||||
// txtResults.AppendText(Environment.NewLine);
|
||||
// txtResults.AppendText(Environment.NewLine);
|
||||
// return;
|
||||
//}
|
||||
|
||||
//ROFstInfo roFstInfo = dq.DocVersionAssociations[0].MyROFst;
|
||||
//string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
|
||||
|
||||
////if (!pathExists(rofstPath))
|
||||
//if (!File.Exists(rofstPath))
|
||||
//{
|
||||
// ProgressBar.ColorTable = eProgressBarItemColor.Error;
|
||||
// FinalProgressBarMessage = "No existing RO.FST";
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtProcess.AppendText("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtProcess.AppendText(Environment.NewLine);
|
||||
// txtResults.AppendText("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
|
||||
// txtResults.AppendText(Environment.NewLine);
|
||||
// txtResults.AppendText(Environment.NewLine);
|
||||
// return;
|
||||
//}
|
||||
|
||||
Cursor = Cursors.WaitCursor;
|
||||
int numBadROLinks = 0;
|
||||
using (DocVersion dv = DocVersion.Get(dq.VersionID))
|
||||
{
|
||||
// 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
|
||||
//{
|
||||
// // only load the RO.fst
|
||||
// ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
|
||||
// roFstInfo = dq.DocVersionAssociations[0].MyROFst;
|
||||
//}
|
||||
//roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
//ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, txtProcess);
|
||||
//roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
|
||||
numBadROLinks = ROFstInfo.DoCheckROLinksInProcedures(dv, DoProgressBarRefresh, txtProcess);
|
||||
}
|
||||
|
||||
Cursor = Cursors.Default;
|
||||
ProgressBar.ColorTable = eProgressBarItemColor.Normal;
|
||||
FinalProgressBarMessage = "RO Links Checked";
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
//txtResults.AppendText("RO links Checked");
|
||||
//txtResults.AppendText(Environment.NewLine);
|
||||
if (numBadROLinks > 0)
|
||||
{
|
||||
badLinksFound = true;
|
||||
txtResults.AppendText(string.Format("{0} Bad RO Links were Found", numBadROLinks));
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText("A \"Bad RO Link\" Annotation was Placed at each Step Location");
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
}
|
||||
else
|
||||
txtResults.AppendText("No Bad RO Links were Detected");
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
return badLinksFound;
|
||||
}
|
||||
// B2018-002 - Invalid Transitions - Define Transition Refresh Statistics
|
||||
private int numTransProcessed = 0;
|
||||
private int numTransFixed = 0;
|
||||
@@ -1205,6 +1356,7 @@ namespace VEPROMS
|
||||
if (swUpdateROVals.Value)
|
||||
{
|
||||
swRefreshTrans.Value = false;
|
||||
swCheckROLinks.Value = false;
|
||||
ResetTV(true);
|
||||
}
|
||||
}
|
||||
@@ -1214,6 +1366,7 @@ namespace VEPROMS
|
||||
if (swRefreshTrans.Value)
|
||||
{
|
||||
swUpdateROVals.Value = false;
|
||||
swCheckROLinks.Value = false;
|
||||
ResetTV(false);
|
||||
}
|
||||
}
|
||||
@@ -1283,6 +1436,9 @@ namespace VEPROMS
|
||||
|
||||
if (swUpdateROVals.Value)
|
||||
UpdateROValues();
|
||||
|
||||
if (swCheckROLinks.Value)
|
||||
CheckROLinks(); // C2022-028 check for Bad RO Links
|
||||
}
|
||||
|
||||
private void btnRunCheck_Click(object sender, EventArgs e)
|
||||
@@ -1370,5 +1526,16 @@ namespace VEPROMS
|
||||
ClearStepProgress();
|
||||
}
|
||||
|
||||
//C2022-028 check for Bad RO Links
|
||||
private void swCheckROLinks_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (swCheckROLinks.Value)
|
||||
{
|
||||
swUpdateROVals.Value = false;
|
||||
swRefreshTrans.Value = false;
|
||||
ResetTV(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user