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
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
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.
Hello!
Have anyone tested it in Kinetic Job Receipt to Inventory?
Transactions are being created every time when we press save button, and bpm code from some posts above actually works well. But…
If you once press save and transaction is created then you can put another quantity and press save again. This will add next transaction. It comes through bpm also but this time all quantities in ds.PartTran are 0.
I have tested it in
OK. I figured out the problem was with FirstOrDefault methhod call.
For the second time I am clicking save there are two rows in dataset. Below code is what I needed.