Data Directive - Get from JobMtl where IssueComplete = false

I’m trying to setup a BPM where it sends an email when Operation 80 is completed. Inside the email I would like to list the parts that are not issued. There is a field in JobMtl called IssueComplete but I’m not sure how to map it to a temporary table so I can pull it into the email.

I’m using a Standard Data Directive from the Erp.LaborDtl.Update.
I should be able to link the JobNum and then query the JobMtl.

I created Invoke BO Method for getting the Customer Name and Job Number based on the LaborDtl.Jobnum and that worked fine. I dont see a way to link to the JobMtl and store it.


image

I dont want to specify an assemblySeq or mtlSeq but this BO is the only thing that might work.
image

Trying “Update Table by Query” with a new dataset variable.

but I do not get any results.

image

One method I can think of is to use the Job BO to GetByID, and iterate through the JobMtl results.
Something like this should work after you call Job.GetByID;

var jobMaterials = this.MyJobDS.JobMtl.Where( x => x.Company == callContextClient.CurrentCompany
&& !x.IssuedComplete ).ToList();

That would return all your materials without the issued complete flag.
Then just build your message string with the list.

foreach( var material in jobMaterials ) mystring += $"\r\n{material.PartNum} {material.IssuedQty} {material.RequiredQty}";

You can also do a lookup against the Db object, to get the data you want, something like this.

var jobMaterials = this.Db.JobMtl.Where( x => x.Company == mycompanyid && x.JobNum == myjobnum && !x.IssuedComplete ).ToList();

As an aside, you are probably going to need another check. I had ran into this before, but due to rounding sometimes you can issue a part and it will not get marked complete. For example, the job calls for 16 inches of a part, but due to rounding it will convert to 16.0001 inches, and issued complete will not be marked. I had got around this by rounding the issued qty and required qty to the same decimal place and comparing them then.

Thank you i’ll post my detailed results after im finished!

Here is the code I have working. I put this into the Execute Custom Code section and then called on the String “NotIssuedParts” in the SendMail widget.

var jobMaterials = this.dsJobEntry.JobMtl.Where( x => x.Company == callContextClient.CurrentCompany
&& !x.IssuedComplete && x.RequiredQty > 0).ToList();
foreach( var material in jobMaterials ) NotIssueParts += $“\r\n{“Part Num:”} {material.PartNum} \r\n{“Description:”} {material.Description} \r\n\t{“Issued:”} {String.Format(”{0:.00}“, material.IssuedQty)} \r\n\t{“Required:”} {String.Format(”{0:.00}“, material.RequiredQty)}\r\n”;

Result emailed.