Job Receipt To Inventory /BPM / Method Directives

bpm

(Suresh Sreedharan) #1

Hi . I am trying to archive so the Quantity received will not exceed the Production Quantity of that particular job with a hard stop , with the code below . But it always accepts more than 1 . Example : Production Quantity = 10 . Job receipt to inventory will allow 11 and after that the code kicks in with a hard stop . Code as below . Any help will be greatly appreciated

Method Directives > Pre-Processing > ReceiptsFromMfg.PreUpdate

Condition:
Number of rows in the “test” query is more then 1
Query
for each ttPartTran where (ttPartTran.RowMod = ‘A’ or ttPartTran.RowMod = ‘U’) , each JobProd where JobProd.Company = ttPartTran.Company and JobProd.JobNum = ttPartTran.JobNum and JobProd.ReceivedQty > JobProd.ProdQty no-lock

Action:
Synchronously execute ABL code records nothing
ABL CODE:
/* Over Receiving Quantity From Job */

For each ttPartTran where ttPartTran.RowMod = ‘A’ or ttPartTran.RowMod = ‘U’ no-lock.
Find first JobProd where JobProd.Company = ttPartTran.Company and JobProd.JobNum = ttPartTran.JobNum and JobProd.ReceivedQty > JobProd.ProdQty no-lock no-error.

If JobProd.ReceivedQty > JobProd.ProdQty Then Do:

{lib/PublishEx.i &ExMsg = "‘You are Over Receiving The Quantity’ + ’
Receiving Quantity = ’ + string(JobProd.ReceivedQty) + ’

Run Quantity = ’ + string(JobProd.ProdQty)+ ’

Please refer Job Order ’ + string(JobProd.JobNum) + ’
"}.

End.
End.


Goal : Quantity received can NOT exceed the production quantity of the Job with a hard stop

Thank you


(Calvin Krusen) #2

Shouldn’t this be done in the .Update method with a “halt execution” (forget what is called in versions before E10) ?

Edit: “Raise an exception” is what I meant.


(Suresh Sreedharan) #3

Hi Calvin . Thanks for the swift response . Yes i have tried with
Action:
Raise exception based on the “test” template

Gives a hard stop with a +1 Quantity . Example Production Quantity = 10 , it gives a hard stop after 11 . Need to get a hardstop on 11 not after 11