diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index c9eac1d2..c2c8192e 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -1333,6 +1333,9 @@ i = 0; //int prevLPI = 6; //float PrevRow = 0; //float rowAdj = 0; // = 18; + + bool usePSIvalue = false; // C2021-065 used with ROLkUpMatch pagelist flag (Barakah Alarms) + string otherChildUnit = ""; // C2021-065 used when OTHER applicability information is used for the ROLookUp foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems) { if (pageItem.Token == null) continue; // can be null if token is dependent on PSI lookup! @@ -1372,43 +1375,72 @@ i = 0; string pltok = pageItem.Token; while (pltok.Contains("RO_Lookup(")) { - int idxstart = pltok.IndexOf("RO_Lookup("); - int idxend = pltok.Substring(idxstart).IndexOf(")"); - string ROLookupstr = pltok.Substring(idxstart, idxend + 1); - string parms = ROLookupstr.Substring(10, ROLookupstr.Length - 11); - MatchCollection sm = regexFindToken.Matches(parms); - foreach (Match m in sm) // resolve pagelist tokens that are parameters for ROLookup() - { - string tnk = m.Value; - ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk); - } - string[] parts = parms.Split(",".ToCharArray());// split on comma - // B2019-031 Support commas embedded in Alarm ID (Procedure Number) - // B2019-075: Added the check for commas in the procedure number - this code was causing a bug in other alarms. - if (parts.Length > 3 && MySection.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]; - } - // 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 - string ROLookupVal = ROLookup(parts[0], parts[1], parts[2]); + int idxstart = pltok.IndexOf("RO_Lookup("); + int idxend = pltok.Substring(idxstart).IndexOf(")"); + string ROLookupstr = pltok.Substring(idxstart, idxend + 1); + string parms = ROLookupstr.Substring(10, ROLookupstr.Length - 11); + MatchCollection sm = regexFindToken.Matches(parms); + foreach (Match m in sm) // resolve pagelist tokens that are parameters for ROLookup() + { + string tnk = m.Value; + ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk); + } + string[] parts = parms.Split(",".ToCharArray());// split on comma + // B2019-031 Support commas embedded in Alarm ID (Procedure Number) + // B2019-075: Added the check for commas in the procedure number - this code was causing a bug in other alarms. + if (parts.Length > 3 && MySection.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 - // 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) + // 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) { - DisplayText dt1 = new DisplayText(MyPromsPrinter.MyItem, ROLookupVal, false, true); - ROLookupVal = dt1.StartText; + 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 } - pltok = pltok.Substring(0, idxstart) + ROLookupVal + ((idxstart + idxend < pltok.Length) ? pltok.Substring(idxstart + idxend + 1) : ""); + ROLookupVal = ROLookup(parts[0], parts[1], "",otherChildUnit); // will return empty string if alarm point is not found in RO database + usePSIvalue = (ROLookupVal != 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 = ROLookup(parts[0], parts[1], parts[2], otherChildUnit); + + // 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(MyPromsPrinter.MyItem, 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) + continue; + MatchCollection matches = regexFindToken.Matches(pltok);//(pageItem.Token); if (matches.Count > 0) { @@ -1571,7 +1603,12 @@ i = 0; } private string ROLookup(string accpageid, string multiid, string deflt) { - ROFSTLookup myLookup = MySection.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MySection.MyDocVersion); + return ROLookup(accpageid, multiid, deflt, ""); + } + // C2021-065 pass in a override for the child unit - in this case the token is being used (Barakah Alarms) + private string ROLookup(string accpageid, string multiid, string deflt, string overrideChild) + { + ROFSTLookup myLookup = MySection.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MySection.MyDocVersion, overrideChild); string accpgid = accpageid; //accpgid = accpgid.Replace("-HIGH", "-HI").Replace("-LOW", "-LO").Replace("_HIGH", "-HI").Replace("_LOW", "-LO").Replace(@"\u8209?", "-"); string val = myLookup.GetROValueByAccPagID("<" + accpgid + "." + multiid + ">", MySection.MyDocVersion.DocVersionConfig.RODefaults_setpointprefix, MySection.MyDocVersion.DocVersionConfig.RODefaults_graphicsprefix);