Index: BL/Flow/Pakbon/Doc.cls.xml =================================================================== diff -u -r61678 -r61689 --- BL/Flow/Pakbon/Doc.cls.xml (.../Doc.cls.xml) (revision 61678) +++ BL/Flow/Pakbon/Doc.cls.xml (.../Doc.cls.xml) (revision 61689) @@ -125,6 +125,9 @@ De Leveringsbon (van handel) is in PDF-bestand reeds beschikbaar (via WebService naar AX) Deze taak zal de pdf printen en pakbon renderen zoals gewoonlijk. +Parameter LeverbonPdfBestandVolledigeNaam : Gebruik steeds netwerkpad (UNC) t.o.v. de Fop-server, dus best '\\fop\FOP\LevBon_Klant\ ... .pdf' +Het bestand zal achteraf opgekuist worden door de FOP-scheduler taak. + Oproepen via : s sc=##class(BL.Flow.Pakbon.Doc).RenderAndPrintPakbonAndPrintLeverbonPdfFile(305229,"VHIP2", LevBonPdfPath) w sc,! 1 @@ -135,34 +138,42 @@ #dim pWithLogo As %Boolean = 0 #dim StaplingMode As %String = "" + #dim sc As %Status = $$$OK If $G(PrinterName) = "" { - ; smijt exception + Set sc = $$$ERROR($$$GeneralError,"Fout bij PrintPakbonEnLeverbon: PrinterName is leeg.") } + Quit:($$$ISERR(sc)) sc + If $$$Not(##class(%File).Exists(LeverbonPdfBestandVolledigeNaam)) { + Set sc = $$$ERROR($$$GeneralError,"Fout bij PrintPakbonEnLeverbon: File does not exist: '"_LeverbonPdfBestandVolledigeNaam_"'.") + } + Quit:($$$ISERR(sc)) sc + #dim blPakbon As BL.Flow.Pakbon.Doc = ..Instantiate() Do blPakbon.Init(DocRef,) Set blPakbon.lbDocs = $LB(BONNr,) Set blPakbon.Printer = PrinterName Set blPakbon.TransformType = "PS" Set blPakbon.lbPPODKeywords = $LB() Set blPakbon.ADBTemplate = blPakbon.GetADBTemplate(0) - + #dim pTraySelect As %String = ##class(BL.Sys.FOP.CommonTasks).GetPrinterTray(blPakbon.Printer,"GEEL","TRAY") #dim pStaplingConfig As %String = ##class(BL.Sys.FOP.CommonTasks).GetStaplingConfig(blPakbon.Printer,.StaplingMode,1) Do blPakbon.XsltParams.SetAt(pWithLogo,"pWithLogo") Do blPakbon.XsltParams.SetAt(pTraySelect,"pTraySelect") Do blPakbon.XsltParams.SetAt(pStaplingConfig,"pStaplingConfig") - - // Create FopTask - #dim Task As Sys.FOP.Task = blPakbon.CreateFopTask("DocRenderPakbonAndPrintPdfFromFile",,) - #dim sc As %Status = blPakbon.DocSetRenderDefs(Task.AddDoc(), ) - ; Add Task to print the pdf LeverbonPdfBestandVolledigeNaam - + // Create FopTask and add Pakbon defs + #dim Task As Sys.FOP.Task = blPakbon.CreateFopTask("DocRenderAndPrintPakbonAndPrintLeverbonPdfFile",,) + Set sc = blPakbon.DocSetRenderDefs(Task.AddDoc(), ) Quit:($$$ISERR(sc)) sc #dim NumCopies As %Integer = 1 Set:($$$ISOK(sc)) sc=Task.AddActionPrint(blPakbon.Printer,NumCopies,,) Quit:($$$ISERR(sc)) sc + + // Also add a Doc with the pdf LeverbonPdfBestandVolledigeNaam + // The system (i.e. Fop Scheduler Task to TaskSequence) is smart enough handle the data, to print the specified file instead of rendering some data + #dim emDoc As Sys.FOP.emDoc = Task.AddMainDoc("PDF",LeverbonPdfBestandVolledigeNaam,,,,,) // Run FopTask Do blPakbon.Close()