Compare commits

..

No commits in common. "bc7460d80171f0ba9836c23da73255d0cab60df0" and "480f742838e24f9123197ef94be4a4f16a08f298" have entirely different histories.

4 changed files with 141 additions and 59 deletions

View File

@ -494,7 +494,6 @@
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,70 +296,47 @@ 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<ProcedureInfo> pil = new List<ProcedureInfo>();
// populate a list of procedures that the user selected to process
foreach (TreeNode tn in myProcedures.Keys)
List<DocVersionInfo> dvil = new List<DocVersionInfo>();
foreach (TreeNode tn in myDocVersions.Keys)
if (tn.Checked)
pil.Add(myProcedures[tn]);
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);
txtResults.Clear();
Application.DoEvents();
pbProcess.Minimum = 0;
pbProcess.Maximum = pil.Count;
pbProcess.Maximum = dvil.Count;
pbProcess.Step = 1;
int i = 0;
while (pil.Count > 0)
while (dvil.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)
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;
ProcedureInfo pq = piq.Dequeue(); // get next procedure from queue
if (!MySessionInfo.CanCheckOutItem(pq.ItemID, CheckOutType.Procedure, ref msg))
DocVersionInfo dq = dviq.Dequeue();
if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg))
{
pil.Add(pq); // cannot open this procedure to process - save to a list of un-processed procedures
sbProcs.AppendLine(msg);
dvil.Add(dq);
sbDocVersions.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);
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);
badLinksFound |= ProcessCheckROLinks(dq);
ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange);
pbProcess.PerformStep();
Application.DoEvents();
@ -375,7 +352,7 @@ namespace VEPROMS
FlexibleMessageBox.Show("No Bad RO links were detected.", "Check RO Links Complete");
ROFstInfo.MessageList = null;
if (piq.Count > 0)
if (dvil.Count > 0)
{
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0);
frmCO.MySessionInfo = MySessionInfo;
@ -387,7 +364,89 @@ 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;

View File

@ -256,19 +256,42 @@ namespace VEPROMS.CSLA.Library
return fixedROs;
}
//C2022-028 for Admin tool to check for bad RO links
//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)
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)
{
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;
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;
@ -280,6 +303,7 @@ namespace VEPROMS.CSLA.Library
//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
}

View File

@ -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>False</EmbedInteropTypes>
<EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>..\..\..\..\3rdPartyLibraries\Edraw\Interop.EDWordLib.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">