B2021-102 Baseline print testing Out of Memory fix printing Parent/Child sets

B2021-102 Moved calls that populate metafile testing file from DlgPrintProcedure CreatePDF and CreatePDFs
This commit is contained in:
John Jenko 2021-09-02 16:20:17 +00:00
parent 99db97598d
commit 80fff4878b
2 changed files with 76 additions and 51 deletions

View File

@ -725,23 +725,29 @@ namespace VEPROMS
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// B2021-102 we now get this information in frmPDFStatusForm()
//MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
//if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
string myPDFPath = GetMultiunitPDFPath();
_MergedPdfPath = myPDFPath; // If Slave, need its subdirectory/unit path for merging
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
// B2021-102 put in the using for better memory management
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd))//;//C2018-009 print PROMS version
{
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
}
}
}
// This is a master/slave for printing of all slaves (SelectedSave == 0)
@ -755,22 +761,28 @@ namespace VEPROMS
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// B2021-102 we now get this information in frmPDFStatusForm()
//MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
//if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
// B2016-249 Output Procedure to folder associated with Parent Child
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
// B2021-102 put in the using for better memory management
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd)) // ;//C2018-009 print PROMS version
{
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
}
}
}
// Not master/slave
@ -783,25 +795,30 @@ namespace VEPROMS
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
int profileDepth1 = ProfileTimer.Push(">>>> GetItemAndChildren");
if (MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
else
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
// B2021-102 we now get this information in frmPDFStatusForm()
//if (MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
// MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
//else
// MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
//// C2018-015 add the procedure tree path and the procedure number and title to the meta file
//if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
ProfileTimer.Pop(profileDepth1);
// B2021-102 put in the using for better memory management
// B2016-249 Output Procedure to folder associated with Parent Child
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked,
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked,
cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text,
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd)) // ;//C2018-009 print PROMS version
{
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
}
}
}
}
@ -903,28 +920,32 @@ namespace VEPROMS
// Also check that format allows override.
ChangeBarDefinition cbd = DetermineChangeBarSettings();
int profileDepth2 = ProfileTimer.Push(">>>> CreatePdf.GetItemAndChildren");
// B2021-088 moved this if/else to frmPDFStatusForm() so that the Approval logic will have access to this logic
//if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0 || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
// MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
//else
// MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a"," | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a"," | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
ProfileTimer.Pop(profileDepth2);
// B2016-249 Output Procedure to folder associated with Parent Child
// B2018-124 use text of watermark form drop down list instead of enum value
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd); //C2018-009 print PROMS version
frmStatus.MakePlaceKeeper = swtbtnGeneratePlacekeeper.Value;
frmStatus.MakeContinuousActionSummary = cbxGenerateConActSum.Checked;
if (Automatic && cbxGenerateConActSum.Checked)
frmStatus.OnlyShowContinuousActionSummary = true;
int profileDepth3 = ProfileTimer.Push(">>>> frmStatus");
frmStatus.ShowDialog();
ProfileTimer.Pop(profileDepth3);
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd))//; //C2018-009 print PROMS version
{
frmStatus.MakePlaceKeeper = swtbtnGeneratePlacekeeper.Value;
frmStatus.MakeContinuousActionSummary = cbxGenerateConActSum.Checked;
if (Automatic && cbxGenerateConActSum.Checked)
frmStatus.OnlyShowContinuousActionSummary = true;
int profileDepth3 = ProfileTimer.Push(">>>> frmStatus");
frmStatus.ShowDialog();
ProfileTimer.Pop(profileDepth3);
}
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
this.Close();
ShowDebugFiles();

View File

@ -90,6 +90,10 @@ namespace VEPROMS
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
else
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
// B2021-102 moved the baseline meta file write here too - should have been done with B2021-088 fix
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
myItem = MyProcedure;
Prefix = prefix;