Creating a verification on endjob in productionfinish

Hello, I need help with my task. I need to verify if all products in BOM are ready to report as finished.

The solution that im thinking is to verify if all sub tasks of the main task are marked.

So I need enable or disable the endjob on the statement result.

Im all new in this so I appreciate all help.

Actually im trying to disable edit value on this field if condition is false.

public class ProdParmReportFinishedVerify
{

   ProdParmReportFinished ProdParmReportFinished;
   ProdTable ProdTable;
 

          
   public void run()
   {
    

        {while select ProdId, ProdStatus, InventRefType, InventRefID from ProdTable where  
            InventRefType::CRMQuotation && InventRefType::FixedAsset && InventRefType::InventJournal
             && InventRefType::InventTransfer && InventRefType::ProdLine && InventRefType::Production
             && InventRefType::Purch && InventRefType::Sales 
            if(ProdStatus::ReportedFinished)
        {
            ProdParmReportFinished.EndJob = NoYes::Yes;
            ProdParmReportFinished_EndJob.allowedit(false);
          info(' Success');
        }
        else
            {
                ProdParmReportFinished.EndJob = NoYes::No;
                info(' Failed verification');
            }
        }


        }

}