예제 #1
0
  /**
   * 复制计划填报的附件到采购需求
   *
   * @param aggReqVO 需求填报的aggvo
   * @throws LfwBusinessException
   * @author liweiqiang 2009-11-17
   */
  private void setDaAtt(AggReqVO aggReqVO) throws LfwBusinessException {

    // 计划填报主表Id
    String srcBillId = null;
    // 计划填报类型
    String srcBillType = null;
    // 计划填报子表Id
    String srcBillItemId = null;
    // 需求填报主表Id
    String tarBillId = null;
    // 需求填报类型
    String tarBillType = null;
    // 需求填报子表Id
    String tarBillItemId = null;

    // 需求填报主表VO
    ReqMainVO reqMainVO;
    // 需求填报子表VO
    ReqItemProdVO reqItemProdVO;
    // 存放需求填报的子表VO数组
    CircularlyAccessibleValueObject[] reqApplyItemList;

    IEbscgFileUploadService service = NCLocator.getInstance().lookup(IEbscgFileUploadService.class);

    // 取得需求填报主表表VO
    reqMainVO = (ReqMainVO) aggReqVO.getParentVO();

    // 需求填报主表Id
    tarBillId = reqMainVO.getPk_xq_req_main();
    // 需求填报类型
    tarBillType = reqMainVO.getBill_type();
    // 计划填报主表Id
    srcBillId = reqMainVO.getPk_jh_plan();

    // 取得需求填报子表VO数组
    reqApplyItemList = aggReqVO.getChildrenVO();

    if (reqApplyItemList != null) {
      for (int i = 0; i < reqApplyItemList.length; i++) {

        // 需求填报子表
        reqItemProdVO = (ReqItemProdVO) reqApplyItemList[i];

        // 需求填报子表Id
        tarBillItemId = reqItemProdVO.getPk_xq_req_item_prod();
        // 采购填报类型
        srcBillType = reqItemProdVO.getBill_type_src();
        // 采购填表子表ID
        srcBillItemId = reqItemProdVO.getPk_bill_item_src();

        service.copyAtt(
            srcBillId, srcBillType, srcBillItemId, tarBillId, tarBillType, tarBillItemId);
      }
    }
  }
예제 #2
0
  /**
   * 未受理的单据才可以弃审
   *
   * @author liweiqiang 2009-12-09
   */
  public NCObject unapprove(NCObject billVO, Object userObj, int step) throws BusinessException {

    NCObject obj = null;

    // 取得需求填报的aggVO
    AggReqVO aggReqVO = (AggReqVO) billVO.getContainmentObject();
    ReqMainVO reqMainVO = (ReqMainVO) aggReqVO.getParentVO();
    // 受理状态 accept_status
    int acceptStatus = reqMainVO.getAccept_status();

    if (acceptStatus == EbsOperaitonConst.OPERATION_REQACCEPT_STATUS_ACCEPTED
        || acceptStatus == EbsOperaitonConst.OPERATION_REQACCEPT_STATUS_FORBACK) {
      obj = super.unapprove(billVO, userObj, step);
    } else {
      throw new LfwRuntimeException("未受理的单据才可以弃审!");
    }

    return obj;
  }
예제 #3
0
  @Override
  public NCObject commit(NCObject billVO, Object userObj, int step) throws BusinessException {
    // 建议采购部门
    String deptSugID;

    // 取得aggVO
    AggReqVO aggVO = (AggReqVO) billVO.getContainmentObject();
    // 取得主表VO
    ReqMainVO reqMainVO = (ReqMainVO) aggVO.getParentVO();

    // pk_dept_sug
    // 建议采购部门
    deptSugID = reqMainVO.getPk_dept_sug();

    if (deptSugID == null || deptSugID.trim().equals("")) {
      throw new LfwRuntimeException("建议采购部门不能为空!");
      // throw new LfwBusinessException("建议采购部门不能为空!");
    }
    return super.commit(billVO, userObj, step);
  }
예제 #4
0
  /**
   * 删除操作时,回写采购计划的单据,将应用状态置为为引用
   *
   * @author liweiqiang 2009-11-27
   */
  public NCObject delete(NCObject billVO, Object userObject) throws BusinessException {

    NCObject obj = super.delete(billVO, userObject);

    int refVal;

    if (obj != null) {
      // 取得aggVO
      AggReqVO aggVO = (AggReqVO) billVO.getContainmentObject();
      // 取得主表VO
      ReqMainVO reqMainVO = (ReqMainVO) aggVO.getParentVO();
      // 主表主键
      String reqMainID = reqMainVO.getPk_xq_req_main();

      IReqService service = NCLocator.getInstance().lookup(IReqService.class);

      // 状态为未引用
      refVal = EbsOperaitonConst.OPERATION_SUM_PLAN_REF_STATUS_NOREF;

      service.updateRefStatus(reqMainID, refVal);
    }

    return obj;
  }
예제 #5
0
  /**
   * 更新需求填报主表VO的方法
   *
   * @param planVO 计划填报的主表VO
   * @return ReqMainVO 需求填报的主表VO
   * @author liweiqiang 2009-11-16
   */
  private ReqMainVO setReqMainVO(PlanVO planVO) {
    ReqMainVO reqMainVO = new ReqMainVO();

    // 单据类型
    reqMainVO.setBill_type("E04B");
    // 需求名称
    reqMainVO.setBill_name(planVO.getPlan_name());
    // 填写采购需求单公司
    reqMainVO.setPk_corp(planVO.getPk_corp());
    // 填写采购需求单部门
    reqMainVO.setPk_dept(planVO.getPk_dept());
    // 填写采购需求单人员
    reqMainVO.setPk_person(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
    // // 建议采购管理部门
    // reqMainVO.setPk_dept_sug("");
    // // 建议采购方式
    // reqMainVO.setSug_pur_method(1);
    // // 建议完成日期
    // reqMainVO.setSug_finish_date("");
    // 预算数
    // reqMainVO.setBudget();
    // 受理状态
    reqMainVO.setAccept_status(EbsOperaitonConst.OPERATION_REQACCEPT_STATUS_ACCEPTED);
    // 来源计划D
    reqMainVO.setPk_jh_plan(planVO.getPk_jh_plan_main());
    // 采购品种类型
    reqMainVO.setStock_type(planVO.getStock_type());
    // 备注
    reqMainVO.setMemo(planVO.getMemo());
    // 制单人
    reqMainVO.setOperatorid(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
    // 制单日期
    reqMainVO.setOperatedate(new UFDate(System.currentTimeMillis()));
    // 单据状态
    reqMainVO.setBillstatus(IBillStatus.FREE);
    reqMainVO.setStatus(VOStatus.NEW);

    return reqMainVO;
  }
예제 #6
0
  /**
   * 将采购计划插入采购需求的处理方法
   *
   * @param key 采购计划的主表主键
   * @param keyPlanItemList 要插入需求填报的子表数据
   * @return 添加的采购需求的主表主键
   * @throws BusinessException
   * @author liweiqiang 2009-11-16
   */
  public String savePlanInfo(String key, String[] keyPlanItemList) throws BusinessException {

    // 计划填报aggVO
    AggPlanVO aggPlanVO;
    // 计划填报主表VO
    PlanVO planVO;
    // 计划填报子表VO
    PlanItemProdVO planItemProdVO;
    // 计划填报子表VO数组
    CircularlyAccessibleValueObject[] planApplyItemList = null;

    // 需求填报AggVO
    AggReqVO aggReqVO = new AggReqVO();
    // 需求填报主表VO
    ReqMainVO reqMainVO;
    // 需求填报子表VO
    ReqItemProdVO reqItemProdVO;

    // 需求填报的NCObject
    NCObject objReq;

    // 返回新生成的需求填报的主表主键ID
    String result = null;
    // 存入选择的插入的计填报子表
    ArrayList<PlanItemProdVO> planItemList = new ArrayList<PlanItemProdVO>();

    // 查询key多对应的需求填报对应的NCObject
    NCObject objPlan =
        MDPersistenceService.lookupPersistenceQueryService()
            .queryBillOfNCObjectByPK(AggPlanVO.class, key);

    if (objPlan != null) {
      // 计划填报aggVO
      aggPlanVO = (AggPlanVO) objPlan.getContainmentObject();

      if (aggPlanVO != null) {
        // 取得计划填报主表VO
        planVO = (PlanVO) aggPlanVO.getParentVO();
        // 取得需求填报主表VO
        reqMainVO = setReqMainVO(planVO);
        // 将需求填报主表VO放入aggVO
        aggReqVO.setParentVO(reqMainVO);

        // 从addVO取出计划填报子表VO数组
        planApplyItemList = aggPlanVO.getChildrenVO();
        if (planApplyItemList != null) {

          ArrayList<ReqItemProdVO> reqItemList = new ArrayList<ReqItemProdVO>();

          for (int i = 0; i < planApplyItemList.length; i++) {
            // 取得计划填报子表VO
            planItemProdVO = (PlanItemProdVO) planApplyItemList[i];

            if (planItemProdVO != null) {

              // int dr = planItemProdVO.getDr();
              // int refStatus = planItemProdVO.getRef_status();

              if (planItemProdVO.getDr() == null || planItemProdVO.getDr() == 0) {
                if (planItemProdVO.getRef_status() == null || planItemProdVO.getRef_status() == 1) {
                  // 需求填报子表VO
                  if (keyPlanItemList != null && keyPlanItemList.length > 0) {
                    if (isInsert(keyPlanItemList, planItemProdVO.getPk_jh_plan_item_prod())) {
                      reqItemProdVO = setReqItemProdVO(planVO, planItemProdVO, keyPlanItemList);
                      // 将选中的需求受理子表VO放入list
                      reqItemList.add(reqItemProdVO);
                      // 将选中的计划填报子表VO放入list
                      planItemList.add(planItemProdVO);
                    }
                  } else {
                    reqItemProdVO = setReqItemProdVO(planVO, planItemProdVO, keyPlanItemList);
                    // 将选中的需求受理子表VO放入list
                    reqItemList.add(reqItemProdVO);
                    // 将选中的计划填报子表VO放入list
                    planItemList.add(planItemProdVO);
                  }
                }
              }
            }
          }

          // 存放需求填报的子表VO数组
          CircularlyAccessibleValueObject[] reqApplyItemList =
              (CircularlyAccessibleValueObject[]) reqItemList.toArray(new ReqItemProdVO[0]);

          // 将需求填报的子表VO数组放入aggVO中
          aggReqVO.setChildrenVO(reqApplyItemList);
        }
        // 生成需求填报的NCObject
        objReq = Ds2NCObjectUtil.wrapVOToNCObject(aggReqVO);
        // 调用write方法,取得返回的需求填报的NCObject
        objReq = super.write(objReq, null);
        // 取得返回的后需求填报的aggVO
        aggReqVO = (AggReqVO) objReq.getContainmentObject();

        // 复制计划填报的附件到采购需求
        setDaAtt(aggReqVO);

        // 复制计划填报的供应商到采购需求
        setSupplier(aggReqVO);

        // 反写采购计划子表的引用状态
        updatePlanItem(planItemList);

        // 反写采购计划主表表的引用状态
        updatePlanVO(key);

        // 取得返回后的需求填报的主表
        reqMainVO = (ReqMainVO) aggReqVO.getParentVO();
        // 取得新生成需求填报的主表主键,返回
        result = reqMainVO.getPk_xq_req_main();
      }
    }

    return result;
  }
예제 #7
0
  /** 王磊2011-3-26改动,判断为空的问题 */
  public NCObject write(NCObject billVO, Object userObject) throws BusinessException {
    // 子表修改记录时插入主表主键
    // 获取AggVO

    BaseDAO dao = new BaseDAO();
    AggReqVO aggReqVO = (AggReqVO) billVO.getContainmentObject();
    if (null != aggReqVO) {
      // 获取主表VO
      ReqMainVO reqMainVO = (ReqMainVO) aggReqVO.getParentVO();

      // 修改不给复制建议人的问题
      String operid = reqMainVO.getPk_oper_person();
      String dept = reqMainVO.getPk_dept_sug();
      try {
        String sql =
            " select * from bd_psndoc where pk_deptdoc = '"
                + dept
                + "' and  pk_psndoc ='"
                + operid
                + "' ";

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

        //				psnvo = (PsndocVO)dao.retrieveByPK(PsndocVO.class, operid);
        if (list != null && list.size() > 0) {

        } else {
          throw new LfwRuntimeException("请不要手动填写采购经办人,你选择的建议采购部门与填写的采购经办人部门不对应,请重新选择!");
        }

      } catch (Exception e) {
        throw new LfwRuntimeException("请不要手动填写采购经办人,你选择的建议采购部门与填写的采购经办人部门不对应,请重新选择!");
        //				Logger.error("请选择建议采购人,不要手动填写!");
        //				Logger.error(e.getMessage());
      }

      String bill_code = reqMainVO.getBill_code();

      if (bill_code == null || bill_code.trim().length() == 0) {

        bill_code = CodPlatformService.billCodeXqRep(LfwRuntimeEnvironment.getPkCorp());
        reqMainVO.setBill_code(bill_code);
      }
      // 获取主表VO属性
      String pk_xq_req_main = reqMainVO.getPk_xq_req_main();
      if (null != pk_xq_req_main && !"".equals(pk_xq_req_main)) {

        // 修改保存时设置修改人和修改时间
        // 修改人
        reqMainVO.setModifier(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
        // 修改时间为当前的系统时间
        reqMainVO.setModifydate(new UFDate(System.currentTimeMillis()));

        // 获取所有子表VO,以数组形式返回
        CircularlyAccessibleValueObject[] cavo = aggReqVO.getChildrenVO();

        if (cavo != null && cavo.length > 0) {
          // 现在可以导入数据,导入数据时是需要把单据保存后才能进行处理,因此去掉了表体不能为空的限制
          // throw new LfwRuntimeException("表体行不能为空");

          for (int i = 0; i < cavo.length; i++) {
            // 为子表VO中的属性set主表主键

            cavo[i].setAttributeValue("pk_xq_req_main", pk_xq_req_main);
          }
        }
      }

      UFDouble ufd = reqMainVO.getBuget_amount();

      //	boolean flag=true;

      CircularlyAccessibleValueObject[] cavo = aggReqVO.getChildrenVO();

      UFDouble amount = new UFDouble(0);

      if (cavo != null && cavo.length > 0) {

        for (CircularlyAccessibleValueObject cav : cavo) {

          if (cav instanceof ReqItemProdVO) {

            ReqItemProdVO pvo = (ReqItemProdVO) cav;

            if (pvo != null) {

              if (pvo.getStatus() != 3) {
                UFDouble tAmount = pvo.getAmount();

                if (tAmount != null) {

                  amount = amount.add(tAmount);
                }
                if (tAmount.toDouble() <= 0) {
                  throw new LfwRuntimeException("预算单价必须大于0");
                }
                //	flag= false;
              }
            }
          }
        }
      }

      /*
      if(flag)
      {
      	throw new LfwRuntimeException("表体行不能为空");
      }
      */
      reqMainVO.setBuget_amount(amount);
    }

    return super.write(billVO, userObject);
  }
예제 #8
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;
  }