Package com.swinarta.sunflower.core.model

Examples of com.swinarta.sunflower.core.model.TransferOrderDetail


    Integer id = RequestUtil.getInteger(getRequestAttributes().get("id"));
   
    if(request.getOperationType() == OPERATION_TYPE.UPDATE){
      Float qty = RequestUtil.getFloat(request.getData().get("qty"));
     
      TransferOrderDetail pod = coreManager.get(TransferOrderDetail.class, id);
      pod.setQty(qty);
     
      try {
        TransferOrderDetail podResp = coreManager.save(TransferOrderDetail.class, pod);
        podResp = coreManager.getTransferOrderDetail(pod.getId());
        DisplayTransferOrderDetail det =  mapper.map(podResp, DisplayTransferOrderDetail.class);

        ProductMeasurement productMeasurement = null;     
        if(podResp.getProduct().getProductMeasurement() != null && !podResp.getProduct().getProductMeasurement().isEmpty()){
          productMeasurement = podResp.getProduct().getProductMeasurement().iterator().next();
        }
       
        if(productMeasurement != null){
          det.getProduct().setProductMeasurement(mapper.map(productMeasurement, DisplayProductMeasurement.class));
        }     
       
        resp = det;
       
      } catch (Exception e) {
        SgwtRestErrorResponse resp1 = new SgwtRestErrorResponse(-1);
        resp1.addError("exception", e.getMessage());
        return resp1;       
      }   
     
    }else if(request.getOperationType() == OPERATION_TYPE.REMOVE){
      TransferOrderDetail pod = coreManager.get(TransferOrderDetail.class, id);
      coreManager.remove(pod);
      return new SgwtRestDeleteResponse(id);
    }   
   
    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);
View Full Code Here


   
    try{
      Product product = coreManager.get(Product.class, productId);
      TransferOrder to = coreManager.get(TransferOrder.class, toId);
     
      TransferOrderDetail tod = new TransferOrderDetail();
      tod.setProduct(product);
      tod.setTransferOrder(to);
      tod.setQty(qty);
     
      TransferOrderDetail todResp = coreManager.save(TransferOrderDetail.class, tod);
      todResp = coreManager.getTransferOrderDetail(tod.getId());
      DisplayTransferOrderDetail det =  mapper.map(todResp, DisplayTransferOrderDetail.class);
     
      ProductMeasurement productMeasurement = null;     
      if(todResp.getProduct().getProductMeasurement() != null && !todResp.getProduct().getProductMeasurement().isEmpty()){
        productMeasurement = todResp.getProduct().getProductMeasurement().iterator().next();
      }
     
      if(productMeasurement != null){
        det.getProduct().setProductMeasurement(mapper.map(productMeasurement, DisplayProductMeasurement.class));
      }     
View Full Code Here

TOP

Related Classes of com.swinarta.sunflower.core.model.TransferOrderDetail

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.