Advertisement
Guest User

Untitled

a guest
May 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. /* ********************************* RESETA DISTRIBUIÇÃO REGIONAL ************************************** */
  2. Id PlanPerId = 'a1v0V00000CKYNk';
  3. String status = 'Distribuído';
  4. Planejamento_Periodico__c pp = [select Id, Name from Planejamento_Periodico__c where Id = :PlanPerId];
  5. System.debug(pp);
  6. pp.Status__c = 'Distribuído para as Regionais';
  7. update pp;
  8.  
  9. List<Objetivo__c> objs = [select Id from Objetivo__c where Planejamento_Periodico__c = :PlanPerId and Status__c = :status];
  10. System.debug(objs.size());
  11. delete objs;
  12.  
  13. List<Objetivo__c> objsToUpdate = [select Id, Meta__c, MetaDistribuicao__c from Objetivo__c where Planejamento_Periodico__c = :PlanPerId and Status__c = 'Ajustar Objeto'];
  14. System.debug(objs.size());
  15. for(Objetivo__c o : objsToUpdate) {
  16.     o.MetaDistribuicao__c=0;
  17. }
  18. update objsToUpdate;
  19.  
  20. List<Horas_Disponiveis__c> listaHD = [SELECT Id, Status__c, Planejamento_Periodico__c, Homem_Hora_Distribuido__c FROM Horas_Disponiveis__c WHERE Planejamento_Periodico__c = :PlanPerId];
  21. for(Horas_Disponiveis__c hd : listaHD) {
  22.     hd.Status__c = 'Não Distribuído';
  23.     hd.Homem_Hora_Distribuido__c = 0;
  24. }
  25. update listaHD;
  26. /* ***************************** FIM DO RESETA DISTRIBUIÇÃO REGIONAL ******************************** */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement