Examples of PurchasingOrderDetail


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

   
    try{
      Product product = coreManager.get(Product.class, productId);
      PurchasingOrder po = coreManager.get(PurchasingOrder.class, poId);
     
      PurchasingOrderDetail pod = new PurchasingOrderDetail();
      pod.setProduct(product);
      pod.setPurchasingOrder(po);
      pod.setQty(qty);
     
      PurchasingOrderDetail podResp = coreManager.save(PurchasingOrderDetail.class, pod);
      podResp = coreManager.getPurchasingOrderDetail(pod.getId());
      DisplayPurchasingOrderDetail det =  mapper.map(podResp, DisplayPurchasingOrderDetail.class);
      det.setCostPrice(podResp.getProduct().getBuying().getCostPrice());
     
      Stock stock = null;
      ProductMeasurement productMeasurement = null;     
      if(podResp.getProduct().getStock() != null && !podResp.getProduct().getStock().isEmpty()){
        stock = podResp.getProduct().getStock().iterator().next();
      }
      if(podResp.getProduct().getProductMeasurement() != null && !podResp.getProduct().getProductMeasurement().isEmpty()){
        productMeasurement = podResp.getProduct().getProductMeasurement().iterator().next();
      }
      if(stock != null){
        det.getProduct().setStock(mapper.map(stock, DisplayStock.class));
      }
     
View Full Code Here

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

    Integer id = RequestUtil.getInteger(getRequestAttributes().get("id"));
   
    if(request.getOperationType() == OPERATION_TYPE.UPDATE){
      Float qty = RequestUtil.getFloat(request.getData().get("qty"));
     
      PurchasingOrderDetail pod = coreManager.get(PurchasingOrderDetail.class, id);
      pod.setQty(qty);
     
      try {
        PurchasingOrderDetail podResp = coreManager.save(PurchasingOrderDetail.class, pod);
        podResp = coreManager.getPurchasingOrderDetail(pod.getId());
        DisplayPurchasingOrderDetail det =  mapper.map(podResp, DisplayPurchasingOrderDetail.class);
        det.setCostPrice(podResp.getProduct().getBuying().getCostPrice());

        Stock stock = null;
        ProductMeasurement productMeasurement = null;     
        if(podResp.getProduct().getStock() != null && !podResp.getProduct().getStock().isEmpty()){
          stock = podResp.getProduct().getStock().iterator().next();
        }
        if(podResp.getProduct().getProductMeasurement() != null && !podResp.getProduct().getProductMeasurement().isEmpty()){
          productMeasurement = podResp.getProduct().getProductMeasurement().iterator().next();
        }
        if(stock != null){
          det.getProduct().setStock(mapper.map(stock, DisplayStock.class));
        }
       
        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){
      PurchasingOrderDetail pod = coreManager.get(PurchasingOrderDetail.class, id);
      coreManager.remove(pod);
      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.