Link between a labor dtl and a parttran

We are reporting production qty and scrap via Time and Expense.

By entering a production qty, a parttran for mfg-stk is created for the part.

At the time of entering production on T&E, I’d like to get what parttran id is related so I can store it along with my box info.

I realize there is no direct link between the two tables. I could go the hard route and search the part tran table for my part, qty, job etc but I was hoping there was a quicker, easier way.

Any thoughts?

You are screwed… In 9X they used to call EndActivity() instead of Update() and it returned the TranNumbers as out params.But that’s gone in 10. It should be very easy though in a BPM run a quick query and get those back based on the LaborSeq and such.

2 Likes

Where should I be placing this BPM? I cant find any ref of tran in LaborDtl and I find no ref to laborseq in Partran.

I figured I’d try a trace to see the flow but it stops at the T&E ops only

I’d stick the BPM in Labor.Update() or something then use the Job, Oper, Employee, Date etc… to find the right part tran usnig LINQ

Here’s what I ran with - I’m hoping I put enough checks to ensure I get the right record. I;m really baffled why I cant use neither the JobNum or PartNum

var ld = ttLaborDtl.Where(l => l.LaborQty > 0).LastOrDefault(); //only records that are prod qty - assume it's the last?

var pt = 
from t in Db.PartTran 
where 
t.Company == callContextClient.CurrentCompany && 
t.Plant == callContextClient.CurrentPlant &&
t.SysDate >= DateTime.Today &&
t.TranType == "MFG-STK" && t.TranQty == ld.LaborQty && 
//t.PartNum == ld.PartNum 
//t.JobNum == ld.JobNum  && 
t.AssemblySeq == ld.AssemblySeq 
orderby t.TranNum descending
select(t.TranNum);