Get data into memory for approval generation so that page number transitions resolve

Fixed B2014-025:If not master/slave, load all data into memory for page number transitions. Present dialog if there are errors in page number transitions so that user can resolve.
Added a property to determine if page number transition has incorrect page number caused by length of step’s text/wrapping & pagination
Set property to determine if page number transition has incorrect page number caused by length of step’s text/wrapping & pagination
Add tracking of inconsistent page number transitions; if pdf already open, don’t run 2nd pass for page number transitions (resulting pdf had unresolved page numbers);
This commit is contained in:
Kathy Ruffing 2014-03-04 17:36:02 +00:00
parent 63acad915d
commit 622717ba1a
7 changed files with 61 additions and 8 deletions

View File

@ -537,6 +537,7 @@ namespace VEPROMS
MyProcedure = myProc;
if (myProc.Sections != null)
{
// This is master/slave & a slave has been selected for printing (SelectedSlave > 0)
if (SelectedSlave > 0)
{
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = SelectedSlave;
@ -555,6 +556,7 @@ namespace VEPROMS
frmStatus.ShowDialog();
if (frmStatus.CancelPrinting) break;
}
// This is a master/slave for printing of all slaves (SelectedSave == 0)
else if (SelectedSlave == 0)
{
for (int k = 1; k <= MyProcedure.MyDocVersion.MultiUnitCount; k++)
@ -575,6 +577,7 @@ namespace VEPROMS
if (frmStatus.CancelPrinting) break;
}
}
// Not master/slave
else
{
SetupForProcedure();
@ -583,7 +586,10 @@ namespace VEPROMS
pbPDFsStatus.Value = i;
// 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.
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
if (MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier)
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
else
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
frmStatus.CloseWhenDone = true;
Application.DoEvents();
@ -713,7 +719,9 @@ namespace VEPROMS
{
DateTime dtStart = DateTime.Now;
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
PromsPrinter.ClearTransPageNumProblems();
CreatePDFs();
PromsPrinter.ReportTransPageNumProblems();
if (VlnSettings.DebugMode)
{
MessageBox.Show(string.Format("{0} Minutes to Print All Procedures"
@ -722,7 +730,7 @@ namespace VEPROMS
}
else // Production or Demo mode
{
MessageBox.Show("Completed Successfully","Print All Procedures", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("Completed Successfully", "Print All Procedures", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
this.Close();
}

View File

@ -1027,7 +1027,10 @@ namespace VEPROMS
}
else
{
pi = ProcedureInfo.GetItemAndChildren(pi.ItemID);
if (pi.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier)
pi = ProcedureInfo.GetItemAndChildrenByUnit(pi.ItemID, 0, pi.MyDocVersion.DocVersionConfig.SelectedSlave);
else
pi = ProcedureInfo.GetItemAndChildren(pi.ItemID);
pi.ChangeBarDate = myDTS;
cail = ContentAuditInfoList.GetSummary(pi.ItemID, pi.ItemID, false, pi.ChangeBarDate);
aail = AnnotationAuditInfoList.GetChronology(pi.ItemID, pi.ItemID, pi.ChangeBarDate);

View File

@ -113,6 +113,7 @@ namespace VEPROMS
Application.DoEvents();
MyPromsPrinter.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
DateTime tStart = DateTime.Now;
if (!CancelStop) PromsPrinter.ClearTransPageNumProblems();
do
{
_PdfFile = MyPromsPrinter.Print(PDFPath);
@ -123,6 +124,7 @@ namespace VEPROMS
this.Close();
return;
}
if (!CancelStop) PromsPrinter.ReportTransPageNumProblems();
DateTime tEnd = DateTime.Now;
MyStatus = _PdfFile + " created.";
MyStatus = string.Format("{0} created in {1:0.} milliseconds", _PdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));

View File

@ -570,18 +570,29 @@ namespace VEPROMS.CSLA.Library
}
set { _PrintLevel = value; }
}
// The following property tracks the page number that this item is on if the resolved
// The following properties track the page number that this item is on if the resolved
// transition text has a Page Number associated with it. Formats that have this either
// have the UseTransitionModfier flag or have '{Page Num}' in respective transition formats.
// If the format requires page numbers in transitions text, two passes are run through the
// data for printing. The first determines page numbers, the seconds resolves the transition
// text.
// text. The PageNumberUsed value is used to determine if the page number in 1st & 2nd passes
// are different. This can be caused by the page number text causing different heights of
// the step that causes change in pagination. If this occurs, the user is presented with a
// dialog box that shows the step that causes the problem & a manual change will be necessary.
// This is a rare occurence so it was decided that the amount of coding effort to fix this
// would be so much in comparison to having the user fix manually (RHM/KBR Feb 2014).
private int _PageNumber = 0;
public int PageNumber
{
get { return _PageNumber; }
set { _PageNumber = value; }
}
private int _PageNumberUsed = 0;
public int PageNumberUsed
{
get { return _PageNumberUsed; }
set { _PageNumberUsed = value; }
}
private float _MSWordPageCount = 0;
public float MSWordPageCount
{

View File

@ -808,6 +808,7 @@ namespace VEPROMS.CSLA.Library
if (tb._ToItem.PageNumber != 0 && tb._FromItem.PageNumber != 0)
{
int pgoffset = tb._ToItem.PageNumber - tb._FromItem.PageNumber;
tb._ToItem.PageNumberUsed = tb._ToItem.PageNumber;
switch (pgoffset)
{
case 1:
@ -831,7 +832,7 @@ namespace VEPROMS.CSLA.Library
tb.Append(" (Page ~)");
}
return true;
}
}
private static bool AddStepNumber(TransitionBuilder tb)
{
// If we're on a step put out the step number.

View File

@ -155,6 +155,26 @@ namespace Volian.Print.Library
get { return _InsertBlankPages; }
set { _InsertBlankPages = value; }
}
private static List<string> _TransPageNumProblems = null;
public static List<string> TransPageNumProblems
{
get { return PromsPrinter._TransPageNumProblems; }
set { PromsPrinter._TransPageNumProblems = value; }
}
public static void ClearTransPageNumProblems()
{
_TransPageNumProblems = null;
}
public static void ReportTransPageNumProblems()
{
if (TransPageNumProblems != null && TransPageNumProblems.Count > 0)
{
string pnProbl = null;
foreach (string pstr in TransPageNumProblems)
pnProbl = pnProbl + "\n" + pstr;
MessageBox.Show("Review the page numbers specified on transitions that transition to the following:\n" + pnProbl, "Inconsistent transition page numbers.");
}
}
public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite, ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages)
{
_MyItem = myItem;
@ -180,7 +200,8 @@ namespace Volian.Print.Library
// if the plant uses transition modifiers and/or page num in transition format,
// need to do two passes. First pass, sets the pagenumbers for each item,
// 2nd pass fills in the page numbers in transitions.
Print(_MyItem as ProcedureInfo, pdfFolder);
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder);
if (retstr == null) return null;
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
return Print(_MyItem as ProcedureInfo, pdfFolder);
}
@ -312,12 +333,14 @@ namespace Volian.Print.Library
private static List<SectionInfo> _MyFoldoutSection = null;
private string Print(ProcedureInfo myProcedure, string pdfFolder)
{
if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>();
if (_MyFoldoutReader != null) _MyFoldoutReader.Clear();
else _MyFoldoutReader = new List<PdfReader>();
if (_MyFoldoutSection != null) _MyFoldoutSection.Clear();
else _MyFoldoutSection = new List<SectionInfo>();
if (myProcedure.Sections != null)
{
int cnt = 0;

View File

@ -313,6 +313,11 @@ namespace Volian.Print.Library
public float ParagraphToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
if (MyItemInfo.PageNumber == 0) MyItemInfo.PageNumber = MyPageHelper.CurrentPageNumber;
else if (MyItemInfo.PageNumberUsed != 0 && MyItemInfo.PageNumberUsed != MyPageHelper.CurrentPageNumber)
{
if (PromsPrinter.TransPageNumProblems == null) PromsPrinter.TransPageNumProblems = new List<string>();
PromsPrinter.TransPageNumProblems.Add(MyItemInfo.ShortPath);
}
if (Processed) return yPageStart;
//float localYPageStart = yPageStart;
Processed = true;