BPM - Specific OP start only if previous OP Completes

Hi Guys,

I am working on a BPM to check if the previous operation has been completed before a selected Operation can start .

image
Example: Any operation before Final Inspection has to be completed ( it could be any operations , we have about 200 operations) IF Final Inspection wants to start

My Code:
Condition
number of rows in the ‘OpSeq’ query is not less than 1
For each ttLaborDtl where ttLaborDtl.RowMod = “A” no-lock,
Each JobOper where JobOper.OprSeq < ttLaborDtl.OprSeq.

Action
ABL Code
/* Complete QAFNL PRIOR OPR*/
For each ttLaborDtl where ttLaborDtl.RowMod = “A” no-lock.
Find Last JobOper where JobOper.OprSeq < ttLaborDtl.OprSeq no-lock.
If avail JobOper Then DO:
If (JobOper.OpCode <> “QAFNL”) and JobOper.OpComplete = False
Then DO:
{lib/PublishEx.i &ExMsg = “‘WARNING!!! You cannot start QA Final Inspection as the previous operation, ’ + string(JobOper.OpDesc) + ’ has not been completed.’”}.
end.
end.
end.

Need some advise on how to get a solution on this . Thanks for any tips

in ERP10, C# you can use the principle and convert the code to ABL

@A.Baeisa
Thanks for the tip . But that will lead to all operations , i am looking to just restrict “ANY” operations that is prior to "JobOper.OpCode = “QAFNL” has to be completed , as the operations sequence varies from job to job . Whichever operation that is prior to QAFNL has to be completed before QAFNL can Start Production Activity .

Hi @Mi3kel,
it is an easy modification, just add a UD checkbox to Operation Master then use it in the code to validate, so if it is true carry on the other validation, and it is the same for your other requirement, i.e. if you need all previous operations not the one before this specific op, remove the Max() function and make the foreach loop code to go through all previous operations instead of the last one.

Hi @A.Baeisa . Would really appreciate if you could show me an example in ABL

unfortunately, all my developed code in c#, i only started coding 18 months ago, but the principle in coding is the same, the only different is the command constructions, and the variety of built-in subroutines (i.e. functions)

I’ve created UD Checkbox on OpMaster.CheckBox06 but it doesnt pass that checkpoint , due to that the job has been created after that operation = “QAFNL” after the checkbox ticked in OpMaster?

 /* Stop labor transaction before QAFNL */
    For each ttLaborDtl where ttLaborDtl.RowMod = "A" no-lock.
    Find Last JobOper where JobOper.Company = Cur-Comp and JobOper.JobNum = ttLaborDtl.JobNum and JobOper.AssemblySeq = ttLaborDtl.AssemblySeq and JobOper.OprSeq < ttLaborDtl.OprSeq no-lock.
    If avail JobOper Then DO:
    /* {lib/PublishInfoMsg.i &InfoMsg = "JobOper.OpCode"}. */
    If JobOper.OpCode = "QAFNL" and JobOper.OpComplete = False
    Then DO:
    {lib/PublishEx.i &ExMsg = "'WARNING!!! You cannot start QA Final Inspection as the previous operation, ' + string(JobOper.OpDesc) + ' has not been completed.'"}.
    end.
    end.
    end.

That triggers the Operation after QAFNL (OP 90 SHIP) but i am trying to trigger the start of operation QAFNL That (OP 70 CLEANWI) is not completed you cant begin QAFNL
image

you need to call the Operation Master Record using ttLaborDtl data, OpCode is your link between the two tables, nothing to do with the JobOper table

you do not need this condition, and if this JobOper.OprSeq < ttLaborDtl.OprSeq satisfied, then later operations should not be effected

/* Stop labor transaction before QAFNL */
For each ttLaborDtl where ttLaborDtl.RowMod = "A" no-lock.
Find Last JobOper where JobOper.Company = Cur-Comp and JobOper.JobNum = ttLaborDtl.JobNum and JobOper.AssemblySeq = ttLaborDtl.AssemblySeq and JobOper.OprSeq < ttLaborDtl.OprSeq no-lock.
If avail JobOper Then DO:
/* {lib/PublishInfoMsg.i &InfoMsg = "JobOper.OpCode"}. */
If ttLaborDtl.OpCode = "QAFNL" and JobOper.OpComplete = False
Then DO:
{lib/PublishEx.i &ExMsg = "'WARNING!!! You cannot start QA Final Inspection as the previous operation, ' + string(JobOper.OpDesc) + ' has not been completed.'"}.
end.
end.
end.

Works Perfectly
Thank you @A.Baeisa

yes but you are hard coding your OpCode, which means every time something new arise you need to go back and amend your code, i.e. it is not data driven, plus is it triggered for all previous operations or the last one only?

It triggers only if the last previous operation not complete
image
image

All the other previous operations is not affected nor the operation after QAFNL