C2025-036 - Cleaned up logic in PROMS code that generates the step/sub-step tabs to reduce un-needed processing in certain cases

This commit is contained in:
John Jenko 2025-06-18 09:20:17 -04:00
parent 149bc601e2
commit abec4d9281
2 changed files with 64 additions and 51 deletions

View File

@ -449,10 +449,9 @@ namespace VEPROMS.CSLA.Library
{
StringBuilder sret = new StringBuilder();
ItemInfo pitem = this;
while (!pitem.IsSection && !pitem.IsHigh)
{
using (StepInfo stpinfo = StepInfo.Get(pitem.ItemID))
using (StepInfo stpinfo = StepInfo.Get(pitem.ItemID))
{
string thisTab = stpinfo.MyTab.CleanText;
@ -4655,43 +4654,50 @@ namespace VEPROMS.CSLA.Library
int localPrintLevel = PrintLevel;
StepSectionData sd = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData;
bool doMeta = false;
if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
if (sd.StepSectionLayoutData.TieTabToLevel) // C2025-036 reduce un-needed processing
{
if (sd.StepSectionLayoutData.ShowSectionTitles
&& !MyDocStyle.CancelSectTitle
&& !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel))
localPrintLevel = PrintLevel + (((ActiveFormat.PlantFormat.FormatData.Express && IsSequential)) ? 0 : CurrentSectionLevel());
if (!ActiveFormat.PlantFormat.FormatData.Express) doMeta = true;
}
if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.CountSubSectionsForLevel)
if (SectionLevel() > 1)
if (ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
{
if (sd.StepSectionLayoutData.ShowSectionTitles
&& !MyDocStyle.CancelSectTitle
&& !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel))
localPrintLevel = PrintLevel + (((ActiveFormat.PlantFormat.FormatData.Express && IsSequential)) ? 0 : CurrentSectionLevel());
if (!ActiveFormat.PlantFormat.FormatData.Express) doMeta = true;
}
if (ActiveFormat.PlantFormat.FormatData.SectData.CountSubSectionsForLevel && (SectionLevel() > 1))
localPrintLevel += 1;
}
SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
// Start with basic cases of alpha/numeric/seq:
// If we have metasections AND...
// If the seqtabs for this given level does not get a section number, use the seqtab rather than
// the ident of the step:
bool useSubStepTabs = false;
if (doMeta && IsHigh
&& !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.MaxIndex].TabToken.Contains("{numericWpar}")
&& tbformat.Contains("{")) useSubStepTabs = true;
// Check to be sure the parent tab should be included... If this sequential is within a note
// or caution or equipment list, don't use parent tab AND always start the numbering as a numeric
if (doMeta && IsSequential && (InNote() || InCaution() ||
(MyParent.IsEquipmentList && !MyParent.FormatStepData.TabData.IdentPrint.Contains("{seq}"))))
if (doMeta) // C2025-036 reduce un-needed processing
{
// if immediate parent is note, caution or equip, use numeric, otherwise use alpha.
localPrintLevel = 0;
int lv = 0;
ItemInfo ii = MyParent;
while (!ii.IsCaution && !ii.IsNote && !ii.IsEquipmentList)
if (IsHigh
&& !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.MaxIndex].TabToken.Contains("{numericWpar}")
&& tbformat.Contains("{")) useSubStepTabs = true;
// Check to be sure the parent tab should be included... If this sequential is within a note
// or caution or equipment list, don't use parent tab AND always start the numbering as a numeric
if (IsSequential && (InNote() || InCaution() ||
(MyParent.IsEquipmentList && !MyParent.FormatStepData.TabData.IdentPrint.Contains("{seq}"))))
{
lv++;
ii = ii.MyParent;
// if immediate parent is note, caution or equip, use numeric, otherwise use alpha.
localPrintLevel = 0;
int lv = 0;
ItemInfo ii = MyParent;
while (!ii.IsCaution && !ii.IsNote && !ii.IsEquipmentList)
{
lv++;
ii = ii.MyParent;
}
lv = lv % 2;
tbformat = (lv == 0) ? "{numeric}." : "{alpha}.";
}
lv = lv % 2;
tbformat = (lv == 0) ? "{numeric}." : "{alpha}.";
}
bool trimTabStart = false;
bool dontTrimParentTabBeforeAppending = false; // B2019-011 for Barakah Alarm format
@ -4757,7 +4763,7 @@ namespace VEPROMS.CSLA.Library
PrintLevel = 0;
// If token includes 'Wpar', the parent tab prefix's the tab.
if (localPrintLevel > 0 && (tbformat.IndexOf("{numericWpar}") > -1 || tbformat.IndexOf("{alphaWpar}") > -1 || tbformat.IndexOf("{ALPHAWpar}") > -1))
if (localPrintLevel > 0 && tbformat.Contains("Wpar}")) // C2025-036 reduce un-needed processing
{
string parentTab = null;
ItemInfo myparent = ActiveParent as ItemInfo;
@ -4872,18 +4878,21 @@ namespace VEPROMS.CSLA.Library
}
string alpha = useLinked?LinkedTab.Trim():AlphabeticalNumbering(ordinal);
if (trimSeqValue) alpha = alpha.Trim(); // F2024-043 trim white around SEQ tab value (for sub-steps)
// B2017-211 Roman High Level steps should be followed by Uppercase alpha substeps - This is being limited to Calvert SAMG Format
if (_ActiveFormat.Name =="BGESAM1" &&MyParent != null && MyParent.IsHigh && MyParent.IsStep && MyParent.FormatStepData.TabData.IdentEdit.Contains("ROMAN"))
tbformat = tbformat.Replace("{alpha}", alpha);
else
tbformat = tbformat.Replace("{alpha}", alpha.ToLower());
tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower());
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && tbformat.Contains("{ALPHA}") && alpha.Length > 1)
tbformat = tbformat.Replace("{ALPHA}. ", alpha + "."); // if double chars, remove one of the space for BGE
else
tbformat = tbformat.Replace("{ALPHA}", alpha);
if (tbformat.ToUpper().Contains("{ALPHA")) // C2025-036 reduce un-needed processing
{
// B2017-211 Roman High Level steps should be followed by Uppercase alpha substeps - This is being limited to Calvert SAMG Format
if (_ActiveFormat.Name == "BGESAM1" && MyParent != null && MyParent.IsHigh && MyParent.IsStep && MyParent.FormatStepData.TabData.IdentEdit.Contains("ROMAN"))
tbformat = tbformat.Replace("{alpha}", alpha);
else
tbformat = tbformat.Replace("{alpha}", alpha.ToLower());
tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower());
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && tbformat.Contains("{ALPHA}") && alpha.Length > 1)
tbformat = tbformat.Replace("{ALPHA}. ", alpha + "."); // if double chars, remove one of the space for BGE
else
tbformat = tbformat.Replace("{ALPHA}", alpha);
tbformat = tbformat.Replace("{ALPHAWpar}", alpha);
tbformat = tbformat.Replace("{ALPHAWpar}", alpha);
}
if (tbformat.ToUpper().Contains("ROMAN"))
{
string roman = RomanNumbering(ordinal);
@ -4891,15 +4900,18 @@ namespace VEPROMS.CSLA.Library
tbformat = tbformat.Replace("{ROMAN}", roman);
tbformat = tbformat.Substring(0, tbformat.Length - ((roman.Length - 1) > 0 ? (roman.Length - 1) : 0));
}
if (tbformat.Contains("{numeric}") && ((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && MyContent.Type == 20002)
if (tbformat.Contains("{numeric}")) // C2025-036 reduce un-needed processing
{
tbformat = tbformat.Replace("{numeric}", ordinal.ToString().PadLeft(2) + ".0");
tbformat = tbformat.Substring(0, tbformat.Length - 2);
}
if (tbformat.Contains("{numeric}") && (this.FormatStepData.AppendDotZero)) // F2018-022 Added step type flag to append a ".0" to the end of the high level step - put in for Westinghouse single column format (wst1)
{
string numtxt = ordinal.ToString().PadLeft(2) + ".0";
tbformat = tbformat.Replace("{numeric}.", numtxt).Replace("{numeric}", numtxt);
if (((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && MyContent.Type == 20002)
{
tbformat = tbformat.Replace("{numeric}", ordinal.ToString().PadLeft(2) + ".0");
tbformat = tbformat.Substring(0, tbformat.Length - 2);
}
if (this.FormatStepData.AppendDotZero) // F2018-022 Added step type flag to append a ".0" to the end of the high level step - put in for Westinghouse single column format (wst1)
{
string numtxt = ordinal.ToString().PadLeft(2) + ".0";
tbformat = tbformat.Replace("{numeric}.", numtxt).Replace("{numeric}", numtxt);
}
}
// if this is a wolf creek background, if the tbformat ends with a '.' don't add a space,
// otherwise add a space.

View File

@ -758,7 +758,7 @@ namespace Volian.Controls.Library
// clear tabs, clears then all so that next 'get' will calculate new.
public void SetAllTabs()
{
RefreshTab();
RefreshTab();
if (_MyAfterEditItems != null) _MyAfterEditItems[0].SetAllTabs(); // B2020-043: used to loop through all, but then recursion would redo.
if (_MyNextEditItem != null) _MyNextEditItem.SetAllTabs();
@ -1160,7 +1160,7 @@ namespace Volian.Controls.Library
{
if (myItemInfoList != null)
foreach (ItemInfo item in myItemInfoList)
AddChildBefore(item, expand);
AddChildBefore(item, expand);
}
public EditItem AddChildBefore(ItemInfoList myItemInfoList, EditItem nextEditItem)
{
@ -3994,7 +3994,8 @@ namespace Volian.Controls.Library
// TODO: Adjust top based upon format
// TODO: Remove Label and just output ident on the paint event
TabLeft = 20;
SetupHeader(itemInfo);
if (!itemInfo.IsStep) // C2025-036 reduce un-needed processing - this will prevent duplicat calls that generate step tabs when loading a procedure
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);