Advance Production order via hand held - Production Parameters issue resolution

There is a resolution to Advance Production order via handheld - Production Parameters issue, where Starting the production order from hand held device does not consider latest parameters. This is due to the cache and after AOS restart it will pick up new parameters, however, if you need to change those parameters frequently then obviously AOS restart will not suite you.
Flush the cache:
[ExtensionOf(classStr(WHSPostProdJournal))]
final class VKWHSPostProdJournal_Extension
{
    public static void prodStartUp(
        ProdId                _prodId,
        Qty                    _qty,
        WHSUserId            _whsUserId,
        BOMAutoConsump        _bomAutoConsump,
        WHSWorkExecuteMode  _workExecuteMode)
    {
        xSysLastValue::FlushCaches();

        next prodStartUp(_prodId, _qty, _whsUserId, _bomAutoConsump, _workExecuteMode);
    }

}
Additionally, due to how methods are called and the default method parameters, the Automatic BOM consumption parameter gets overwritten each time to a specific value, which might require additional development to resolve it.

1. WHSWorkExecute.prodStartUp
The BOMAutoConsump gets the default value here:
2. WHSPostProdJournal.prodStartUp

a - parameter is optional here as well, however from the previous method it is specified and therefore value is not "default" anymore
b - gets the value of the last parameters
c - it checks if BOMAutoConsump parameter is not default and if not - overwrites the previously restored value. And the value is not default as called stated the specific value for parameter 4.

In CoC for WHSPostProdJournal.prodStartUp BOMAutoConsump value can be changed to any specific and even can be restored from the last saved (how to restore see [b] block from the screenshot above).


The realization of Report as finished process is even worse, majority of parameters are either hardcoded or default of other parameters. If you want to restore them from the last saved then here is the CoC extension:
[ExtensionOf(classStr(WhsWorkCreateProdPut))]
final class VKWhsWorkCreateProdPut_Extension
{

    protected void setProdParmReportFinishedMainProductFieldsForProdItem()
    {
        next setProdParmReportFinishedMainProductFieldsForProdItem();

        // flush cache to get not cached values
        xSysLastValue::FlushCaches();
        // restore last saved values
        ProdMultiReportFinished prodMultiReportFinished = ProdMultiReportFinished::construct(null);
        prodMultiReportFinished.initParmDefault();
        prodMultiReportFinished.initParmBuffer(prodParmReportFinishedMainProduct);
    }

}



 

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.

Authors are allowed to set their own AdSense units.
Join us.

Blog Tags