Exemplo n.º 1
0
  public PickingDetail mapRow(ResultSet rs, int row) throws SQLException {

    PickingDetail pic = new PickingDetail();
    PutawayDetail put = new PutawayDetail();
    Product pro = new Product();
    WarehouseLocation wh = new WarehouseLocation();

    pro.setProductId(rs.getString(1));
    pro.setProductCode(rs.getString(2));
    pro.setProductName(rs.getString(3));
    put.setBalance(rs.getInt(4));
    put.setUnitCode(rs.getString(5));
    wh.setLocationCode(rs.getString(6));
    pic.setProducts(pro);
    pic.setBalance(put.getBalance());
    pic.setUnitCode(put.getUnitCode());
    pic.setWhlocation(wh);

    /* default pickingDetail
    dto.setPickingId(rs.getString(1));
    dto.getProducts().setProductId(rs.getString(2));
    dto.getProducts().setProductCode(rs.getString(3));
    dto.getProducts().setProductName(rs.getString(4));
    dto.setExpiredDate(rs.getDate(5));
    dto.setUnitCode(rs.getString(6));
    dto.setQtyOrder(rs.getInt(7));
    dto.setQtyPick(rs.getInt(8));
    dto.setBalance(rs.getInt(9));
    dto.setUserId(rs.getString(10));
    dto.getCorp().setId(rs.getString(11));
    dto.getWhlocation().setLocationCode(rs.getString(12));
    dto.getWh().setWhCode(rs.getString(13));
    */
    return pic;
  }
Exemplo n.º 2
0
  public void ajaxDocument(HttpServletRequest request, HttpServletResponse response)
      throws ProductDaoException, SupplierDaoException, IOException {

    String prsNumber = request.getParameter("key1");
    String itemCode = request.getParameter("key2");
    String supplierCode = request.getParameter("key3");

    /* get assigned supplier */
    ProductDao productDao = DaoFactory.createProductDao();
    SupplierDao supplierDao = DaoFactory.createSupplierDao();
    AssignCanvassingDao assignCanvassingDao = DaoFactory.createAssignCanvassingDao();
    List<AssignCanvassing> acs =
        assignCanvassingDao.findByPrsNumberItemCodeSupplierCode(prsNumber, itemCode, supplierCode);
    String out = "[";
    for (AssignCanvassing x : acs) {
      if (!out.equals("[")) {
        out += ",";
      }

      Product p = productDao.findWhereProductCodeEquals(x.getProductCode()).get(0);
      Supplier s = supplierDao.findWhereSupplierCodeEquals(x.getSupplierCode()).get(0);

      out +=
          "{\"prsNo\": \""
              + x.getPrsNumber()
              + "\", "
              + "\"assignDate\": \""
              + new SimpleDateFormat("dd/MM/yyyy").format(x.getCreateDate())
              + "\", "
              + "\"itemCode\": \""
              + x.getProductCode()
              + "\", "
              + "\"itemName\": \""
              + p.getProductName()
              + "\", "
              + "\"supplierCode\": \""
              + x.getSupplierCode()
              + "\", "
              + "\"supplierName\": \""
              + s.getSupplierName()
              + "\", "
              + "\"unitPrice\": \""
              + x.getUnitPrice()
              + "\", "
              + "\"top\": \""
              + x.getTop()
              + "\", "
              + "\"topDesc\": \""
              + x.getTopDesc()
              + "\", "
              + "\"tod\": \""
              + x.getTod()
              + "\", "
              + "\"warranty\": \""
              + x.getWp()
              + "\"}";
    }
    out += "]";
    response.getWriter().print(out);
  }
Exemplo n.º 3
0
  public void ajaxSearch(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ProductDaoException, SupplierDaoException {
    Boolean b = Boolean.FALSE;
    PrintWriter pw = response.getWriter();
    LoginUser lu = (LoginUser) request.getSession().getAttribute("user");
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

    ProductDao productDao = DaoFactory.createProductDao();
    SupplierDao supplierDao = DaoFactory.createSupplierDao();
    AssignCanvassingDao assignCanvassingDao = DaoFactory.createAssignCanvassingDao();
    pw.print(
        "{\"maxpage\": "
            + assignCanvassingDao.ajaxMaxPagePA(
                request.getParameter("where"),
                new BigDecimal(request.getParameter("show")),
                lu.getUserId())
            + ",\"data\": [");
    List<AssignCanvassing> acs =
        assignCanvassingDao.ajaxSearchPA(
            request.getParameter("where"),
            request.getParameter("order"),
            Integer.parseInt(request.getParameter("page"), 10),
            Integer.parseInt(request.getParameter("show")),
            lu.getUserId());
    for (AssignCanvassing x : acs) {
      Product p = productDao.findWhereProductCodeEquals(x.getProductCode()).get(0);
      Supplier s = supplierDao.findWhereSupplierCodeEquals(x.getSupplierCode()).get(0);
      if (b) pw.print(",");
      pw.print("{\"1\": \"" + x.getId() + "\", ");
      pw.print("\"2\": \"" + x.getPrsNumber() + "\", ");
      pw.print("\"3\": \"" + x.getSupplierCode() + "\", ");
      pw.print("\"4\": \"" + s.getSupplierName() + "\", ");
      pw.print(
          "\"5\": \""
              + (x.getUpdatedDate() == null ? "" : sdf.format(x.getUpdatedDate()))
              + "\", ");
      pw.print("\"6\": \"" + x.getProductCode() + "\", ");
      pw.print("\"7\": \"" + p.getProductName() + "\"}");
      b = Boolean.TRUE;
    }
    pw.print("]}");
  }
Exemplo n.º 4
0
  public ModelAndView getSupplier(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ProductDaoException, SupplierDaoException {

    String supplierCode = request.getParameter("key");
    LoginUser lu = (LoginUser) request.getSession().getAttribute("user");

    /* get assigned supplier */
    ProductDao productDao = DaoFactory.createProductDao();
    SupplierDao supplierDao = DaoFactory.createSupplierDao();
    PrsDetailDao prsDetailDao = DaoFactory.createPrsDetailDao();
    AssignCanvassingDao assignCanvassingDao = DaoFactory.createAssignCanvassingDao();
    List<AssignCanvassing> acs =
        assignCanvassingDao.findForPriceAssign(supplierCode, lu.getUserId());

    Map<String, Object> json = new HashMap<String, Object>();
    List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();
    for (AssignCanvassing x : acs) {

      Product p = productDao.findWhereProductCodeEquals(x.getProductCode()).get(0);
      Supplier s = supplierDao.findWhereSupplierCodeEquals(x.getSupplierCode()).get(0);
      PrsDetail pd = prsDetailDao.findByPrsProduct(x.getPrsNumber(), x.getProductCode());

      Map<String, Object> row = new HashMap<String, Object>();
      row.put("0", x.getId());
      row.put("1", x.getPrsNumber());
      row.put("2", new SimpleDateFormat("dd/MM/yyyy").format(x.getCreateDate()));
      row.put("3", x.getProductCode());
      row.put("4", p.getProductName());
      row.put("5", pd.getQty());
      row.put("6", x.getSupplierCode());
      row.put("7", s.getSupplierName());

      rows.add(row);
    }
    json.put("rows", rows);

    return new ModelAndView("jsonView", json);
  }