Hello,
This is my first time using Epicor REST services. I am building a web page that creates and schedules jobs.
The code creates the job, gets the details for the materials but it won’t schedule the job.
This is my code for scheduling the job:
private static void ScheduleJob(string _serviceUrl, string jobNum)
{
Console.WriteLine("Schedule Job");
var scheduleJob = new ScheduleEngineModel
{
Company = "MyCompany",
JobNum = jobNum,
AssemblySeq = 0,
OprSeq = 0,
OpDtlSeq = 0,
StartDate = DateTime.Now,
StartTime = 0,
EndDate = DateTime.Now,
EndTime = 43200,
SchedTypeCode = "JJ",
ScheduleDirection = "End",
OverrideMtlCon = true,
OverRideHistDateSetting = 2,
RowMod = "A"
};
string scheduleJobToSend = "{\"ds\":" + JsonConvert.SerializeObject(scheduleJob) + "}";
var client = new RestClient(string.Format("{0}{1}", _serviceUrl, "Erp.BO.ScheduleEngineSvc/MoveJobItem()"));
var request = GetNewRequest();
request.AddParameter("application/json; charset=utf-8", scheduleJobToSend, ParameterType.RequestBody);
request.RequestFormat = DataFormat.Json;
var content = GetContent(client, request);
Console.WriteLine(content);
}
private static string GetContent(RestClient client, RestRequest request)
{
string content = "";
try
{
IRestResponse response = client.Execute(request);
content = response.Content;
}
catch (Exception ex)
{
content = ex.Message;
}
return content;
}
This what the service returns:
{“parameters”:{“l_finished”:true,“c_WarnLogTxt”:""}}
It seems that it finished successfully but when I open the job in Epicor, the job is not scheduled.
I used a workflow as the blueprint for the web page. This is the what the conversion that schedules the job in the workflow looks like:
What am I missing?
Thanks for your help.