Currently i would like create a BPM from user to prevent over-issue JR. Example we had set “Safety Stock” under Part maintenance to 1400, onhand qty currently have 1360. If user issued 50 supposed system should block it.
However, when i create the BPM and try to access JobHead.ProdQty, it keep return me 0. Can know how to get the qty 50 in BPM custom code?
You’re using the correct field there JobHead.ProdQty. I think the issue may be related to when you’re calling it (like the field may not be populated yet at the time you call the BPM). What BPM are you using (method/data directive and which method) ? Also, when you’re looping through ttJobHead, try looping only the rows which have been changed:
var jobs = (from jrows in ttJobHead where (jrows.RowMod=="U" || jrows.RowMod=="A") select jrows);
foreach (var job in jobs) .....
Ok, did some tests here and looks like the JobHead.InTran data directive is called exaclty 6 times when you add a job through Quick Job Entry. The first 2 times the ProdQty is 0, while the next 4 times the ProdQty is correct.
I would get rid of the data directive and try a method directive from QuickJobEntry - have a look at ValidateJobInfo, PreGenerateJob or GenerateJob. Trace logs are your best friend here.