C2021-063 logic to generate an Alarm Point List text file
This commit is contained in:
parent
7bd4dace4c
commit
74128ed79e
@ -17,16 +17,16 @@ namespace Volian.Print.Library
|
|||||||
private string _Title;
|
private string _Title;
|
||||||
public string Title
|
public string Title
|
||||||
{
|
{
|
||||||
get { return _Title; } // used for pdf outline
|
get { return _Title; } // used for pdf outline
|
||||||
set { _Title = value; }
|
set { _Title = value; }
|
||||||
}
|
}
|
||||||
private int _PageCount; // number of pages in the particular pdf, to aid in determining total page count for merged pdf
|
private int _PageCount; // number of pages in the particular pdf, to aid in determining total page count for merged pdf
|
||||||
public int PageCount
|
public int PageCount
|
||||||
{
|
{
|
||||||
get { return _PageCount; }
|
get { return _PageCount; }
|
||||||
set { _PageCount = value; }
|
set { _PageCount = value; }
|
||||||
}
|
}
|
||||||
private string _PdfFileName; // used for finding the procedure's pdf file to merge
|
private string _PdfFileName; // used for finding the procedure's pdf file to merge
|
||||||
public string PdfFileName
|
public string PdfFileName
|
||||||
{
|
{
|
||||||
get { return _PdfFileName; }
|
get { return _PdfFileName; }
|
||||||
@ -84,7 +84,7 @@ namespace Volian.Print.Library
|
|||||||
_docVersionInfo = dvi;
|
_docVersionInfo = dvi;
|
||||||
}
|
}
|
||||||
// the following merges the procedure pdfs into a single pdf
|
// the following merges the procedure pdfs into a single pdf
|
||||||
public bool DoTheMerge(Dictionary<string, List<int>> MergedLandscapPages)
|
public bool DoTheMerge(Dictionary<string, List<int>> MergedLandscapPages, bool generatePointListFile)
|
||||||
{
|
{
|
||||||
if (MergedPdfs == null)
|
if (MergedPdfs == null)
|
||||||
{
|
{
|
||||||
@ -95,6 +95,14 @@ namespace Volian.Print.Library
|
|||||||
string slashReplace = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_";
|
string slashReplace = _docVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_";
|
||||||
MergedFileName = _folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf";
|
MergedFileName = _folder + @"\" + _docVersionInfo.MyFolder.Name.Replace("/", slashReplace).Replace("\\", slashReplace) + ".pdf";
|
||||||
MergedFileName = ItemInfo.StripRtfFormatting(MergedFileName);
|
MergedFileName = ItemInfo.StripRtfFormatting(MergedFileName);
|
||||||
|
// C2021-063 file name of Alarm Point List file containing Serial Number, Title, and merged Page Number
|
||||||
|
StreamWriter sw = null;
|
||||||
|
string PointListPageNums = MergedFileName.Replace(".pdf", "_PointList.txt");
|
||||||
|
if (generatePointListFile)
|
||||||
|
{
|
||||||
|
FileInfo fi = new FileInfo(PointListPageNums);
|
||||||
|
sw = fi.CreateText();
|
||||||
|
}
|
||||||
PdfWriter writer = null;
|
PdfWriter writer = null;
|
||||||
// see if it can be created and if not, see if it is open and tell user:
|
// see if it can be created and if not, see if it is open and tell user:
|
||||||
try
|
try
|
||||||
@ -117,10 +125,17 @@ namespace Volian.Print.Library
|
|||||||
int mergedPageNumber = 0; // this is the number that will be used for the <page> token (for <page> of <of>)
|
int mergedPageNumber = 0; // this is the number that will be used for the <page> token (for <page> of <of>)
|
||||||
int totalPages = 0; // this is the number that will be used for the <of> token (for <page> of <of>)
|
int totalPages = 0; // this is the number that will be used for the <of> token (for <page> of <of>)
|
||||||
foreach (MergedPdfProc mpp in MergedPdfs) totalPages += mpp.PageCount;
|
foreach (MergedPdfProc mpp in MergedPdfs) totalPages += mpp.PageCount;
|
||||||
bool doPageNum = GetPageOfInfo(); // get the format and location of page number - this can be reused for each procedure
|
bool doPageNum = GetPageOfInfo(); // get the format and location of page number - this can be reused for each procedure
|
||||||
// the MergedPdfs contains a list of all of the procedures' pdfs that will be merged into the final pdf
|
// the MergedPdfs contains a list of all of the procedures' pdfs that will be merged into the final pdf
|
||||||
|
int idxSerialNum = 0; // used to generate the Alarm serial number for Point List file
|
||||||
foreach (MergedPdfProc mpp in MergedPdfs)
|
foreach (MergedPdfProc mpp in MergedPdfs)
|
||||||
{
|
{
|
||||||
|
// C2021-063 write Alarm Point List information to the text file
|
||||||
|
if (generatePointListFile)
|
||||||
|
{
|
||||||
|
// write Serial Number, Title, and Page Number in the Point List file
|
||||||
|
sw.WriteLine("{0}\t{1}\t{2}", idxSerialNum++, mpp.Title, mergedPageNumber + 1);
|
||||||
|
}
|
||||||
string pdffilename = _folder + @"\" + mpp.PdfFileName;
|
string pdffilename = _folder + @"\" + mpp.PdfFileName;
|
||||||
if (!File.Exists(pdffilename))
|
if (!File.Exists(pdffilename))
|
||||||
{
|
{
|
||||||
@ -175,6 +190,12 @@ namespace Volian.Print.Library
|
|||||||
_MyLog.Error(tmp, ex);
|
_MyLog.Error(tmp, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// C2021-063 display the generated Alarm Point List text in NotePad
|
||||||
|
if (generatePointListFile)
|
||||||
|
{
|
||||||
|
sw.Close();
|
||||||
|
System.Diagnostics.Process.Start(PointListPageNums);
|
||||||
|
}
|
||||||
doc.Close();
|
doc.Close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user