2011-08-02 12 views
2

ジャーナルを検証しようとすると、ジャーナルの各バウチャーに対してLedgerJournalEngine ErrorExistsを使用します。何らかの理由で、コード内のすべてのエラーを検出することはありませんが、クライアントでvalidateボタンを使用すると、エラーが情報ログに記録されます。LedgerJournalEngine.errorExists(voucherNumber)はエラーを報告していません

ジャーナルのバウチャーを検証する良い方法はありますか?

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); 
      } 
     } 
    } 
} 

答えて

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; 
関連する問題