F2022-024 – logic to support printing of Time Critical Action Summary report

This commit is contained in:
John Jenko 2022-08-11 18:09:10 +00:00
parent 8f765e0294
commit 80581d7e4d
2 changed files with 100 additions and 5 deletions

View File

@ -76,6 +76,15 @@ namespace VEPROMS
get { return _OnlyShowContinuousActionSummary; } get { return _OnlyShowContinuousActionSummary; }
set { _OnlyShowContinuousActionSummary = value; } set { _OnlyShowContinuousActionSummary = value; }
} }
// F2022-024 this flag is used when the Time Critical Action Sumamry is printed from the tree or ribbon button
// it will prevent the temporary PDF (generated with printing - needed to get page numbers) from being displayed
// and will delete that temporary PDF file
private bool _OnlyShowTimeCriticalActionSummary = false;
public bool OnlyShowTimeCriticalActionSummary
{
get { return _OnlyShowTimeCriticalActionSummary; }
set { _OnlyShowTimeCriticalActionSummary = value; }
}
private bool _DidAll = false; private bool _DidAll = false;
public bool DidAll public bool DidAll
{ {
@ -192,6 +201,8 @@ namespace VEPROMS
tmrRun.Enabled = true; tmrRun.Enabled = true;
if (MakeContinuousActionSummary) if (MakeContinuousActionSummary)
Text = Text.Replace("PDF", "Continuous Action Summary"); Text = Text.Replace("PDF", "Continuous Action Summary");
else if (MakeTimeCriticalActionSummary)
Text = Text.Replace("PDF", "Time Critical Action Summary"); // F2022-024 Time Critical Action
} }
private string _PdfFile; private string _PdfFile;
@ -216,6 +227,15 @@ namespace VEPROMS
set { _MakeContinuousActionSummary = value; } set { _MakeContinuousActionSummary = value; }
} }
// F2022-024 Time Critical Action Summary
private bool _MakeTimeCriticalActionSummary = false;
public bool MakeTimeCriticalActionSummary
{
get { return _MakeTimeCriticalActionSummary; }
set { _MakeTimeCriticalActionSummary = value; }
}
private void tmrRun_Tick(object sender, EventArgs e) private void tmrRun_Tick(object sender, EventArgs e)
{ {
tmrRun.Enabled = false; tmrRun.Enabled = false;
@ -251,7 +271,7 @@ namespace VEPROMS
cachePartInfo = PartInfo.CacheList; cachePartInfo = PartInfo.CacheList;
} }
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary); _PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary);
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
@ -332,7 +352,7 @@ namespace VEPROMS
{ {
try // B2019-106 Error Handling for PDF Open try // B2019-106 Error Handling for PDF Open
{ {
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary) if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary && !OnlyShowTimeCriticalActionSummary) // F2022-024 Time Critical Action Summary
{ {
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile); System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
@ -340,7 +360,7 @@ namespace VEPROMS
sdp.WaitForInputIdle(); sdp.WaitForInputIdle();
} }
if (OnlyShowContinuousActionSummary) if (OnlyShowContinuousActionSummary || OnlyShowTimeCriticalActionSummary) // F2022-024 Time Critical Action Summary
System.IO.File.Delete(pdffile); // remove the temporary PDF file used to create the Continuous Action Summary System.IO.File.Delete(pdffile); // remove the temporary PDF file used to create the Continuous Action Summary
if (MyPromsPrinter.MyPlacekeeper != null) if (MyPromsPrinter.MyPlacekeeper != null)
@ -370,6 +390,21 @@ namespace VEPROMS
MyPromsPrinter.MyContActSummary.Visible(); MyPromsPrinter.MyContActSummary.Visible();
} }
// F2022-024 this will display the generated Time Critical Action Summary in MS Word (starting a new instance of MS Word outside of PROMS)
if (MyPromsPrinter.MyTimeCriticalActSummary != null)
{
string instructions = "The Time Critical Action Summary will be opened in MS Word.\n\nYou can make modifications and copy it into a PROMS Word section.";
MessageBox.Show(instructions, "Time Critical Action Summary");
// The ContActSummaryDelay is a switch that can be added to the PROMS.exe shortcut
// ex: VEPROMS.EXE /ContActSummaryDelay=2.5 will delay it 2 1/2 seconds
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("TimeCritActSummaryDelay", 1.0f);
int mydelay = (int)(1000 * delay);
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyTimeCriticalActSummary.Visible();
}
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -91,6 +91,9 @@ namespace VEPROMS
_SelectedStepTabPanel.MyStepTabRibbon.ContActionSummaryRequest += MyStepTabRibbon_ContActionSummaryRequest; _SelectedStepTabPanel.MyStepTabRibbon.ContActionSummaryRequest += MyStepTabRibbon_ContActionSummaryRequest;
_SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree -= new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree); _SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree -= new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree);
_SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree += new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree); _SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree += new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree);
// F2022-024 Time Critical Action Summary
_SelectedStepTabPanel.MyStepTabRibbon.TimeCriticalActionSummaryRequest -= MyStepTabRibbon_TimeCriticalActionSummaryRequest;
_SelectedStepTabPanel.MyStepTabRibbon.TimeCriticalActionSummaryRequest += MyStepTabRibbon_TimeCriticalActionSummaryRequest;
} }
} }
} }
@ -126,6 +129,38 @@ namespace VEPROMS
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit //added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0; pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
} }
// F2022-024 Time Critical Action Summary
void MyStepTabRibbon_TimeCriticalActionSummaryRequest(object sender, StepTabRibbonEventArgs args)
{
DialogResult dr = System.Windows.Forms.DialogResult.Yes;
ProcedureInfo piThis = null;
if (_CurrentItem != null) piThis = _CurrentItem.MyProcedure;
ProcedureInfo pi = args.Proc as ProcedureInfo;
if (piThis != null && pi.ItemID != piThis.ItemID) pi = piThis;
if (pi == null) return;
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
pi.MyDocVersion.DocVersionConfig.SelectedSlave = pi.ProcedureConfig.SelectedSlave;
DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi);
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
prnDlg.SelectedSlave = (pi.ProcedureConfig.SelectedSlave == 0) ? -1 : pi.ProcedureConfig.SelectedSlave;
prnDlg.MySessionInfo = MySessionInfo;
prnDlg.Automatic = true;
prnDlg.CreateTimeCriticalActionSummary = true;
prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
prnDlg.Prefix = "TCASTMP_"; // A temporary procedure PDF is created to grab page numbers
prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
public DocVersionInfo SelectedDVI public DocVersionInfo SelectedDVI
{ {
@ -473,6 +508,7 @@ namespace VEPROMS
tv.Processing += tv_Processing; tv.Processing += tv_Processing;
tv.CreateContinuousActionSummary += new vlnTreeViewEvent(tv_CreateContinuousActionSummary); tv.CreateContinuousActionSummary += new vlnTreeViewEvent(tv_CreateContinuousActionSummary);
tv.SelectDateToStartChangeBars += tv_SelectDateToStartChangeBars; tv.SelectDateToStartChangeBars += tv_SelectDateToStartChangeBars;
tv.CreateTimeCriticalActionSummary += new vlnTreeViewEvent(tv_CreateTimeCriticalActionSummary);
displayBookMarks.ResetBookMarksInPROMSWindows += displayBookMarks_ResetBookMarksInPROMSWindows; displayBookMarks.ResetBookMarksInPROMSWindows += displayBookMarks_ResetBookMarksInPROMSWindows;
} }
@ -1119,6 +1155,30 @@ namespace VEPROMS
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0; pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
} }
void tv_CreateTimeCriticalActionSummary(object sender, vlnTreeEventArgs args)
{
DialogResult dr = System.Windows.Forms.DialogResult.Yes;
ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
if (pi == null) return;
tc.SaveCurrentEditItem(pi);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi, true);
prnDlg.MySessionInfo = MySessionInfo;
prnDlg.SelectedSlave = args.UnitIndex;
prnDlg.Automatic = true;
prnDlg.CreateTimeCriticalActionSummary = true;
prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
prnDlg.Prefix = "TCASTMP_"; // prefix the temporary procedure PDF file that is generated (to grab page numbers)
prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
void RefreshDisplayHistory(object sender) void RefreshDisplayHistory(object sender)
{ {
displayHistory.RefreshChangeList(); displayHistory.RefreshChangeList();
@ -1209,7 +1269,7 @@ namespace VEPROMS
void frmVEPROMS_Activated(object sender, EventArgs e) void frmVEPROMS_Activated(object sender, EventArgs e)
{ {
Volian.Base.Library.vlnStackTrace.ShowStack(); //Volian.Base.Library.vlnStackTrace.ShowStack();
if (ActiveControl == tc) tc.HideCaret(); if (ActiveControl == tc) tc.HideCaret();
// refresh anything that pertains to external files or programs: // refresh anything that pertains to external files or programs:
@ -2928,7 +2988,7 @@ namespace VEPROMS
void tc_ToggleRibbonExpanded(object sender, EventArgs args) void tc_ToggleRibbonExpanded(object sender, EventArgs args)
{ {
Volian.Base.Library.vlnStackTrace.ShowStackLocal("tc_ToggleRibbonExpanded {0}", ribbonControl1.Expanded); //Volian.Base.Library.vlnStackTrace.ShowStackLocal("tc_ToggleRibbonExpanded {0}", ribbonControl1.Expanded);
ribbonControl1.Expanded = !ribbonControl1.Expanded; ribbonControl1.Expanded = !ribbonControl1.Expanded;
} }