Hello all,
We are in the throes of converting from classic to Kinetic.
In Job Entry, we have a bunch of custom code.
I am attempting to implement the first portion of it in Application Studio.
Here’s the not-as-brief-as-I’d-like summary:
We have a custom field (Character01) on JobHead, that indicates which production line (A,B,C,D) will be used for the job. Line D handles larger jobs, and has different operations available than Lines A,B,C.
In the legacy code, when the Line changes, we loop through and change the JobOper and JobOpDtl records, adjusting ResourceGroupID, ResourceID, and ProdStandard in the JobOpDtl table, and adjusting the LaborEntryMethod in the JobOper table.
We have created a function that we call from AfterChange on the Line field in Application Studio. The event passes in JobNum and Line to the function. I believe we need to do something to cause the JobOper and JobOpDtl records to get updated. The function is changing the local values, but after the function returns, the values are not updated in the Job.
Maybe we need to pass in a reference to those objects, so that when we update them in the function, they are updated in Kinetic?
Any advice or insults are welcome. ![]()
{
//Value Check to prevent error
if(string.IsNullOrEmpty(this.Line)) return;
var edvJobHead = Db.JobHead.Where(x => x.JobNum == this.JobNum).FirstOrDefault();
var edvJobOper = Db.JobOper.Where(x => x.JobNum == this.JobNum);
var edvJobOpDtl = Db.JobOpDtl.Where(x => x.JobNum == this.JobNum);
int jobOpRowCount = edvJobOpDtl.Count();
if(jobOpRowCount <= 0)
{
this.PublishInfoMessage("No operations found.", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Job Entry", "Change Line");
return;
}
this.PublishInfoMessage("New Line:" + this.Line, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Job Entry", "Change Line");
if(this.Line == "D")
{
this.PublishInfoMessage("Line D, before loop", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Job Entry", "Change Line");
int i = 0;
foreach(var edvJobOpDtl_row in edvJobOpDtl)
{
this.PublishInfoMessage("before switch in Line D logic. i = " + i.ToString() + ", Operation: " + edvJobOpDtl_row.OprSeq.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Job Entry", "Change Line");
switch((int)edvJobOpDtl_row.OprSeq)
{
case 40:
this.PublishInfoMessage("case 40", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Job Entry", "Change Line");
edvJobOpDtl_row.ResourceGrpID = string.Empty;
edvJobOpDtl_row.ResourceID = "LTD01";
edvJobOpDtl_row.ProdStandard = 420;
// How to reference JobOper for the same operation? How to update it?
// edvJobOper[i].LaborEntryMethod = "Q";
break;
case 41:
this.PublishInfoMessage("case 41", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Job Entry", "Change Line");
edvJobOpDtl_row.ResourceGrpID = string.Empty;
edvJobOpDtl_row.ResourceID = "LTD02";
edvJobOpDtl_row.ProdStandard = 0;
// edvJobOper[i].LaborEntryMethod = "B";
break;
// Ops 50 through 90 omitted for brevity.
case 100:
this.PublishInfoMessage("case 100", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Job Entry", "Change Line");
edvJobOpDtl_row.ResourceGrpID = string.Empty;
edvJobOpDtl_row.ResourceID = "LTAUDCLD";
edvJobOpDtl_row.ProdStandard = 30;
// edvJobOper[i].LaborEntryMethod = "Q";
break;
}
i++;
}
// How do we cause the updates from the loop to get written (eventually) to the db?
// After the loop, edvJobOpDtl_row no longer exists.
}
}
