Пример #1
1
  @Transactional
  @RequestMapping(value = "/saveBooking", method = RequestMethod.POST)
  public void saveBooking(
      HttpServletResponse httpservletResponse, @RequestParam("grnId") Integer grnId) {
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = new Date();
    String current = dateFormat.format(date);
    try {
      GrnVO grnVO = grnManager.get(grnId);

      // Update oders booking details
      OdersVO odersVO = oderManager.get(grnVO.getOrders().getOderId());
      odersVO.setGrnQty(odersVO.getGrnQty() - grnVO.getQuantity());
      odersVO.setBookingQty(odersVO.getBookingQty() + grnVO.getQuantity());
      oderManager.update(odersVO);

      grnVO.setStatus("booking");
      grnVO.setBookingDate(current);
      grnVO.setBookingUserId("1");
      String status = grnManager.update(grnVO);

      if (grnVO != null) {

        writeJsonString(httpservletResponse, "{\"Data\":\"" + status + "\",\"success\":true}");
      } else {
        writeJsonString(httpservletResponse, "{\"Data\":\"" + status + "\",\"success\":false}");
      }
    } catch (Exception e) {
      System.out.print(e);
      getLogger().error(e.getMessage());
      writeJsonString(
          httpservletResponse, "{\"Data\":\"" + e.getMessage() + "\",\"success\":false}");
    }
  }
Пример #2
0
  @RequestMapping(value = "/issuedGRN", method = RequestMethod.POST)
  public void issuedGRN(
      HttpServletResponse httpservletResponse, @RequestParam("grnId") Integer grnId) {
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = new Date();
    String current = dateFormat.format(date);
    try {

      GrnVO grnVO = grnManager.get(grnId);
      grnVO.setStatus("issued");

      // Update Daily isseued
      DailyOdersVO dailyOder =
          dailyOdersManager.getDailyOder(grnVO.getOrders().getOderId(), current).get(0);
      dailyOder.setDayIss(dailyOder.getDayIss() + grnVO.getQuantity());
      dailyOdersManager.update(dailyOder);

      OdersVO odersVO = grnVO.getOrders();
      odersVO.setBookingQty(odersVO.getBookingQty() - grnVO.getQuantity());
      odersVO.setGinQty(odersVO.getGinQty() + grnVO.getQuantity());
      oderManager.update(odersVO);
      grnVO.setIssuedDate(current);
      grnVO.setIssuedUserId("1");
      String status = grnManager.update(grnVO);

      if (grnVO != null) {
        writeJsonString(httpservletResponse, "{\"Data\":\"" + status + "\",\"success\":true}");
      } else {
        writeJsonString(httpservletResponse, "{\"Data\":\"" + status + "\",\"success\":true}");
      }
    } catch (Exception e) {
      getLogger().error(e.getMessage());
      writeJsonString(
          httpservletResponse, "{\"Data\":\"" + e.getMessage() + "\",\"success\":false}");
    }
  }