Production order should not get Released on material shortage

Production order should not get Released on material shortage

There is an evergreen issue in Dynamics 365 material reservation for production: despite the policy “Require full reservation“, the production order is released even if there is a shortage of materials:

The issue is very well known, I have been combating it since 2018. It has been reported to Microsoft on numerous occasions by my colleagues around the world: Production order should not get status Released if raw material release to warehouse fails.

The consequences are dire. A released order’s jobs will appear on the Shop floor control terminal and animate the worker to start the order. In the course of the assembly the worker is going to be forced to interrupt his/her work and fetch the parts from the warehouse. Later, at the report as finished / material backflushing stage at the Production floor terminal, it is going to prevent the online material consumption if the backflushing principle is set to Finish.

Apparently, the BOM line and the warehouse work generation are not in the same transaction scope as the overall production order release. Indeed, the ProdWHSRelease call is performed outside of the ttsbegin/ttscommit pair in ProdUpdRelease:

                ttscommit;
                this.printout();
            }
        }
        catch (Exception::Deadlock)
        {
            retry;
        }
...
        prodTable.reread();
        if (ProdParametersDim::find(prodTable.InventDimId).ProductionLineRelease == WHSProductionLineRelease::OnProdOrderRelease)
        {
            ProdWHSRelease::newFromProdParmRelease(prodParmRelease).whsReleaseSingleOrder(prodTable);
        }

}

Since Microsoft refuses to fix this problem, let me publish a programmatic solution. We put the ProdWHSRelease call into the endUpdateProduction() method if the order requires full reservation. Then we prevent the execution of ProdWHSRelease for the second time by temporarily changing one parameter and then reverting it back:

DontReleaseOnMaterialShortage.axpp

You are welcome!