Has anyone successfully used the ScheduleEngine adapter and been able to send a job to a particular resource?
I’ve used the MoveJobItem method. It reschedules the job when I want it, but sends it to the default resource (first resource on the resource group).
I ran a trace on the Resource Scheduling Board (and Multi) to see how they do it. They both use the methods SetMachines and ChangeResource.
SetMachines doesn’t change the schedule, and I get an error “Resource record not found” when ChangeResource executes. It looks to me like all the data going in is good.
Any experience with them? Will post code if it’s helpful. I just wondered if anyone had gotten it to work.
I’m moving a list of them on a dashboard so we can arrange similar setup groups together on respective resources, trying to get away from manual rescheduling.
void SetJobDetails(string Res, string job)
{
var ja = new JobEntryAdapter(oTrans);
ja.BOConnect();
ja.GetByID(job);
//set the resource... IN THIS CASE, I am setting ALL ops in this job *this may be different for your use
if(!string.IsNullOrEmpty(Res))
foreach(JobEntryDataSet.JobOpDtlRow jod in ja.JobEntryData.JobOpDtl)
{
jod.RowMod = "U";
ja.ChangeJobOpDtlResourceID(Res);
ja.Update();
}
ja.Dispose();
}
I was able to change the resource at the Job Operations Detail for phase 1 of the project but then was told that they only want changes to ResourceTimeUsed.
Thats the tricky part. I did a trace on the Multi Resource Scheduling Board and found only a few methods were called. SetMachines and ChangeResource…
The first doesnt change the resource on the schedule and the second throws an error “Resource record not found”. The data going in looks good.
Are you sure you are passing it a ResourceID? The reason I ask is because the UI (at least in the job) shows the ResourceName, but it is the ID it wants.
I took a different tack and was able to change the resource on the Job Op Detail then use the scheduler to change the resource on Resource Time used. The side effect is that it changes the dates on the tables. Ideally I would like to be able to change the resource without changing the dates.
What I have so far - I load just the job and operation being changed. The resource is being changed, the resource group does not have to be (both the from resource and to resource are in the same group)
dsJobOneOp.JobOpDtl.Rows[0]["RowMod"] = "U";
boJob.ChangeJobOpDtlResourceID(newResourceID, dsJobOneOp);
boJob.Update(dsJobOneOp); // Sets the resource on JobOpDtl
string multiSchedTypeCodes = "";
boScheduleEngine.GetMultiSchedTypeCodes(out multiSchedTypeCodes);
bool schedulingMultiJobActive = false;
bool minimizeWIPFlag = false;
bool allowMoveJobsAcrossPlants = false;
bool autoLoadParentJobs = false;
bool autoLoadChildJobs = false;
int BWSchedStartTime = 0;
string schedulingDirection = "";
boScheduleEngine.GetSchedulingFlags(out schedulingMultiJobActive, out minimizeWIPFlag, out allowMoveJobsAcrossPlants, out autoLoadParentJobs, out autoLoadChildJobs, out BWSchedStartTime, out schedulingDirection);
bool v_Engineered = false;
boJob.CheckEngineered(out v_Engineered);
Erp.BO.ScheduleEngineDataSet dsScheduleEngine = new Erp.BO.ScheduleEngineDataSet();
boScheduleEngine.GetScheduleRecord(dsScheduleEngine); // Create new Schedule Record
dsScheduleEngine.ScheduleEngine.Rows[0]["Company"] = ((Ice.Core.Session)session).CompanyID;
dsScheduleEngine.ScheduleEngine.Rows[0]["JobNum"] = dsJobOneOp.JobOper.Rows[0]["JobNum"];
dsScheduleEngine.ScheduleEngine.Rows[0]["WhatIf"] = false;
dsScheduleEngine.ScheduleEngine.Rows[0]["Finite"] = false;
dsScheduleEngine.ScheduleEngine.Rows[0]["SchedTypeCode"] = "OO"; // = "JJ";
dsScheduleEngine.ScheduleEngine.Rows[0]["ScheduleDirection"] = "End";
dsScheduleEngine.ScheduleEngine.Rows[0]["SetupComplete"] = false;
dsScheduleEngine.ScheduleEngine.Rows[0]["ProductionComplete"] = false;
dsScheduleEngine.ScheduleEngine.Rows[0]["RecalcExpProdYld"] = false;
dsScheduleEngine.ScheduleEngine.Rows[0]["UseSchedulingMultiJob"] = schedulingMultiJobActive;
dsScheduleEngine.ScheduleEngine.Rows[0]["SchedulingMultiJobIgnoreLocks"] = false;
dsScheduleEngine.ScheduleEngine.Rows[0]["SchedulingMultiJobMinimizeWIP"] = minimizeWIPFlag;
dsScheduleEngine.ScheduleEngine.Rows[0]["SchedulingMultiJobMoveJobsAcrossPlants"] = allowMoveJobsAcrossPlants;
boScheduleEngine.MoveJobItem(dsScheduleEngine, out bool I_finished, out string c_WarnLogTxt); // Sets the resource for resource time used
Im still working on the dates, setting the date fields in the ScheduleEngine dataset does not seem to be doing anything, nor does changing the schedule type code to JJ
We are backwards scheduling hence setting it to End
Thanks everyone for the help so far. I am farther along than I was!