C2021-018 logic to support showing Alarm Point RO info in the step Editor
This commit is contained in:
parent
0d464dfa10
commit
fdc72f891d
@ -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);
|
||||
|
@ -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("<U");
|
||||
int eindx = tmp.IndexOf(">", sindx + 1);
|
||||
string reptmp;
|
||||
while (sindx > -1 && eindx > -1) // B2022-007 added while loop to process more than one <U- RO value
|
||||
{
|
||||
reptmp = str.Substring(sindx, eindx - sindx + 1);
|
||||
tmp = reptmp.ToUpper();
|
||||
if (tmp == "<U>") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number);
|
||||
else if (tmp == "<U-TEXT>") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Text);
|
||||
else if (tmp == "<U-NUMBER>") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Number);
|
||||
else if (tmp == "<U-NAME>") str = str.Replace(reptmp, dvi.DocVersionConfig.Unit_Name);
|
||||
else if (tmp == "<U-ID>") 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 == "<U-OTHERTEXT>") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Text);
|
||||
else if (tmp == "<U-OTHERNUMBER>") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Number);
|
||||
else if (tmp == "<U-OTHERNAME>") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_Name);
|
||||
else if (tmp == "<U-OTHERID>") str = str.Replace(reptmp, dvi.DocVersionConfig.Other_Unit_ID);
|
||||
else str = str.Replace(reptmp, tmp.Replace("<", "*?").Replace(">", "?*"));
|
||||
tmp = str.ToUpper();
|
||||
sindx = tmp.IndexOf("<U");
|
||||
eindx = 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(@"<U"))
|
||||
{
|
||||
// C2021-064 If we are processing the EOP number or an ROLookUp in the pagelist, then strip out the Parent/Child unit tokens
|
||||
// so that we are left with just the EOP number. This is used along with Parent/Child RO Values (in RO Editor)
|
||||
if ((token.Equals("{EOPNUMROLU}") || token.Equals("[EOPNUMROLU]")))
|
||||
{
|
||||
// copied Rgex from DisplayText and modifed to remove the Parent/Child Unit information
|
||||
// i.e. <U>, <U-ID>, <U-NAME>, <U-TEXT>, <U-NUMBER>, <U-OTHERID>, <U-OTHERNAME>, <U-OTHERTEXT>, <U-OTHERNUMBER>
|
||||
eopnum = Regex.Replace(eopnum, @"\<U\>", "", 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("<U>") || val.ToUpper().Contains("<U-")) // Replace token with the applicable unit information
|
||||
{
|
||||
string unbr3 = ResolveUnitApp(section.MyDocVersion, val);
|
||||
plstr = unbr3 ?? "";
|
||||
}
|
||||
plstr = plstr.Replace(token, val);
|
||||
break; // B2019-134 break out of switch statement after processing the <SI- token so that it can loop and handle any other tokens on the same line
|
||||
}
|
||||
else
|
||||
{
|
||||
string pstok = token.Substring(indx + 1, qindx - indx - 1);
|
||||
plstr = DocVersionInfo.GetInheritedSIValue(section.MyProcedure, pstok);
|
||||
// C2021-051: Applicability tokens in Procedure Set and Folder Specific Information
|
||||
if (plstr.ToUpper().Contains("<U>") || val.ToUpper().Contains("<U-")) // Replace token with the applicable unit information
|
||||
{
|
||||
string unbr3 = ResolveUnitApp(section.MyDocVersion, val);
|
||||
plstr = unbr3 ?? "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (token.Contains(@"PS-"))
|
||||
{
|
||||
ProcedureConfig procConfig = new ProcedureConfig(section.MyProcedure.MyContent.Config);
|
||||
if (procConfig != null)
|
||||
{
|
||||
int indx = token.IndexOf("-");
|
||||
int qindx = token.IndexOf("?", indx);
|
||||
string val = null;
|
||||
if (qindx == -1)
|
||||
{
|
||||
val = procConfig.GetValue("PSI", token.Substring(4, token.Length - 5));
|
||||
// F2021-034: Resolve applicability unit tokens (not just '<u>')
|
||||
if (val.ToUpper().Contains("<U>") || val.ToUpper().Contains("<U-")) // Replace token with the applicable unit information
|
||||
{
|
||||
string unbr3 = ResolveUnitApp(section.MyDocVersion, val);
|
||||
val = unbr3 ?? "";
|
||||
}
|
||||
plstr = plstr.Replace(token, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
string pstok = token.Substring(indx + 1, qindx - indx - 1);
|
||||
plstr = procConfig.GetValue("PSI", pstok);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plstr == "") retval = false;
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private static Regex regexFindToken = new Regex("{[^{}]*}");
|
||||
// C2021-018 used to display Alarm Point Table RO values in the editor
|
||||
// Spin through the pagelist for this seciton and grap the Alarm Point Information
|
||||
protected string GetAlarmPointTableInfo(ItemInfo itmInfo)
|
||||
{
|
||||
SectionInfo section = itmInfo.GetSectionInfo();
|
||||
StringBuilder strAlrmPtTableInfo = new StringBuilder();
|
||||
// get alarm point data from pagelist
|
||||
bool usePSIvalue = false; // C2021-065 used with ROLkUpMatch pagelist flag (Barakah Alarms)
|
||||
int lastRow = -1;
|
||||
string otherChildUnit = ""; // C2021-065 used when OTHER applicability information is used for the ROLookUp
|
||||
foreach (VEPROMS.CSLA.Library.PageItem pageItem in itmInfo.MyDocStyle.pagestyle.PageItems)
|
||||
{
|
||||
if (pageItem.Token == null) continue; // can be null if token is dependent on PSI lookup!
|
||||
//DidHLSText = false; // reset to false for this group of tokens.
|
||||
//if (pageItem.Token.Contains("HLSTEXT"))
|
||||
// Console.WriteLine("{0} - PageList Token", pageItem.Token);
|
||||
|
||||
// C2019-006 - Moved and modified the RO_Lookup() logic here, before we process the tokens in the page list
|
||||
// this allows us to use RO_Lookup() in a "PS=" conditional token (is usually a PSI check box)
|
||||
// A while loop was also added to the we can have more than one call to RO_Lookup() on a pagelist line
|
||||
// this logic was put in for Barakah Alarms
|
||||
// Note that each Alarm is defined as its own RO in the Referenced Object database, with multiple return values
|
||||
// to define the Window ID, Alarm, Source, Setpoint, etc. for example.
|
||||
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;
|
||||
ProcessROLookupCfgParams(section, ref parms, tnk); // translate the tokens in the parameters
|
||||
}
|
||||
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 && 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("<U\\U8209?OTHER")) // proc number has <u-otherxxx> 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);
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user