Stop Material Issue If OP is Complete


I’ve started writing a BPM that will stop the shop floor from issuing material on a closed Operation. I did a trace and saw it was the IssueReturn BO and then said If TranQty changes from any to another, invoke Op BO. However, the IssueReturn doesn’t have the Op Number in it, so I can’t connect them.

Anyone have a better idea to get this done? I am thinking I may be going at this backwards.

If you setup your materials with related operations, then you have to link the material to the operation through that related op field. Check out JobMtl.RelatedOperation.

So, you would do the BPM on JobMtl, a Data Directive, correct?

I think a method directive approach is usually best. Which is the last method that submits the data to perform the “Issue”?

The method is IssueReturn. IssueReturn doesn’t have Related Operation.

This links the material part number to the related operation.

	[JobMtl].[JobNum] as [JobMtl_JobNum],
	[JobMtl].[AssemblySeq] as [JobMtl_AssemblySeq],
	[JobMtl].[MtlSeq] as [JobMtl_MtlSeq],
	[JobMtl].[PartNum] as [JobMtl_PartNum],
	[JobMtl].[RelatedOperation] as [JobMtl_RelatedOperation],
	[JobMtl].[MtlBurRate] as [JobMtl_MtlBurRate],
	[JobOper].[OpComplete] as [JobOper_OpComplete]
from Erp.JobMtl as JobMtl
inner join Erp.JobOper as JobOper on 
	JobMtl.RelatedOperation = JobOper.OprSeq
	 JobMtl.JobNum = JobOper.JobNum
	and JobMtl.AssemblySeq = JobOper.AssemblySeq

You have to do this in custom code somehow. Use the custom code widget to link the material part to the operation and then pull down the OpComplete flag to use as your test to issue or not.

I don’t have the exact code, but something like this:

var rel = (from rRow in Db.OrderRel where rRow.OrderNum == MyOrder && rRow.OrderLine == MyLine && rRow.OrderRelNum == MyRel select rRow))
	if (rel != null)
		// put your OpComplete check in here

The sample above is from a different BPM where I look at the OrderRel table. I think something like this should be able to pull your data. I am not sure if you need to do a join inside the custom code.
Good luck!