Index: BL/Prod/VoorraadTelling.cls.xml =================================================================== diff -u -r40246 -r73690 --- BL/Prod/VoorraadTelling.cls.xml (.../VoorraadTelling.cls.xml) (revision 40246) +++ BL/Prod/VoorraadTelling.cls.xml (.../VoorraadTelling.cls.xml) (revision 73690) @@ -81,6 +81,16 @@ 1 + +BL.Sys.FOP.DocBaseV7Helper +1 + + + +BL.Sys.FOP.DocBaseDirectoryUtils +1 + + 1 @@ -724,7 +736,7 @@ ]]> - + pxDoc:BL.Prod.sub.pxVoorraadTelSettings,Printer:%String 1 1 @@ -760,6 +772,132 @@ ]]> + +pxDoc:BL.Prod.sub.pxVoorraadTelSettings,Printer:%String +1 +1 + + + + + +NEW method : use with DocBase v7 on DocBase01-DEV/ACP/PRD +pxDoc:BL.Prod.sub.pxVoorraadTelSettings,Printer:%String +1 +1 +")_"_"_pxDoc.TellingOms_".pdf" + #dim FilePathOnShared As %String = $$FULLPAD^vhDEV($$DIRUSER^vhDEV(),FileName) + If (FilePathOnShared = "") || ($L(FilePathOnShared,"\")<=2) { + Do ##class(TECH.ExceptionHandler).Throw(##class(TECH.Exceptions.GeneralErrorException).%New("Kon geen correct pad genereren om '"_pxDoc_"' te printen naar printer '"_Printer_"'. Pad : '"_FilePathOnShared_"'")) + } + Do Logger.Info("PrintOne","Print naar bestand : "_FilePathOnShared) + + #dim DirectoryOnDfs As %String = ..DocBaseDirectoryUtils.GeefPDFTestDir() ; Indien DFS problemen geeft, gebruik dan effe "\\Notes01\FOP\TestOutput\CacheTst2010\" + #dim FilePathOnDfs As %String = ##class(TECH.Files).AppendFile(DirectoryOnDfs,FileName) + #dim sc As %Status = $$$OK + + // 1. RenderAndFile via DFS + Set sc=..blVoorraadtellingDoc.RenderAndFile(..pxDocList,FilePathOnDfs) + Do ##class(TECH.Exceptions.StatusException).ThrowIndienNietOK(sc,"Error while generating 'VoorraadTellingDoc'. Failed to create DocBase task for '"_FileName_"'.") + + // 2. Wait until caché can see + #dim lbWaitSeconds = $ListBuild(1,1,1,1,2,2,3,4,5,5,5) + #dim blnFileExists As %Boolean = ##class(TECH.Files).WaitUntilFileExists(FilePathOnDfs, lbWaitSeconds, Logger, "Render VoorraadTellingDoc", "RenderAndFile.FilePath: ") + Do:($$$Not(blnFileExists)) ##class(TECH.Exceptions.GeneralErrorException).Throw("Error while generating 'VoorraadTellingDoc' for '"_FileName_"'. After DocBase task 'RenderAndFile' caché-server could not find file '"_FilePathOnDfs_"'. ") + + // 3. Print file (from DFS) to Printer --> 2 gekende problemen : zie (*) + Do ##class(BL.Sys.FOP.CommonTasks).PrintPDF(FilePathOnDfs,Printer,1) + Do ##class(TECH.Exceptions.StatusException).ThrowIndienNietOK(sc,"Error while generating 'VoorraadTellingDoc'. DocBase failed to print file '"_FilePathOnDfs_"'.") + + // 4. Copy file to Shared-dir + Do ##class(TECH.Files).CopyFile(FilePathOnDfs,FilePathOnShared) + + // 5. Clean up file on DFS + #dim IsFileDeleted As %Integer = 0 ; ##class(TECH.File).Delete(FilePathOnDfs) + Do Logger.Info("PrintOne","Opkuis VoorraadTellingDoc : bestand : '"_FilePathOnDfs_"' is "_$S(IsFileDeleted=1 :"verwijderd.", 1:"NIET verwijderd (result='"_IsFileDeleted_"'")) + + Do ..pxDocList.Settings.Clear() + + Quit sc +]]> + + + + +NEW method : use with DocBase v7 on DocBase01-DEV/ACP/PRD +pxDoc:BL.Prod.sub.pxVoorraadTelSettings,Printer:%String +1 +1 +")_"_"_pxDoc.TellingOms_".pdf" + #dim FilePathOnShared As %String = $$FULLPAD^vhDEV($$DIRUSER^vhDEV(),FileName) + If (FilePathOnShared = "") || ($L(FilePathOnShared,"\")<=2) { + Do ##class(TECH.ExceptionHandler).Throw(##class(TECH.Exceptions.GeneralErrorException).%New("Kon geen correct pad genereren om '"_pxDoc_"' te printen naar printer '"_Printer_"'. Pad : '"_FilePathOnShared_"'")) + } + Do Logger.Info("PrintOne","Print naar bestand : "_FilePathOnShared) + + #dim DirectoryOnDfs As %String = ..DocBaseDirectoryUtils.GeefPDFTestDir() ; Indien DFS problemen geeft, gebruik dan effe "\\Notes01\FOP\TestOutput\CacheTst2010\" + #dim FilePathOnDfs As %String = ##class(TECH.Files).AppendFile(DirectoryOnDfs,FileName) + #dim sc As %Status = $$$OK + + // 1a. RenderAndPrint (in PostScript formaat) + Set sc=..blVoorraadtellingDoc.RenderAndPrint(..pxDocList,Printer) + Do ##class(TECH.Exceptions.StatusException).ThrowIndienNietOK(sc,"Error while generating 'VoorraadTellingDoc'. Failed to create DocBase task for printer '"_Printer_"'.") + + // 1b. RenderAndFile via DFS + Set sc=..blVoorraadtellingDoc.RenderAndFile(..pxDocList,FilePathOnDfs) + Do ##class(TECH.Exceptions.StatusException).ThrowIndienNietOK(sc,"Error while generating 'VoorraadTellingDoc'. Failed to create DocBase task for '"_FileName_"'.") + + // 2. Wait until caché can see + #dim lbWaitSeconds = $ListBuild(1,1,1,1,2,2,3,4,5,5,5) + #dim blnFileExists As %Boolean = ##class(TECH.Files).WaitUntilFileExists(FilePathOnDfs, lbWaitSeconds, Logger, "Render VoorraadTellingDoc", "RenderAndFile.FilePath: ") + Do:($$$Not(blnFileExists)) ##class(TECH.Exceptions.GeneralErrorException).Throw("Error while generating 'VoorraadTellingDoc' for '"_FileName_"'. After DocBase task 'RenderAndFile' caché-server could not find file '"_FilePathOnDfs_"'. ") + + // 3. Print file (from DFS) to Printer --> 2 gekende problemen : zie (*) + ;Do ##class(BL.Sys.FOP.CommonTasks).PrintPDF(FilePathOnDfs,Printer,1) + ;Do ##class(TECH.Exceptions.StatusException).ThrowIndienNietOK(sc,"Error while generating 'VoorraadTellingDoc'. DocBase failed to print file '"_FilePathOnDfs_"'.") + + // 4. Copy file to Shared-dir + Do ##class(TECH.Files).CopyFile(FilePathOnDfs,FilePathOnShared) + + // 5. Clean up file on DFS + #dim IsFileDeleted As %Integer = ##class(TECH.File).Delete(FilePathOnDfs) + Do Logger.Info("PrintOne","Opkuis VoorraadTellingDoc : bestand : '"_FilePathOnDfs_"' is "_$S(IsFileDeleted=1 :"verwijderd.", 1:"NIET verwijderd (result='"_IsFileDeleted_"'")) + + Do ..pxDocList.Settings.Clear() + + Quit sc + + /* + Gekende problemen bij Print file (from DFS) to Printer : + - [OK] Printer moet PDF ondersteunen; + - [OK] hoe DFS aan DocBase doorgeven : Log van DocBase : Error occurred while trying to read 'file:///\\vanhoecke.be\APPS\DEV\DocBase\PDFTest\VoorraadTel_onbekend_TestByWimV.pdf'. + - [CHECK] Als punt 3 de printopdracht is (lees: Zet FopTaak op de FopQueue en ga voort), dan volgt meteen punt 4 en 5, zijnde kopieer en kuis op. Dus als de opkuis eerder gebeurt dan + dat DocBase begint te printen, dan is de file weg en zal DocBase fout geven "file not found" ! + Conclusie : misschien toch eenvoudiger om 2x DocBase aan te roepen : 1x RenderAndPrint (.PS-formaat) en 1x RenderAndFile (.PDF) + */ +]]> + + Controleert of er zones zijn die in beide lijsten staan