B2022-144 added logic to process dividual procedures to check for bad RO Links

Also fixed a build issue for the controls library
This commit is contained in:
2023-06-28 10:08:33 -04:00
parent 719ee03ba4
commit 376a462c2d
4 changed files with 59 additions and 141 deletions

View File

@@ -494,6 +494,7 @@
this.swRefreshTblsForSrch.TabIndex = 32;
this.swRefreshTblsForSrch.Value = true;
this.swRefreshTblsForSrch.ValueObject = "Y";
this.swRefreshTblsForSrch.ValueChanged += new System.EventHandler(this.swCk_ValueChanged);
//
// lblRefreshTblForSrch
//

View File

@@ -296,47 +296,70 @@ 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
//B2022-144 Allow to check individual procedures for bad RO links
private void CheckROLinks()
{
bool badLinksFound = false;
this.Cursor = Cursors.WaitCursor;
List<DocVersionInfo> dvil = new List<DocVersionInfo>();
foreach (TreeNode tn in myDocVersions.Keys)
List<ProcedureInfo> pil = new List<ProcedureInfo>();
// populate a list of procedures that the user selected to process
foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked)
dvil.Add(myDocVersions[tn]);
pil.Add(myProcedures[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);
txtResults.Clear();
Application.DoEvents();
pbProcess.Minimum = 0;
pbProcess.Maximum = dvil.Count;
pbProcess.Maximum = pil.Count;
pbProcess.Step = 1;
while (dvil.Count > 0)
int i = 0;
while (pil.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)
StringBuilder sbProcs = new StringBuilder();
// Put the list of procedures in a queue
Queue<ProcedureInfo> piq = new Queue<ProcedureInfo>();
foreach (ProcedureInfo pi in pil)
piq.Enqueue(pi);
pil.Clear();
string prevStatMsgSet = string.Empty;
string statmsgproc = string.Empty;
while (piq.Count > 0)
{
string msg = string.Empty;
DocVersionInfo dq = dviq.Dequeue();
if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg))
ProcedureInfo pq = piq.Dequeue(); // get next procedure from queue
if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg))
{
dvil.Add(dq);
sbDocVersions.AppendLine(msg);
pil.Add(pq); // cannot open this procedure to process - save to a list of un-processed procedures
sbProcs.AppendLine(msg);
}
else
{
string statmsgset = string.Format("Check ROs Links in Procedure Set \"{0}\"", pq.MyDocVersion.MyFolder.Name);
if (statmsgset != prevStatMsgSet)
{
txtResults.AppendText(statmsgset);
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
prevStatMsgSet = statmsgset;
}
ProcedureInfo.ResetCheckROLinkCounters();
DoProgressBarRefresh(++i, piq.Count, string.Format("{0} ({1}/{2} ROs)", pq.DisplayNumber, i, piq.Count));
ContentInfo.StaticContentInfoChange += new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
badLinksFound |= ProcessCheckROLinks(dq);
statmsgproc = string.Format(" Checking Procedure {0}", pq.DisplayNumber);
txtResults.AppendText(statmsgproc);
txtResults.AppendText(Environment.NewLine);
int numBadROLinks = ROFstInfo.CheckROLinksInThisProcedure(pq, txtProcess); // check the procedure for bad RO links
badLinksFound |= (numBadROLinks > 0);
string smsg = (numBadROLinks > 0) ? string.Format(" {0} Bad RO Link(s) Found", numBadROLinks) : " No Bad RO Links Found";
txtResults.AppendText(smsg);
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
pbProcess.PerformStep();
Application.DoEvents();
@@ -352,7 +375,7 @@ namespace VEPROMS
FlexibleMessageBox.Show("No Bad RO links were detected.", "Check RO Links Complete");
ROFstInfo.MessageList = null;
if (dvil.Count > 0)
if (piq.Count > 0)
{
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0);
frmCO.MySessionInfo = MySessionInfo;
@@ -364,89 +387,7 @@ namespace VEPROMS
}
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;