예제 #1
0
  /**
   * 合同失效按钮的处理方法
   *
   * @param pk
   * @param state
   * @param mgr_level
   * @return
   * @throws LfwBusinessException
   */
  public String htCancelState(String pk) throws LfwBusinessException {
    try {
      DzcgMainAuthority dma = new DzcgMainAuthority();

      if (dma.existsCloseData(pk, EbsOperaitonConst.CLOSEREQCODE)) {

        return "此单据已经被关闭,无法进行此操作!";
      }
      ContractVO contraceVO = (ContractVO) getBaseDao().retrieveByPK(ContractVO.class, pk);
      contraceVO.setOa_state(0); // 失效状态
      contraceVO.setModifydate(new UFDate(System.currentTimeMillis()));
      contraceVO.setModifyid(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
      contraceVO.setPub_date(new UFDate(System.currentTimeMillis()));
      contraceVO.setPub_user(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
      contraceVO.setPub_username(LfwRuntimeEnvironment.getUserVO().getUserName());
      contraceVO.setStatus(VOStatus.UPDATED);
      baseDao.updateVO(
          contraceVO,
          new String[] {
            "oa_state", "pub_user", "pub_username", "pub_date", "modifyid", "modifydate"
          });
    } catch (Exception e) {
      throw new LfwRuntimeException("合同设置失效失败!");
    }
    return "success";
  }
예제 #2
0
  public String StCommit(String id) {
    String result = "Y";
    Object operatorID = LfwRuntimeEnvironment.getPkUser();
    DzcgMainAuthority dma = new DzcgMainAuthority();
    String corp = LfwRuntimeEnvironment.getCorp().getUnitcode();

    if (!dma.isExRole("administrator", operatorID.toString())
        && !id.equals(operatorID.toString())) {
      result = "N";
    }
    return result;
  }
예제 #3
0
  // 复写父类的保存方法,解决了修改时子表中主表外键丢失的问题
  // 添加了当合同为普通合同时,合同金额为必输项的数据项检查
  public NCObject write(NCObject billVO, Object userObject) throws BusinessException {
    // 子表修改记录时插入主表主键
    // 获取AggVO
    AggContractVO aggContractVO = (AggContractVO) billVO.getContainmentObject();
    if (null != aggContractVO) {
      // 获取主表VO
      ContractVO ContractVO = (ContractVO) aggContractVO.getParentVO();
      String message[] = DzcgMainAuthority.queryXDeptAndPsnByCon(ContractVO);

      if (ContractVO.getXq_dept() == null) ContractVO.setXq_dept(message[0]);
      if (ContractVO.getXreq_psn() == null) ContractVO.setXreq_psn(message[1]);
      if (ContractVO.getXreq_no() == null) ContractVO.setXreq_no(message[4]);

      if (ContractVO.getXreq_name() == null) ContractVO.setXreq_name(message[5]);

      // lifeic修改把合同金额校验去掉,使用自动计算合同金额
      // 获取用户输入的合同类型,当合同类型为普通合同时做合同金额的必输项检查
      /*
      if(ContractVO.getCt_type().intValue() == EbsOperaitonConst.OPERATION_STOCK_TYPE_COMMON_CONTRACT){
      	if (ContractVO.getCt_amount() == null){
      		throw new LfwRuntimeException(null,"请输入合同金额!",null);
      	}
      }else{
      	//当合同类型为框架协议时将合同金额设置为空
      	ContractVO.setCt_amount(null);
      }
      */
      // 检查合同生效日期和合同结束日期的合法性
      // 合同生效日期
      //			UFDate dtBeginDay = ContractVO.getCt_validate_date();
      //			//合同结束日期
      //			UFDate dtEndDay = ContractVO.getCt_closed_date();
      //			//合同结束日期不早于合同生效日期
      //			if(dtBeginDay.compareTo(dtEndDay) > 0){
      //				throw new LfwRuntimeException("合同结束日期不能早于合同生效日期!");
      //			}

      UFDouble total = new UFDouble(0);
      // 获取主表VO属性
      String pk_ht_contract = ContractVO.getPk_ht_contract();
      if (null != pk_ht_contract && !"".equals(pk_ht_contract)) {
        // 修改保存时设置修改人和修改时间
        // 修改人为当前登录者
        ContractVO.setModifyid(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
        // 修改日期为当前系统日期
        ContractVO.setModifydate(new UFDate(System.currentTimeMillis()));
        // 获取所有字表VO,以数组形式返回
      }

      ProdPriceRepoVO[] cavo =
          (ProdPriceRepoVO[]) aggContractVO.getTableVO("prod_price_item_array");
      if (cavo != null) {
        int count = 0;
        for (int i = 0; i < cavo.length; i++) {
          if (cavo[i].getStatus() != VOStatus.DELETED) {
            // 判断行数据中产品分类、产品名称、生效日期和失效日期单位是否输入
            if (null == cavo[i].getPk_da_prod_cate() || "".equals(cavo[i].getPk_da_prod())) {
              throw new LfwRuntimeException("表体第" + (i + 1) + "行:请选择产品分类!");
            }
            /*
            if (null == cavo[i].getPk_da_prod() || "".equals(cavo[i].getPk_da_prod())){
            	throw new LfwRuntimeException(null,"表体第"+(i+1)+"行:请选择产品!",null);
            }
            */
            if (null == cavo[i].getProd_unit() || "".equals(cavo[i].getProd_unit())) {
              throw new LfwRuntimeException("表体第" + (i + 1) + "行:请选择单位!");
            }

            /*
            if (null == cavo[i].getEffective_date() || "".equals(cavo[i].getEffective_date())){
            	throw new LfwRuntimeException(null,"表体第"+(i+1)+"行:请选择生效日期!",null);
            }
            if (null == cavo[i].getIneffective_date() || "".equals(cavo[i].getIneffective_date())){
            	throw new LfwRuntimeException(null,"表体第"+(i+1)+"行:请选择失效日期!",null);
            }
            */
            // 更改VO状态,重新插入页面输入的行数据信息
            if (cavo[i].getStatus() != VOStatus.DELETED) {
              cavo[i].setStatus(VOStatus.NEW);
            }
            // 为子表VO中的属性set主表主键
            cavo[i].setAttributeValue("pk_ht_contract", pk_ht_contract);

            total = total.add(cavo[i].getDiscounted_amount());

          } else {
            cavo[i] = null;
            count++;
          }
        }

        // 修改删除行项目之后保存还出现该行项目问题,在获取之后删除保存
        // 创建一个存放删除记录后的容器
        ProdPriceRepoVO[] cavonew = new ProdPriceRepoVO[cavo.length - count];
        // 为存放数组声明的一个下标
        int Index = 0;
        // 为删除记录后的容器赋值
        for (int i = 0; i < cavo.length; i++) {
          if (null == cavo[i]) {

          } else {
            cavonew[Index] = cavo[i];
            Index++;
          }
        }

        aggContractVO.setTableVO("prod_price_item_array", cavonew);

        ConstratMoneyPlanVO[] cavo1 =
            (ConstratMoneyPlanVO[]) aggContractVO.getTableVO("moeny_plan_item_array");
        if (cavo1 != null) {
          for (int i = 0; i < cavo1.length; i++) {

            if (cavo1[i].getAttributeValue("pk_ht_money_plan") == null
                || cavo1[i].getAttributeValue("pk_ht_money_plan").equals("")) {

              cavo1[i].setStatus(VOStatus.NEW);
              cavo1[i].setAttributeValue("pk_ht_contract", pk_ht_contract);
            }
          }
        }
      }

      ContractVO.setCt_amount(total);

      // 普通自动生成编码的处理  wangyea  2010-12-31
      String contract_no = null;
      if (ContractVO.getContract_no() == null || ContractVO.getContract_no().length() == 0) {

        if (ContractVO.getR_pk_ht_contract() != null
            && ContractVO.getR_pk_ht_contract().length() > 0) {
          // 关联合同编号
          contract_no =
              CodPlatformService.billCodeGlContract(
                  ContractVO.getPk_corp(), ContractVO.getR_pk_ht_contract());
        } else {
          // 普通合同编号
          contract_no = CodPlatformService.billCodeContract(ContractVO.getPk_corp());
        }

      } else {
        if (ContractVO.getPk_ht_contract() != null) {
          // 查询数据库中的关联合同主键,判断关联合同是否修改
          String ora_r_pk =
              CodPlatformService.queryLinkContractByPk(ContractVO.getPk_ht_contract());

          // 修改关联合同时,重新生成关联合同编码
          if (ContractVO.getR_pk_ht_contract() != null && ora_r_pk != null) {
            // 如果去掉了关联合同
            if (!ContractVO.getR_pk_ht_contract().equals(ora_r_pk)) {
              // 关联合同编号   如果关联合同变化则重新生成编码
              contract_no =
                  CodPlatformService.billCodeGlContract(
                      ContractVO.getPk_corp(), ContractVO.getR_pk_ht_contract());
            } else {
              // 合同编号不变
              contract_no = ContractVO.getContract_no();
            }
          } else {
            if (ora_r_pk != null && ContractVO.getR_pk_ht_contract() == null) {
              // 普通合同编号
              contract_no = CodPlatformService.billCodeContract(ContractVO.getPk_corp());
            } else if (ora_r_pk == null && ContractVO.getR_pk_ht_contract() == null) {
              // 合同编号不变
              contract_no = ContractVO.getContract_no();
            } else if (ora_r_pk == null && ContractVO.getR_pk_ht_contract() != null) {
              // 关联合同编号   如果关联合同变化则重新生成编码
              contract_no =
                  CodPlatformService.billCodeGlContract(
                      ContractVO.getPk_corp(), ContractVO.getR_pk_ht_contract());
            } else {
              // 合同编号不变
              contract_no = ContractVO.getContract_no();
            }
          }
        }
      }
      ContractVO.setContract_no(contract_no);
      // 编码判断处理完成

    }
    IContractService service =
        (IContractService) NCLocator.getInstance().lookup(IContractService.class);
    return service.doWrite(billVO, userObject);
  }
예제 #4
0
  /**
   * 复写查询表头方法
   *
   * @user zhengcy
   * @datetime 2009-12-9上午09:19:13
   * @see
   *     nc.lfw.billtemplate.delegator.deft.DefaultBusinessDelegator#queryHeadAllData(nc.md.model.IBusinessEntity,
   *     java.lang.String, java.lang.String, nc.lfw.data.PaginationInfo)
   */
  public NCObject[] queryHeadAllData(
      IBusinessEntity headEntity, String strBillType, String strWhere, PaginationInfo info)
      throws BusinessException {
    // 分页用的查询service
    IPageSizeQueryService service = NCLocator.getInstance().lookup(IPageSizeQueryService.class);
    // 合同主键
    String key = "pk_ht_contract";
    // 合同数据库表
    String tableName = "ebs_ht_contract";
    // 调用分页查询Service接口,并将PaginationInfo对象传入
    // key 查询表的主键
    // tableName 查询的表名
    // type SuperVo类名
    // strWhere 查询的条件
    // info dataset分页托管

    Object operatorID = LfwRuntimeEnvironment.getPkUser();
    DzcgMainAuthority dma = new DzcgMainAuthority();
    DzcgMainAuthority dz = new DzcgMainAuthority();
    String corp = LfwRuntimeEnvironment.getCorp().getUnitcode();
    String corpCode = LfwRuntimeEnvironment.getPkCorp();
    if (dz.isExRole(corp + "E058A", operatorID.toString())) {
      strWhere += " and 1=1 ";
    } else if (dz.isExRole(corp + "E058S", operatorID.toString())) {
      strWhere += "  and pk_corp='" + corpCode + "' ";
    } else {
      if (dma.isExRole(
          corp + "MANAGER", operatorID.toString())) // 季凌峰2012/11/22   当为部门头的角色的时候则走此方法
      {
        strWhere +=
            ""
                + (strWhere.trim() == "" ? "" : " and")
                + " ( pk_dept in( "
                + dma.dzcgMainAuthority(operatorID.toString())
                + ") or operatorid = '"
                + operatorID
                + "') ";
      } else {
        strWhere +=
            "" + (strWhere.trim() == "" ? "" : " and") + " operatorid = '" + operatorID + "'";
      }
    }

    if (strWhere != null && "".equals(strWhere.trim())) {

      strWhere =
          "ct_type = "
              + EbsOperaitonConst.OPERATION_STOCK_TYPE_COMMON_CONTRACT
              + " and srcpkcontract is null ";
    } else {

      strWhere +=
          " and ct_type = "
              + EbsOperaitonConst.OPERATION_STOCK_TYPE_COMMON_CONTRACT
              + " and srcpkcontract is null ";
    }

    NCObject[] ncobjects = service.queryWithPage(key, tableName, ContractVO.class, strWhere, info);
    return ncobjects;
    // TODO Auto-generated method stub
    // return super.queryHeadAllData(headEntity, strBillType, strWhere, info);
  }
예제 #5
0
  /**
   * 更新单据受理状态的方法
   *
   * @author liweiqiang
   * @param key 主表的PK值
   * @param btnNo 出发事件的按钮编号 2009-11-12
   */
  public String setAcceptStatusValue(String key, String btnNo) throws LfwBusinessException {

    BaseDAO dao = new BaseDAO();
    try {

      DzcgMainAuthority dma = new DzcgMainAuthority();

      if (dma.existsCloseData(key, EbsOperaitonConst.CLOSEREQCODE)) {

        return "此单据已经被关闭,无法进行此操作!";
      }

    } catch (Exception e) {
      Logger.error(
          (new StringBuilder("采购申请,点击收回按钮时没有申请单数据 Pk_xq_req_main  == ")).append(key).toString());
      return "操作失败,请重新操作!";
    }

    String result = null;
    ReqMainVO reqMainVO = new ReqMainVO();
    reqMainVO.setPk_xq_req_main(key);
    reqMainVO.setStatus(1);

    ReqMainVO reqMainDeptVO = null;
    String fieldNames[] = {
      "accept_status", "modifydate", "modifier", "pk_oper_person", "pk_dept_sug", "zdy1"
    };
    try {
      reqMainDeptVO = (ReqMainVO) dao.retrieveByPK(ReqMainVO.class, key);
    } catch (Exception e) {
      Logger.error(
          (new StringBuilder("采购申请,点击收回按钮时没有申请单数据 Pk_xq_req_main  == ")).append(key).toString());
      return "无法进行收回,没有找到申请单数据,请刷新后在进行操作!";
    }
    reqMainVO.setModifydate(new UFDate(System.currentTimeMillis()));
    reqMainVO.setModifier(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
    IReqService service = (IReqService) NCLocator.getInstance().lookup(IReqService.class);
    if ("998".equals(btnNo)) {
      Integer acceptstatus = reqMainDeptVO.getAccept_status();
      Integer billstatus = reqMainDeptVO.getBillstatus();
      if (acceptstatus == null || billstatus == null) {
        Logger.error("采购申请,点击收回按钮时没有找到正确的单据状态 acceptstatus == null, billstatus == null");
        return "请刷新界面数据,在重新操作!";
      }
      Logger.warn(
          (new StringBuilder("采购申请,点击收回按钮时数据状态为  acceptstatus == "))
              .append(acceptstatus)
              .append(", billstatus == ")
              .append(billstatus)
              .toString());
      switch (acceptstatus.intValue()) {
        case 3: // '\003'
          reqMainVO.setAccept_status(Integer.valueOf(1));
          reqMainVO.setBillstatus(Integer.valueOf(8));
          reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person());
          reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug());
          reqMainVO.setZdy1(reqMainDeptVO.getZdy1());
          service.setReqVOValue(reqMainVO, fieldNames);
          return "收回成功!";
      }
      return "只有在提交受理状态下才能收回单据";
    }
    if (btnNo.equals("1")) {
      reqMainVO.setAccept_status(Integer.valueOf(2));
    } else if (btnNo.equals("2")) {
      boolean flagTmp = false;
      // yanlei start 将建议采购经办人进行处理,对照转授权表。。有被授权人时,改为被授权人
      try {
        // 获取当前方案申请记录
        ArrayList<ReqMainVO> reqMainVOTmp =
            (ArrayList<ReqMainVO>)
                dao.retrieveByClause(
                    ReqMainVO.class,
                    " pk_xq_req_main like '" + reqMainVO.getPk_xq_req_main() + "'");
        // 获取原建议采购经办人主键
        //		String old_pk_oper_person =
        // (String)((AggReqVO)ncobjects[i].getContainmentObject()).getParentVO().getAttributeValue("pk_oper_person");
        String old_pk_oper_person = reqMainVOTmp.get(0).getPk_oper_person();
        if (null != old_pk_oper_person && !"".equals(old_pk_oper_person)) {
          // 查询出被授权人人员的编码
          String sqlPsnTmp = " pk_psndoc like '" + old_pk_oper_person + "'";
          ArrayList<PsndocVO> psnvoTmp =
              (ArrayList<PsndocVO>) (dao.retrieveByClause(PsndocVO.class, sqlPsnTmp));
          List<SmUserVO> asqvoTmp =
              (List<SmUserVO>)
                  dao.executeQuery(
                      "SELECT * FROM sm_user bd , sm_userandclerk sm WHERE "
                          + " sm.pk_psndoc='"
                          + psnvoTmp.get(0).getPk_psnbasdoc()
                          + "' AND sm.userid = bd.cuserid",
                      new BeanListProcessor(SmUserVO.class));
          //				String sqlAsTmp = " cuserid = (select userid from sm_userandclerk tttt where
          // tttt.pk_psndoc='"+psnvoTmp.get(0).getPk_psnbasdoc()+"'";
          //				ArrayList<SmUserVO> asqvoTmp =
          // (ArrayList<SmUserVO>)(dao.retrieveByClause(SmUserVO.class, sqlAsTmp));
          String old_cuserid = asqvoTmp.get(0).getPrimaryKey();

          String sqlWhere =
              " isnull(dr,0) = 0 and operatorid like '" + old_cuserid.toString() + "'";
          ArrayList<ZsqVO> zsqvo = (ArrayList<ZsqVO>) (dao.retrieveByClause(ZsqVO.class, sqlWhere));
          if (null != zsqvo && 0 != zsqvo.size()) {

            if ((null != zsqvo.get(0).getAuthorid())
                && !old_cuserid.equals(zsqvo.get(0).getAuthorid())) {
              // 被授权人的人员id
              String new_cuserid = zsqvo.get(0).getAuthorid();
              Date date1 = new Date(System.currentTimeMillis());
              SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
              String currDateStr = df.format(date1);
              UFDate currDate = new UFDate(currDateStr);
              UFDateTime uft = new UFDateTime(System.currentTimeMillis());

              UFDateTime end_date = null;
              if (null != zsqvo.get(0).getEnd_author()) {
                end_date = zsqvo.get(0).getEnd_author();
              }
              boolean is_youxiao = false;
              if (null != end_date) {
                is_youxiao = uft.before(end_date);
              }
              boolean is_everl_author = false;
              if (null != zsqvo.get(0).getIs_everl_author()) {
                is_everl_author = zsqvo.get(0).getIs_everl_author().booleanValue();
              }
              if (null == new_cuserid) {
                reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person());
                reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug());
                reqMainVO.setZdy1(reqMainDeptVO.getZdy1());
              } else if (is_youxiao || is_everl_author) {
                // 查询出被授权人人员的编码
                // 当被授权人为操作人员时
                //							List<PsndocVO> psnvo = (List<PsndocVO>)dao.executeQuery(  "SELECT
                // bd.pk_psndoc FROM bd_psndoc bd , sm_userandclerk sm WHERE " +
                //									" sm.userid='"+new_cuserid+"' AND sm.pk_psndoc = bd.pk_psnbasdoc", new
                // BeanListProcessor(PsndocVO.class));

                String sqlPsn = " pk_psndoc like '" + new_cuserid + "'";
                ArrayList<PsndocVO> psnvo =
                    (ArrayList<PsndocVO>) (dao.retrieveByClause(PsndocVO.class, sqlPsn));
                //							String sqlUser = "******"+new_cuserid+"'";
                //							ArrayList<SmUserVO> asqvo =
                // (ArrayList<SmUserVO>)(dao.retrieveByClause(SmUserVO.class, sqlUser));
                //							String str_code = asqvo.get(0).getUser_code();
                //							String sqlPsn = " psncode like '"+str_code+"'";
                //							ArrayList<PsndocVO> psnvo =
                // (ArrayList<PsndocVO>)(dao.retrieveByClause(PsndocVO.class, sqlPsn));
                //
                //	((AggReqVO)ncobjects[i].getContainmentObject()).getParentVO().setAttributeValue("pk_oper_person", psnvo.get(0).getPk_psndoc());
                reqMainVO.setPk_oper_person(psnvo.get(0).getPk_psndoc());
                reqMainVO.setPk_dept_sug(psnvo.get(0).getPk_deptdoc());
                reqMainVO.setZdy1(psnvo.get(0).getPk_corp());
              } else {
                reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person());
                reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug());
                reqMainVO.setZdy1(reqMainDeptVO.getZdy1());
              }
            } else {
              reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person());
              reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug());
              reqMainVO.setZdy1(reqMainDeptVO.getZdy1());
            }
          } else {
            reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person());
            reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug());
            reqMainVO.setZdy1(reqMainDeptVO.getZdy1());
          }
        } else {
          reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person());
          reqMainVO.setPk_dept_sug(reqMainDeptVO.getPk_dept_sug());
          reqMainVO.setZdy1(reqMainDeptVO.getZdy1());
        }
      } catch (DAOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }
      // yanlei end

      String sql =
          " select * from ebs_xq_req_item_prod where pk_xq_req_main ='"
              + key
              + "' and isnull(dr,0) = 0";

      // 查找合同表体数据

      try {
        List<ReqItemProdVO> list =
            (List<ReqItemProdVO>) dao.executeQuery(sql, new BeanListProcessor(ReqItemProdVO.class));

        if (list == null || list.size() <= 0) {

          return "表体数据无数据!";
        }
      } catch (Exception e) {

      }

      reqMainVO.setAccept_status(Integer.valueOf(3));

      if (flagTmp) reqMainVO.setPk_oper_person(reqMainDeptVO.getPk_oper_person());
      // 申请人
      String pk_persom = reqMainDeptVO.getOperatorid();
      // 申请处理人
      // yanlei start 当未授权时,发件人为原处理人,有授权人时,发件人变为被授权人
      String pk_oper_person = reqMainVO.getPk_oper_person();

      String psnname = "";
      String email = "";
      String person = "";
      String email_s = "";
      String dianhua = "";
      String deptName = "";

      DzcgMainAuthority dma = new DzcgMainAuthority();
      try {
        // 获取人员管理档案信息
        PsndocVO pvo = dma.getPsndocByPk(pk_oper_person);
        PsndocVO pdvo = dma.getPsndocVO(pk_persom);
        DeptdocVO dept = dma.getDeptInfo(reqMainDeptVO.getPk_dept());
        if (pvo != null) {

          // 处理人员
          psnname = pvo.getPsnname();

          PsnbasdocVO pbvo = null;

          pbvo = dma.getPsnbasdocVOByPk(pvo.getPk_psnbasdoc());
          if (pbvo != null) {
            // 处理人邮箱
            email = pbvo.getEmail();
          }
        }
        if (dept != null) {
          deptName = dept.getDeptname();
        }

        if (pdvo != null) {

          // 申请人名称
          person = pdvo.getPsnname();

          PsnbasdocVO pcvo = null;

          pcvo = dma.getPsnbasdocVOByPk(pdvo.getPk_psnbasdoc());

          if (pcvo != null) {
            // 申请人电话邮箱
            email_s = pcvo.getEmail();
            dianhua = pcvo.getMobile();
          }
        }

      } catch (Exception e) {
        Logger.error("采购申请提交受理,发送email时获取人员档案信息失败!");
        Logger.error(e.getMessage());
      }

      // ---zhoqui--修改邮件发送内容---
      String title = "新的采购项目等待您处理";

      StringBuffer mail =
          new StringBuffer(
              psnname
                  + ":<br>&nbsp;&nbsp;&nbsp;&nbsp;电子采购系统(需求受理)中有新的采购项目等待您处理。<br>&nbsp;&nbsp;&nbsp;&nbsp;项目名称【");
      mail.append(reqMainDeptVO.getBill_name()).append("】【");
      mail.append(reqMainDeptVO.getBill_code()).append("】<br><br>");
      mail.append(deptName).append("<br>联系人:");
      mail.append(person).append("(申请人)<br>电话:");
      mail.append(dianhua).append("<br>邮箱:");
      mail.append(email_s).append("<br>注:此邮件为系统自动发出,请勿直接回复。谢谢!");

      dma.sendEmail(title, mail.toString(), email);

    } else {
      reqMainVO.setAccept_status(Integer.valueOf(4));
    }

    service.setReqVOValue(reqMainVO, fieldNames);

    // 现在都是email的通信机制所以不发送代办事项
    /*
    try
    {
    	IPredictQueryService queryService = (IPredictQueryService)NCLocator.getInstance().lookup(IPredictQueryService.class);

    	MessageinfoVO messageinfoVO = new MessageinfoVO();
    	messageinfoVO.setBillid(null);
    	messageinfoVO.setBillno("/manageui.jsp?ctrl=nc.ui.ebscg.xqreqaccept.ClientUIWebCtrl&model=nc.ui.ebscg.xqreqaccept.ReqAcceptPageModel&delegator=nc.ui.ebscg.xqreqaccept.ReqAcceptDelegator&pageId=E05405");
    	messageinfoVO.setContent((new StringBuilder("采购申请提交受理,请进入待处理查看!")).append(new UFDateTime(System.currentTimeMillis())).toString());
    	messageinfoVO.setPk_billtype("E04C");
    	messageinfoVO.setPk_corp(LfwRuntimeEnvironment.getPkCorp());
    	messageinfoVO.setPk_srcbilltype(messageinfoVO.getPk_billtype());
    	messageinfoVO.setSenddate(new UFDateTime(System.currentTimeMillis()));
    	messageinfoVO.setSenderman(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
    	messageinfoVO.setSendermanName(LfwRuntimeEnvironment.getUserVO().getUserName());
    	messageinfoVO.setPriority(new Integer(0));
    	List uaVOs = queryService.queryUserInfoByRolecode(reqMainDeptVO.getPk_dept_sug(), LfwRuntimeEnvironment.getCorp().getUnitcode(), "E05405");
    	messageinfoVO.setState(new Integer(0));
    	messageinfoVO.setType(new Integer(3));
    	if (uaVOs != null)
    	{
    		for (Iterator iterator = uaVOs.iterator(); iterator.hasNext(); dao.insertVO(messageinfoVO))
    		{
    			UserAndClerkVO uaVO = (UserAndClerkVO)iterator.next();
    			messageinfoVO.setCheckman(uaVO.getUserid());
    		}

    	}
    }
    catch (DAOException e1)
    {
    	throw new LfwRuntimeException("向建议采购部门采购申请处理人发送待办失败!");
    }
    */
    result = "success";
    return result;
  }
예제 #6
0
  /**
   * 实现通过子表条件查到主表的信息
   *
   * @author liweiqiang 2009-11-11
   */
  public NCObject[] queryHeadAllData(
      IBusinessEntity headEntity, String strBillType, String strWhere, PaginationInfo info)
      throws BusinessException {

    //		// 对子表的Where条件封装处理
    //		if (strWhere != null && strWhere.length() > 0) {
    //			String[] strWhereGroup = strWhere.split("AND");
    //			int forInt = 0;
    //			forInt = strWhereGroup.length;
    //			for (int i = 0; i < forInt; i++) {
    //				if (strWhereGroup[i].indexOf(childTable) > -1) {
    //					String str = strWhereGroup[i];
    //					strWhereGroup[i] = "pk_xq_req_main in (SELECT req_prod_array.pk_xq_req_main "
    //							+ "FROM ebs_xq_req_item_prod as req_prod_array WHERE "
    //							+ str + ")";
    //				}
    //			}
    //
    //			// 重新给WHERE条件赋值
    //			strWhere = "";
    //
    //			for (int i = 0; i < forInt; i++) {
    //				if (i == 0) {
    //					strWhere = " " + strWhereGroup[0];
    //				} else {
    //					strWhere = strWhere + " AND " + strWhereGroup[i];
    //				}
    //			}
    //
    //		}

    // 单行刷新或由待办进入时不走下面的过滤条件 wangyea

    String corp = LfwRuntimeEnvironment.getCorp().getUnitcode();

    // 审批流状态时,为空
    if (info != null) {
      // 在session中获取用户所在部门ID
      Object userDeptID =
          LfwRuntimeEnvironment.getWebContext()
              .getRequest()
              .getSession()
              .getAttribute(LoginSessionConstant.LOGIN_SESSION_USER_DEPT);
      Object operatorID = LfwRuntimeEnvironment.getPkUser();
      DzcgMainAuthority dma = new DzcgMainAuthority();
      if (strWhere == null || strWhere.trim().length() == 0) {
        strWhere = " 1 = 1 ";
      }
      if (dma.isExRole("HQ01ADMIN", operatorID.toString())) {
        strWhere += " and " + " 1 = 1 ";
      } else if (dma.isExRole(
          corp + "MANAGER", operatorID.toString())) // 当为部门头的角色的时候则走此方法   季凌峰2012/11/22
      {
        strWhere +=
            ""
                + (strWhere.trim() == "" ? "" : " and")
                + "( pk_dept in( "
                + dma.dzcgMainAuthority(operatorID.toString())
                + ") or operatorid = '"
                + operatorID
                + "'  )";
      } else {
        strWhere +=
            "" + (strWhere.trim() == "" ? "" : " and") + " operatorid = '" + operatorID + "'";
      }
    }

    // 分页用的查询service
    IPageSizeQueryService service = NCLocator.getInstance().lookup(IPageSizeQueryService.class);

    String key = "pk_xq_req_main";
    String tableName = "ebs_xq_req_main";

    // 调用分页查询Service接口,并将PaginationInfo对象传入
    NCObject[] ncobjects =
        service.queryWithPage(
            key, tableName, ReqMainVO.class, strWhere, info, " order by operatedate desc");

    return ncobjects;
    // return super.queryHeadAllData(headEntity, strBillType, strWhere,
    // info);
  }