コード例 #1
0
  @RequestMapping(value = "/inspOperationAdd", method = RequestMethod.POST)
  public String saveInspOperation(
      @ModelAttribute("inspOperationCmd") InspOperationBean inspOperationBean,
      HttpServletRequest request,
      HttpServletResponse response) {
    String inspOperationSave = null;
    response.setCharacterEncoding("UTF-8");
    List<InspOperationStep> inspOperationStep = new ArrayList<InspOperationStep>();

    String stepNo[] = inspOperationBean.getInspOperStepNo();
    String sam[] = inspOperationBean.getNoOfSamples();

    InspOperationBean inspBean = (InspOperationBean) inspOperationBean;

    if (stepNo != null) {
      for (int m = 0; m < stepNo.length; m++) {
        InspOperationStep dnd = new InspOperationStep();
        dnd.setInspOperStepNo(stepNo[m]);
        dnd.setNoOfSamples(sam[m]);
        inspOperationStep.add(dnd);
      }
    }
    try {
      inspBean.setInspOprStep(inspOperationStep);
      flag = inspOperService.saveInspOperationDetails(inspBean);

      if (flag == true) {
        session = request.getSession(false);
        Date date = new Date();
        String modifiedDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
        auditLogService.setAuditLogSave(
            session.getAttribute("userId").toString(),
            "A",
            "Inspection Operation",
            "ROW",
            String.valueOf(inspBean.getInspOperationId()),
            "1",
            modifiedDate,
            session.getAttribute("userName").toString());
        inspOperationSave = "Inspection Operation Data Saved Successfully";

      } else {
        inspOperationSave = "Inspection Operation Data Insertion Failures";
        return "redirect:inspOperationHome.mnt?addIOSFail=" + inspOperationSave + "";
      }

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

    return "redirect:inspOperationHome.mnt?addIOSsus=" + inspOperationSave + "";
  }
コード例 #2
0
  @RequestMapping(value = "/inspOperationUpdate", method = RequestMethod.POST)
  public String inspOperationUpdate(
      @ModelAttribute("inspOperationCmd") InspOperationBean inspUpdate,
      HttpServletRequest request,
      HttpServletResponse response) {
    response.setCharacterEncoding("UTF-8");
    String inspUpadted = null;

    List<InspOperationStep> inspOperationStep = new ArrayList<InspOperationStep>();

    String stepNo[] = inspUpdate.getInspOperStepNo();
    String sam[] = inspUpdate.getNoOfSamples();
    int[] stepId = inspUpdate.getInspOperStepId();
    String childDelete = "", ss = "1";
    int id = 0;

    if (stepNo != null) {
      for (int m = 0; m < stepNo.length; m++) {
        InspOperationStep dnd = new InspOperationStep();
        dnd.setInspOperStepNo(stepNo[m]);
        dnd.setNoOfSamples(sam[m]);
        id = stepId[m];
        childDelete = request.getParameter("Check" + id);
        if (ss.equals(childDelete)) {
          flag = inspOperService.deleteInspOperStep(id);
        } else {
          inspOperationStep.add(dnd);
        }
      }
    }

    try {

      inspUpdate.setInspOprStep(inspOperationStep);
      flag = inspOperService.updateInspOperation(inspUpdate);

      if (flag == true) {
        inspUpadted = "Inspection  Operation Data Updated Successfully";

      } else {
        inspUpadted = "Inspection  Operation Data Updation Failed";
        return "redirect:inspOperationHome.mnt?updateInspFail=" + inspUpadted + "";
      }

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

    return "redirect:inspOperationHome.mnt?updateInspSus=" + inspUpadted + "";
  }