I am trying to use the MoveJobItem method. I am not getting very far. This is what I have setup in my UBAQ BPM:
I have a UBAQ that joins my UD07 table with JobHead. My UD07 table just has a list of job numbers and new dates. The goal is to look at the job listed in UD07, then (backwards, finite) schedule that job using the new date.
In the BPM the condition is looking for the Calculated_Flag field to be unchecked. As long as there are unchecked flags, the loop continues. Once all the flag fields are checked, the loop should end, having scheduled all the jobs on the UD07 list to the new dates.
The first Custom Code Widget: Look at the BAQ and pull the first row that is not flagged.
var xRow = (from ttResults_Row in queryResultDataset.Results where ttResults_Row.Calculated_Flag == false select ttResults_Row).FirstOrDefault();
MyJob = xRow.JobHead_JobNum;
NewDate = xRow.UD07_Date01;
The second Custom Code Widget: Schedule the job on this row using the new date.
var schedDS = new Erp.BO.ScheduleEngineDataSet();
var sp = (Erp.BO.ScheduleEngineDataSet.ScheduleEngineRow)schedDS.ScheduleEngine.NewRow();
sp["Company"] = callContextClient.CurrentCompany;
sp["JobNum"] = MyJob;
sp["AssemblySeq"] = 0;
sp["OprSeq"] = 0;
sp["OpDtlSeq"] = 0;
sp["StartDate"] = NewDate;
sp["StartTime"] = 0;
sp["EndDate"] = NewDate;
sp["EndTime"] = 0;
sp["WhatIf"] = false;
sp["Finite"] = true;
sp["SchedTypeCode"] = "jj";
sp["ScheduleDirection"] = "End";
sp["SetupComplete"] = false;
sp["ProductionComplete"] = false;
sp["OverrideMtlCon"] = true;
sp["OverRideHistDateSetting"] = 2;
sp["RecalcExpProdYld"] = false;
sp["UseSchedulingMultiJob"] = false;
sp["SchedulingMultiJobIgnoreLocks"] = false;
sp["SchedulingMultiJobMinimizeWIP"] = false;
sp["SchedulingMultiJobMoveJobsAcrossPlants"] = false;
sp["SysRowID"] = Guid.NewGuid();
sp["RowMod"] = "A";
schedDS.ScheduleEngine.AddScheduleEngineRow(sp);
using (Erp.Proxy.BO.ScheduleEngineImpl boSched = Ice.Assemblies.ServiceRenderer.GetService<Erp.Proxy.BO.ScheduleEngineImpl>(Db))
{
boSched.MoveJobItem(schedDS, out finished, out Msg);
}
Third Custom Code Widget: Check off the row that has now been scheduled.
var xRow = (from ttResults_Row in queryResultDataset.Results where ttResults_Row.Calculated_Flag == false select ttResults_Row).FirstOrDefault();
xRow.Calculated_Flag = true;
When I try to run this code I get this error:
Server Side Exception
Type 'Erp.Proxy.BO.ScheduleEngineImpl' is not a service contract.
Exception caught in: Epicor.ServiceModel
Error Detail
============
Description: Type 'Erp.Proxy.BO.ScheduleEngineImpl' is not a service contract.
Correlation ID: 7d7c8306-83f0-4d39-af2e-152d984e3ed1
Program: Epicor.System.dll
Method: ResolveService
Line Number: 115
Column Number: 17
Client Stack Trace
==================
at Ice.Cloud.ProxyBase`1.CallWithCommunicationFailureRetry(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, RestRpcValueSerializer serializer)
at Ice.Cloud.ProxyBase`1.CallWithMultistepBpmHandling(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Ice.Cloud.ProxyBase`1.Call(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Ice.Proxy.BO.DynamicQueryImpl.RunCustomAction(DynamicQueryDataSet queryDS, String actionID, DataSet queryResultDataset)
at Ice.Adapters.DynamicQueryAdapter.<>c__DisplayClass43_0.<RunCustomAction>b__0(DataSet datasetToSend)
at Ice.Adapters.DynamicQueryAdapter.ProcessUbaqMethod(String methodName, DataSet updatedDS, Func`2 methodExecutor, Boolean refreshQueryResultsDataset)
at Ice.Adapters.DynamicQueryAdapter.RunCustomAction(DynamicQueryDataSet queryDS, String actionId, DataSet updatedDS, Boolean refreshQueryResultsDataset)
at Ice.UI.App.BAQDesignerEntry.BAQTransaction.<>c__DisplayClass379_0.<CallRunCustom>b__0(Int32& rowReturned)
at Ice.UI.App.BAQDesignerEntry.Forms.BAQDiagramForm.ShowQueryResults(DataSet dsResults, getQueryResult getResults, ReportAdditionalInfo additionalInfo)
at Ice.UI.App.BAQDesignerEntry.BAQTransaction.CallRunCustom()
I thought I had all the right pieces in place. What am I missing? I am also not sure how to define the start date. The whole point of scheduling is to figure out that start date. But I can’t leave it blank without error. How does Epicor define the start date for the Schedule Engine dataset that gets fed into MoveJobItem?
Thanks!
Nate