I have successfully created a function which does the same thing as the “Reserve” action in the Fulfillment Workbench, using the BO service Erp.BO.OrderAllocSvc.
I am now trying to create a “Unreserve” function. When calling the BO method “Unreserve”, the desired allocation is removed from PartAlloc table, but the ReservedQty in PartWhse table remains. The only way I found to sync the PartWhse is to run the “Refresh Part Quantities and Allocations” update report.
Looking at the traces of “Unreserve” Fulfillment Workbench action, I can’t find what is missing to update the PartWhse table.
Has anyone successfully called OrderAllocSvc.Unreserve(…) method with both PartAlloc and PartWhse updated?
Sharing with you my Fulfillment Library, which I call from the REST api. OrderFulfillmentLib.efxb (266.6 KB)
I had a similar issue but I was calling the “Allocation” method. Ended up needing to add some lines to force processing of “deferred transactions”. Maybe the Reserve/Unreserve features need that too.
Wow, that did the trick! I had read this thread, but as I am doing Reserve/Unreserve and no allocations, never thought it would work.
I can’t thank you enough. Have a good day.
// To call after BO.Unreserve(...). It will magically sync PartWhse reserved quantities with PartAlloc.
using (var dbContext = Ice.Services.ContextFactory.CreateContext<ErpContext>())
{
Erp.Internal.Lib.DeferredUpdate libDeferredUpdate = new Erp.Internal.Lib.DeferredUpdate(dbContext);
libDeferredUpdate.UpdPQDemand();
}