C2022-004 Logic to print a Unit Designator Watermark

C2022-004 added Unit Designator Watermark option
C2022-004 added format xml structure for Unit Designator Watermark and a flag to use it on Approval PDFs
This commit is contained in:
2022-02-23 21:01:33 +00:00
parent 4e2b669199
commit b1a39f4a21
4 changed files with 149 additions and 23 deletions

View File

@@ -82,7 +82,7 @@ namespace VEPROMS
get { return _DidAll; }
set { _DidAll = value; }
}
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf)
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor)
{
// B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic
ProcedureInfo MyProcedure = myItem as ProcedureInfo;
@@ -103,13 +103,44 @@ namespace VEPROMS
// if the version number of PROMS is 1.0, then we are running a Demo version.
// When running a Demo version, force a "Sample" watermark when printing.
// B2020-022 append a ".pdf" extension if the file name does on have one.
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF"))?pdfFile:pdfFile+".pdf", insertBlankPages, allOrAuto,Prefix,saveLinks,removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf);
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF"))?pdfFile:pdfFile+".pdf", insertBlankPages, allOrAuto,Prefix,saveLinks,removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf, watermarkColor);
MyPromsPrinter.PromsVersion = (showPROMSVer) ? AboutVEPROMS.PROMSVersion : ""; //C2018-009 print PROMS version
PDFPath = pdfPath;
this.Text = "Creating PDF of " + myItem.DisplayNumber;
_NewLocation = newLocation;
DialogResult = DialogResult.OK;
}
public static void SetUnitWatermark(ProcedureInfo procInfo, ref string waterMarkText, ref string watermarkColor)
{
// C2022-004 BNPP Unit Specific Watermark
// Check if the user selected the "Unit Designator" watermark.
// If the procedure number starts with any of the ProcNumPrefix values (set in the format file) then
// set the Watermark Override text and color variables with the values from the format
if (waterMarkText.ToUpper().Equals("UNIT DESIGNATOR") && procInfo.ActiveFormat.PlantFormat.FormatData.UnitWatermarkList != null)
{
foreach (UnitWatermark uw in procInfo.ActiveFormat.PlantFormat.FormatData.UnitWatermarkList)
{
if (procInfo.DisplayNumber.StartsWith(uw.ProcNumPrefix) || uw.ProcNumPrefix.ToUpper() == "DEFAULT")
{
waterMarkText = uw.WMText;
watermarkColor = uw.WMColor;
break;
}
}
// Check if the watermark is the defined Parent/Child applicability token (field)
// if procedure does not use parent/child, then make the watermark text blank (empty string)
if (waterMarkText.ToUpper() == "[U-TEXT]")
{
string utxt = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Text : "";
waterMarkText = (utxt == null) ? "" : utxt;
}
else if (waterMarkText.ToUpper() == "[U-NUMBER]")
{
string uNum = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Number : "";
waterMarkText = (uNum == null) ? "" : uNum;
}
}
}
// used when the approved function creates an export file with unlinked ROs and Transitons. Word sections that have RO tokens are saved with the RO Vaules in DocReplace
// DocReplace is passed on to the Export functions.
private Dictionary<int, byte[]> _DocReplace;