コード例 #1
0
 /**
  * 受理编号查询
  *
  * @return
  */
 public String queryNumber() {
   List<WorkPlaceQuality> flist =
       workPlaceQualityBiz.getEntitiesByTwoColumn(
           WorkPlaceQuality.class, "acceptNum", searchNumber, "del_flag", false);
   if (flist != null && flist.size() > 0) {
     workPlaceQuality = flist.get(0);
   } else {
     this.setMsg("数据库中没有查找到此受理编号");
   }
   wplaceQualityId = workPlaceQuality.getId();
   return editwPlaceQuality();
 }
コード例 #2
0
  /**
   * 受理保存 修改
   *
   * @return
   */
  public String saveOrupdateWork() {

    User loginUser = getCurrentUser();
    if (loginUser == null) {
      this.setMsg("用户登陆已过期,请重新登陆!!!");
      logger.info("用户登陆已过期,请重新登陆!!!");
      // return list
      return shutdown();
    }
    String area = null;
    if (!UtilTools.isEmpty(town)) {
      area = town; // + "," + street;
      workPlaceQuality.setArea(area);
    }

    WorkPlaceQuality wpDB = null;
    WorkPlaceEvalResult weDB = null;
    // Integer qId = Integer.parseInt(qualityId);
    if (workPlaceQuality != null) {
      // add new
      String slnumber = workPlaceQuality.getNumber_code() + year + slcode;
      String shnumber = year + shnumbercode + shcode;
      workPlaceQuality.setAcceptNum(slnumber);
      workPlaceQuality.setRecordNum(shnumber);
      List<WorkPlaceQuality> cqList =
          workPlaceQualityBiz.getEntitiesByTwoColumn(
              WorkPlaceQuality.class, "acceptNum", slnumber, "del_flag", false);

      if (workPlaceQuality != null && workPlaceQuality.getId() == null) {
        workPlaceQuality.setStatus(WebConstants.REPORT_STATUS_2);
        if (cqList != null && cqList.size() > 0) {
          this.setMsg("受理编号已存在");
          return editwPlaceQuality();
        }
        if (!UtilTools.isEmpty(acceptDate)) {
          workPlaceQuality.setAcceptDate(UtilTools.getStingTime(acceptDate));
          workPlaceQuality.setSampleDate(UtilTools.getStingTime(acceptDate));
        } else {
          workPlaceQuality.setAcceptDate(UtilTools.getCurrentTime());
          workPlaceQuality.setSampleDate(UtilTools.getCurrentTime());
        }

        Quality qlity =
            qualityBiz.getEntityById(Quality.class, workPlaceQuality.getQuality().getId());
        if (aibefore != null) {
          workPlaceQuality.setAibefore(aibefore.toString());
        }
        workPlaceQuality.setQuality(qlity);
        workPlaceQuality.setAcceptName(loginUser.getName());

        workPlaceEvalResult = new WorkPlaceEvalResult();
        workPlaceQuality.setWorkPlaceEvalResult(workPlaceEvalResult);
        workPlaceEvalResult.setWorkPlaceQuality(workPlaceQuality);

        workPlaceQuality = workPlaceQualityBiz.saveOrUpdateEntity(workPlaceQuality);
        wplaceQualityId = workPlaceQuality.getId();
        if (aibefore != null) {
          workPlaceSampleBiz.addSamples(workPlaceQuality, aibefore);
        }
        List<NumberCode> numList =
            numberCodeBiz.getEntitiesByTwoColumn(
                NumberCode.class,
                "qualityNum",
                WebConstants.CATEGORY_QUALITY_ZYC,
                "shnum",
                workPlaceQuality.getRecordNum());
        if (numList != null && numList.size() > 0) {
          numberCodeBiz.deleteEntity(NumberCode.class, numList.get(0).getId());
        }
        return editwPlaceQuality();

      }
      // update exist
      else if (workPlaceQuality != null && workPlaceQuality.getId() != null) {
        if (cqList != null && cqList.size() > 1) {
          this.setMsg("受理编号已存在");
          return editwPlaceQuality();
        }
        wpDB = workPlaceQualityBiz.getEntityById(WorkPlaceQuality.class, workPlaceQuality.getId());
        String accUserName = wpDB.getAcceptName();
        // Template template = templateBiz.getEntityById(Template.class,
        // templateId);
        if (!loginUser.getName().equals(accUserName)) {
          this.setMsg("对不起,不是自已受理的样品不能修改");
          return editwPlaceQuality();
        }

        if (workPlaceQuality.getAcceptDate() != null) {
          wpDB.setAcceptDate(workPlaceQuality.getAcceptDate());
        }

        wpDB.setAddress(workPlaceQuality.getAddress());
        if (!UtilTools.isEmpty(workPlaceQuality.getArea())) {
          wpDB.setArea(workPlaceQuality.getArea());
        }

        Quality qlity =
            qualityBiz.getEntityById(Quality.class, workPlaceQuality.getQuality().getId());

        wpDB.setCheckUnit(workPlaceQuality.getCheckUnit());
        // wpDB.setHbcategory(kitchenQuality.getHbcategory());

        wpDB.setQuality(qlity);

        wpDB.setNumber_code(workPlaceQuality.getNumber_code()); // 检查

        // wpDB.setQuality(kitchenQuality.getQuality());
        wpDB.setRecordNum(workPlaceQuality.getRecordNum());
        // wpDB.setSamplNum(kitchenQuality.getSamplNum());

        wpDB.setSamplSource(workPlaceQuality.getSamplSource());
        wpDB.setSamplUnit(workPlaceQuality.getSamplUnit());

        wpDB.setStandNum(workPlaceQuality.getStandNum());
        wpDB.setStatus(WebConstants.REPORT_STATUS_2); // 修改

        // weDB = wpDB.getWorkPlaceEvalResult();
        // weDB.setModifiedDate(UtilTools.getCurrentTime());
        // weDB.setModifiedName(loginUser.getName());
        // weDB.setEvalRemark(workPlaceEvalResult.getEvalRemark());
        // weDB.setSensAppr(workPlaceEvalResult.getSensAppr());
        // weDB.setSensEval(workPlaceEvalResult.getSensEval());
        // feDB.setSensRemark(kitchenEvalResult.getSensRemark());
        // weDB.setSensSugg(workPlaceEvalResult.getSensSugg());
        if (aibefore != null) {
          wpDB.setAibefore(aibefore.toString());
        }
        // wpDB.setWorkPlaceEvalResult(weDB);
        workPlaceQuality = workPlaceQualityBiz.saveOrUpdateEntity(wpDB);
        wplaceQualityId = workPlaceQuality.getId();
        if (aibefore != null) {
          workPlaceSampleBiz.addSamples(workPlaceQuality, aibefore);
        }
        this.setMsg("修改作业场所样品成功!");
        logger.info("修改作业场所样品成功!");
        return editwPlaceQuality();
      }
    } else {
      ActionContext.getContext().getSession().remove("wplaceQualityId");
      return editwPlaceQuality();
    }

    // return and list
    return editwPlaceQuality();
  }