REST Api Scheduling a Job

Here are some examples

One thing to note is that the scheduling engine is a bit of a bear… The way I’ve done it via REST is to use a UBAQ and write the scheduling code in the UBAQ Update Method. Here’s an example

ScheduleEngineTableset seTs = new ScheduleEngineTableset();
var schedEng =(ScheduleEngineRow) seTs.ScheduleEngine.NewRow();
schedEng.Company = callContextClient.CurrentCompany;
schedEng.JobNum = newJobNum;
schedEng.AssemblySeq = 0;
schedEng.OprSeq = 0;
schedEng.OpDtlSeq = 0;
schedEng.StartDate = DateTime.Now.AddDays(njds.JobHead[0].KitTime);
schedEng.StartTime =0;
schedEng.EndDate = njds.JobHead[0].ReqDueDate;
schedEng.WhatIf = false;
schedEng.Finite = false;
schedEng.OverrideMtlCon = njds.JobHead[0].IgnoreMtlConstraints;
schedEng.OverRideHistDateSetting = 2;
schedEng.SetupComplete =false;
schedEng.ProductionComplete = false;
schedEng.SchedTypeCode = "ja";
schedEng.ScheduleDirection = "End";
schedEng.RecalcExpProdYld = false;
schedEngine.GetSchedulingMultiJobFlags(out _schedulingMultiJobActive, out _minimizeWIPFlag, out _allowMoveJobsAcrossPlants, out _autoLoadParentJobs, out _autoLoadChildJobs);


schedEng.UseSchedulingMultiJob = _schedulingMultiJobActive;
schedEng.SchedulingMultiJobMinimizeWIP = _minimizeWIPFlag;
schedEng.SchedulingMultiJobIgnoreLocks=false;
schedEng.SchedulingMultiJobMoveJobsAcrossPlants = _allowMoveJobsAcrossPlants;
schedEng.SysRowID = njds.JobHead[0].SysRowID;
schedEng.RowMod= "A";
seTs.ScheduleEngine.Add(schedEng);
string txt="";
bool finished;

schedEngine.MoveJobItem(seTs, out finished, out txt);
schedEngine.AcceptChanges(string.Empty,seTs);
2 Likes