2

在尝试验证日记帐时,我对日记帐中的每个凭证使用 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);
            }
        }
    }
}
4

1 回答 1

2

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

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;
于 2011-08-03T13:00:43.643 回答