Exemplo n.º 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";
  }
Exemplo n.º 2
0
  /**
   * 复写审批方法,当审批通过时更新将协议产品价格库的有效性
   *
   * @user zhengcy
   * @datetime 2009-11-24上午11:07:25
   * @see
   *     nc.lfw.billtemplate.delegator.deft.DefaultPfBusinessDelegator#approve(nc.md.data.access.NCObject,
   *     java.lang.Object, int)
   */
  public NCObject approve(NCObject billVO, Object userObj, int step) throws BusinessException {
    BillcodeGenerater bgr = new BillcodeGenerater();
    // 生成单据号
    String billno = bgr.getBillCode("E05C", LfwRuntimeEnvironment.getPkCorp(), null, null);

    // 调用Service接口实现审批和协议价格库表插入新数据操作
    IContractService service =
        (IContractService) NCLocator.getInstance().lookup(IContractService.class);
    return service.doApprove(
        billVO, userObj, step, LfwRuntimeEnvironment.getUserVO().getPrimaryKey(), billno);
  }
Exemplo n.º 3
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;
  }
Exemplo n.º 4
0
  public void processRefModel(String refCode, AbstractRefModel refModel, String filterSql) {

    // TODO Auto-generated method stub
    StringBuffer sql = new StringBuffer();

    // 在session中获取用户所在部门ID
    Object userDeptID =
        LfwRuntimeEnvironment.getWebContext()
            .getRequest()
            .getSession()
            .getAttribute(LoginSessionConstant.LOGIN_SESSION_USER_DEPT);

    PsndocDefaulRefModel psrefModel = (PsndocDefaulRefModel) refModel;
    // 过滤参照树列表条件
    psrefModel.setClassWherePart(
        psrefModel.getClassWherePart() + " and  pk_deptdoc = '" + userDeptID + "' ");

    String temp = psrefModel.getClassWherePart() + " and  pk_deptdoc = '" + userDeptID + "' ";
    // 过滤参数列表条件
    sql.append(" and bd_psndoc.pk_deptdoc = '");
    sql.append(userDeptID);
    sql.append("' ");

    refModel.addWherePart(sql.toString());
  }
Exemplo n.º 5
0
  /**
   * 设置部门id到session中
   *
   * @author zhouqi
   * @datetime2012-09-18
   */
  public void setSessionValue(String corp) {

    LfwRuntimeEnvironment.getWebContext()
        .getRequest()
        .getSession()
        .setAttribute("sunshineCorpIdForDeptdoc", corp);
  }
Exemplo n.º 6
0
  /*
   * (non-Javadoc)
   *
   * @see
   * nc.lfw.billtemplate.delegator.deft.DefaultBusinessDelegator#queryHeadAllData
   * (nc.md.model.IBusinessEntity, java.lang.String, java.lang.String,
   * nc.lfw.data.PaginationInfo)
   */
  @Override
  public NCObject[] queryHeadAllData(
      IBusinessEntity headEntity, String strBillType, String strWhere, PaginationInfo info)
      throws BusinessException {

    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_jh_plan_sample_main in (SELECT "
                  + childTable
                  + ".pk_jh_plan_sample_main "
                  + "FROM ebs_jh_plan_sample_item as "
                  + childTable
                  + " WHERE "
                  + str
                  + ")";
        }
      }

      // 重新给WHERE条件赋值
      strWhere = "";

      for (int i = 0; i < forInt; i++) {
        if (!"".equals(strWhere)) strWhere = strWhere + " AND " + strWhereGroup[i];
        else strWhere = " " + strWhereGroup[i];
      }
    }

    // 在session中获取用户所在部门ID
    Object userDeptID =
        LfwRuntimeEnvironment.getWebContext()
            .getRequest()
            .getSession()
            .getAttribute(LoginSessionConstant.LOGIN_SESSION_USER_DEPT);
    if (null != userDeptID && !"".equals(userDeptID)) {
      // 存在部门ID通过部门过滤样表数据
      strWhere += " AND pk_dept = '" + userDeptID + "'";
    } else {
      // 不存在部门ID不显示样表数据,传入21位恒不存在值
      strWhere += " AND pk_dept = 'xxxxxxxxxxxxxxxxxxxxx'";
    }

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

    String key = "pk_jh_plan_sample_main";
    String tableName = "ebs_jh_plan_sample_main";

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

    return ncobjects;
  }
Exemplo n.º 7
0
 /**
  * 页面公告类型值发生变更时,将选中的值放到Session中
  *
  * @author zhengcy
  * @datetime 2009-12-15下午02:57:55
  * @return void
  */
 public void saveGGTypeToSession() throws BusinessException {
   // 获取上下文环境
   WebContext context = LfwRuntimeEnvironment.getWebContext();
   context
       .getRequest()
       .getSession()
       .setAttribute("E04O_GG_TYPE", new Integer(context.getRequest().getParameter("ggType")));
 }
Exemplo n.º 8
0
 /**
  * 页面恢复按钮功能
  *
  * @author zhengcy
  * @datetime 2009-12-3下午04:30:22
  * @return String
  */
 public void doResume() throws BusinessException {
   // 获取自定义delegator类
   BulletinAllDelegator delegator = (BulletinAllDelegator) this.billHandler;
   // 获取上下文环境
   WebContext context = LfwRuntimeEnvironment.getWebContext();
   // 公告主键
   String strBulletinPk = context.getRequest().getParameter("strBulletinPk");
   delegator.doResume(strBulletinPk);
 }
Exemplo n.º 9
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;
  }
Exemplo n.º 10
0
  public String isDutyPerson() throws LfwBusinessException {
    WebContext ctx = getWebContext();
    String open_pk = ctx.getParameter("projectPk").toString();

    // 获得当前登录人ID
    String loginUserId = LfwRuntimeEnvironment.getUserVO().getPrimaryKey();
    // 开启功能的逻辑控制判断

    String personPk = ((OpenDelegator) this.billHandler).isDutyPerson(open_pk);

    if (loginUserId.equals(personPk)) {
      return "Y";
    } else {
      return "N";
    }
  }
Exemplo n.º 11
0
 /**
  * 复写查询表头数据函数
  *
  * @user zhengcy
  * @datetime 2009-11-11下午03:12:42
  * @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 pInfo)
     throws BusinessException {
   // 非联查采购受理时
   if (strWhere.indexOf("pk_xq_req_accept_main") == -1) {
     // 增加未被参照生成采购预案的过滤条件
     strWhere =
         strWhere
             + "AND pk_xq_req_accept_main not in (SELECT pk_xq_req_accept_main FROM ebs_xy_predict_main WHERE pk_xq_req_accept_main IS NOT NULL AND isnull(dr,0)=0) ";
     // 增加评审承办人过滤条件:评审承办人=当前登录者
     strWhere =
         strWhere
             + "AND deal_person in (SELECT p.pk_psndoc FROM sm_userandclerk c,bd_psndoc p WHERE c.pk_psndoc = p.pk_psnbasdoc and c.userid = '"
             + LfwRuntimeEnvironment.getUserVO().getPrimaryKey()
             + "')";
   }
   return super.queryHeadAllData(headEntity, strBillType, strWhere, pInfo);
 }
Exemplo n.º 12
0
  // ----------------------
  public String sdbSyn() throws LfwBusinessException {
    WebContext ctx = getWebContext();
    String pk_xy_step_pub = ctx.getParameter("pk_xy_step_pub");
    String pk_xy_proj_main = ctx.getParameter("pk_xy_proj_main");
    String success = "ok";
    String operatorID = LfwRuntimeEnvironment.getUserVO().getPrimaryKey();

    BaseDAO dao = new BaseDAO();
    try {
      String sqlb =
          "select * from ebs_xy_projexec_personjzx  where ( discard_status != '3' or discard_status is null ) and  zdy3 ='"
              + pk_xy_step_pub
              + "' and pk_person in "
              + "(select pk_psndoc from bd_psndoc where pk_psnbasdoc in "
              + "(select pk_psndoc from sm_userandclerk where userid  = '"
              + operatorID
              + "'))";
      List<ProjGroupVO> listb =
          (List<ProjGroupVO>) dao.executeQuery(sqlb, new BeanListProcessor(ProjGroupVO.class));

      if (listb != null && listb.size() > 0) {
        ProjGroupVO pcg = listb.get(0);
        String judgment = pcg.getZdy1();
        if ("是".equals(judgment)) {
          success = "N";
        } else {
          pcg.setZdy1("是");
          dao.updateVO(pcg, new String[] {"zdy1"});
        }

      } else {
        success = "你不属于采购小组人员或者采购小组人员变化了,请重新打开采购执行界面!";
      }
    } catch (Exception e) {
      Logger.error("签到失败");
      Logger.error(e.getMessage(), e);
      success = "签到失败";
    }

    return success;
  }
Exemplo n.º 13
0
  /*
   * (non-Javadoc)
   *
   * @see
   * nc.lfw.billtemplate.delegator.deft.DefaultPfBusinessDelegator#write(nc
   * .md.data.access.NCObject, java.lang.Object)
   */
  @Override
  public NCObject write(NCObject billVO, Object userObject) throws BusinessException {
    // 子表修改记录时插入主表主键
    // 获取AggVO
    AggPlanSample aggPlanSample = (AggPlanSample) billVO.getContainmentObject();
    if (null != aggPlanSample) {
      // 获取主表VO
      PlanSampleVO planSampleVO = (PlanSampleVO) aggPlanSample.getParentVO();
      // 获取主表VO属性
      String pk_jh_plan_sample_main = planSampleVO.getPk_jh_plan_sample_main();

      // 增加对长度的判断 2009-12-07 lwq
      // 填报说明
      String fillDesc = planSampleVO.getFill_desc();

      if (fillDesc != null) {
        byte[] value = fillDesc.getBytes();

        if (value.length > 500) {
          throw new LfwRuntimeException("填报说明应少于250个字!");
        } else {
          if (null != pk_jh_plan_sample_main && !"".equals(pk_jh_plan_sample_main)) {
            // 设置修改人与修改日期
            planSampleVO.setModifyid(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
            planSampleVO.setModifydate(new UFDate());
            // 获取所有字表VO,以数组形式返回
            CircularlyAccessibleValueObject[] cavo =
                aggPlanSample.getTableVO("jh_plan_sample_array");
            if (null != cavo && cavo.length != 0) {
              for (int i = 0; i < cavo.length; i++) {
                // 为子表VO中的属性set主表主键
                cavo[i].setAttributeValue("pk_jh_plan_sample_main", pk_jh_plan_sample_main);
              }
            }
          }
        }
      }
    }
    return super.write(billVO, userObject);
  }
Exemplo n.º 14
0
  /**
   * 合同复制的处理
   *
   * @author wangyea 2011-2-15
   * @param pk
   * @return
   * @throws LfwBusinessException
   */
  public String copyct(String pk) throws LfwBusinessException {
    try {
      ContractVO contraceVO = (ContractVO) getBaseDao().retrieveByPK(ContractVO.class, pk);

      // 设置生效状态
      contraceVO.setOa_state(0); // 1 为生效  0 为失效  oa状态
      contraceVO.setCt_pub(0); // 0 未发布  1 发布      发布状态
      contraceVO.setStatus(VOStatus.NEW);
      contraceVO.setBillstatus(nc.vo.trade.pub.IBillStatus.FREE); // 审核状态
      // 合同编号处理  普通合同  wangyea 2011-4-23
      String contract_no = CodPlatformService.billCodeContract(contraceVO.getPk_corp());
      // 如果是关联合同
      //			if(contraceVO.getR_pk_ht_contract()!=null &&
      // contraceVO.getR_pk_ht_contract().length()>0){
      //				//contraceVO.setR_pk_ht_contract(contraceVO.getR_pk_ht_contract());//关联合同主键
      //				contract_no =
      // CodPlatformService.billCodeGlContract(contraceVO.getPk_corp(),contraceVO.getR_pk_ht_contract());
      //			}else{
      //				contraceVO.setR_pk_ht_contract(pk);//关联合同主键
      //			}
      contraceVO.setR_pk_ht_contract(null);
      contraceVO.setPk_ht_contract(null);
      contraceVO.setPk_supplier(null);
      contraceVO.setContract_no(null);
      contraceVO.setOperatedate(new UFDate(System.currentTimeMillis()));
      contraceVO.setOperatorid(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
      // 制单人,日期,部门,修改人,修改日期
      contraceVO.setModifyid(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
      contraceVO.setModifydate(new UFDate(System.currentTimeMillis()));
      Object userDeptID =
          LfwRuntimeEnvironment.getWebContext()
              .getRequest()
              .getSession()
              .getAttribute(LoginSessionConstant.LOGIN_SESSION_USER_DEPT);
      if (userDeptID != null
          && userDeptID.toString() != null
          && userDeptID.toString().length() > 0) {
        contraceVO.setPk_dept(userDeptID.toString());
      }
      contraceVO.setModifydate(new UFDate(System.currentTimeMillis()));
      contraceVO.setModifyid(LfwRuntimeEnvironment.getUserVO().getPrimaryKey());
      contraceVO.setApprovedate(null);
      contraceVO.setApproveid(null);
      contraceVO.setApprovenote(null);
      contraceVO.setTcomm1rtf(null);
      contraceVO.setTcomm2rtf(null);
      contraceVO.setTcomm3rtf(null);
      String newpk = baseDao.insertVO(contraceVO);

      if (newpk != null && newpk.length() > 0) {
        // 查询合同表体明细
        String sql =
            "select * from ebs_ht_prod_price_repo where pk_ht_contract='"
                + pk
                + "' and isnull(dr,0)=0 ";
        List<ProdPriceRepoVO> list_price =
            (List<ProdPriceRepoVO>)
                getBaseDao().executeQuery(sql, new BeanListProcessor(ProdPriceRepoVO.class));
        if (list_price != null && list_price.size() > 0) {
          for (ProdPriceRepoVO priceVO : list_price) {
            priceVO.setPk_ht_prod_price_repo(null);
            priceVO.setPk_ht_contract(newpk);
            baseDao.insertVO(priceVO);
          }
        }
      }

      return newpk;
    } catch (Exception e) {
      throw new LfwRuntimeException("合同复制失败!");
    }
  }
Exemplo n.º 15
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);
  }
Exemplo n.º 16
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;
  }
Exemplo n.º 17
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);
  }
Exemplo n.º 18
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);
  }
Exemplo n.º 19
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);
  }