Craig
(Craig Rogers)
May 29, 2025, 7:02pm
22
I did for my BPM. its a pre-process labor update method directive.
this.lbr = false;
var Lbrqty = ds.LaborDtl.Where(x => x.RowMod != "").FirstOrDefault();
if(Lbrqty != null)
{
var caller = callContextClient.AssemblyName;
if (caller != null)
{
if(caller.Contains("EndActivity") && Lbrqty.LaborQty > 0)
{
//var lb = ttLaborDtl.Where(x => x.Updated()).FirstOrDefault();
var ttLDtl = ds.LaborDtl.Where(x => x.RowMod != "").FirstOrDefault();
if(ttLDtl != null)
{
var oper = (from joper in Db.JobOper
where joper.JobNum == ttLDtl.JobNum && joper.AssemblySeq == ttLDtl.AssemblySeq && joper.OprSeq == ttLDtl.OprSeq
select new {joper}).FirstOrDefault();
if(oper != null)
{
bool QtyExceeded = Db.JobOper.Any(x =>
x.Company == ttLDtl.Company &&
x.JobNum == ttLDtl.JobNum &&
x.AssemblySeq == ttLDtl.AssemblySeq &&
x.OprSeq == ttLDtl.OprSeq &&
ttLDtl.LaborQty + x.QtyCompleted > x.RunQty);
callContextBpmData.Number01 = Math.Round(oper.joper.RunQty , 2 , MidpointRounding.AwayFromZero);
callContextBpmData.Number02 = Math.Round( oper.joper.QtyCompleted , 2 , MidpointRounding.AwayFromZero) ;
if (QtyExceeded)
//if(lb.LaborQty > 0)
{
lbr = true;
}
}
}
}
}
}
2 Likes
KBMihaila
(Karen B Mihaila)
June 19, 2025, 2:44pm
23
Mike,
I picked this back up and added the variable but I am getting the following error on my custom code:
Ernie
(Ernie Lowell)
June 19, 2025, 3:02pm
24
Try changing “ttLaborDtl” to “ds.LaborDtl”
1 Like
KBMihaila
(Karen B Mihaila)
June 19, 2025, 3:09pm
25
Ernie:
ds.LaborDtl
Ernie,
Do I do change it everywhere or just on that line.
Karen
Ernie
(Ernie Lowell)
June 19, 2025, 3:17pm
26
Everywhere. I’m not a programmer (and actual programmers are rolling over in the aisles when they see me answering questions like this), but I’ve had to make this change a lot.
1 Like
gpayne
(Greg Payne)
June 19, 2025, 3:29pm
27
@KBMihaila You only need to change it on the top line.
That code looks like it came from the ABL to C# converter and the code by @Craig is more like how we would approach things now.
KBMihaila
(Karen B Mihaila)
June 19, 2025, 4:30pm
28
Greg,
It doesn’t seem to work?? No errors just no message. If I use Craigs custom code what would I need to change? Any direction is appreciated.
Karen
KBMihaila
(Karen B Mihaila)
June 19, 2025, 4:36pm
29
@gpayne
this is the errors I get when I use Craigs code:
Craig
(Craig Rogers)
June 19, 2025, 4:39pm
30
lbr is a global variable. you will need to create that first. its a Bool.
KBMihaila
(Karen B Mihaila)
June 19, 2025, 4:43pm
31
@Craig ,
I applied the variable and no errors I will add Labor and see if I get the Exception Message.
Thanks,
Karen
KBMihaila
(Karen B Mihaila)
June 19, 2025, 6:07pm
32
@Craig I am having no luck and am wondering if you can take a look at my BPM? See attached
Ticket 57212.bpm (21.3 KB)
KBMihaila
(Karen B Mihaila)
June 19, 2025, 6:38pm
33
@Craig
Disregard. I think I’ve got it! I will reach out with more questions.
Karen
2 Likes
gpayne
(Greg Payne)
June 19, 2025, 6:42pm
34
@KBMihaila Good to hear. I was away from my machine. We are closed today.