Sunday, October 28, 2012

How to post multiple picking list journals


Hi all!

For my first post I decided to write an article with the instructions for posting multiple picking list journals.

Well, let's start!

For real it's all pretty simple, the idea is to create a button in ProdJournalTable form and override its clicked method...

here's the code:

void clicked()
{
    DialogButton                            dialogBtn = DialogButton::Yes;
    ProdJournalCheckPostBOM     prodJournalCheckPostBOM;
    ProdJournalId                           journal;

    //here I entered a second level of confirmation before start with posting
    dialogBtn = Box::yesNo("Registrare tutti i giornali di distinta di prelievo?", DialogButton::No);
       
        if(dialogBtn != DialogButton::No)
        {
        prodJournalTable = prodJournaltable_ds.getFirst(true);
        while (prodJournalTable)
        {
            journal                 = prodJournalTable.JournalId;
            ProdJournalCheckPostBOM = ProdJournalCheckPostBOM::newPostJournal(journal,false);
            try
            {
            ProdJournalCheckPostBOM.run();
            }
            catch
            {
            info("Il giornale contiene errori");
            }
            prodJournalTable = ProdJournalTable_ds.getNext();
        }
        }
        info("Fine");
}

this code runs every selected journal and post it if there are no errors (in case of journal with errors, the procedure try to post next journal).
Don't forget to set "Multiselect" button property to "Yes"...

see you next time...!

No comments:

Post a Comment