Change Resource Group ID for Open Jobs

Well, the BO doesn’t work the way we want it to. There’s probably a good reason why the Epicor BO is not allowing a direct update of the Resource. Epicor may be making changes in other places of the database that you are not aware of. Maybe Capacity Planning? Costing? Capability Planning? We just don’t know. That’s why it’s best to work through the BOs the way the Client would and then automate from there instead of trying to get around it.

Have you run a trace of how to change a Resource Group on an Operation from the client?

I was afraid of that. That is a good reason.
I guess I just have to wait until they fix the BO?

I ran my trace on the JobEntry form. I manually found a job with ‘12VA’ an then started the trace, updated the code to ‘4A’, and then read the trace.

I assume you don’t want 15,000 lines of trace data. So the potentially relevant methods from my trace are:
Update
ChangeJobOpDtlResourceGrpID
CheckInactiveSchedRequirement
GetDatasetForTree (this probably isn’t relevant)

These types of methods are usually checks between lookup and the update. Sometimes they just check for errors, sometimes they do the change in your dataset (so you don’t have to in code).

I’m assuming that your list isn’t in order?

1 Like

The exact order of JobEntry BO methods are:

  • ChangeJobOpDtlResourceGrpID
  • CheckInactiveSchedRequirement
  • Update
  • GetDatasetForTree

I would rerun that trace, but start with a blank screen. Have all of your lookup values handy so you can typed them in instead of searching for them (because you won’t need the search stuff) But you will need a dataset populated, and your list methods doesn’t have anything that does that. So that dataset was populated before you started the trace.

That’s where Jose and Josh’s Trace Helper Utility comes into play!

It should help you identify only the methods that you’ll need to replicate the steps you want to do.

3 Likes

I would create a BPM

Use the BO widgets
GetJobByID
Change resource id field
ChangeJobOpDtlResourceGrpID
Update the RowMod
Update

What @Mark_Wonsil said!!

Yes! I got that utility this morning and I already love it! That is actually how I am getting the list of methods to use. I will try to use all BO widgets instead of doing it all in code.

I did modify the code to try to use just the methods:

Erp.Contracts.JobEntrySvcContract jobEntryBO = null;
jobEntryBO = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobEntrySvcContract>(Db);

foreach (var row in ttResults)
{
  {
    myCount = myCount + 1;
    MyJob = row.JobHead_JobNum;
    MyAsm = row.JobAsmbl_AssemblySeq;
    MyOp = row.JobOper_OprSeq;
    var jobTableset = new JobEntryTableset();
    jobTableset = jobEntryBO.GetByID(row.JobHead_JobNum);
     
   
    jobEntryBO.ChangeJobOpDtlResourceGrpID(NewResGrpID, ref jobTableset);
    jobEntryBO.CheckInactiveSchedRequirement("", "", NewResGrpID, out myString);
    jobEntryBO.Update(ref jobTableset);
    
  }
}

This returns a new error:

Business Layer Exception

Operation Detail is not available.

Exception caught in: Epicor.ServiceModel

Error Detail

Description: Operation Detail is not available.
Program: Erp.Services.BO.JobEntry.dll
Method: ChangeJobOpDtlResourceGrpID
Line Number: 11770
Column Number: 17
Table: JobOpDtl

Thanks all for your time and valuable feedback! I’ll keep trying!

1 Like

try and do this with the widget. at least then you will know what is needed for the call.

1 Like

And it will probably upgrade better as well.

There has to be something missing in that process. The GetByID returns everything on the job. Then the update is only the job data set and the whole job. Something has to be set somewhere so that the method knows which resource ID (AsmSeq, and OpSeq) to change.

Just putting my two cents in, but I know when we manually change a resource on a scheduled job, it causes various things to happen IF that job is not removed from the schedule and then re-scheduled. Make sure you can do this or you will run into this.

Global scheduling may handle it but how often do you want to run it?

1 Like

I get this error for every row I tried to process. In my case 123 operations returned in the query. Thankfully epicor put them all into one error window so I didn’t have to click ok 123 times!

Operation Detail is not available.
Message No.: 1
Description: Operation Detail is not available.
Program: Erp.Services.BO.JobEntry.dll
Method: ChangeJobOpDtlResourceGrpID
Line Number: 11770
Column Number: 17
Table: JobOpDtl

My BPM may look a bit convoluted. I have to loop through each of the rows in my results query. Here is my BPM outline and variables:


And the action details:

The code I placed in the custom code widget ‘Set TotalRows’:

var row = (from ttResults_row in ttResults where ttResults_row.Calculated_Processed == false select ttResults_row);
TotalRows = row.Count();

The code I placed in the custom code widget ‘Set MyJob’:

var row = (from ttResults_row in ttResults where ttResults_row.Calculated_Processed == false select ttResults_row).FirstOrDefault();
{
    myCount = myCount + 1;
    MyJob = row.JobHead_JobNum;
    MyAsm = row.JobAsmbl_AssemblySeq;
    MyOp = row.JobOper_OprSeq;
    row.Calculated_Processed = true;
}

I think this will be a regular task for a while as we update our internal systems to match the shop floor. However, I expect once the update is done we won’t be changing this kind of thing regularly. Maybe i’m making a mountain from a molehill, but its the journey not the destination. Right? :slight_smile:

In an effort to implement this criteria, I have updated my BPM to check for engineered and released statuses. The BPM stores these values internally for each row of the query. Then at the end resets the original status based on that variable. Perhaps it is just my ignorance, but I couldn’t find a flag in the JobHead table for ‘isScheduled’. To determine if the job is scheduled, I just checked to see if both engineered and released are checked. If they are, then I assume it has been scheduled. (This is a big assumption on my part! Is there a better flag to check if a job is scheduled?)

Below I have included my updated BPM with all the criteria and BO methods in place. I also included a small portion of the resulting errors.

Here is the updated code for the ‘Set myJob’ widget:

var row = (from ttResults_row in ttResults where ttResults_row.Calculated_Processed == false select ttResults_row).FirstOrDefault();
{
    myCount = myCount + 1;
    MyJob = row.JobHead_JobNum;
    MyAsm = row.JobAsmbl_AssemblySeq;
    MyOp = row.JobOper_OprSeq; 
    myComp = row.JobHead_Company;
    myReqDueDate = row.JobHead_ReqDueDate;
    myProdQty = row.JobHead_ProdQty;
    myDueDate = row.JobHead_DueDate;
    myStartDate = row.JobHead_StartDate;
    isEngin = row.JobHead_JobEngineered;
    isRel = row.JobHead_JobReleased;
    if (row.JobHead_JobEngineered && row.JobHead_JobReleased)
    {
      isSched = true;
    }
    row.Calculated_Processed = true;
}

Partial list of Errors:
JobHead has not changed.
JobHead has not changed.
Can not remove from schedule, Job is still engineered.
Operation Detail is not available.
JobHead has not changed.

I know everyone wants me to move to the DMT. While they consider getting the tool, I am still stuck trying to get this to work.

Stepping back I see that Brandon has a point. GetByID gets my job, and Update updates the whole job.

The basic process I am trying to use to update the job is:

  • Invoke Erp.JobEntry.GetByID (myJob, myDS)
  • Set myDS.JobHead.JobEngineered = false (for the changed row)
  • Also tried: Set ttResults.JobHead_JobEngineered = false (for the changed row)
  • Invoke Erp.JobEntry.ChangeJobHeadJobEngineered (myDS)

When I try to run this action I get the “Job has not changed.” error occurring on the method line. Of course this is a vastly simplified version, but I want to make sure I am taking the right approach.

The BPM is huge and ugly now that I included all the extra criteria to check and reset Engineered, Released, and Scheduled.


(My God! Look at this thing! Someone stop me!)

Did you use the trace utility to see what changed from the original data set to the final one? The BO’s change some stuff, but other stuff is changed by the UI and doesn’t show up in the trace. Those differences are what you would need to set using a set field widget.

Yes, I did run the trace while updating a job using the JobEntry form.

  • I opened the form, then started the trace.
  • Typed in my job number.
  • Clicked Op 40 in the tree view.
  • Clicked the Resource in the tree view.
  • Selected a new Resource Group from the list.
  • Copied the value from the Resource Group box.
  • Clicked on Op 40 in the tree view.
  • Pasted that value back into the operation Description field.
  • Saved the job.
  • Ended the trace.

I am using the trace parser.

When I compared the Update methods, I noticed a lot of fields marked as changed contain a decimal “0.000” and the return show integer “0”. I don’t need to worry about these right?

Otherwise I see a few other fields changed that I am not accounting for, including:

<ProdLabRate>
<SetupLabRate>
<EstLaborCost>
<LaborEntryMethodDesc>
<PrimaryProdOpDtlDesc>
<PrimaryResourceGrpDesc>
<PrimaryResourceGrpID>
<PrimarySetupOpDtlDesc>
<ShowStatusIcon>
<StdBasisDescription>
<StdFormatDescription>
<ResourceGrpIDDescription>

If I am understanding correctly, I need to set the values for these fields using a process similar to what I outlined above. Right? When I use the setfield widget do I set the ttResults field or the tableset field?

Thanks a bunch!
Nate

You have to change the rowmod of the dataset to U.

I would do this in small steps, makes debugging easier.

Do I have to do this through custom code? I don’t see RowMod in the setfield widget.