Показать сообщение отдельно
Старый 19.07.2017, 14:29   #1  
iiipoizone is offline
iiipoizone
Участник
 
43 / 11 (1) +
Регистрация: 07.09.2015
Трудности с формированием PDF в пакетном режиме
При формировании PDF файла в пакетном задании происходит остановка службы или просто прерывание выполнения.
Не в пакетном режиме все нормально формируется.


PDF формируется через штатный функционал Report:
X++:
public int print()
{
    int ret;
    this.printJobSettings().suppressScalingMessage(true);
    this.printJobSettings().clientPrintJobSettings().suppressScalingMessage(true);
    if (email)
    {
           this.printJobSettings().setTarget(PrintMedium::File);
           this.printJobSettings().format(PrintFormat::PDF);
           FileName = strfmt(@'\\AOS-01\@Shared\Exchange\TK\%1%2_%3.pdf',"СчетНаОплату",today(),salesPurchReport.getHeaderData().SalesPurchId);
           if (WinapiServer::fileExists(FileName))
           {
                WinapiServer::deleteFile(FileName);
           }
           this.printJobSettings().fileName(FileName);
    }

    info("ret = super()");

    ret = super();
    this.printPDFMail();
    return ret;
}
Текста ошибки никаких не выдается, но путем создания infolog понял по журналу выполнения пакета, что сбой заключается в классе:

SysReportRun который отнаследован от ReportRun

X++:
/* <SYS>
void run(boolean onlyReport = false)
</SYS> */
// <GEEU>
public void run(boolean onlyReport = false)
// </GEEU>
{
    // If this report is a webReport the run a webReport.
    if (webSession() && runBaseReport)
    {
        runBaseReport.runWebReport();
    }
    else
    {
        // When running the report and onlyReport = true then run the report.
        if (!onlyReport && runBaseReport)
        {
            if (runBaseReport.prompt())
            {
                runBaseReport.run();
            }
            // If the prompt returns false the do not run the report.
            // The RunBaseReport.Run method calls the ReportRun.run method with the parm onlyReport = true.
            return;
        }
    }

    this.buildPrintGrandTotal();
    this.buildPrintOnlyTotals();

    // <GEEU>
    this.updateReportDesign_W();

    // </GEEU>
    info("beforeSuper"); // инфолог виден в журнале выполнения
    super(); // Метод в ядре AX. что внутри не понятно =(
     info("AfterSuper");  // До этого инфолога выполнение не доходит
}
У кого-то получалось создавать PDF в пакете?