Update JobEntry Tableset / JobOper Table in BPM

,

I am trying to recreate a service connect workflow in a BPM that changes an operation and reschedules a job from a CSV file and I starting with the simple beginning to make sure I could get a changing tableset:

var srvJobEntry = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobEntrySvcContract>(this.Db);
Erp.Tablesets.JobEntryTableset JobEntryTS = new Erp.Tablesets.JobEntryTableset();
JobEntryTS = srvJobEntry.GetByID("011658");
JobEntryTS.JobOper[0].CommentText = "TEST";
JobEntryTS.JobOper[0].RowMod = "U";
srvJobEntry.Update(ref JobEntryTS);

I get the following error:

image

Is there something special I need to do with the JobEntry Tableset to update it? I can get at the data and present it in a message box but not update it.

Thanks,
Ross

This might be the situation where the BO goes haywire if it doesn’t see an unchanged row and an updated row in the tableset…

Take a look at this post: Trouble updating PartLot inside BPM - ERP 10 - Epicor User Help Forum (epiusers.help)

2 Likes

Thanks, Tom. I appreciate the pointer. That worked. Updated snippet below:

var srvJobEntry = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.JobEntrySvcContract>(this.Db);
Erp.Tablesets.JobEntryTableset JobEntryTS = new Erp.Tablesets.JobEntryTableset();
JobEntryTS = srvJobEntry.GetByID(jobNum);
var newJO = (Erp.Tablesets.JobOperRow)JobEntryTS.JobOper.NewRow();
BufferCopy.Copy(JobEntryTS.JobOper[0], newJO);
newJO.CommentText = "TEST";
newJO.RowMod = "U";
JobEntryTS.JobOper.Add(newJO);
srvJobEntry.Update(ref JobEntryTS);

Ross

2 Likes

I know this is an older post, but was curious if something like this would work for If the Job Date changed, then reschedule? I am not good at coding, so was curious before I go off and try this out in test. Any advice on something like this?

@Will79 , you could look at doing something off the back of the JobEntry.Update method.

  1. Possibly a few checks before:
  • Job Due Date Changed

  • Job Released = True

  • Job Due Date != Null

Etc Etc. …

  1. Then invoke the ScheduleEngineSvcContract
  var scheduleEngineBO =Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.ScheduleEngineSvcContract>(this.Db);

if (scheduleEngineBO == null) throw new BLException("Could not render service Erp.Contracts.ScheduleEngineSvcContract.");

Erp.Tablesets.ScheduleEngineTableset scheduleEngineDS 
= new Erp.Tablesets.ScheduleEngineTableset();
           
{
 Erp.Tablesets.ScheduleEngineRow row 
= (Erp.Tablesets.ScheduleEngineRow)scheduleEngineDS.ScheduleEngine.NewRow();

            row.Company = callContextClient.CurrentCompany;
            row.JobNum = Your Job No;
            row.AssemblySeq = 0;
            row.OprSeq = 0;
            row.OpDtlSeq = 0;
            row.StartDate = DateTime.Today;
            row.StartTime = 0;
            row.EndDate = New Due Date;
            row.EndTime = 0;
            row.WhatIf = false;
            row.Finite = false;
            row.SchedTypeCode = "JA";
            row.ScheduleDirection = "End";
            row.SetupComplete =false;
            row.ProductionComplete = false;
            row.OverrideMtlCon = false;
            row.OverRideHistDateSetting = 2;
            row.RecalcExpProdYld = false;
            row.UseSchedulingMultiJob = false;
            row.SchedulingMultiJobIgnoreLocks=false;
            row.SchedulingMultiJobMinimizeWIP = false;
            row.SchedulingMultiJobMoveJobsAcrossPlants = false;
                                   
             bool finished = false;
             string message = string.Empty;

              scheduleEngineDS.ScheduleEngine.Add(row);

              scheduleEngineBO.MoveJobItem(scheduleEngineDS, out finished, out message);

	     if(finished == true)
            {
             //Message After Schd run
            }      

        }
1 Like