@NateS is right, you are diving into the deep end! But if you read through all the threads here (many with him on it!), you can eventually figure out everything you need. After lurking many posts here I achieved it with C# Code Widget in an Epicor Function, but I no longer have that code.
Below is a function for scheduling a job that I do have, but it is in JavaScript. It might be helpful though to see the data that needs sent:
//all params are strings.. @runShift should be "day" or "night" @runDay is MM/DD/YYYY format
async scheduleJob(jobNum, runDay, runShift, resourceID, resourceGrpID) {
const runDate = new Date(runDay);
if (isNaN(runDate)) {
throw new Error("Invalid runDay format. Use 'MM/DD/YYYY'.");
}
const shiftStartTime = runShift === "day" ? 60 * 60 * 7 : 60 * 60 * 15;
const shiftEndTime = shiftStartTime + 60 * 60 * 8;
const startDate = new Date(runDate.getTime() + shiftStartTime * 1000).toISOString();
const endDate = new Date(runDate.getTime() + shiftEndTime * 1000).toISOString();
const scheduleEngineDataSet = {
ScheduleEngine: [
{
Company: this.parent.getCompany(),
JobNum: jobNum,
AssemblySeq: 0,
OprSeq: 10,
OpDtlSeq: 0,
StartDate: startDate,
StartTime: shiftStartTime,
EndDate: endDate,
EndTime: shiftEndTime,
WhatIf: false,
Finite: false,
SchedTypeCode: "JA",
ScheduleDirection: "START",
SetupComplete: false,
ProductionComplete: false,
OverrideMtlCon: true,
OverRideHistDateSetting: 2,
ResourceID: resourceID,
ResourceGrpID: resourceGrpID,
RecalcExpProdYld: false,
UseSchedulingMultiJob: false,
SchedulingMultiJobIgnoreLocks: false,
SchedulingMultiJobMinimizeWIP: false,
SchedulingMultiJobMoveJobsAcrossPlants: false,
RowMod: "A",
},
],
};
const endpoint = `Erp.BO.ScheduleEngineSvc/MoveJobItem()`;
return await this.parent.fetchApi(endpoint, "POST", { ds: scheduleEngineDataSet });
}
I pulled this from a JS Class for dispatching unfirm jobs from MRP to a selected resource on day/night shift (for the first operation which was a fixed hours operation), so you will need to adjust this for your use case. What I found in my webapp was I needed to do a few things (engineering/unengineering) to achieve everything I wanted. Here was the order that worked for me:
- (1) Unengineer job
- (2) Update job start date / required date
- (3) Assigning Resource ID
- (4) Engineer job
- (5) Schedule job
I just bring that up in case you happen to run into more problems. But if you are just scheduling and the job is already engineered, then I think what I posted is enough. If you do need more, and you think it would be helpful I can post the full JS Class which has all the endpoints/data needed for all the steps I listed above.