From f8269a7ac6c8b6fae3fad7cd582005003a6c3d11 Mon Sep 17 00:00:00 2001 From: Jake Date: Mon, 8 Aug 2022 10:04:21 +0000 Subject: [PATCH] B2022-088: Find Doc Ro button not working in Word Sections B2022-089: Updating RO Crashes --- PROMS/LBWordLibrary/LBComObject.cs | 42 +++++ PROMS/LBWordLibrary/LBObjectExtension.cs | 19 ++ .../DlgPrintProcedure.cs | 16 +- .../VEPROMS User Interface/dlgExportImport.cs | 13 +- .../Config/ROFSTLookup.cs | 165 +++++++++++------- .../Extension/AuditExt.cs | 2 + .../Extension/DocumentExt.cs | 16 +- .../Extension/ROFSTExt.cs | 31 +++- .../Extension/RevisionInfoExt.cs | 8 +- PROMS/Volian.Controls.Library/DisplayRO.cs | 69 ++++---- PROMS/Volian.Controls.Library/ImageItem.cs | 5 +- .../PDFConsistencyCheckReport.cs | 5 +- PROMS/Volian.Print.Library/vlnParagraph.cs | 5 +- 13 files changed, 271 insertions(+), 125 deletions(-) diff --git a/PROMS/LBWordLibrary/LBComObject.cs b/PROMS/LBWordLibrary/LBComObject.cs index dc51052f..8bc36189 100644 --- a/PROMS/LBWordLibrary/LBComObject.cs +++ b/PROMS/LBWordLibrary/LBComObject.cs @@ -492,6 +492,48 @@ namespace LBWordLibrary public partial class LBRange : LBComObject { public LBRange() { } + + // B2022-088: Find Doc Ro button not working in Word Sections + public LBFind Find + { + get { return new LBFind(GetProperty("Find")); } + } + + public int MoveStart() + { + return InvokeMethod("MoveStart", Missing.Value, Missing.Value) as int? ?? 0; + } + + public int MoveStart(object Unit, object Count) + { + return InvokeMethod("MoveStart", Unit, Count) as int? ?? 0; + } + + public int MoveEnd() + { + return InvokeMethod("MoveEnd", Missing.Value, Missing.Value) as int? ?? 0; + } + + public int MoveEnd(object Unit, object Count) + { + return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0; + } + + public void InsertSymbol(int CharacterNumber) + { + InvokeMethod("InsertSymbol", CharacterNumber, Missing.Value, Missing.Value, Missing.Value); + } + + public void InsertSymbol(int CharacterNumber, object Font, object Unicode, object Bias) + { + InvokeMethod("InsertSymbol", CharacterNumber, Font, Unicode, Bias); + } + + public void TypeText(string Text) + { + InvokeMethod("TypeText", Text); + } + public LBRange(Object item) : base(item) { } // B2018-028 Word 2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word. // We now need to calculated the last row of text in the PROMS attachment differently. diff --git a/PROMS/LBWordLibrary/LBObjectExtension.cs b/PROMS/LBWordLibrary/LBObjectExtension.cs index d04b1e4e..040cd288 100644 --- a/PROMS/LBWordLibrary/LBObjectExtension.cs +++ b/PROMS/LBWordLibrary/LBObjectExtension.cs @@ -840,6 +840,25 @@ namespace LBWordLibrary { return new LBRange(InvokeMethod("GoTo", What, Which, Count, Missing.Value)); } + B2022-088: Find Doc Ro button not working in Word Sections + public bool LastWasUpper + { + get + { + int start = this.Start - 1; + + while (start >= 0) + { + this.Start = start; + this.End = start + 1; + string previous = LBDocumentClass.GetRangeText(this); + if (Regex.IsMatch(previous, "[A-Z]")) return true; + if (Regex.IsMatch(previous, "[a-z]")) return false; + start = start - 1; + } + return false; + } + } } public partial class LBSelection : LBComObject { diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index fb46f0f8..caee8f5d 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -735,12 +735,12 @@ namespace VEPROMS // This is master/slave & a slave has been selected for printing (SelectedSlave > 0) if (SelectedSlave > 0) { - bool includeProc = MyProcedure.ApplInclude(SelectedSlave); // C2021-027: Procedure level PC/PC + bool includeProc = MyProcedure.ApplInclude(SelectedSlave); // C2021-027: Procedure level PC/PC? if (!includeProc) VlnSvgPageHelper.CountInApplProcs++; // B2021-127: BNPPalr - Auto set of serial # if (includeProc) { MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = SelectedSlave; - SetupForProcedure(); + SetupForProcedure();? //B2022-030 moved the watermark stuff after SetupForProcedure so that DisplayNumber is properly resolved and the proper unit watermark is found // also moved the setting of override watermark to after SetUnitWatermark so that it truely overrrides frmPDFStatusForm.SetUnitWatermark(MyProcedure, ref waterMarkText, ref watermarkColor); //C2022-004 Unit Designator watermark // C2021-062 save the entered Rev Number to all of the procedures that are being printed @@ -984,6 +984,11 @@ namespace VEPROMS //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a"," | ")); //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText); + // B2022-088: Find Doc Ro button not working in Word Sections + // Initialize Print Cache + MSWordToPDF.RoPrintCache = new Dictionary(); + + // RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered. ProfileTimer.Pop(profileDepth2); // B2016-249 Output Procedure to folder associated with Parent Child @@ -1000,6 +1005,13 @@ namespace VEPROMS frmStatus.ShowDialog(); ProfileTimer.Pop(profileDepth3); } + + // B2022-088: Find Doc Ro button not working in Word Sections + // Cleanup Print Cache + MSWordToPDF.RoPrintCache.Clear(); + MSWordToPDF.RoPrintCache = null; + + MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0; this.Close(); ShowDebugFiles(); diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 8c1c5cab..33d01b17 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -4086,16 +4086,19 @@ namespace VEPROMS //} _DidConvertROsToText |= true; } + private bool _DidProcessROs = false; // B2017-076 flag that ROs where processed private void AddROUsages(Content content, XmlNode xn) { AddROUsages(content, xn, false); } + // part of bug fix B2017-060 added the isGrid parameter private void AddROUsages(Content content, XmlNode xn, bool isGrid) { if (_ImportingApprovedExportFile) return; //B2020-095 the links are already removed from the import file _DidProcessROs = false; + if (_ConvertROsToTextDuringImport) ConvertImportProcedureROsToText(content, xn); else @@ -4113,7 +4116,15 @@ namespace VEPROMS ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion); - string roval = lookup.GetRoValue(roid); + // B2022-088: Find Doc Ro button not working in Word Sections + string roidBase = string.Empty; + string roidExt = string.Empty; + + string roid16 = ROFSTLookup.FormatRoidKey(roid, ref roidBase, ref roidExt, true); + ROFSTLookup.rochild roc = lookup.GetRoChild(roid16); + + string roval = roc.value; + //string roval = (roc.ID < 0 || string.IsNullOrEmpty(roc.value)) ? "?" : roc.value; if (roval == "?") { diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs index aa25b768..0c43d91a 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs @@ -137,6 +137,8 @@ namespace VEPROMS.CSLA.Library private int _selectedSlave; private string _otherChild = string.Empty; + private bool _autoCombineSingleRetValues = true; + private List _lstRoValues; private List _multiRoValues; private Dictionary _dicRoVars; @@ -195,6 +197,13 @@ namespace VEPROMS.CSLA.Library } } + + public bool AutoCombineSingleRetValues + { + get { return _autoCombineSingleRetValues; } + set { _autoCombineSingleRetValues = value; } + } + #endregion #region Constructors @@ -293,6 +302,35 @@ namespace VEPROMS.CSLA.Library #region (RO Info By AccPageID) + public string FormatAccPageKey(string accPageID) + { + if (string.IsNullOrEmpty(accPageID)) + return accPageID; + + string spDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_setpointprefix : string.Empty; + string igDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_graphicsprefix : string.Empty; + + return FormatAccPageKey(accPageID, spDefault, igDefault); + } + + public string FormatAccPageKey(string accPageID, ref string accPageBase, ref string accPageExt, bool useDefaultExt = true) + { + string accPageKey = FormatAccPageKey(accPageID); + + if (Regex.IsMatch(accPageKey, @".*\.[A-Z]")) + { + accPageBase = accPageKey.Substring(0, accPageKey.Length - 2); + accPageExt = Convert.ToString(accPageKey.ToCharArray().LastOrDefault()); + } + else + { + accPageBase = accPageKey; + accPageExt = (!accPageKey.StartsWith("")) accPageID = string.Format("{0}>", accPageID); - accPageID = accPageID.Replace("", ""); + accPageID = accPageID.Replace("", ""); accPageID = accPageID.ToCleanString(); // Removes any spaces // Clean up the AccPageID before using it to do a lookup @@ -344,13 +382,22 @@ namespace VEPROMS.CSLA.Library return accPageKey; } + public ROFSTLookup.rochild GetROChildByAccPageID(string accPageID) + { + string spDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_setpointprefix : string.Empty; + string igDefault = (MyDocVersionInfo != null && MyDocVersionInfo.DocVersionConfig != null) ? MyDocVersionInfo.DocVersionConfig.RODefaults_graphicsprefix : string.Empty; + + return GetROChildByAccPageID(accPageID, spDefault, igDefault); + } + public ROFSTLookup.rochild GetROChildByAccPageID(string accPageID, string spDefault, string igDefault) { + // Cleanup accPageID if necessary [Note* This will also handle any UnitInfo Ro Values (ex: "")] string accPageKey = FormatAccPageKey(accPageID, spDefault, igDefault); - + ROFSTLookup.rochild rc = RofstDataGetChildByAccPageID(_rofstID, accPageID, spDefault, igDefault); - if (!string.IsNullOrEmpty(rc.roid) && Regex.IsMatch(accPageKey, @".*\.[A-Z]") && rc.children != null && rc.children.Count() > 0) + if (!string.IsNullOrEmpty(rc.roid) && rc.roid.Length < 16 && Regex.IsMatch(accPageKey, @".*\.[A-Z]") && rc.children != null && rc.children.Count() > 0) { // Check if AccPageID/Key has a return value specific extension. Try to find the RoChild record with the specific return value type, // If not found Or the specific extension value is (Null or Empty), then just return the first/default return value type in the list of children @@ -372,12 +419,19 @@ namespace VEPROMS.CSLA.Library if (!string.IsNullOrEmpty(roid)) { roid = roid.ToUpper(); - roid = roid.Replace("", ""); + roid = roid.Replace("", ""); roid = roid.ToCleanString(); // Removes any spaces if ((!roid.StartsWith(" "FFFF000000020041"] + + roid = string.Format("{0}00000000", roid).Substring(0, 12) + "0041"; } } @@ -403,12 +457,12 @@ namespace VEPROMS.CSLA.Library public ROFSTLookup.rochild GetRoChild(string roid, bool loadChildren = false, bool loadAllChildren = false) { - // Cleanup Roid if necessary (Note* This method also handles the UnitInfo Ro Values. ex: "") + // Cleanup roid if necessary [Note* This will also handle any UnitInfo Ro Values (ex: "")] roid = FormatRoidKey(roid); ROFSTLookup.rochild rc = GetRoChild12(roid, loadChildren, loadAllChildren); - if (!roid.StartsWith("FFFF") && roid.Length == 16 && rc.children != null && rc.children.Length > 0) + if (!roid.StartsWith("FFFF") && rc.children != null && rc.children.Length > 0 && roid.Length == 16) { // If specific match exists for multi-return values, then return specified value, otherwise default to the first child if (rc.children.Where(x => x.roid.ToUpper() == roid.ToUpper()).Any()) @@ -420,18 +474,15 @@ namespace VEPROMS.CSLA.Library return rc; } - - - public string GetRoValue(string roid) - { - return GetRoChild(roid).value; - } - public string GetTranslatedRoValue(string roid, bool DoCaret, bool DoDOSSuperSubScript) { roid = FormatRoidKey(roid); - string retval = GetRoValue(roid); + string retval = GetRoChild(roid).value; + + if (string.IsNullOrEmpty(retval)) + return string.Empty; + retval = ReplaceUnicode(retval, DoCaret); retval = ConvertFortranFormatToScienctificNotation(retval); @@ -446,41 +497,6 @@ namespace VEPROMS.CSLA.Library return (!string.IsNullOrEmpty(retval)) ? retval.Replace("\r\n", @"\par ") : retval; } - public static string GetParentChildDefaultValue(string roval) - { - var test = GetParentChildROValue(roval, 0); - - // C2021-026 Get the Parent (Default) RO value if the return value include P/C information otherwise return the RO value as is. - // This is used for the insert RO interface on the Step Properties panel - if (string.IsNullOrEmpty(roval)) - return null; - - - string rntval = roval.Replace("\xFF", "\xa0").Replace(@"\u160?", " "); - - while (rntval.Contains("", startCVIdx); - string aplicValues = rntval.Substring(startCVIdx, EndCVidx + 6 - startCVIdx); - int endDefIdx = rntval.IndexOf(",", startCVIdx); - - // C2022-001 - handle if there is no child value in the RO FSt - // B2022-051 - was sometimes leaving "/APL>" when processing return value made up from multiple RO (editor) fields - // added check to make where next found comma was within the current - string defValue = rntval.Substring(startCVIdx + 16, ((endDefIdx > 0 && endDefIdx < EndCVidx) ? endDefIdx : EndCVidx) - (startCVIdx + 16)); - rntval = rntval.Replace(aplicValues, defValue); - } - - rntval = rntval.Trim(); - - // If Default Value is selected (selChldIdx = 0), and return value is empty then replace with Standard Missing Default Value - return (string.IsNullOrEmpty(rntval)) ? ROFSTLookup.RoMissingDefaultValue : rntval; - //return rntval; - } - - - public List GetValueDifferences(int originalRofstID, ref List delList) { return RofstDataGetValueDifferences(originalRofstID, _rofstID, ref delList); @@ -1087,6 +1103,11 @@ namespace VEPROMS.CSLA.Library private Dictionary RofstDataSearch(int rofstID, string value, int searchTypeID, bool onlyRoid16, int? maxNumRecords) { + // Currently, the RO Value Search only uses the default values for each of the (16) digit Ext Specific RO Return Values + // The defaults for each (16) digit Ext Specific RO Return Value are stored separately in the [RofstDefaultValue] table so they can be indexed / optimized + // for performance. In the future, the search can easily be modified to also include all unit specific return values as well. All we need to do is + // add a new table [RofstReturnValue] in the database to hold all of the different extension specific return values for each unit when applicable. + // All of the records in the [RofstReturnValue] will have a Foreign Key reference back to their RO Child Base objects in the [RofstChild] table. Dictionary dic = new Dictionary(); if (string.IsNullOrEmpty(value)) @@ -1508,13 +1529,15 @@ namespace VEPROMS.CSLA.Library rc.title = (string)dr.GetValue("title"); rc.roid = (string)dr.GetValue("roid"); - if (!string.IsNullOrEmpty((string)dr.GetValue("appid"))) - rc.appid = (string)dr.GetValue("appid"); - - if (!string.IsNullOrEmpty((string)dr.GetValue("value"))) + if (!string.IsNullOrEmpty((string)dr.GetValue("appid"))) { - rc.value = (string)dr.GetValue("value"); - ProcessROReturnValue(ref rc, rc.value, GetRODatabaseTitleIndex(rc.roid)); + rc.appid = (string)dr.GetValue("AccPageID"); + + if (!string.IsNullOrEmpty((string)dr.GetValue("value"))) + { + rc.value = (string)dr.GetValue("value"); + ProcessROReturnValue(ref rc, rc.value, GetRODatabaseTitleIndex(rc.roid)); + } } else if (loadChildren || loadAllChildren) { @@ -1561,6 +1584,7 @@ namespace VEPROMS.CSLA.Library { child.children = new ROFSTLookup.rochild[lstValues.Count]; + // Load all extension specific return values (1 to many) for (int i = 0; i < lstValues.Count; i++) { var roExt = Extensions.Where(x => x.Offset.Equals(i + 1)).SingleOrDefault(); @@ -1577,7 +1601,23 @@ namespace VEPROMS.CSLA.Library child.children[i].children = new List().ToArray(); } - child.value = null; + + if (AutoCombineSingleRetValues && lstValues.Count == 1) + { + // When the RO object only has only return value and the "AutoCombineSingleRetValues" is set to True. + // Instead of returning the RoChildBase object with a single RoReturnVal object attached, just return the single Ro ReturnValue object. + var roRetVal = child.children.First(); + + //child.title = roRetVal.title; + child.appid = roRetVal.appid; + child.roid = roRetVal.roid; + child.value = roRetVal.value; + child.children = new List().ToArray(); + } + else + { + child.value = null; + } } _lstRoValues.Clear(); @@ -1645,7 +1685,6 @@ namespace VEPROMS.CSLA.Library // If Default Value is selected (selChldIdx = 0), and return value is empty then replace with Standard Missing Default Value return (selChldIdx == 0 && sb.ToString().Trim().Length <= 0) ? ROFSTLookup.RoMissingDefaultValue : sb.ToString().Trim(); - //return sb.ToString(); } private List GetROReturnValue(string roval) @@ -1888,7 +1927,8 @@ namespace VEPROMS.CSLA.Library private string ReplaceUnicode(string s2, bool DoCaret) { - string orig = s2; + if (string.IsNullOrEmpty(s2)) + return s2; s2 = s2.Replace(@"\u160?", ""); // convert hard spaces bug fix: B2016-206 s2 = s2.Replace(@"\", @"\u9586?"); // convert backslashes to a backslash symbol @@ -1935,9 +1975,10 @@ namespace VEPROMS.CSLA.Library s2 = s2.Replace("\xD6", @"\u8595?"); // Down Arrow if (DoCaret) s2 = s2.Replace("^", @"\u916?"); - // Convert dash to a non-breaking dash. This is a unicode character. - // This character will be used in veproms rather than a dash. - //if the dash is preceeded byte a token remove the space following the token + + // Convert dash to a non-breaking dash. This is a Unicode character. + // This character will be used in PROMS rather than a dash. + // if the dash is proceeded byte a token remove the space following the token s2 = Regex.Replace(s2, @"(\\[^ \\?]*) \-", @"$1\u8209?"); s2 = s2.Replace("-", @"\u8209?"); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs index f30de3f1..2c1c4de6 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/AuditExt.cs @@ -1617,7 +1617,9 @@ namespace VEPROMS.CSLA.Library { RoUsageInfo rou = RoUsageInfo.Get(ro.ROUsageID); string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, tmp.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues); + ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID); + int mytype = rocc.type; cont.FixContentText(rou, myvalue, mytype, myRoFst); } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 55ce15b0..3335dd9d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -783,7 +783,8 @@ namespace VEPROMS.CSLA.Library // 5) If a specific RoChild return value does not exist (maybe it was removed in the ROEditor / latest RO.FST file), then just return // the first RoChild return value in the "children" collection (0041) instead - private static Dictionary _roPrintCache = new Dictionary(); + // B2022-088: Find Doc Ro button not working in Word Sections + public static Dictionary RoPrintCache = new Dictionary(); #endregion @@ -1154,9 +1155,6 @@ namespace VEPROMS.CSLA.Library int lastStart = sel == null ? 0 : sel.Start; - // Cache RO Values while printing for performance increase - _roPrintCache = new Dictionary(); - while (sel != null) { if (!string.IsNullOrEmpty(sel.Text)) @@ -1335,10 +1333,6 @@ namespace VEPROMS.CSLA.Library } } - // Disable/Clear RO Cache When done looking up RO Values during printing - _roPrintCache.Clear(); - _roPrintCache = null; - if (statusChange != null) statusChange(VolianStatusType.Update, 0, "Creating PDF"); sel = MyApp.Selection; sel.WholeStory(); @@ -1398,7 +1392,7 @@ namespace VEPROMS.CSLA.Library string accPageKey = ROFSTLookup.FormatAccPageKey(selText, spPrefix, igPrefix, ref accPageBase, ref accPageExt, true); // Check if the Rochild is in the PrintCache (use base accPageID without specific extension) - if (!_roPrintCache.ContainsKey(accPageBase)) + if (!RoPrintCache.ContainsKey(accPageBase)) { // Lookup RoChild Info from database roc = lookup.GetROChildByAccPageID(accPageBase, spPrefix, igPrefix); @@ -1408,11 +1402,11 @@ namespace VEPROMS.CSLA.Library return ROFSTLookup.GetEmptyRoChild(); // If Valid Rochild, then add Rochild to Print Cache - _roPrintCache.Add(accPageBase, roc); + RoPrintCache.Add(accPageBase, roc); } else // Get Base Rochild from Print Cache { - roc = (ROFSTLookup.rochild)_roPrintCache[accPageBase]; + roc = (ROFSTLookup.rochild)RoPrintCache[accPageBase]; } // Check if RO is a "Unit Information" value (Ex: , etc..) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs index 2c3b2723..5b9d4731 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ROFSTExt.cs @@ -664,10 +664,12 @@ namespace VEPROMS.CSLA.Library if (activeRoids.Contains(chg.Substring(0, 12))) { ROFSTLookup.rochild roch = newLookup.GetRoChild(chg); - string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLookup.GetRoValue(chg), roch.value); + string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLookup.GetRoChild(chg).value, roch.value); // roid's are stored in database as 16 characters long in the RoUsages table. They may be stored as 12 characters in the ro.fst. - string padroid = chg.Length <= 12 ? chg + "0000" : chg; + // string padroid = chg.Length <= 12 ? chg + "0000" : chg; + // B2022-088: Find Doc Ro button not working in Word Sections + string padroid = ROFSTLookup.FormatRoidKey(chg, true); using (RoUsageInfoList affected = RoUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed", versionList)) { @@ -708,14 +710,17 @@ namespace VEPROMS.CSLA.Library { foreach (string chg in chgList) { - string padroid = chg.Length <= 12 ? chg + "0000" : chg; + // B2022-088: Find Doc Ro button not working in Word Sections + // string padroid = chg.Length <= 12 ? chg + "0000" : chg; + string padroid = ROFSTLookup.FormatRoidKey(chg, true); + if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Updating RO Values"); if (activeDRoids.Contains(chg.Substring(0, 12))) { ROFSTLookup.rochild roch = newLookup.GetRoChild(chg); - string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLookup.GetRoValue(chg), roch.value); + string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLookup.GetRoChild(chg).value, roch.value); // roid's are stored in database as 16 characters long in the rousages table. They may be stored as 12 characters in the ro.fst. using (DROUsageInfoList affected = DROUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed", versionList)) @@ -738,9 +743,12 @@ namespace VEPROMS.CSLA.Library { foreach (string del in delList) { - string padroiddel = del.Length <= 12 ? del + "0000" : del; + // B2022-088: Find Doc Ro button not working in Word Sections + //string padroiddel = del.Length <= 12 ? del + "0000" : del; + string padroiddel = ROFSTLookup.FormatRoidKey(del, true); + if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Removing Old RO Values"); - string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoValue(del)); + string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoChild(del).value); if (activeRoids.Contains(del.Substring(0, 12).ToUpper())) { @@ -773,8 +781,15 @@ namespace VEPROMS.CSLA.Library { foreach (string del in delList) { - string padroiddel = del.Length <= 12 ? del + "0000" : del; - string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoValue(del)); + + // B2022-088: Find Doc Ro button not working in Word Sections + string padroiddel = ROFSTLookup.FormatRoidKey(del, true); + if (myProgressBarRefresh != null) myProgressBarRefresh(++iCount, chgList.Count, "Removing Old RO Values"); + + string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoChild(del).value); + + // If there's an issue then maybe try getting the RoChild with the Padded roid instead + //string desc = string.Format("Deleted RO: Value = {0}", origLookup.GetRoChild(padroiddel).value); if (activeDRoids.Contains(del.Substring(0, 12).ToUpper())) { diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/RevisionInfoExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/RevisionInfoExt.cs index 16e17f63..50b3b2d7 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/RevisionInfoExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/RevisionInfoExt.cs @@ -930,6 +930,7 @@ namespace VEPROMS.CSLA.Library foreach (DROUsageInfo myRO in myList) if (!myROIDs.Contains(myRO.ROID.ToUpper())) myROIDs.Add(myRO.ROID.ToUpper()); + //create checkro record for each roid //_MyTimer.ActiveProcess = "Get DocVersionInfo"; // DocVersionInfo dbi = proc.ActiveParent as DocVersionInfo; @@ -942,8 +943,13 @@ namespace VEPROMS.CSLA.Library ROFSTLookup lookup = rofst.GetROFSTLookup(dvi); //_MyTimer.ActiveProcess = "Populating RevisionChecksXML table"; cc.ROConsistency.ROFstDate = rofst.DTS; + foreach (string s in myROIDs) - cc.AddROCheck(s, ItemInfo.ConvertToDisplayText(lookup.GetRoValue(s))); + { + // B2022-088: Find Doc Ro button not working in Word Sections + cc.AddROCheck(s, ItemInfo.ConvertToDisplayText(((ROFSTLookup.rochild)lookup.GetRoChild(s)).value)); + } + //_MyTimer.ActiveProcess = "External"; } private static void BuildTransitionFromChecks(ConsistencyChecks cc, ProcedureInfo proc) diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 58242e14..4819b90a 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -311,7 +311,7 @@ namespace Volian.Controls.Library // Stop the timer _searchTimer.Stop(); - // Process RO Search + // Process RO Value Search if (MyRTB != null && !MyRTB.IsDisposed) { ProcessSearch(MyRTB.SelectedText, (int)ROFSTLookup.SearchTypes.StartsWith); @@ -475,10 +475,8 @@ namespace Volian.Controls.Library FlexibleMessageBox.Show(this, "Text must be selected in the document in order for an RO find to be performed.", "Select Text", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } - else - { - ProcessSearch(mytext, (int)ROFSTLookup.SearchTypes.StartsWith); - } + + ProcessSearch(mytext, (int)ROFSTLookup.SearchTypes.StartsWith); } } @@ -868,7 +866,7 @@ namespace Volian.Controls.Library if (dti.MyDSOTabPanel != null) // A Word Document tab is the active tab { - string accPageID = string.Format("<{0}>", roc.appid); + string accPageID = string.Format("<{0}>", roc.appid.ToUpper()); // Insert the RO text at the current cursor position in the word document // NOTE: assuming any type of RO can be put in an Accessory (MSWord) Document @@ -881,7 +879,6 @@ namespace Volian.Controls.Library { if (CheckROSelection(roc)) // check for RO type is valid for this type of step/substep { - // the roid may be 12 or 16 chars long, with the last 4 set if there is unit specific value // Pad to 16 to store in the RoUsage table. string padroid = ROFSTLookup.FormatRoidKey(roc.roid, true); string linktxt = string.Format(@"#Link:ReferencedObject: {0} {1}", padroid, MyROFST.RODbID); @@ -1017,47 +1014,51 @@ namespace Volian.Controls.Library // tries to process a search while the main tab/procedure is closing try { - if (!this.Enabled) - searchValue = string.Empty; - - if (!string.IsNullOrEmpty(searchValue)) + if (this.Enabled && !string.IsNullOrEmpty(searchValue)) { Dictionary dicRoVals = new Dictionary(); searchValue = searchValue.Replace('\u2011', '-').Replace(@"\u9586?", @"\\"); - if (_lastSearchValue != searchValue) + // B2022-088: Find Doc Ro button not working in Word Sections + if (searchValue.StartsWith("<") && searchValue.EndsWith(">")) { - if (MyROFST != null && searchValue.Length >= 2) - { - dicRoVals = MyROFSTLookup.Search(searchValue, searchTypeID, false, MaxNumSearchRecords); - } + ROFSTLookup.rochild roc = MyROFSTLookup.GetROChildByAccPageID(searchValue); + if (roc.ID >= 0 && !string.IsNullOrEmpty(roc.value)) + dicRoVals.Add(roc.roid, roc.value); + } + else if (searchValue.Length >= 2 && searchValue != _lastSearchValue) + { + dicRoVals = MyROFSTLookup.Search(searchValue, searchTypeID, false, MaxNumSearchRecords); + } - if (dicRoVals != null && dicRoVals.Count > 0) - { - lbFound.SelectedValueChanged -= new EventHandler(lbFound_SelectedValueChanged); - lbFound.DataSource = new BindingSource(dicRoVals, null); - lbFound.ValueMember = "Key"; // roid - lbFound.DisplayMember = "Value"; // default value + if (dicRoVals.Count > 0) + { + lbFound.SelectedValueChanged -= new EventHandler(lbFound_SelectedValueChanged); - lbFound.SelectionMode = SelectionMode.One; - lbFound.SelectedIndex = -1; - lbFound.Visible = true; + lbFound.DataSource = new BindingSource(dicRoVals, null); + lbFound.ValueMember = "Key"; // roid + lbFound.DisplayMember = "Value"; // default value - lbFound.SelectedValueChanged += new EventHandler(lbFound_SelectedValueChanged); + lbFound.SelectionMode = SelectionMode.One; + lbFound.SelectedIndex = -1; + lbFound.Visible = true; - if (lbFound.Items != null && lbFound.Items.Count == 1) - lbFound.SelectedIndex = 0; - } - else - { - lbFound.DataSource = null; - lbFound.Visible = false; - } + lbFound.SelectedValueChanged += new EventHandler(lbFound_SelectedValueChanged); + + if (lbFound.Items != null && lbFound.Items.Count == 1) + lbFound.SelectedIndex = 0; + } + else + { + searchValue = string.Empty; + lbFound.DataSource = null; + lbFound.Visible = false; } } else { + searchValue = string.Empty; lbFound.DataSource = null; lbFound.Visible = false; } diff --git a/PROMS/Volian.Controls.Library/ImageItem.cs b/PROMS/Volian.Controls.Library/ImageItem.cs index fbe90f96..a2ada15d 100644 --- a/PROMS/Volian.Controls.Library/ImageItem.cs +++ b/PROMS/Volian.Controls.Library/ImageItem.cs @@ -513,8 +513,9 @@ namespace Volian.Controls.Library else { string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); - val = lookup.GetRoValue(subs[1]); - if (val == null || val == "?") val = lookup.GetRoValue(subs[1].Substring(0, 12)); + // B2022-088: Find Doc Ro button not working in Word Sections + val = lookup.GetRoChild(subs[1]).value; + if (val == null || val == "?") val = lookup.GetRoChild(subs[1].Substring(0, 12)).value; if (val == "?") { // Do 'empty' image box. diff --git a/PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs b/PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs index 20252298..ff5c357f 100644 --- a/PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs +++ b/PROMS/Volian.Print.Library/PDFConsistencyCheckReport.cs @@ -342,8 +342,9 @@ namespace Volian.Print.Library ROFSTLookup.rochild rocc = lu.GetRoChild(roc.ROID); if (rocc.type == 1) { - string newROValue = lu.GetRoValue(roc.ROID).Replace('`', '\xb0'); - string rotitle = string.Format("{0} - Current Version: {1}", lu.GetROTitle(roc.ROID), lu.GetRoValue(roc.ROID).Replace('`','\xb0')); + // B2022-088: Find Doc Ro button not working in Word Sections + string newROValue = lu.GetRoChild(roc.ROID).value.Replace('`', '\xb0'); + string rotitle = string.Format("{0} - Current Version: {1}", lu.GetROTitle(roc.ROID), lu.GetRoChild(roc.ROID).value.Replace('`','\xb0')); if (ros.ContainsKey(rotitle)) { // B2021-025: Add 'Approved' to message here and in line below to help clarify report info diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 474149c3..2b8df8d4 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -4049,8 +4049,9 @@ namespace Volian.Print.Library else { string[] subs = m.Groups[3].Value.Split(" ".ToCharArray()); - val = lookup.GetRoValue(subs[1]); - if (val == null || val == "?") val = lookup.GetRoValue(subs[1].Substring(0, 12)); + // B2022-088: Find Doc Ro button not working in Word Sections + val = lookup.GetRoChild(subs[1]).value; + if (val == null || val == "?") val = lookup.GetRoChild(subs[1].Substring(0, 12)).value; if (val == "?") { erMsg = string.Format("Referenced Object does not exist.");