Made CreatePlot public so I could access it in the generation of the Complete RO Report

Logic for Complete RO Report
This commit is contained in:
2015-01-27 20:58:36 +00:00
parent ae31f8bf34
commit 246e09e0da
3 changed files with 157 additions and 142 deletions

View File

@@ -192,10 +192,14 @@ namespace Volian.Controls.Library
EnableOrDisablePrintButton();
cmbxROUsageSort.SelectedIndex = 0;
tabTransitionReports.Visible = false;
cbxComplete.Enabled = false;
cbxComplete.Enabled = true;
cbxSummary.Enabled = true;
cbxIncldMissingROs.Checked = true;
cbxIncldMissingROs.Enabled = cbxROUsage.Checked;
if (cbxROUsage.Checked)
cbxIncldMissingROs.Text = "Include Missing ROs";
else if (cbxComplete.Checked)
cbxIncldMissingROs.Text = "Include Empty RO Fields";
cbxIncldMissingROs.Checked = !cbxSummary.Checked;
cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked;
}
public void SelectReferencedObjectTab()
@@ -242,6 +246,12 @@ namespace Volian.Controls.Library
btnPrintReport.Enabled = ((cbxComplete.Checked || cbxSummary.Checked) && lstCheckedROs.Count > 0);
break;
}
if (cbxROUsage.Checked)
cbxIncldMissingROs.Text = "Include Missing ROs";
else if (cbxComplete.Checked)
cbxIncldMissingROs.Text = "Include Empty RO Fields";
cbxIncldMissingROs.Checked = cbxROUsage.Checked || cbxComplete.Checked;
cbxIncldMissingROs.Visible = cbxROUsage.Checked || cbxComplete.Checked;
}
private void tabTransitionReports_Click(object sender, EventArgs e)
@@ -258,7 +268,6 @@ namespace Volian.Controls.Library
xpSetToReport.Enabled = cbxROUsage.Checked;
xpSetToReport.Expanded = cbxROUsage.Checked;
cmbxROUsageSort.Enabled = cbxROUsage.Checked;
cbxIncldMissingROs.Enabled = cbxROUsage.Checked;
xpSelROs.Enabled = true;
xpSelROs.Expanded = true;
EnableOrDisablePrintButton();
@@ -269,7 +278,6 @@ namespace Volian.Controls.Library
xpSetToReport.Enabled = cbxROUsage.Checked;
xpSetToReport.Expanded = cbxROUsage.Checked;
cmbxROUsageSort.Enabled = cbxROUsage.Checked;
cbxIncldMissingROs.Enabled = cbxROUsage.Checked;
// reset the RO tree and clear anything that was selected
advTreeROFillIn(true);
lstCheckedROs.Clear();
@@ -392,8 +400,6 @@ namespace Volian.Controls.Library
{
foreach (DocVersionInfo dv in fi.FolderDocVersions)
{
//if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft)
//{
DevComponents.AdvTree.Node newnode = new DevComponents.AdvTree.Node();
newnode.Text = dv.ToString();
newnode.Tag = dv;
@@ -403,7 +409,6 @@ namespace Volian.Controls.Library
newnode.CheckBoxThreeState = false;
newnode.CheckBoxVisible = true;
par.Nodes.Add(newnode);
//}
}
}
}
@@ -418,7 +423,6 @@ namespace Volian.Controls.Library
if (lstCheckedDocVersions.Count == 1)//Mydocversion == null)
{
Mydocversion = (DocVersionInfo)n.Tag;
//advTreeStepTypesFillIn();
}
}
else
@@ -430,7 +434,6 @@ namespace Volian.Controls.Library
if (Mydocversion != lstCheckedDocVersions[0])
{
Mydocversion = lstCheckedDocVersions[0];
//advTreeStepTypesFillIn();
}
}
else
@@ -460,21 +463,12 @@ namespace Volian.Controls.Library
private void advTreeProcSets_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
{
DevComponents.AdvTree.Node n = advTreeProcSets.SelectedNode;
//if (advTreeStepTypes.Nodes.Count == 1 && n.Checked)
//{
// Mydocversion = (DocVersionInfo)n.Tag;
// advTreeStepTypesFillIn();
//}
}
private void advTreeProcSetsPreSelect()
{
bool keeplooking = true;
//build a stack (bread crumb trail) of where is procedure set came from within the tree.
Stack<string> crumbs = new Stack<string>();
//crumbs.Push(Mydocversion.Name); // ex: "working draft"
//crumbs.Push(Mydocversion.MyFolder.Name); // ex: "Emergency Procedures"
//crumbs.Push(Mydocversion.MyFolder.MyParent.Name); // ex: "STPNOC-South Texas"
//crumbs.Push(advTreeProcSets.Nodes[0].Text); //top node of my tree
crumbs.Push(Mydocversion.Name); // ex: "working draft"
crumbs.Push(Mydocversion.MyFolder.Name); // ex: "Emergency Procedures"
@@ -524,19 +518,14 @@ namespace Volian.Controls.Library
public void advTreeROFillIn(bool blSeachTabClicked)
{
DevComponents.AdvTree.Node topnode = null;
int cntnd = 0;
//VETreeNode vtn = VETreeNode.GetFolder(1);
//FolderInfo fi = vtn.VEObject as FolderInfo;
//int fiCount = fi.ChildFolderCount;
advTreeRO.Nodes.Clear();
if (_MyROFSTLookup == null) return;
advTreeRO.BeforeExpand +=new AdvTreeNodeCancelEventHandler(advTreeRO_BeforeExpand);
advTreeRO.AfterExpand += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse);
advTreeRO.AfterCollapse += new AdvTreeNodeEventHandler(advTreeRO_AfterExpandorCollapse);
//lstCheckedDocVersions.Clear();
topnode = new DevComponents.AdvTree.Node();
topnode.Text = "All Referenced Objects";
topnode.Tag = null;//fi;
topnode.Tag = null;
topnode.CheckBoxVisible = true;
advTreeRO.Nodes.Add(topnode);
@@ -547,7 +536,6 @@ namespace Volian.Controls.Library
tn.Tag = _MyROFSTLookup.myHdr.myDbs[i];
tn.CheckBoxVisible = true;
topnode.Nodes.Add(tn);
//cmboTreeROs.Nodes.Add(tn);
AddDummyGroup(_MyROFSTLookup.myHdr.myDbs[i], tn);
}
@@ -649,7 +637,6 @@ namespace Volian.Controls.Library
tmp.CheckBoxVisible = true;
int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp);
//tn.Nodes.Add(tmp);
DevComponents.AdvTree.Node sub = new DevComponents.AdvTree.Node();
sub.Text = "VLN_DUMMY_FOR_TREE";
tmp.Nodes.Add(sub);
@@ -662,7 +649,6 @@ namespace Volian.Controls.Library
tmp.CheckBoxVisible = true;
int index = FindIndex(tn.Nodes, tmp.Text);
tn.Nodes.Insert(index, tmp);
//tn.Nodes.Add(tmp);
}
}
}
@@ -817,16 +803,30 @@ namespace Volian.Controls.Library
MessageBox.Show("Could not find associated path for ro data.","No RO Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
return "";
}
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" " + "\"" + ROList + "\"";
//string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" " + "\"" + ROList + "\"";
if (!Directory.Exists(MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath))
{
MessageBox.Show(string.Format("RO Database directory does not exist: {0}", MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath));
return "";
}
string cmpRptExePath = roapp.Substring(0, roapp.LastIndexOf("\\")) + "\\CmpRpt.exe ";
roDataFile = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\\" + roDataFile;
try
{
System.Diagnostics.Process.Start(cmpRptExePath, roloc);
if (File.Exists(roDataFile)) File.Delete(roDataFile);
Application.DoEvents();
string fname = VlnSettings.TemporaryFolder + "\\ROCompleteRprt.txt";
FileInfo fi = new FileInfo(fname);
using (StreamWriter sw = fi.CreateText())
{
sw.Write(ROList);
sw.Close();
}
string roloc = "\"" + MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\" \"/f=" + fname + "\"";
System.Diagnostics.Process p = System.Diagnostics.Process.Start(cmpRptExePath, roloc);
// need to wait, sometimes the Print.tmp file that is generated is not available
p.WaitForExit(); // without arguments, this will wait indefinately
}
catch (Exception ex)
{
@@ -835,7 +835,6 @@ namespace Volian.Controls.Library
string tmpmsg = ex.Message;
MessageBox.Show(tmpmsg, "RO Report Error: " + ex.GetType().Name);
}
roDataFile = MyDVI.DocVersionAssociations[0].MyROFst.MyRODb.FolderPath + "\\" + roDataFile;
return roDataFile;
}
private void btnPrintReport_Click(object sender, EventArgs e)
@@ -852,7 +851,7 @@ namespace Volian.Controls.Library
GenerateROList();
string ROList = GetListOfROs(false);//don't include the RODbID in the RO list
string roDataFile = BuildRODataFile(ROList);
OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, cbxComplete.Checked));
OnPrintRequest(new DisplayReportsEventArgs("Complete RO Report", "Complete RO Report", roDataFile, MyROFSTLookup, cbxComplete.Checked, this.Mydocversion.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, cbxIncldMissingROs.Checked));
}
else if (cbxROUsage.Checked)
{
@@ -860,7 +859,6 @@ namespace Volian.Controls.Library
GenerateROList();
string SearchString = GetListOfROs(true);// Include the RODbID in the RO list
ItemInfoList SearchResults = ItemInfoList.GetListFromROReport(DocVersionList, "", SearchString, "");
//OnPrintRequest(new DisplaySearchEventArgs(ReportTitle, TypesSelected, SearchString, lbSrchResults.DataSource as ICollection<ItemInfo>));
if (!usageSortedByProcedure) // sort on ROs
{
Csla.SortedBindingList<ItemInfo> sortedResults = new Csla.SortedBindingList<ItemInfo>(SearchResults);
@@ -938,6 +936,20 @@ namespace Volian.Controls.Library
get { return _IncludeMissingROs; }
set { _IncludeMissingROs = value; }
}
private bool _ConvertCaretToDelta = true;
public bool ConvertCaretToDelta
{
get { return _ConvertCaretToDelta; }
set { _ConvertCaretToDelta = value; }
}
private bool _IncludeEmptyROFields = true;
public bool IncludeEmptyROFields
{
get { return _IncludeEmptyROFields; }
set { _IncludeEmptyROFields = value; }
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ICollection<ItemInfo> myItemInfoList, bool sortByProcedure, bool includeMissingROs)
{
// RO Usage Report
@@ -948,12 +960,15 @@ namespace Volian.Controls.Library
_IncludeMissingROs = includeMissingROs;
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, bool completeROReport)
public DisplayReportsEventArgs(string reportTitle, string typesSelected, string roDataFile, ROFSTLookup rofstLookUp, bool completeROReport, bool convertCaretToDelta, bool includeEmptyROFields)
{
_ReportTitle = reportTitle;
_TypesSelected = typesSelected;
_RODataFile = roDataFile;
_CompleteROReport = completeROReport;
_ConvertCaretToDelta = convertCaretToDelta;
_rofstLookup = rofstLookUp;
_IncludeEmptyROFields = includeEmptyROFields;
}
public DisplayReportsEventArgs(string reportTitle, string typesSelected, ROFSTLookup rofstLookUp, List<string> roListForReport)
{