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


(Mark Rowley) #4

Hi, I am looking for exactly the same syntax for the method directive receiptfrommfg.

did you get a resolution to this?
Thanks.


(Mark Rowley) #6

this ABL did the trick on a method directive…/ReceiptsFromMfg.OnChangeActTranQty

I found this post really useful and just modified the ABL

FOR EACH ttPartTran WHERE (ttPartTran.RowMod = ‘A’ OR ttPartTran.RowMod = ‘U’) NO-LOCK.

DEFINE VARIABLE QtyReceived As INTEGER NO-UNDO INITIAL 0.
DEFINE VARIABLE TextMessage As CHARACTER NO-UNDO.
DEFINE VARIABLE QtyCompleted AS INTEGER NO-UNDO INITIAL 0.

FIND FIRST JobHead WHERE JobHead.Company = CUR-COMP AND JobHead.JobNum = ttPartTran.JobNum NO-LOCK.
ASSIGN QtyCompleted = JobHead.QtyCompleted.

FOR EACH PartTran WHERE PartTran.Company = CUR-COMP AND PartTran.JobNum = ttPartTran.JobNum AND PartTran.TranType = ‘MFG-STK’ NO-LOCK.
QtyReceived = QtyReceived + PartTran.TranQty.
END.

ASSIGN TextMessage = 'This additional receipt quantity will mean the total received quantity will exceed the jobs current completed quantity of ’ + STRING(QtyCompleted).

IF (QtyReceived + ttPartTran.ActTranQty) > QtyCompleted THEN DO:
{lib\PublishEx.i &exMsg = "TextMessage "}
{&THROW_PUBLIC}.
END.

END.