Hey there,
Struggling with creating a job from scratch in a post method BPM in quote update. I’m building a temporary job to get details into the quote line.
When I run a trace in Job Entry I see the main assembly in JobAsmbl pop up after the first update (after entering part, description, and required by date).
But I’m not getting the main assembly created until the BPM finishes (I think). This seems to be creating some problems when I try to add subassemblies.
Here’s this:
jobEntry.GetNewJobHead(ref dsJob);
var JobHead_xRow = (from JobHead_Row in dsJob.JobHead
where JobHead_Row.RowMod == IceRow.ROWSTATE_ADDED
select JobHead_Row).FirstOrDefault();
if (JobHead_xRow != null)
{
JobHead_xRow.JobNum = jobNum;
JobHead_xRow.PartNum = "FSQuoteJobSetup";
JobHead_xRow.PartDescription = "FSQuoteJobSetup";
JobHead_xRow.InCopyList = true;
JobHead_xRow.ReqDueDate = DateTime.Today;
JobHead_xRow.Plant = callContextClient.CurrentPlant;
jobEntry.ChangeJobHeadPartNum(ref dsJob);
jobEntry.Update(ref dsJob); // in the trace JobAsmbl pops up in the dataset here
jobEntry.GetNewJobProd(ref dsJob, JobHead_xRow.JobNum, JobHead_xRow.PartNum, 0, 0, 0, string.Empty, string.Empty, 0);
dsJob.JobProd[0].WIPToMiscShipment = true;
dsJob.JobProd[0].MakeToStockQty = 1m;
dsJob.JobProd[0].WIPQty = 1m;
jobEntry.Update(ref dsJob);
//jobEntry.InsertNewJobAsmbl(ref dsJob, JobHead_xRow.JobNum, 0, 0, -1); // Tried this and also get new job assembly – inserts as assembly 1, not 0
var JobAsmbl_xRow = (from JobAsmbl_Row in dsJob.JobAsmbl
select JobAsmbl_Row).FirstOrDefault();
if (JobAsmbl_xRow != null)
{
// does not display unless I manually add the assembly – if I do that, this displays AssemblySeq = 1
this.PublishInfoMessage("to assy (1st) " + JobAsmbl_xRow.AssemblySeq.ToString(), Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "", "");
}
I thought about setting the basic job up in a pre method and bringing it into the post method with the assembly 0 hopefully already set. But I don’t see a way to load it into the dataset (dsJob). If I try jobEntry.GetByID(jobNum, ref dsJob); I get the message “No overload for method ‘GetByID’ takes 2 arguments.”
Any guidance?
Thanks,
Joe