예제 #1
0
 /**
  * Return part modification initial page
  *
  * @param request HttpServletRequest
  * @param form ActionForm
  * @return String Return modification page, forward = "addInit"
  */
 public String modifyInit(HttpServletRequest request, ActionForm form) {
   String forward = "addInit";
   ArrayList locationList = new ArrayList();
   try {
     Long chkId = new Long(request.getParameter("id").trim());
     //			ReturnPartBo bo = new ReturnPartBo();
     locationList = returnPartBo1.locationList();
     request.setAttribute("ReturnPartForm", returnPartBo1.find(chkId));
     request.setAttribute("locationList", locationList);
   } catch (Exception e) {
     e.printStackTrace();
   }
   request.setAttribute("state", "modify");
   return forward;
 }
예제 #2
0
  /**
   * Delete return part record
   *
   * @param request HttpServletRequest
   * @param form ActionForm
   * @return String Return result message page, forward = "alert"
   */
  public String returnPartDelete(HttpServletRequest request, ActionForm form) {
    String forward = "alert";
    int tag = -1;
    String flag = "";
    try {
      String chkId = request.getParameter("chkId");

      String[] idList = null;

      if (chkId != null && !chkId.equals("")) {
        // idList = chkId.split(",");
        //				ReturnPartBo rb=new ReturnPartBo();
        tag = returnPartBo1.deleteList(chkId);
      }

      if (tag == 1) {
        flag = "returnPartDeleteSucc";
      } else {
        flag = "returnPartDeleteError";
      }

      request.setAttribute("businessFlag", flag);
      request.setAttribute("tag", tag + "");
      request.setAttribute("state", "delete");
    } catch (Exception e) {
      e.printStackTrace();
    }
    return forward;
  }
예제 #3
0
  /**
   * Add return part record
   *
   * @param request HttpServletRequest
   * @param form ActionForm
   * @return String Return result message page, forward = "alert"
   */
  public String returnPartAdd(HttpServletRequest request, ActionForm form) {
    int tag = -1;
    String flag = "";
    String forward = "alert";
    try {
      ReturnPartForm rf = (ReturnPartForm) form;
      /*
       * 折扣率的添加判断
       */
      /*if(rf.getDiscountRate().equals(new Double(0))){
      	rf.setDiscountRate(null);
      }*/
      //			ReturnPartBo rb=new ReturnPartBo();
      //	if(rb.isExistence(rf))
      //	{

      rf.setCreateBy((Long) request.getSession().getAttribute("userId"));
      rf.setCreateDate(
          new Timestamp(
              ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate().getTime()));
      tag = returnPartBo1.add(rf);
      //	}*/
      if (tag == 1) {
        flag = "returnPartAddSucc";
      } else {
        flag = "returnPartAddError";
      }
      request.setAttribute("businessFlag", flag);
      request.setAttribute("tag", tag + "");
      request.setAttribute("state", "add");
    } catch (Exception e) {
      e.printStackTrace();
    }
    return forward;
  }
예제 #4
0
  /**
   * ajax check rma is duplicate
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return if duplicate return false then not duplicate return true
   */
  public void ajaxRmaDuplicateCheck(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    try {
      String id = request.getParameter("id");
      String partCode = request.getParameter("partCode");
      String rmaParCode = request.getParameter("rmaParCode");
      //		 	String returnLocation=request.getParameter("returnLocation");
      //		 	String orgName=request.getParameter("orgName");
      //		 	String registeredModel=request.getParameter("registeredModel");
      //		 	String IWPeriod=request.getParameter("IWPeriod");
      //		 	String discountRate=request.getParameter("discountRate");
      //		 	Double discountRatdDouble;

      String result = "false";
      //		 	if(discountRate==null||!Operate.isNumeric(discountRate)){
      //		 		discountRatdDouble=null;
      //		 	}else{
      //		 		discountRatdDouble=Double.valueOf(discountRate);
      //		 	}

      ReturnPartForm rpf = new ReturnPartForm();
      rpf.setPartCode(partCode);
      rpf.setReturnPartCode(rmaParCode);
      //			rpf.setReturnLocCode(returnLocation);
      //			rpf.setOrgName(orgName);
      //			rpf.setModelCode(registeredModel);
      //			rpf.setWarrantyPeriod(IWPeriod);
      //			rpf.setDiscountRate(discountRatdDouble);
      ArrayList list = returnPartBo1.list(rpf);
      if (id == null || id.isEmpty()) { // add
        result = list != null && list.size() > 1 ? "false" : "true";
      } else { // modify
        if (list == null || list.size() <= 1) {
          result = "true";
        } else if (list.size() > 2) { // 一定有重复的了
          result = "false";
        } else if (list.size() > 1) { // 可能是没有修改数据直接提交
          String[] data = (String[]) list.get(1);
          result = id.equals(data[8]) ? "true" : "false"; // 如果查到一条并且是修改的那条则认为没重复可以Save
        }
      }

      PrintWriter writer = response.getWriter();
      response.setContentType("text/xml");
      response.setHeader("Cache-Control", "no-cache");

      writer.println("<xml>");
      writer.println("<flag>" + result + "</flag>");
      writer.println("</xml>");
      writer.flush();
      writer.close();

    } catch (Exception e) {
      e.getStackTrace();
    }
  }
예제 #5
0
 /**
  * Query return part mapping form
  *
  * @param request HttpServletRequest
  * @param form ActionForm
  * @return String Return query result page, forward ="list"
  */
 public String list(HttpServletRequest request, ActionForm form) {
   String forward = "list";
   ArrayList returnPartList = new ArrayList();
   ArrayList locationList = new ArrayList();
   //		ReturnPartBo rb=new ReturnPartBo();
   try {
     ReturnPartForm rf = (ReturnPartForm) form;
     /*
      * 折扣率的查询转换
      */
     /*if(rf.getDiscountRateSub()!=null&&!rf.getDiscountRateSub().equals("")){
     	rf.setDiscountRate(new Double(rf.getDiscountRateSub()));
     }*/
     returnPartList = returnPartBo1.list(rf);
     locationList = returnPartBo1.locationList();
     request.setAttribute("partList", returnPartList);
     request.setAttribute("locationList", locationList);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return forward;
 }
예제 #6
0
  /**
   * Modify return part record
   *
   * @param request HttpServletRequest
   * @param form ActionForm
   * @return String Return result message page, forward = "alert"
   */
  public String returnPartModify(HttpServletRequest request, ActionForm form) {
    String forward = "alert";
    int tag = -1;
    String flag = "";
    try {
      ReturnPartForm rf = (ReturnPartForm) form;
      /*
       * 折扣率添加的判断
       */
      /*if(rf.getDiscountRate().equals(new Double(0))){
      	rf.setDiscountRate(null);
      }*/
      //			ReturnPartBo rb=new ReturnPartBo();

      Long returnPartId = rf.getReturnPartId();
      ReturnPartForm rpf = (ReturnPartForm) returnPartBo1.find(returnPartId);

      rf.setCreateBy(rpf.getCreateBy());
      rf.setCreateDate(rpf.getCreateDate());
      rf.setUpdateBy((Long) request.getSession().getAttribute("userId"));
      rf.setUpdateDate(
          new Timestamp(
              ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate().getTime()));
      tag = returnPartBo1.modify(rf);
      if (tag == 1) {
        flag = "returnPartModifySucc";

      } else {
        flag = "returnPartModifyError";
      }
      request.setAttribute("businessFlag", flag);
      request.setAttribute("state", "modify");
      request.setAttribute("tag", tag + "");
    } catch (Exception e) {
      e.printStackTrace();
    }
    return forward;
  }
예제 #7
0
 /**
  * Return part addition initial page
  *
  * @param request HttpServletRequest
  * @param form ActionForm
  * @return String Return addition page,forward = "addInit"
  */
 public String addInit(HttpServletRequest request, ActionForm form) {
   String forward = "addInit";
   ArrayList locationList = new ArrayList();
   try {
     ReturnPartForm returnPartForm = new ReturnPartForm();
     //			ReturnPartBo bo = new ReturnPartBo();
     locationList = returnPartBo1.locationList();
     request.setAttribute("ReturnPartForm", returnPartForm);
     request.setAttribute("locationList", locationList);
     request.setAttribute("state", "Add");
   } catch (Exception e) {
     e.printStackTrace();
   }
   return forward;
 }
예제 #8
0
  /**
   * Parse Excel file
   *
   * @param request HttpServletRequest
   * @param form ActionForm
   * @return Forward page
   */
  public String returnPartParse(HttpServletRequest request, ActionForm form) {
    String forward = "resultMessage";

    try {
      String filePath = request.getParameter("filePath");
      HttpSession session = request.getSession();
      Long userId = (Long) session.getAttribute("userId");
      //			ReturnPartBo rpo = new ReturnPartBo();
      ArrayList dataList = returnPartBo1.excelParse(filePath, userId.toString());
      int tag[] = (int[]) dataList.get(0);
      if (tag[0] == 1 || tag[0] == -1) {
        request.setAttribute("tag", tag[0] + "");
        request.setAttribute("parseNum", tag[1] + "");
        request.setAttribute("businessFlag", "returnPartParse");
      } else {
        forward = "uploadDateErrRp";
        request.setAttribute("dataList", dataList);
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return forward;
  }