Examples of ReturnToSupplierDetail


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

   
    try{
      Product product = coreManager.get(Product.class, productId);
      ReturnToSupplier ret = coreManager.get(ReturnToSupplier.class, retId);
     
      ReturnToSupplierDetail retd = new ReturnToSupplierDetail();
      retd.setProduct(product);
      retd.setReturnToSupplier(ret);
      retd.setQty(qty);
     
      ReturnToSupplierDetail retResp = coreManager.save(ReturnToSupplierDetail.class, retd);
      retResp = coreManager.getReturnToSupplierDetail(retd.getId());
      DisplayReturnToSupplierDetail det =  mapper.map(retResp, DisplayReturnToSupplierDetail.class);
      det.setCostPrice(retResp.getProduct().getBuying().getCostPrice());
     
      ProductMeasurement productMeasurement = null;     
      if(retResp.getProduct().getProductMeasurement() != null && !retResp.getProduct().getProductMeasurement().isEmpty()){
        productMeasurement = retResp.getProduct().getProductMeasurement().iterator().next();
      }
     
      if(productMeasurement != null){
        det.getProduct().setProductMeasurement(mapper.map(productMeasurement, DisplayProductMeasurement.class));
      }     
View Full Code Here

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

    Integer id = RequestUtil.getInteger(getRequestAttributes().get("id"));
   
    if(request.getOperationType() == OPERATION_TYPE.UPDATE){
      Float qty = RequestUtil.getFloat(request.getData().get("qty"));
     
      ReturnToSupplierDetail ret = coreManager.get(ReturnToSupplierDetail.class, id);
      ret.setQty(qty);
     
      try {
        ReturnToSupplierDetail retResp = coreManager.save(ReturnToSupplierDetail.class, ret);
        retResp = coreManager.getReturnToSupplierDetail(retResp.getId());
        DisplayReturnToSupplierDetail det =  mapper.map(retResp, DisplayReturnToSupplierDetail.class);
        det.setCostPrice(retResp.getProduct().getBuying().getCostPrice());

        ProductMeasurement productMeasurement = null;
        if(retResp.getProduct().getProductMeasurement() != null && !retResp.getProduct().getProductMeasurement().isEmpty()){
          productMeasurement = retResp.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){
      ReturnToSupplierDetail retd = coreManager.get(ReturnToSupplierDetail.class, id);
      coreManager.remove(retd);
      return new SgwtRestDeleteResponse(id);
    }   
   
    SgwtRestFetchResponseBase ret = new SgwtRestFetchResponseBase(resp);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.