diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index aa127d47..a4ee5d43 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -1092,6 +1092,11 @@ namespace VEPROMS.CSLA.Library if (_Text == string.Empty) _Text = "?"; } + // C2021-018 used to update the content record when displaying Alarm Pont Table information in the step Editor (BNPP alarms) + public void UpdateAlarmTableInfoView(string updateText) + { + _Text = updateText; + } public void LoadNonCachedGrid() { _MyGrid = GridInfo.GetNonCached(ContentID); diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index ff79e8dc..12ea0b1e 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -3545,6 +3545,304 @@ namespace Volian.Controls.Library return MyPreviousEditItem.MyParent; } } + // C2021-018 used to display Alarm Point Table RO values in the editor + // Get the RO value for the given RO AccPageID and multiple Return Value option + private string ROLookupForEditorView(SectionInfo MySection, string accpageid, string multiid, string deflt) + { + ROFSTLookup myLookup = MySection.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MySection.MyDocVersion, ""); + string accpgid = accpageid; + string val = myLookup.GetROValueByAccPagID(string.Format("<{0}.{1}>",accpgid,multiid), MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix); + if (val == null) + { + accpgid = accpgid.Replace(@"\u8209?", "-"); + val = myLookup.GetROValueByAccPagID(string.Format("<{0}.{1}>", accpgid, multiid), MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix); + } + if (!deflt.StartsWith("[") && val != null && val.Trim().Length > 0) // don't return val if it's an empty or blank string - jsj 01-28-2019 + { + val = val.Replace("[xB3]", "\xB3"); + val = val.Replace("[xB2]", "\xB2"); + return val; + } + return deflt; + } + // C2021-018 used to display Alarm Point Table RO values in the editor + private string ResolveUnitApp(DocVersionInfo dvi, string str) + { + if (dvi == null) return str; + string tmp = str.ToUpper(); + int sindx = tmp.IndexOf("", sindx + 1); + string reptmp; + while (sindx > -1 && eindx > -1) // B2022-007 added while loop to process more than one ") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number); + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Text); + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number); + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Name); + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_ID); + // B2021-145: For applicability, the tree view & pdf file name are not getting resolved when using any of the ‘OTHER’ tokens + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Text); + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Number); + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Name); + else if (tmp == "") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_ID); + else str = str.Replace(reptmp, tmp.Replace("<", "*?").Replace(">", "?*")); + tmp = str.ToUpper(); + sindx = tmp.IndexOf("", sindx + 1); + } + return str; + } + // C2021-018 used to display Alarm Point Table RO values in the editor + // translate pagelist tokens that are used in the parameters for the RO Lookup calls + private bool ProcessROLookupCfgParams(VEPROMS.CSLA.Library.SectionInfo section, ref string plstr, string token) + { + bool retval = true; + + // Paglist token inside a PS= conditional are surrounded by square brackets instead of curley + // ex. [BOX3] instead of {BOX3}, thus the redunant looking cases + switch (token) + { + case "{EOPNUM}": + case "[EOPNUM]": + case "{PREDELIMEOPNUM}": + case "[PREDELIMEOPNUM]": + case "{EOPNUMROLU}": + case "[EOPNUMROLU]": + string eopnum = section.MyProcedure.MyContent.Number; + if (eopnum.ToUpper().Contains(@", , , , , , , , + eopnum = Regex.Replace(eopnum, @"\", "", RegexOptions.IgnoreCase); + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)ID)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)NAME)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)TEXT)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)NUMBER)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + // B2021-148 remove space character after "OTHER" + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERID)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERNAME)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERTEXT)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + eopnum = Regex.Replace(eopnum, @"\<(U(-|\\u8209\?)OTHERNUMBER)\>(-|\\u8209\?)", "", RegexOptions.IgnoreCase); + } + else + eopnum = section.MyProcedure.DisplayNumber;// B2021-066: found and fixed during proc pc/pc work + } + if (token.Equals("{ PREDELIMEOPNUM}")) + { + // only use up to the first non-alphanumeric character of the procedur number + // Prairie Island (NSP) Alarms use this token + int idx = 0; + while (idx < eopnum.Length && char.IsLetterOrDigit(eopnum[idx])) idx++; + if (idx < eopnum.Length) + eopnum = eopnum.Substring(0, idx); + } + plstr = plstr.Replace(token, eopnum); + break; + default: + if (token.Contains(@"SI-")) // procedure set specific information. (at folder or working draft levels) + { + DocVersionConfig dvConfig = new DocVersionConfig(section.MyProcedure.MyDocVersion.Config); + FolderConfig folderConfig = new FolderConfig(section.MyProcedure.MyDocVersion.MyFolder.Config); + if (dvConfig != null || folderConfig != null) + { + int indx = token.IndexOf("-"); + int qindx = token.IndexOf("?", indx); + string val = null; + if (qindx == -1) + { + val = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, token.Substring(4, token.Length - 5)); + // C2021-051: Applicability tokens in Procedure Set and Folder Specific Information + if (val.ToUpper().Contains("") || val.ToUpper().Contains("") || val.ToUpper().Contains("') + if (val.ToUpper().Contains("") || val.ToUpper().Contains(" 3 && section.MyProcedure.DisplayNumber.IndexOf(",") > 0)// If extra commas combine first part to account for it + { + int n = parts.Length - 3; + string part0 = parts[0]; + for (int i = 0; i < n; i++) // append parts based upon the number of parts (commas) + part0 += "," + parts[i + 1]; + parts[0] = part0; + parts[1] = parts[n + 1];// Get the last 2 parts + parts[2] = parts[n + 2]; + } + string ROLookupVal = ""; + // parts[0] - the RO to look up - for Alarms, is usually the EOP number thus uses the "{EOPNUM}" token + // parts[1] - Which of the multiple return value from the RO to return + // parts[2] - the value to use if not found in ROs - usually defined in a PSI field for that Alarm procedure + + // C2021-065 Barakah Alarms - check if child RO alarm ID matches the resolved procedure number + // if not, then use the values stored in the PSI instead of the value returned for ROLookup() + // for all of the Alarm Point window items (ROLookup() items) in the pagelist for this section (BNPP Alarms format) + // Note only one pagelist item has this flag and this special pagelist item needs to be listed before any other ROLoopUP items + if (pageItem.ROLkUpMatch) // check for paglist flag + { + string rawPrcNum = section.MyProcedure.MyContent.Number; + // C2021-065 see if we need to get the Other child info from ROLookUp + if (rawPrcNum.ToUpper().StartsWith(" in its definiation (procedure property page) + { + string procnum = section.MyProcedure.DisplayNumber; // get the cooked (resolved) procedure number + int idx = procnum.IndexOf('-'); + otherChildUnit = procnum.Substring(0, idx); // we need to get RO info for the Other child applicability - this gets child's number + } + ROLookupVal = ROLookupForEditorView(section, parts[0], parts[1], ""); // will return empty string if alarm point is not found in RO database + usePSIvalue = (ROLookupVal == null || ROLookupVal.Length == 0);//!= section.MyProcedure.DisplayNumber); // use PSI value if child alarm ID not found or does not match resolved procedure number (alarm point) + } + // C2021-065 if usePSIvalue is true, then we know alarm point info is not in the RO database, so just use the default (PSI) value + if (usePSIvalue) + ROLookupVal = parts[2]; // C2021-065 use the value defined in the PSI + else + ROLookupVal = ROLookupForEditorView(section, parts[0], parts[1], parts[2]); + + // F2021-053: Do replace words for Page List items. This uses a DisplayText constructor that flags this case + // and gets the resulting replaced words + if (pageItem.RepWords) + { + DisplayText dt1 = new DisplayText(itmInfo, ROLookupVal, false, true); + ROLookupVal = dt1.StartText; + } + // replace the pagelist token with ROLookupVal + pltok = pltok.Substring(0, idxstart) + ROLookupVal + ((idxstart + idxend < pltok.Length) ? pltok.Substring(idxstart + idxend + 1) : ""); + } + // C2021-065 (BNPP Alarms format) we are processing a paglist flag (ROLkUpMatch) to determine how to get Alarm Point information + // Nothing else is on this page list item, so use "continue" to jump to the next pagelist item as nothing gets printed for this item + if (!pageItem.ROLkUpMatch && pageItem.ROLkUpInEditor) + { + if (lastRow < pageItem.Row) + { + if (lastRow != -1) + strAlrmPtTableInfo.Append("\r\n"); + strAlrmPtTableInfo.Append(string.Format("\\ul {0}\\ulnone : ",pltok)); + lastRow = (int)pageItem.Row; + } + else + strAlrmPtTableInfo.Append(pltok); + } + } + return strAlrmPtTableInfo.ToString(); + } + // C2021-018 used to display Alarm Point Table RO values in the editor + // we use a read-only note type, off of step section, to display the Alarm Point table RO information + // create the note if it does not exist, update if it does + // The docstyle for the step section must have the ShowAlarmPointWindowInfo flag + protected void SetupAlarmTableView(ItemInfo iteminfo) + { + if (iteminfo.IsStepSection && iteminfo.MyDocStyle.ShowAlarmPointWindowInfo) + { + string alrPtTblInfo = GetAlarmPointTableInfo(iteminfo); + if (!iteminfo.HasCautionOrNote) // BNPP Alarm format does not allow notes/cautions off of sections + { + ItemInfo tmpinfo = iteminfo.InsertChild(E_FromType.Note, 20028, alrPtTblInfo); + (tmpinfo.MyConfig as StepConfig).MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum("0"); // set applicability to none + (tmpinfo.MyConfig as StepConfig).Step_CBOverride = "Off"; // turn of the change bar + MyItemInfo = tmpinfo; // SaveConfig() uses MyItemInfo which is null at this point, so set it to our new step item + SaveConfig(); + } + else + { + if (iteminfo.Notes != null && iteminfo.Notes[0] != null) + { + ContentInfo cntinfo = iteminfo.Notes[0].MyContent; + if (!cntinfo.Text.Equals(alrPtTblInfo)) + cntinfo.UpdateAlarmTableInfoView(alrPtTblInfo); // update with the new alarm point table information + } + } + } + } protected void SetupEditItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem, bool addFirstChld) { if (myStepPanel.TopMostEditItem == null) myStepPanel.TopMostEditItem = this; @@ -3558,6 +3856,7 @@ namespace Volian.Controls.Library // TODO: Remove Label and just output ident on the paint event TabLeft = 20; SetupHeader(itemInfo); + SetupAlarmTableView(itemInfo); // C2021-018 display alarm point table information in the step editor (if the format flag is set) this.Paint += new PaintEventHandler(EditItem_Paint); this.BackColorChanged += new EventHandler(EditItem_BackColorChanged); this.Move += new EventHandler(EditItem_Move); diff --git a/PROMS/Volian.Controls.Library/RTBItem.cs b/PROMS/Volian.Controls.Library/RTBItem.cs index 18fecee9..2f623802 100644 --- a/PROMS/Volian.Controls.Library/RTBItem.cs +++ b/PROMS/Volian.Controls.Library/RTBItem.cs @@ -869,6 +869,7 @@ namespace Volian.Controls.Library } else { + if (MyStepPanel == null) return; // C2021-018 check for null reference (display alarm point table info in editor) if (MyStepRTB.Focused) // If active Set BackColor to the active color MyStepRTB.BackColor = MyStepPanel.ActiveColor; else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor