B2020-081 better logic for steps with more than on RNO level to try and keep the RNO sub-step from breaking (where possible) and to see if the entire second RNO could also fit on the page

This commit is contained in:
John Jenko 2020-06-03 20:10:53 +00:00
parent 5922ddb3e6
commit c1849897db
2 changed files with 81 additions and 32 deletions

View File

@ -1400,6 +1400,32 @@ namespace VEPROMS.CSLA.Library
} }
return level; return level;
} }
// B2020-081 used in HasSecondRNOThatWillFit() in pagination.cs
// Get the total number of RNO levels in the step
public int GetMaxRNOLevels
{
get
{
return MyHLS.GetMaxRNOLevelsFromChildren;
}
}
private int GetMaxRNOLevelsFromChildren
{
get
{
int maxRNOLevel = RNOLevel;
if (MyContent.ContentParts != null)
{
foreach (PartInfo pi in MyContent.ContentParts)
{
foreach (ItemInfo ii in pi.MyItems)
maxRNOLevel = Math.Max(maxRNOLevel, ii.GetMaxRNOLevelsFromChildren);
}
}
return maxRNOLevel;
}
}
private bool ParentAndOr private bool ParentAndOr
{ {
get get

View File

@ -1005,7 +1005,7 @@ namespace Volian.Print.Library
{ {
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter - yAccountForBottomMsg, yLowerLimit, paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter - yAccountForBottomMsg, yLowerLimit,
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop);
// B2020-032 put in for Barakah EOPs 1T4-OP-EOP-XX-0100 Attachement 32 step 1.2.2a where a table was printing on a page by itself. // B2020-032 put in for Barakah EOPs 1T4-OP-EOP-XX-0100 Attachement 32 step 1.2.2a where a table was printing on a page by itself.
// The following logic will walk up to each parent level to see try and get as many parent step levels on the same page // The following logic will walk up to each parent level to see try and get as many parent step levels on the same page
// as the Table. // as the Table.
@ -1072,7 +1072,7 @@ namespace Volian.Print.Library
{ {
vlnParagraph paraBreak2 = FindPageBreak(yStart, ySpaceOnCurPage - (SixLinesPerInch + accountForCalvertAlarmConditionResponseFooter), yLowerLimit, vlnParagraph paraBreak2 = FindPageBreak(yStart, ySpaceOnCurPage - (SixLinesPerInch + accountForCalvertAlarmConditionResponseFooter), yLowerLimit,
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop);
if (paraBreak2 != null && paraBreak != paraBreak2) if (paraBreak2 != null && paraBreak != paraBreak2)
{ {
yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - paraBreak2.Height)); yLoc = ySpaceOnCurPage - (paraBreak2.YOffset - (YTopMost + yTop - paraBreak2.Height));
@ -1093,7 +1093,7 @@ namespace Volian.Print.Library
{ {
vlnParagraph paraBreak3 = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter, yLowerLimit + 144, vlnParagraph paraBreak3 = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter, yLowerLimit + 144,
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop);
if (paraBreak3 != null) if (paraBreak3 != null)
{ {
float yLoc3 = ySpaceOnCurPage - (paraBreak3.YOffset - (YTopMost + yTop)); float yLoc3 = ySpaceOnCurPage - (paraBreak3.YOffset - (YTopMost + yTop));
@ -1153,7 +1153,7 @@ namespace Volian.Print.Library
else if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro && accountForCalvertAlarmConditionResponseFooter == 0) else if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro && accountForCalvertAlarmConditionResponseFooter == 0)
{ {
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - vlnPrintObject.SixLinesPerInch * 4, yLowerLimit, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - vlnPrintObject.SixLinesPerInch * 4, yLowerLimit, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop);
if (paraBreak.MyItemInfo.MyPrevious == null) if (paraBreak.MyItemInfo.MyPrevious == null)
if (paraBreak.MyParent.ChildrenAbove.Count > 0) if (paraBreak.MyParent.ChildrenAbove.Count > 0)
paraBreak = paraBreak.MyParent.ChildrenAbove[0]; paraBreak = paraBreak.MyParent.ChildrenAbove[0];
@ -1246,7 +1246,7 @@ namespace Volian.Print.Library
float ySpaceAt7LPI = ((ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter) * SixLinesPerInch / _SevenLinesPerInch) - _SevenLinesPerInch; float ySpaceAt7LPI = ((ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter) * SixLinesPerInch / _SevenLinesPerInch) - _SevenLinesPerInch;
vlnParagraph paraBreak7 = FindPageBreak(yStart, ySpaceAt7LPI, yLowerLimit, vlnParagraph paraBreak7 = FindPageBreak(yStart, ySpaceAt7LPI, yLowerLimit,
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly, yTop);
if (paraBreak7 != null && paraBreak7.YOffset > paraBreak.YOffset && paraBreak.MyItemInfo.StepLevel >= paraBreak7.MyItemInfo.StepLevel) if (paraBreak7 != null && paraBreak7.YOffset > paraBreak.YOffset && paraBreak.MyItemInfo.StepLevel >= paraBreak7.MyItemInfo.StepLevel)
{ {
paraBreak = paraBreak7; paraBreak = paraBreak7;
@ -1452,7 +1452,7 @@ namespace Volian.Print.Library
/// <param name="myList"></param> /// <param name="myList"></param>
/// <returns></returns> /// <returns></returns>
private static vlnParagraph FindPageBreak(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList, vlnParagraph lastBreak, float fullPage, private static vlnParagraph FindPageBreak(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList, vlnParagraph lastBreak, float fullPage,
float myBottomMsgSpace,bool RNOContinueOnly) float myBottomMsgSpace,bool RNOContinueOnly, float yTop)
{ {
vlnParagraph minPara = null; vlnParagraph minPara = null;
//StringBuilder minBuff = new StringBuilder(); //StringBuilder minBuff = new StringBuilder();
@ -1588,8 +1588,13 @@ namespace Volian.Print.Library
// B2020-013 premature break in RNO column - Callaway OTO-AC-00002 step 2 // B2020-013 premature break in RNO column - Callaway OTO-AC-00002 step 2
// B2020-016 for Robinson AOP-010 step 27 was breaking too soon // B2020-016 for Robinson AOP-010 step 27 was breaking too soon
// B2020-073 was not keeping all of RNO sub-step together - Comanche Peak FRC-0.1 (unit 1) Step 14 // B2020-073 was not keeping all of RNO sub-step together - Comanche Peak FRC-0.1 (unit 1) Step 14
if ((-yLocation + yStart) >= yLowerLimit && !myPara.HasSecondRNOThatWillFit(yStart, yLowerLimit, yUpperLimit, myList, stepLevel)) // Only if it is more than the lower limit // B2020-081 was breaking on an AER substep that has an long RNO - should keep AER substep and part of RNO on the page = D.C. Cook "Current (Post FLEX) U1 NOP NOT [EOPs]" set, ES-0.1 step 1.
return myPara; if ((-yLocation + yStart) >= yLowerLimit)
{
vlnParagraph rnoChild = myPara.HasSecondRNOThatWillFit(yStart, yLowerLimit, yUpperLimit, myList, stepLevel, yTop); // Only if it is more than the lower limit
if (rnoChild != null)
return rnoChild;
}
// B2019-103, B2019-114 Break at a step if the step will fit on a page by itself and it will // B2019-103, B2019-114 Break at a step if the step will fit on a page by itself and it will
// not fit in the current page // not fit in the current page
float yAdjustLastSubStep = 0; float yAdjustLastSubStep = 0;
@ -1637,35 +1642,53 @@ namespace Volian.Print.Library
// B2020-013 premature break in RNO column - Callaway OTO-AC-00002 step 2 // B2020-013 premature break in RNO column - Callaway OTO-AC-00002 step 2
// B2020-016 bad pagination on RNOs for Robinson AOP-010 step 27 , AOP-024 Step 10, EOP E-0 step 10, EOP ECA-2.1 step 28 // B2020-016 bad pagination on RNOs for Robinson AOP-010 step 27 , AOP-024 Step 10, EOP E-0 step 10, EOP ECA-2.1 step 28
// B2020-073 was not keeping all of RNO sub-step together - Comanche Peak FRC-0.1 (unit 1) Step 14 // B2020-073 was not keeping all of RNO sub-step together - Comanche Peak FRC-0.1 (unit 1) Step 14
private bool HasSecondRNOThatWillFit(float yStart, float yLowerLimit, float yUpperLimit, StepLevelList myList, int stepLevel) // B2020-081 was breaking on an AER substep that has an long RNO - should keep AER substep and part of RNO on the page = D.C. Cook "Current (Post FLEX) U1 NOP NOT [EOPs]" set, ES-0.1 step 1.
private vlnParagraph HasSecondRNOThatWillFit(float yStart, float yLowerLimit, float yUpperLimit, StepLevelList myList, int stepLevel, float yTop)
{ {
if (!MyItemInfo.IsInRNO || stepLevel+1 >= myList.Count) // note: "this" is the myPara from where this method is called
return false; // does not have second RNO if (!MyItemInfo.IsInRNO || MyItemInfo.GetMaxRNOLevels <= 1) // GetMaxRNOLevels will get the greatest (lowest) RNO level in the step
return this; // does not have second (more than one) RNO - break at the myPara
// see if there is a second RNO then see if it will fit on the page
vlnParagraph tmp = this; vlnParagraph tmp = this;
// see there there is a second RNO then see if it will fit on the page while (!tmp.MyItemInfo.IsRNOPart) tmp = tmp.MyParent; // if on a substep of an RNO, move up the substep's parent (RNO)
while (!tmp.MyItemInfo.IsRNOPart) tmp = tmp.MyParent; vlnParagraph parent = tmp;
if (tmp.MyItemInfo.RNOs != null && tmp.MyItemInfo.RNOs.Count > 0) while (parent.MyParent != null && !parent.MyParent.MyItemInfo.IsSection) parent = parent.MyParent; // this will take us to the High level step
{ float yTopParent = parent.YTopMost; // this is where the HLS starts printing
int maxLevel = 1; if (this.MyItemInfo.IsRNOPart && this.MyItemInfo.RNOLevel > 1)
foreach (int lev in myList.Keys) // B2020-078 Don't include the highest step level if ((this.YTopMost - yTopParent + yStart - yTop + this.YSize) > yUpperLimit)
maxLevel = Math.Max(lev, maxLevel);
// B2020-077 This was changed from a standard for loop (for int i = 0 to myList.Count) since there can be
// gaps in the list of step levels.
foreach (int lev in myList.Keys) // loop thru the other step levels
{ {
if (lev > stepLevel && lev < maxLevel)// B2020-078 Don't include the highest step level foreach (vlnParagraph chld in parent.ChildrenBelow)
{ if (YBottomMostExcludingRNO(chld) > this.YTopMost)
foreach (float yLocation in myList[lev].Keys) // loop thru yLocation from pagination list return null; // the AER text overlaps the RNO text - DON'T use the myPara and keep looking instead
{ return this; // myPara is an RNO and the entire RNO will fit
if ((tmp != myList[lev][yLocation] && myList[lev][yLocation].MyItemInfo.IsRNOPart) ||
(myList[lev][yLocation].MyParent != tmp) && myList[lev][yLocation].MyParent.MyItemInfo.IsRNOPart)
return true; // has a second RNO that will fit
}
}
} }
}
return false; // check the children of the myPara and see if it has an RNO that will fit
foreach (vlnParagraph chld in tmp.ChildrenBelow)
if (chld.MyItemInfo.IsRNOPart)
if ((chld.YTopMost + yStart + yTop - yTopParent) > yLowerLimit)
if ((chld.YTopMost + yStart + yTop - yTopParent) < yUpperLimit)
return chld; // second RNO will fit, use this instead of myPara
// check to see if there is AER substep children that would be spit if we pagination on the RNO
foreach (vlnParagraph chld in parent.ChildrenBelow)
if (YBottomMostExcludingRNO(chld) > this.YTopMost)
return null; // the AER text positioning overlaps the RNO text positioning (caused AER sub-steps to be split onto next page (i.e. RO step) have pagination logic keep looking for place to break
return this; // current myPara is good
} }
// B2020-081 used in HasSecondRNOThatWillFit() get the size of the AER and its substeps
private float YBottomMostExcludingRNO(vlnParagraph chld)
{
float maxBottomMost = chld.YBottom;
foreach (vlnParagraph gChld in chld.ChildrenBelow)
if (gChld.MyItemInfo.IsRNOPart == false)
maxBottomMost = Math.Max(maxBottomMost, YBottomMostExcludingRNO(gChld));
return maxBottomMost;
}
private static bool StepWillFitOnBlankPageButNotOnCurrentPage(vlnParagraph myPara, float yLocation, float yStart,float fullPage) private static bool StepWillFitOnBlankPageButNotOnCurrentPage(vlnParagraph myPara, float yLocation, float yStart,float fullPage)
{ {
// B2019-150 & B2019-151 Pagination Bugs Seen for Summer EOP4.1 Step 10 and // B2019-150 & B2019-151 Pagination Bugs Seen for Summer EOP4.1 Step 10 and