diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs index ee346ceb..a917d5b3 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs @@ -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 // diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs index c6218f58..8dbc901c 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs @@ -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 dvil = new List(); - foreach (TreeNode tn in myDocVersions.Keys) + List pil = new List(); + // 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 dviq = new Queue(); - 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 piq = new Queue(); + 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; diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs index 6f045ee7..113edc89 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs @@ -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 diff --git a/PROMS/Volian.Controls.Library/Volian.Controls.Library.csproj b/PROMS/Volian.Controls.Library/Volian.Controls.Library.csproj index d43ebd90..a4caf541 100644 --- a/PROMS/Volian.Controls.Library/Volian.Controls.Library.csproj +++ b/PROMS/Volian.Controls.Library/Volian.Controls.Library.csproj @@ -108,7 +108,7 @@ False - True + False ..\..\..\..\3rdPartyLibraries\Edraw\Interop.EDWordLib.dll