From 622717ba1aedaceac109c1d5d8fb108eb111ff59 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 4 Mar 2014 17:36:02 +0000 Subject: [PATCH] =?UTF-8?q?Get=20data=20into=20memory=20for=20approval=20g?= =?UTF-8?q?eneration=20so=20that=20page=20number=20transitions=20resolve?= =?UTF-8?q?=20Fixed=20B2014-025:If=20not=20master/slave,=20load=20all=20da?= =?UTF-8?q?ta=20into=20memory=20for=20page=20number=20transitions.=20Prese?= =?UTF-8?q?nt=20dialog=20if=20there=20are=20errors=20in=20page=20number=20?= =?UTF-8?q?transitions=20so=20that=20user=20can=20resolve.=20Added=20a=20p?= =?UTF-8?q?roperty=20to=20determine=20if=20page=20number=20transition=20ha?= =?UTF-8?q?s=20incorrect=20page=20number=20caused=20by=20length=20of=20ste?= =?UTF-8?q?p=E2=80=99s=20text/wrapping=20&=20pagination=20Set=20property?= =?UTF-8?q?=20to=20determine=20if=20page=20number=20transition=20has=20inc?= =?UTF-8?q?orrect=20page=20number=20caused=20by=20length=20of=20step?= =?UTF-8?q?=E2=80=99s=20text/wrapping=20&=20pagination=20Add=20tracking=20?= =?UTF-8?q?of=20inconsistent=20page=20number=20transitions;=20if=20pdf=20a?= =?UTF-8?q?lready=20open,=20don=E2=80=99t=20run=202nd=20pass=20for=20page?= =?UTF-8?q?=20number=20transitions=20(resulting=20pdf=20had=20unresolved?= =?UTF-8?q?=20page=20numbers);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DlgPrintProcedure.cs | 12 +++++++-- .../dlgApproveProcedure.cs | 5 +++- .../frmPDFStatusForm.cs | 2 ++ .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 15 +++++++++-- .../Extension/TransitionExt.cs | 3 ++- PROMS/Volian.Print.Library/PromsPrinter.cs | 27 +++++++++++++++++-- PROMS/Volian.Print.Library/vlnParagraph.cs | 5 ++++ 7 files changed, 61 insertions(+), 8 deletions(-) diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index e3621acc..0f3bf43d 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -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(); } diff --git a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs index 02f4a691..cc83d5bc 100644 --- a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs +++ b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs @@ -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); diff --git a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs index 2c41173a..fc76a3d7 100644 --- a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs +++ b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs @@ -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)); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index c6c95db5..72b6ded0 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -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 { diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index f8153e6f..1e297f88 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -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. diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 3db96201..0c098cfd 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -155,6 +155,26 @@ namespace Volian.Print.Library get { return _InsertBlankPages; } set { _InsertBlankPages = value; } } + private static List _TransPageNumProblems = null; + public static List 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 _MyFoldoutSection = null; private string Print(ProcedureInfo myProcedure, string pdfFolder) { + if (_TransPageNumProblems == null) _TransPageNumProblems = new List(); + if (_MyFoldoutReader != null) _MyFoldoutReader.Clear(); else _MyFoldoutReader = new List(); if (_MyFoldoutSection != null) _MyFoldoutSection.Clear(); else _MyFoldoutSection = new List(); - + if (myProcedure.Sections != null) { int cnt = 0; diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 5ce0cf1f..2ad83222 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -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(); + PromsPrinter.TransPageNumProblems.Add(MyItemInfo.ShortPath); + } if (Processed) return yPageStart; //float localYPageStart = yPageStart; Processed = true;