diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 3bcb0e61..a3467265 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -1901,6 +1901,39 @@ namespace VEPROMS.CSLA.Library return includeOnCAS; } } + + // F2022-024 Time Critical Action Step + // determine if the the current step should automatically be placed on the Time Critical Action Summary + // Note, this logic only checks the format setting of the step. We will check the value of the Tag's Check Box later on. + public bool IncludeOnTimeCriticalActionSum + { + get + { + bool includeOnTCAS = false; + if ((int)MyContent.Type < 20000) return includeOnTCAS; + int stepType = ((int)MyContent.Type) % 10000; + StepDataList sdlist = ActiveFormat.PlantFormat.FormatData.StepDataList; + if (stepType > sdlist.MaxIndex) + { + _MyLog.InfoFormat(string.Format("IncludeOnTimeCriticalActionSum - Error getting type - contentid = {0}", MyContent.ContentID)); + return false; + } + // By default the PROMS step types that are initally identified as a Time Critical Action type will return True, + // unless the format flag "ExcludeFromTimeCriticalActSum" is set on that step type + StepData sd = sdlist[stepType]; + switch (stepType) + { + case 60: // Time Critical Action High Level Step + includeOnTCAS = !sd.ExcludeFromTimeCriticalActSum; // if flag is not set then Automatically include this step/sub-step on the Time Critical Action Summary + break; + default: + includeOnTCAS = !sd.ExcludeFromTimeCriticalActSum; ; // don't automatically include this step/sub-step + break; + } + return includeOnTCAS; + } + } + public bool IsSameType(ItemInfo cmpItmInfo) { return (((int)MyContent.Type) % 10000) == (((int)cmpItmInfo.MyContent.Type) % 10000); @@ -4057,6 +4090,22 @@ namespace VEPROMS.CSLA.Library tbformat = tbformat.Replace("{LNK Step Num}", LinkedTab==null?"NA":LinkedTab.Trim(" .".ToCharArray()).PadLeft(2));//Ordinal.ToString().PadLeft(2)); if (tbformate != null && tbformate.Contains("{LNK Step Num}")) tbformate = tbformate.Replace("{LNK Step Num}", LinkedTab == null ? "NA" : LinkedTab.Trim(" .".ToCharArray()).PadLeft(2));//Ordinal.ToString()); + if (tbformate != null && tbformate.Contains("{!Clock}")) + { + int macindx = tbformate.IndexOf("{!Clock}"); + if (macindx > -1) //i found it - one + { + int endidx = tbformate.IndexOf("}", macindx); + if (endidx > -1) + { + // F2022-024 Clock is defined in genmac as a text using the Wingding font and uses the Clock unicode character and is used when the step is printed + // But for the editor screen, we use the character defined at the step tab with MacroEditTag + // For Robinson's case, the MacroEditTag is an'!' character + // replace the {!Clock} token with MacroEditTag - for Robinson, this will be an ! character + tbformate = tbformate.Substring(0, macindx) + FormatStepData.TabData.MacroEditTag + tbformate.Substring(macindx + endidx + 1); + } + } + } } if (tbformat.Contains("{indent}")) // Robinson Background format CPBCK tbformat = tbformat.Substring(8); // we just need to remove the "{indent}" and leave the spaces @@ -4404,18 +4453,34 @@ namespace VEPROMS.CSLA.Library _MyTab.AsteriskOffset = -10; tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this. } - int macroindx = tbformat.IndexOf("{!C"); - if (macroindx > -1) + // F2022-024 Clock is defined in genmac as a text using the Wingding font and uses the Clock unicode character and is used when the step is printed + // But for the editor screen, we use the character defined at the step tab with MacroEditTag + // For Robinson's case, the MacroEditTag is an'!' character + int macroindx = tbformat.IndexOf("{!Clock}"); + if (macroindx > -1) //i found it { - // C2017-026: have visual indicator for CAS Step - if (FormatStepData.TabData.IdentEdit.Contains("*. ")) + int endidx = tbformat.IndexOf("}", macroindx); + if (endidx > -1) { - cltext = cltext == null ? tbformat.Substring(0, macroindx) + "*. " + tbformat.Substring(macroindx + 8) : cltext.Remove(macroindx, 5); + // replace the {!Clock} token with MacroEditTag - for Robinson, this will be an ! character + cltext = cltext == null ? tbformat.Substring(0, macroindx) + FormatStepData.TabData.MacroEditTag + tbformat.Substring(macroindx + endidx + 1) : cltext.Remove(macroindx, 5); } - else + } + else + { + macroindx = tbformat.IndexOf("{!C"); + if (macroindx > -1) { - cltext = cltext == null ? tbformat.Remove(macroindx, 5) : cltext.Remove(macroindx, 5); - cltext = cltext + " "; + // C2017-026: have visual indicator for CAS Step + if (FormatStepData.TabData.IdentEdit.Contains("*. ")) + { + cltext = cltext == null ? tbformat.Substring(0, macroindx) + "*. " + tbformat.Substring(macroindx + 8) : cltext.Remove(macroindx, 5); + } + else + { + cltext = cltext == null ? tbformat.Remove(macroindx, 5) : cltext.Remove(macroindx, 5); + cltext = cltext + " "; + } } } macroindx = tbformat.IndexOf("{!diamond1}"); @@ -4488,15 +4553,33 @@ namespace VEPROMS.CSLA.Library if (!IsSection && FormatStepData.TabData.IdentAltPrint != null && FormatStepData.TabData.IdentAltPrint != "") { string newtab = null; - int indxnewtab = FormatStepData.TabData.IdentAltPrint.LastIndexOf('\\'); + string fmtAltPrintTab = FormatStepData.TabData.IdentAltPrint; + int idxClock = -1; + int idxEndClock = -1; + if (fmtAltPrintTab.Contains("{!Clock}")) + { + idxClock = fmtAltPrintTab.IndexOf("{!Clock}"); + idxEndClock = idxClock + 7; + int i = idxEndClock; + while (i+1 <= fmtAltPrintTab.Length && fmtAltPrintTab[i+1] == ' ') i++; // spin past any spaces after Clock + idxEndClock = i; + } + int indxnewtab = fmtAltPrintTab.LastIndexOf('\\'); if (indxnewtab >= 0) { _MyTab.BasicTab = isAlpha ? alpha : ordinal.ToString(); - newtab = FormatStepData.TabData.IdentAltPrint.Substring(indxnewtab + 1); + newtab = fmtAltPrintTab.Substring(indxnewtab + 1); if (newtab.Contains("{numeric}") || newtab.Contains("{LNK Step Num}")) { newtab = tbformat; - newtab = @"\ul " + newtab.Substring(0, newtab.IndexOf(":") + 1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":") + 1); + if (idxClock > -1) + { + newtab = newtab.Substring(0, idxEndClock + 1) + @"\ul " + newtab.Substring(idxEndClock + 1, newtab.IndexOf(":") + 1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":") + 1); + } + else + { + newtab = @"\ul " + newtab.Substring(0, newtab.IndexOf(":") + 1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":") + 1); + } } // also see if there is the 'pagelist' string in this tab: // C2018-003 fixed use of getting the active section @@ -4504,9 +4587,16 @@ namespace VEPROMS.CSLA.Library ActiveSection != null && ((ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageListSpBckgrnd) != E_DocStructStyle.DSS_PageListSpBckgrnd)) // the reason that the underline commands were not included in format file is that the '\' character // is used as a separator and the following code will not impact other formats - HighLevelStepTabPageList = @"\ul " + FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab).Trim() + @"\ulnone " + (tbformat.StartsWith(" ") ? "" : " ") + tbformat; + if (idxClock > -1) + { + HighLevelStepTabPageList = fmtAltPrintTab.Substring(0, idxEndClock + 1) + @"\ul " + fmtAltPrintTab.Substring(idxEndClock+1, indxnewtab - (idxEndClock+1)).Trim() + @"\ulnone " + (tbformat.StartsWith(" ") ? "" : " ") + tbformat; + } + else + { + HighLevelStepTabPageList = @"\ul " + fmtAltPrintTab.Substring(0, indxnewtab).Trim() + @"\ulnone " + (tbformat.StartsWith(" ") ? "" : " ") + tbformat; + } else - HighLevelStepTabPageList = FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab) + tbformat; + HighLevelStepTabPageList = fmtAltPrintTab.Substring(0, indxnewtab) + tbformat; _MyTab.AltPrintTab = newtab; if (tbformate != null && tbformate != "") tbformat = tbformate; }