Merge pull request 'B2022-144 added logic to process individual procedures to check for bad RO Links' (#7) from B2022-144_CheckROLinks into Development
Merging changes to test executable for generic purposes relating to the Administrative Tools.
This commit is contained in:
commit
bc7460d801
@ -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
|
||||
//
|
||||
|
@ -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;
|
||||
|
@ -256,53 +256,29 @@ namespace VEPROMS.CSLA.Library
|
||||
return fixedROs;
|
||||
}
|
||||
|
||||
|
||||
//C2022-028 for Admin tool to check for bad RO links
|
||||
public static int DoCheckROLinksInProcedures(DocVersion docver, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus)
|
||||
{
|
||||
/**** commented out for now - keep in case we decide to try to fix some of the RO links
|
||||
//ROFst rofst = null;
|
||||
//rofst = docver.DocVersionAssociations[0].MyROFst;
|
||||
***/
|
||||
|
||||
DocVersionInfo dvi = DocVersionInfo.Get(docver.VersionID);
|
||||
|
||||
int badROLinks = CheckROLinksInProcedures(dvi, myProgressBarRefresh, tbStatus);
|
||||
|
||||
myProgressBarRefresh(100, 100, "Check RO Links Complete"); // update the progress bar
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
|
||||
// pop up a message window telling the user the RO Check has completed and how many bad ROs were found
|
||||
// if MessageList is not null, then append the results message to it. We are running via Admin tools and doing more than one procedure set
|
||||
// and will diplay the messages once after all processing is completed
|
||||
if (MessageList != null)
|
||||
MessageList.AppendLine((badROLinks == 0 ? "No Bad RO Links Found for " : string.Format("{0} Bad RO Links Found in ", badROLinks)) + dvi.MyFolder.Name);
|
||||
|
||||
return badROLinks;
|
||||
}
|
||||
public static int CheckROLinksInProcedures(DocVersionInfo dvi, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus)
|
||||
//B2022-144 we now loop through checked procedures list from Admin Tools and call this method for each procedure we want to process
|
||||
public static int CheckROLinksInThisProcedure(ProcedureInfo proc, System.Windows.Forms.TextBox tbStatus)
|
||||
{
|
||||
int FoundBadROLinks = 0;
|
||||
|
||||
DocVersionInfo dvi = DocVersionInfo.Get(proc.MyDocVersion.VersionID);
|
||||
if (dvi.DocVersionConfig.SelectedSlave <= 0)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (ProcedureInfo proc in dvi.Procedures)
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
DateTime start = DateTime.Now;
|
||||
|
||||
ProcedureInfo.ResetCheckROLinkCounters();
|
||||
myProgressBarRefresh(++i, dvi.Procedures.Count, string.Format("{0} ({1}/{2} ROs)", proc.DisplayNumber, i, dvi.Procedures.Count));
|
||||
ProcedureInfo.CheckReferenceObjectsLinks(proc);
|
||||
FoundBadROLinks += ProcedureInfo.BadROLinksCount;
|
||||
ProcedureInfo.ResetCheckROLinkCounters();
|
||||
ProcedureInfo.CheckReferenceObjectsLinks(proc);
|
||||
FoundBadROLinks += ProcedureInfo.BadROLinksCount;
|
||||
|
||||
TimeSpan ts = DateTime.Now - start;
|
||||
TimeSpan ts = DateTime.Now - start;
|
||||
|
||||
if (tbStatus != null)
|
||||
tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
|
||||
/*** keep for now - incase we decide to fix RO links later on, this will show the number of RO Links that we fixed
|
||||
//tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0}, Fixed {4} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
|
||||
***/
|
||||
}
|
||||
if (tbStatus != null)
|
||||
tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
|
||||
/*** keep for now - incase we decide to fix RO links later on, this will show the number of RO Links that we fixed
|
||||
//tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0}, Fixed {4} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
|
||||
***/
|
||||
}
|
||||
|
||||
return FoundBadROLinks; // return the total number of bad RO links (in step text only) for the entire procedure set
|
||||
|
@ -108,7 +108,7 @@
|
||||
<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<Reference Include="Interop.EDWordLib, Version=8.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
<HintPath>..\..\..\..\3rdPartyLibraries\Edraw\Interop.EDWordLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
|
||||
|
Loading…
x
Reference in New Issue
Block a user