Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

HowTo Report as Finished a job by X++

(0) ShareShare
ReportReport
Posted on by 44

Hello All,

I need to report every job in a production by a button click in X++.

I have already a button wich stops all actives jobs in a production, Inspired by the defualt AX class method JmgJobBundle.createStopJobsRegistrations()

I just need something like that where I can Give it the JobId by parameter and it will just report as feedback with the quantity reported in progress it has accrued at that moment.

I dont want to create one on my own because I dont want to miss all the standard validations

thanks a lot for all your support.

  • Suggested answer
    Wafaei Profile Picture
    Wafaei 7 on at
    RE: HowTo Report as Finished a job by X++

    public void reportFeedbackFinished()

    {

       HcmWorker                   hcmWorker;

       JmgRegistrationSetup        jmgRegistrationSetup;

       JmgRegistrationSetup        employeeSetup;

       JmgJobBundle                bundle;

       JmgRegistrationData registrationData = new JmgRegistrationData();

       JmgJobFeedbackData feedbackData = new JmgJobFeedbackData();

       jmgEmployee employee = JmgEmployee::findCardNo('2727');

       utcdatetime  registrationTime = DateTimeUtil::newDateTime(JmgProfileSeconds::getSysDate(), JmgProfileSeconds::getSysTime());

       JmgRegistrationParameters   params;

       JmgPostStandardSystem       jmgPostStandardSystem;

       List                        statusQtyProdJournalCheckPost;

       JmgProdMultiReportFinished  jmgProdMultiReportFinished;

       hcmWorker                   = employee.HcmWorker();

       jmgRegistrationSetup        = JmgRegistrationSetup::find('Production');

       employeeSetup               = JmgRegistrationSetup::find(JmgEmployee::find(employee.Worker).RegistrationSetupId);

       bundle                      = new JmgJobBundle(employee.Worker, false, false, false, employeeSetup ? employeeSetup : jmgRegistrationSetup);

       if (bundle.emplClockedIn())

       {

           feedbackData.parmJobId('MUSH-000298');

           feedbackData.parmGoodQuantity(1);

           feedbackData.parmStatus(JmgFeedbackStatus::Completed);

           params = bundle.getFeedbackParameters(feedbackData.parmJobId());

           params.errorSpecification(feedbackData.parmErrorSpecification());

           params.goodQuantity(feedbackData.parmGoodQuantity());

           params.reportAsFinished(feedbackData.parmStatus());

           bundle.addJob(JmgJobTable::find(feedbackData.parmJobId()));

           jmgPostStandardSystem = JmgPostStandardSystem::constructJobBundle(bundle, false);

           // Status/quantity.

           statusQtyProdJournalCheckPost = jmgPostStandardSystem.createProdStatusQty();

           // Report as finished

           jmgProdMultiReportFinished = jmgPostStandardSystem.createReportFinishedJournal();

           bundle.setStatusQtyJournalPosting(statusQtyProdJournalCheckPost);

           bundle.setReportFinishedJournalPosting(jmgProdMultiReportFinished);

           bundle.makeFeedbackOnActiveJobs(DateTimeUtil::date(registrationTime), DateTimeUtil::time(registrationTime));

       }

       info('Done');

    }

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Report as Finished a job by X++

    Hi Sergei

    Yeah, the logic still is pretty complicated. that a lot code to followup and change.

    I thinks maybe is a easier way. Create Route Card Journals by hand. you know how to do that?

  • Suggested answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: HowTo Report as Finished a job by X++

    Hi CBNester,

    The service is based on "Feedback" approach.

    Have you tried to check if Production control - Periodic - Manufacturing execution - Change feedback form can help you to complete jobs for certain employees manually? My knowledge about the production module is quite limited, so I can't answer all of your questions.

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Report as Finished a job by X++

    Hi Sergei,

    Can you describe overall how it works? how this service method works. registrationData can be for any user or is for the worker currently working in the job?. the List job is for all active jobs? or are all the jobs that the current worker is trying to feedback?

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Report as Finished a job by X++

    I want to give the production manager to RAF when he consider pertinent. regardless of workers "In progress". He will have the last call.

    Now I have a button in the ProdListPage to stop all active jobs of selected production. (see image). the thing is that if he wants to RAF AX says that there are still jobs not reported as finished.

    So I just want a simple logic to report as finished the jobs with a simple click. maybe to prompt the Manager if he decides which job to RAF individually.

    pastedimage1588225215191v1.png

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: HowTo Report as Finished a job by X++

    Hi CBNestor,

    Just to be sure that we are talking about the same thing.

    There is a form "Production control - Periodic - Manufacturing execution - Change feedback". On the form you can select resource and update feedback to Completed statuses. Is it something you would like to have on "Raw registrations" form too?

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Report as Finished a job by X++

    If I stop I job from the Raw registration.

    Is it possible to manually report as finished this job? by a journal or something?

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: HowTo Report as Finished a job by X++

    Hi CBNestor,

    Looks like you need to use JmgJobBundle class to do this.

    By the way, there is a ready-made method in D365 for web service, maybe you can play with it and try to adjust to AX2012.

    public void reportFeedback(JmgRegistrationData _registrationData, List _jobs)
    {
        ListEnumerator enumerator = _jobs.getEnumerator();
        JmgJobFeedbackData feedbackData;
        JmgEmployee  employee = this.getEmployeeByLogin(_registrationData.parmLogin());
        utcdatetime  registrationTime = this.registrationTime(_registrationData.parmClientDateTime());
        JmgJobBundle bundle = new JmgJobBundle(employee.Worker, false, false, false);
        JmgRegistrationParameters params;
        JmgPostStandardSystem       jmgPostStandardSystem;
        List                        statusQtyProdJournalCheckPost;
        JmgProdMultiReportFinished  jmgProdMultiReportFinished;
    
        while (enumerator.moveNext())
        {
            feedbackData = enumerator.current();
            params = bundle.getFeedbackParameters(feedbackData.parmJobId());
            params.errorSpecification(feedbackData.parmErrorSpecification());
            params.goodQuantity(feedbackData.parmGoodQuantity());
            params.reportAsFinished(feedbackData.parmStatus());
            bundle.addJob(JmgJobTable::find(feedbackData.parmJobId()));
        }
    
        jmgPostStandardSystem = JmgPostStandardSystem::constructJobBundle(bundle, false);
    
        // Status/quantity.
        statusQtyProdJournalCheckPost = jmgPostStandardSystem.createProdStatusQty();
        // Report as finished
        jmgProdMultiReportFinished = jmgPostStandardSystem.createReportFinishedJournal();
    
        bundle.setStatusQtyJournalPosting(statusQtyProdJournalCheckPost);
        bundle.setReportFinishedJournalPosting(jmgProdMultiReportFinished);
    
        bundle.makeFeedbackOnActiveJobs(DateTimeUtil::date(registrationTime), DateTimeUtil::time(registrationTime));
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,684 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,414 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans