LedgerJournalEngine.errorExists(voucherNumber) 不报告错误

发布于 2024-11-27 11:06:47 字数 953 浏览 0 评论 0原文

当尝试验证日记帐时,我对日记帐中的每张凭证使用 LedgerJournalEngine ErrorExists。由于某种原因,它无法捕获代码中的所有错误,但如果我使用客户端中的验证按钮,错误将显示在信息日志中。

有没有更好的方法来验证日记中的凭证?

changecompany(ledgerJournalTable.dataAreaId)
{
    ledgerJournalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::Yes,NoYes::No);
    lje = LedgerJournalEngine::construct(ledgerJournalTable.JournalType);
    lje.newJournalActive(ledgerJournalTable,true);
    ledgerJournalCheckPost.parmLedgerJournalEngine(lje);
    try
    {
        ledgerJournalCheckPost.run();
    }
    catch
    {
        ledgerJournalCheckPost.validate();
        while select ledgerJournalTrans where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum
        {
            if(lje.errorExists(ledgerJournalTrans.Voucher))
            {
                errors.addError(lje.errorLog(ledgerJournalTrans.Voucher),ledgerJournalTrans.RecId);
            }
        }
    }
}

When attempting to validate a journal I use the LedgerJournalEngine ErrorExists for each voucher in the journal. For some reason it doesn't catch all errors in the code but if I use the validate button in the client the errors are in the info log.

Is there a better way to validate a voucher in a journal?

changecompany(ledgerJournalTable.dataAreaId)
{
    ledgerJournalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::Yes,NoYes::No);
    lje = LedgerJournalEngine::construct(ledgerJournalTable.JournalType);
    lje.newJournalActive(ledgerJournalTable,true);
    ledgerJournalCheckPost.parmLedgerJournalEngine(lje);
    try
    {
        ledgerJournalCheckPost.run();
    }
    catch
    {
        ledgerJournalCheckPost.validate();
        while select ledgerJournalTrans where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum
        {
            if(lje.errorExists(ledgerJournalTrans.Voucher))
            {
                errors.addError(lje.errorLog(ledgerJournalTrans.Voucher),ledgerJournalTrans.RecId);
            }
        }
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仙女 2024-12-04 11:06:47

这就是我想出的办法,到目前为止它似乎按预期工作。如果有人有更好的方法请告诉我。

changecompany(ledgerJournalTable.dataAreaId)
{
    ledgerJournalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::No);
    lje = LedgerJournalEngine::construct(ledgerJournalTable.JournalType);
    lje.newJournalActive(ledgerJournalTable,true);
    ledgerJournalCheckPost.parmLedgerJournalEngine(lje);
    try
    {
        ledgerJournalCheckPost.run();
        while select ledgerJournalTrans where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum
        {
            if(lje.errorInJournal() || ledgerJournalCheckPost.numOfErrorsInList()>0)
            {
                errors.addError(lje.errorLog(ledgerJournalTrans.Voucher),ledgerJournalTrans.RecId);
            }
        }
        ledgerJournalCheckPost.parmPost(NoYes::Yes);
        ledgerJournalCheckPost.run();
    }
    catch
    {
        ledgerJournalCheckPost.validate();
        while select ledgerJournalTrans where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum
        {
            if(lje.errorInJournal() || ledgerJournalCheckPost.numOfErrorsInList()>0)
            {
                errors.addError(lje.errorLog(ledgerJournalTrans.Voucher),ledgerJournalTrans.RecId);
            }
        }
    }
    ledgerJournalCheckPost = null;
    lje = null;
    ledgerJournalTrans = null;
    ledgerJOurnalTable = null;
}
return errors;

So this is what I have come up with, so far it seems to be working as expected. If anyone has a better way please let me know.

changecompany(ledgerJournalTable.dataAreaId)
{
    ledgerJournalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::No);
    lje = LedgerJournalEngine::construct(ledgerJournalTable.JournalType);
    lje.newJournalActive(ledgerJournalTable,true);
    ledgerJournalCheckPost.parmLedgerJournalEngine(lje);
    try
    {
        ledgerJournalCheckPost.run();
        while select ledgerJournalTrans where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum
        {
            if(lje.errorInJournal() || ledgerJournalCheckPost.numOfErrorsInList()>0)
            {
                errors.addError(lje.errorLog(ledgerJournalTrans.Voucher),ledgerJournalTrans.RecId);
            }
        }
        ledgerJournalCheckPost.parmPost(NoYes::Yes);
        ledgerJournalCheckPost.run();
    }
    catch
    {
        ledgerJournalCheckPost.validate();
        while select ledgerJournalTrans where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum
        {
            if(lje.errorInJournal() || ledgerJournalCheckPost.numOfErrorsInList()>0)
            {
                errors.addError(lje.errorLog(ledgerJournalTrans.Voucher),ledgerJournalTrans.RecId);
            }
        }
    }
    ledgerJournalCheckPost = null;
    lje = null;
    ledgerJournalTrans = null;
    ledgerJOurnalTable = null;
}
return errors;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文