Advertisement
tko_pb

GoodsMovemenForFaildedApproved.java

Apr 2nd, 2019
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. package org.wirabumi.gen.oez.porting;
  2.  
  3. import java.util.List;
  4.  
  5. import org.openbravo.base.exception.OBException;
  6. import org.openbravo.base.secureApp.VariablesSecureApp;
  7. import org.openbravo.dal.service.OBDal;
  8. import org.openbravo.model.ad.ui.Tab;
  9. import org.openbravo.model.materialmgmt.transaction.InternalMovement;
  10. import org.wirabumi.gen.oez.event.DocumentRoutingHandlerAction;
  11.  
  12. public class GoodsMovemenForFaildedApproved extends DocumentRoutingHandlerAction {
  13.     private final String completeStatus="CO";
  14.  
  15.     @Override
  16.     public void doRouting(String adWindowId, String adTabId, String doc_status_to, VariablesSecureApp vars,
  17.             List<String> recordId) {
  18.         for (String goodsMovementID : recordId){
  19.             InternalMovement goodMovId = OBDal.getInstance().get(InternalMovement.class, goodsMovementID);
  20.             String docstatus = goodMovId.getOezDocstatus();
  21.             Boolean recordIsProcessed = goodMovId.isProcessed();
  22.             Boolean recordIsCompleted = docstatus.equalsIgnoreCase(completeStatus) ;
  23.  
  24.             if (recordIsProcessed && !recordIsCompleted) {
  25.                 goodMovId.setOezDocstatus(completeStatus);
  26.                 OBDal.getInstance().save(goodMovId);
  27.                 OBDal.getInstance().flush();
  28.                 continue;
  29.             }
  30.             else {
  31.                 throw new OBException("@ActionNotAllowedHere@");
  32.             }
  33.         }
  34.     }
  35.  
  36.     @Override
  37.     public String getCoDocumentNo(String recordID, Tab tab) {
  38.         // TODO Auto-generated method stub
  39.         return null;
  40.     }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement