F2022-024 – added logic to generate a Time Critical Action Summary report

F2022-024 – logic to replace {!Clock} with the defined genmac macro when step tab is printed from the pagelist (Enhanced Backgrounds)
This commit is contained in:
John Jenko 2022-08-11 18:27:03 +00:00
parent bfeed42a59
commit 67a19a4358
4 changed files with 92 additions and 16 deletions

View File

@ -33,7 +33,7 @@ namespace Volian.Print.Library
while (!ii.IsHigh) ii = ii.MyParent;
return ii;
}
public ContinuousActionSummary(pkParagraphs myContActSteps, VE_Font pkFont)
public ContinuousActionSummary(pkParagraphs myContActSteps, VE_Font pkFont, bool doingTimeCriticalSummary = false)
{
ItemInfo prevHLSii = null;
string txtPageNum = ""; // this gets asigned the page number continuous action step text.
@ -44,7 +44,7 @@ namespace Volian.Print.Library
//_WordApp.Visible = true;
_pkFont = pkFont;
AddTable();
AddHeader();
AddHeader(doingTimeCriticalSummary); // F2022-024 pass flag when creating a Time Critical Action Summary report
foreach (pkParagraph myContAct in myContActSteps)
{
if (myContAct.MyChildren.Count > 0)
@ -165,9 +165,12 @@ namespace Volian.Print.Library
col.SetWidth(72 * .56F, LBWdRulerStyle.wdAdjustNone);
_WordTbl.Rows.AllowBreakAcrossPages = 0;
}
private void AddHeader()
private void AddHeader(bool doingTimeCriticalSummary)
{
WriteCell("START", true, true);
if (doingTimeCriticalSummary) // F2022-024 Title for Time Critical Action Summary Report
WriteCell("STEP TIME CRITICAL ACTION", true, true);
else
WriteCell("STEP CONTINUOUS ACTION", true, true);
WriteCell("DONE", true, true);
WriteCell("PAGE", true, false);

View File

@ -361,7 +361,7 @@ namespace Volian.Print.Library
// B2019-152: MergedLandscapePages is a dictionary whose key is the pdf file name & values are all of the page numbers
// in that pdf that should have landscaped page numbers. These are added when the page is finished (onEndPage)
public static Dictionary<string, List<int>> MergedLandscapePages = null;
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary)
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary)
{
if (_MyItem is ProcedureInfo)
{
@ -386,10 +386,10 @@ namespace Volian.Print.Library
SectionInfo.ResetLookupStepSectPageBreaks(); // B2017-192: Reset lists for tracking page breaks
SectionInfo.ResetLookupStepSectPageBreaksForSupInfo();
SupInfoPrintType = E_SupInfoPrintType.DoPageBreaks;
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false, false);
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false, false, false);
if (retstr == null) return null;
SupInfoPrintType = E_SupInfoPrintType.Merge;
string tmps = Print(_MyItem as ProcedureInfo, pdfFolder, false, false);
string tmps = Print(_MyItem as ProcedureInfo, pdfFolder, false, false, false);
if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{
ReportForcedPaginations();
@ -399,7 +399,7 @@ namespace Volian.Print.Library
}
else // B2017-186 Neither Facing Pages or Page Number Transitions
{
string tmpss = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
string tmpss = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary);
if (!BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{
ReportForcedPaginations();
@ -424,17 +424,17 @@ namespace Volian.Print.Library
// Second pass prints the supplemental information pdfs using the list generated in the first pass to know where to do the
// supplemental information page breaks & then merges in those pages when printing the step sections.
SupInfoPrintType = E_SupInfoPrintType.DoPageBreaks;
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false, false);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, false, false, false);
if (retstr == null) return null;
SupInfoPrintType = E_SupInfoPrintType.Merge;
}
retstr = Print(_MyItem as ProcedureInfo, pdfFolder + @"\PageNumberPass1", false, false);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder + @"\PageNumberPass1", false, false, false);
if (retstr == null) return null;
BeforePageNumberPdf = retstr;
BeforePageNumber2Pdf = null; // C2017-018 Initialize Pass 2 PDF Name
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary);
if (! BatchPrint && ForcedPaginations != null && ForcedPaginations.Count > 0) // B2020-159: Forced Pagination Reporting
{
ReportForcedPaginations();
@ -463,7 +463,7 @@ namespace Volian.Print.Library
RefreshPageNumber(_MyItem);
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalActionSummary);
}
}
return retstr;
@ -570,7 +570,7 @@ namespace Volian.Print.Library
}
public void NewPage()
{
string path = Volian.Base.Library.vlnStackTrace.StackToStringLocal(2, 1);
//string path = Volian.Base.Library.vlnStackTrace.StackToStringLocal(2, 1);
NewPage(false);
}
public void NewPage(bool sectionChange)
@ -744,7 +744,7 @@ namespace Volian.Print.Library
set { PromsPrinter._MyFoldoutReader = value; }
}
private static List<SectionInfo> _MyFoldoutSection = null;
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary)
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalAction)
{
if (_ForcedPaginations != null) _ForcedPaginations.Clear();
int profileDepth = ProfileTimer.Push(">>>> PromsPrinter.Print");
@ -768,7 +768,7 @@ namespace Volian.Print.Library
// if floating foldouts, need a list of sections & foldoutreaders. Just do first for now.
_MyFoldoutSection.Add(mySection);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false, false);
_MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null);
cnt++;
}
@ -785,7 +785,7 @@ namespace Volian.Print.Library
return null;
}
}
string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper, makeContinuousActionSummary);
string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper, makeContinuousActionSummary, makeTimeCriticalAction);
ProfileTimer.Pop(profileDepth);
return retval;
}
@ -826,7 +826,7 @@ namespace Volian.Print.Library
set { _WatermarkOverrideColor = value; }
}
//private PdfReader readerWord;
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper, bool makeContinuousActionSummary)
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary)
{
int profileDepth = ProfileTimer.Push(">>>> PrintProcedureOrFoldout");
Rtf2Pdf.TextAtCounter = 0;
@ -1118,6 +1118,15 @@ namespace Volian.Print.Library
if (_MyHelper.MyContActSteps.Count > 0)
MyContActSummary = new ContinuousActionSummary(_MyHelper.MyContActSteps, pkFont);
}
// F2022-024 Generate the Time Critical Action Summary
// we use the ContinuousActionSummary generator to create the Time Critical summay
if (_MyHelper != null && makeTimeCriticalActionSummary)
{
// Set the font for the Time Critical Action Summary
VE_Font pkFont = myProcedure.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.Font; // uses font defined in the format or uses what is definced in BaseAll format
if (_MyHelper.MyTimeCriticalActionSteps.Count > 0)
MyTimeCriticalActSummary = new ContinuousActionSummary(_MyHelper.MyTimeCriticalActionSteps, pkFont, true);
}
_MyHelper = null;
ProfileTimer.Pop(profileDepth);
return outputFileName;
@ -1165,6 +1174,15 @@ namespace Volian.Print.Library
set { _MyContActSummary = value; }
}
//F2022-024 Time Critical Action Summary
private ContinuousActionSummary _MyTimeCriticalActSummary = null;
public ContinuousActionSummary MyTimeCriticalActSummary
{
get { return _MyTimeCriticalActSummary; }
set { _MyTimeCriticalActSummary = value; }
}
public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection)
{
if (mySection.PageNumber == -1) // If page num transition goes to a section, need the pagenumber of section.
@ -2139,6 +2157,9 @@ namespace Volian.Print.Library
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper); // add this step text to the PlaceKeeper (Calvert Cliffs)
if (myParagraph.MyContAct != null)
_MyHelper.MyContActSteps.Add(myParagraph.MyContAct); // add this step to the Continuous Action Summary
// F2022-024 Time Critical Action
if (myParagraph.MyTimeCriticalAction != null)
_MyHelper.MyTimeCriticalActionSteps.Add(myParagraph.MyTimeCriticalAction); // add this step to the Time Critical Action Summary
}
else if (!myItemInfo.MyDocStyle.OptionalSectionContent)
{

View File

@ -43,6 +43,12 @@ namespace Volian.Print.Library
{
get { return _MyContActSteps; }
}
// F2022-024 Time Critical Action Step
private pkParagraphs _MyTimeCriticalActionSteps = new pkParagraphs();
public pkParagraphs MyTimeCriticalActionSteps
{
get { return _MyTimeCriticalActionSteps; }
}
private float? _BottomContent = null;// RHM20150525 - Table Scrunch
public float? BottomContent
{
@ -2189,6 +2195,11 @@ i = 0;
plstr = HLRNO==null?string.Empty:plstr.Replace(token, HLRNO);
break;
case "{HLSTAB}":
if (HLSTAB.Contains("{!Clock}")) // F2022-024 replace with the clock symbol defined in GenMac format file
{
HLSTAB = HLSTAB.Replace("{!Clock}",string.Empty).TrimStart(" ".ToCharArray());
svgGroup.Add(PageItemToSvgUse(pageItem, "Clock"));
}
plstr = plstr.Replace(token, HLSTAB);
break;
case "{UNITALPHA}":

View File

@ -3419,6 +3419,13 @@ namespace Volian.Print.Library
get { return _MyContAct; }
set { _MyContAct = value; }
}
// F2022-024 Time Critical Action
private pkParagraph _MyTimeCriticalAction = null;
public pkParagraph MyTimeCriticalAction
{
get { return _MyTimeCriticalAction; }
set { _MyTimeCriticalAction = value; }
}
public static bool InList(int id, params int[] ids)
{
foreach (int listid in ids)
@ -3497,6 +3504,11 @@ namespace Volian.Print.Library
// Save step text information to be used to create a Continuous Action Summary
BuildContinuousActionSummary(parent, itemInfo);
// F2022-024 Time Critical Step
// Save step text information to be used to create a Time Critical Action Summary
BuildTimeCriticalActionSummary(parent, itemInfo);
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
_MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
@ -4978,6 +4990,35 @@ namespace Volian.Print.Library
}
}
}
private void BuildTimeCriticalActionSummary(vlnParagraph parent, ItemInfo itemInfo)
{
if (itemInfo is SectionInfo)
{
MyTimeCriticalAction = new pkParagraph(this);
if (parent != null && parent.MyItemInfo.IsSection)
parent.MyTimeCriticalAction = MyTimeCriticalAction;
}
else if (itemInfo is StepInfo)
{
StepConfig sc = itemInfo.MyConfig as StepConfig;
if ((sc != null && sc.Step_TCAS == "True") || ((sc == null || sc.Step_TCAS == null) && itemInfo.IncludeOnTimeCriticalActionSum))
{
// save this step info for use on the Continuous Action Summary
vlnParagraph tparent = parent;
while (tparent != null && tparent.MyTimeCriticalAction == null)
tparent = tparent.MyParent;
if (parent.MyTimeCriticalAction != null)
{
if (itemInfo.IsCautionPart || itemInfo.IsNotePart)
MyTimeCriticalAction = parent.MyTimeCriticalAction.AddCautionsAndNotes(this);
else
MyTimeCriticalAction = parent.MyTimeCriticalAction.AddChild(this);
}
else
MyTimeCriticalAction = tparent.MyTimeCriticalAction.AddChild(this);
}
}
}
private vlnParagraph FindParentRNO()
{