Hello All,
Am trying to automate the Auto-Reserve in fulfillment workbench triggering BPM by Scheduling the System Agent.
The same code is working without any issues in the Customisation on Button Click Event.
In BPM it’s Auto Reserving directly with the Quantity on the Order Release level without considering the On Hand Stock.
Any help on this please
Erp.Contracts.OrderAllocSvcContract orderAllocImpl = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.OrderAllocSvcContract>(Db);
Erp.Tablesets.OrderAllocListTableset orderAllocListTSMain = orderAllocImpl.GetListOfOrders("", strOrderHedWhereClause, strOrderDtlWhereClause, strOrderRelWhereClause, "",
"NoFilter,NoFilter,false,false", lCountry, "", "NoFilter", "OrderRel.ReqDate , OrderRel.OrderNum, OrderRel.OrderLine, OrderRel.OrderRelNum",
"", "", 0, 0, out morePages, "");
orderAllocImpl.OrderAllocationGetRows(orderAllocListTSMain, 0);
var vOrderAllocListTS = (from xRow in orderAllocListTSMain.OrderAllocList
select xRow);
int iSeq = 1;
foreach (var vOrderAllocListTS_Row in (from xRow in orderAllocListTSMain.OrderAllocList
select xRow))
{
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
orderAllocImpl = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.OrderAllocSvcContract>(Db);
Erp.Tablesets.SlimOrderAllocTableset soatTS = new Erp.Tablesets.SlimOrderAllocTableset();
var slimordAllocrow = soatTS.SlimOrderAlloc.NewRow();
slimordAllocrow["AssemblySeq"] = 0;
slimordAllocrow["Company"] = callContextClient.CurrentCompany;
slimordAllocrow["DemandType"] = "Order";
slimordAllocrow["FulfillmentSeq"] = 1;//iSeq++;
slimordAllocrow["JobNum"] = "";
slimordAllocrow["MtlSeq"] = 0;
slimordAllocrow["OrderLine"] = vOrderAllocListTS_Row.OrderLine; //1
slimordAllocrow["OrderNum"] = vOrderAllocListTS_Row.OrderNum; //"1060309";//
slimordAllocrow["OrderRelNum"] = vOrderAllocListTS_Row.OrderRelNum; //"1";//
slimordAllocrow["SelectedForAction"] = true;
slimordAllocrow["TFOrdLine"] = 0;
slimordAllocrow["TFOrdNum"] = 0;
slimordAllocrow["RowMod"] = "";
soatTS.SlimOrderAlloc.Add(slimordAllocrow);
//fulseq = fulseq + 1;
orderAllocImpl.CheckDates(ref soatTS, out strCmsg);
orderAllocImpl.AutoReserve(ref soatTS, "", "all", out strCmsg);
txScope.Complete();
}//End of Transaction Scope
}//End of for loop
orderAllocImpl.Dispose();