Continuous Action Summary logic

This commit is contained in:
John Jenko 2015-10-23 18:21:02 +00:00
parent 7adcafa29b
commit 8ad203006d
4 changed files with 60 additions and 50 deletions

View File

@ -464,6 +464,11 @@ namespace Volian.Controls.Library
{
if (NodeSelect != null) NodeSelect(sender, args);
}
public event vlnTreeViewEvent CreateContinuousActionSummary;
private void OnCreateContinuousActionSummary(object sender, vlnTreeEventArgs args)
{
if (CreateContinuousActionSummary != null) CreateContinuousActionSummary(sender, args);
}
public event vlnTreeViewEvent PrintProcedure;
private void OnPrintProcedure(object sender, vlnTreeEventArgs args)
{
@ -746,6 +751,7 @@ namespace Volian.Controls.Library
cm.MenuItems.Add("New Section", new EventHandler(mi_Click));
if (pri.MyDocVersion.MultiUnitCount > 1)
{
MenuItem micas = new MenuItem("Create Continuous Action Summary");
MenuItem mip = new MenuItem("Print");
MenuItem mia = new MenuItem("Approve");
int k = 0;
@ -756,13 +762,17 @@ namespace Volian.Controls.Library
mp.Tag = k;
MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
ma.Tag = k;
MenuItem mc = micas.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mc.Tag = k;
}
cm.MenuItems.Add(micas);
cm.MenuItems.Add(mip);
cm.MenuItems.Add(mia);
AddApprovedRevisionsMultiUnit(cm.MenuItems, pri);
}
else
{
cm.MenuItems.Add("Create Continuous Action Summary", new EventHandler(mi_Click));
cm.MenuItems.Add("Print", new EventHandler(mi_Click));
cm.MenuItems.Add("Approve", new EventHandler(mi_Click));
AddApprovedRevisions(cm.MenuItems, pri);
@ -1235,6 +1245,9 @@ namespace Volian.Controls.Library
case "Approve Some Procedures for":
OnApproveSomeProcedures(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, mi.Text, (int)mi.Tag));
break;
case "Create Continuous Action Summary":
OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null,0,mi.Text,(int)mi.Tag));
break;
default:
MessageBox.Show(string.Format("Unrecognized Menu Item '{0}'", mip.Text));
break;
@ -1400,6 +1413,9 @@ namespace Volian.Controls.Library
case "Update RO Values":
UpdateROValues(SelectedNode as VETreeNode);
break;
case "Create Continuous Action Summary":
OnCreateContinuousActionSummary(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null,0));
break;
//case "Check Out Procedure Set":
// CheckOutDocVersion(SelectedNode as VETreeNode);
// break;

View File

@ -239,13 +239,13 @@ namespace Volian.Print.Library
get { return _BeforePageNumberPdf; }
set { _BeforePageNumberPdf = value; }
}
public string Print(string pdfFolder, bool makePlacekeeper)
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary)
{
if (_MyItem is ProcedureInfo)
{
if (!(_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier ||
_MyItem.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier))
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
return Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
else
{
// if the plant uses transition modifiers and/or page num in transition format,
@ -253,12 +253,12 @@ namespace Volian.Print.Library
// 2nd pass fills in the page numbers in transitions.
DirectoryInfo di = new DirectoryInfo(pdfFolder + @"\PageNumberPass1");
if (!di.Exists) di.Create();
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder + @"\PageNumberPass1", false);
string retstr = Print(_MyItem as ProcedureInfo, pdfFolder + @"\PageNumberPass1", false, false);
if (retstr == null) return null;
BeforePageNumberPdf = retstr;
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
if (TransPageNumProblems.Count > 0)
{
if (BatchPrint || ( MessageBox.Show("Page Number Transitions may be fixed if a second pass is performed. Do you want to perform a second pass?", "Page Number Transition Errors", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
@ -273,7 +273,7 @@ namespace Volian.Print.Library
RefreshPageNumber(_MyItem);
ProcedureInfo.RefreshPageNumTransitions(_MyItem as ProcedureInfo);
_MyReaderHelper = new ReaderHelper(this);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper);
retstr = Print(_MyItem as ProcedureInfo, pdfFolder, makePlacekeeper, makeContinuousActionSummary);
}
}
return retstr;
@ -518,7 +518,7 @@ namespace Volian.Print.Library
set { PromsPrinter._MyFoldoutReader = value; }
}
private static List<SectionInfo> _MyFoldoutSection = null;
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper)
private string Print(ProcedureInfo myProcedure, string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary)
{
int profileDepth = ProfileTimer.Push(">>>> PromsPrinter.Print");
if (_TransPageNumProblems == null) _TransPageNumProblems = new List<string>();
@ -540,7 +540,7 @@ namespace Volian.Print.Library
// if floating foldouts, need a list of sections & foldoutreaders. Just do first for now.
_MyFoldoutSection.Add(mySection);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false);
string foldoutPdf = PrintProcedureOrFoldout(myProcedure, mySection, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\Foldout" + cnt.ToString() + @".pdf", false, false);
_MyFoldoutReader.Add(foldoutPdf != null ? new PdfReader(foldoutPdf) : null);
cnt++;
}
@ -557,7 +557,7 @@ namespace Volian.Print.Library
return null;
}
}
string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper);
string retval = PrintProcedureOrFoldout(myProcedure, null, outputFileName, makePlacekeeper, makeContinuousActionSummary);
ProfileTimer.Pop(profileDepth);
return retval;
}
@ -592,7 +592,7 @@ namespace Volian.Print.Library
set { _AllowAllWatermarks = value; }
}
private PdfReader readerWord;
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper)
private string PrintProcedureOrFoldout(ProcedureInfo myProcedure, SectionInfo myFoldoutSection, string outputFileName, bool makePlacekeeper, bool makeContinuousActionSummary)
{
int profileDepth = ProfileTimer.Push(">>>> PrintProcedureOrFoldout");
Rtf2Pdf.TextAtCounter = 0;
@ -837,6 +837,14 @@ namespace Volian.Print.Library
if (_MyHelper.MyPlacekeepers.Count > 0)
MyPlacekeeper = new Placekeeper(_MyHelper.MyPlacekeepers, pkFont);
}
// Generate the Continuous Action Summary
if (_MyHelper != null && makeContinuousActionSummary)
{
// Set the font for the Continue Action Summary
VE_Font pkFont = myProcedure.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.ContinuousActionSummaryData.Font; // uses font defined in the format or uses what is definced in BaseAll format
if (_MyHelper.MyContActSteps.Count > 0)
MyContActSummary = new ContinuousActionSummary(_MyHelper.MyContActSteps, pkFont);
}
_MyHelper = null;
ProfileTimer.Pop(profileDepth);
return outputFileName;
@ -856,6 +864,15 @@ namespace Volian.Print.Library
get { return _MyPlacekeeper; }
set { _MyPlacekeeper = value; }
}
private ContinuousActionSummary _MyContActSummary = null;
public ContinuousActionSummary MyContActSummary
{
get { return _MyContActSummary; }
set { _MyContActSummary = value; }
}
public void CreateWordDocPdf(PdfContentByte cb, SectionInfo mySection)
{
if (mySection.PageNumber == -1) // If page num transition goes to a section, need the pagenumber of section.
@ -1458,7 +1475,9 @@ namespace Volian.Print.Library
{
localYPageStart = myParagraph.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
if (myParagraph.MyPlaceKeeper != null)
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper);
_MyHelper.MyPlacekeepers.Add(myParagraph.MyPlaceKeeper); // add this step text to the PlaceKeeper (Calvert Cliffs)
if (myParagraph.MyContAct != null)
_MyHelper.MyContActSteps.Add(myParagraph.MyContAct); // add this step to the Continuous Action Summary
}
else if (!myItemInfo.MyDocStyle.OptionalSectionContent)
PrintTextMessage(cb, "No Section Content", _TextLayer);

View File

@ -26,6 +26,11 @@ namespace Volian.Print.Library
{
get { return _MyPlacekeepers; }
}
private pkParagraphs _MyContActSteps = new pkParagraphs();
public pkParagraphs MyContActSteps
{
get { return _MyContActSteps; }
}
private float? _BottomContent = null;// RHM20150525 - Table Scrunch
public float? BottomContent
{

View File

@ -2746,8 +2746,12 @@ namespace Volian.Print.Library
if (KeepOnParentLine(itemInfo)) yoff = parent.YOffset;
}
float yOffOrig = yoff;
// Save step text information to be used to create a PlaceKeeper (Calver Cliffs)
BuildPlacekeeper(parent, itemInfo);
//BuildContinuousActionSummary(parent, itemInfo); - under construction - jsj
// Save step text information to be used to create a Continuous Action Summary
BuildContinuousActionSummary(parent, itemInfo);
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
_MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
@ -3886,55 +3890,21 @@ namespace Volian.Print.Library
private void BuildContinuousActionSummary(vlnParagraph parent, ItemInfo itemInfo)
{
if (itemInfo.InList(41553,41472,41447))
Console.WriteLine("Stop");
//if (itemInfo is SectionInfo) //&& (itemInfo as SectionInfo).SectionConfig.Section_Placekeeper.ToUpper() != "N") // if is a section type and the section is marked to create placekeeper
//{
// MyContAct = new pkParagraph(this);
// if (parent != null && parent.MyItemInfo.IsSection)
// parent.MyContAct = MyContAct;
//}
//else if (parent != null && parent.MyContAct != null && itemInfo is StepInfo)//InList(parent.MyItemInfo.ItemID, 513, 514, 519, 520, 525))
//{
// StepConfig sc = itemInfo.MyConfig as StepConfig;
// if (sc != null && sc.Step_CAS == true)
// {
// if (itemInfo.IsCautionPart || itemInfo.IsNotePart)
// MyContAct = parent.MyContAct.AddCautionsAndNotes(this);
// else
// MyContAct = parent.MyContAct.AddChild(this);
// }
//}
if (itemInfo is SectionInfo) //&& (itemInfo as SectionInfo).SectionConfig.Section_Placekeeper.ToUpper() != "N") // if is a section type and the section is marked to create placekeeper
if (itemInfo is SectionInfo)
{
MyContAct = new pkParagraph(this);
if (parent != null && parent.MyItemInfo.IsSection)
parent.MyContAct = MyContAct;
}
else if (itemInfo is StepInfo)//InList(parent.MyItemInfo.ItemID, 513, 514, 519, 520, 525))
else if (itemInfo is StepInfo)
{
StepConfig sc = itemInfo.MyConfig as StepConfig;
if (sc != null && sc.Step_CAS == true)
if ((sc != null && sc.Step_CAS == "True") || ((sc == null || sc.Step_CAS == null) && itemInfo.IncludeOnContActSum))
{
//if (parent != null && parent.MyContAct == null)
// parent.MyContAct = new pkParagraph(parent);
// save this step info for use on the Continuous Action Summary
vlnParagraph tparent = parent;
while (tparent != null && tparent.MyContAct == null)// .MyParent != null && tparent.MyParent.MyContAct == null) //&& tparent.MyParent.MyItemInfo is StepInfo)//tparent.MyParent.MyContAct == null)
{
//if (tparent.MyParent.MyContAct != null)
// tparent.MyContAct = tparent.MyParent.MyContAct.AddChild(tparent);
//else
//{
//}
//if (tparent.MyParent.MyContAct == null)
// tparent.MyParent.MyContAct = new pkParagraph(tparent.MyParent);
//tparent.MyParent.MyContAct.AddChild(tparent);
while (tparent != null && tparent.MyContAct == null)
tparent = tparent.MyParent;
}
//if (parent.MyContAct == null)
//{
// parent.MyContAct = new pkParagraph(parent);
//}
if (parent.MyContAct != null)
{
if (itemInfo.IsCautionPart || itemInfo.IsNotePart)