Exemplo n.º 1
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;
  }
Exemplo n.º 2
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);
  }
Exemplo n.º 3
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.º 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;
  }
Exemplo n.º 5
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);
  }
Exemplo n.º 6
0
  /**
   * 复写查询表体数据函数
   *
   * @user zhengcy
   * @datetime 2009-12-16上午11:45:14
   * @see
   *     nc.lfw.billtemplate.delegator.deft.DefaultBusinessDelegator#queryBodyAllData(nc.md.model.IBusinessEntity,
   *     java.lang.String, java.lang.String, java.lang.String, nc.lfw.data.PaginationInfo)
   */
  public NCObject[] queryBodyAllData(
      IBusinessEntity arg0, String arg1, String arg2, String arg3, PaginationInfo arg4)
      throws BusinessException {
    BaseDAO dao = new BaseDAO();

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

      String[] contions = arg3.split("and");

      if (contions.length == 3 || contions.length == 4) {

        String type = contions[2];

        String types[] = type.split("=");

        if (types.length == 2) {

          if (types[0].trim().equals("type")) {

            IContractQueryService service =
                (IContractQueryService) NCLocator.getInstance().lookup(IContractQueryService.class);
            List<ProdPriceRepoVO> list =
                service.queryQuoteInfo1(
                    new String[] {contions[0].split("=")[1], contions[1].split("=")[1]});

            if (list != null && list.size() > 0) {
              return Ds2NCObjectUtil.wrapVOsToNCObjects(list.toArray(new ProdPriceRepoVO[0]));
            } else {
              return new NCObject[0];
            }

          } else if (types[0].trim().equals("ghtype")) {
            // 编辑状态下获取价格列表的方法,避免刷新之后数据出错。
            IContractQueryService service =
                (IContractQueryService) NCLocator.getInstance().lookup(IContractQueryService.class);
            List<ProdPriceRepoVO> list =
                service.queryQuoteInfo1(
                    new String[] {contions[0].split("=")[1], contions[1].split("=")[1]});

            if (list != null && list.size() > 0) {

              if (contions != null && contions.length > 0) {
                for (String ss : contions) {
                  if (ss.indexOf("pk_ht_contract") != -1) {
                    arg3 = ss;
                  }
                }
              }

              if (arg3.indexOf("pk_ht_contract") != -1) {
                String pk = arg3.split("=")[1];
                pk = pk.trim().substring(1, 21);
                for (ProdPriceRepoVO vo : list) {
                  vo.setPk_ht_contract(pk);
                }
                dao.deleteByClause(ProdPriceRepoVO.class, "pk_ht_contract='" + pk + "'");

                dao.insertVOArray(list.toArray(new ProdPriceRepoVO[0]));

                String className = arg0.getFullClassName();
                // 协议价格库过滤出所属合同的信息 wangye
                if ("nc.vo.ebscg.htcontract.ProdPriceRepoVO".equals(className)) {
                  arg3 += " and isnull(contract_info,0)=0 ";
                }
                // 调用默认的表体查询方法
                return super.queryBodyAllData(arg0, arg1, arg2, arg3, arg4);
              } else {
                return new NCObject[0];
              }
              // return Ds2NCObjectUtil.wrapVOsToNCObjects(list.toArray(new ProdPriceRepoVO[0]));
            } else {
              return new NCObject[0];
            }
          }
        }
      }
    }
    if (arg3.indexOf("pk_ht_contract") == -1 && arg3.indexOf("bill_id") == -1) {
      // 根据采购方案主键和供应商主键查询表体数据
      String[] strWhere = arg3.split("=");
      IContractQueryService service =
          (IContractQueryService) NCLocator.getInstance().lookup(IContractQueryService.class);
      List<ProdPriceRepoVO> list = service.queryQuoteInfo(strWhere);

      if (list != null && list.size() > 0) {
        return Ds2NCObjectUtil.wrapVOsToNCObjects(list.toArray(new ProdPriceRepoVO[0]));
      } else {
        return new NCObject[0];
      }
    } else {
      String className = arg0.getFullClassName();
      // 协议价格库过滤出所属合同的信息 wangye
      if ("nc.vo.ebscg.htcontract.ProdPriceRepoVO".equals(className)) {
        arg3 += " and isnull(contract_info,0)=0 ";

      } else if ("nc.vo.ebscg.htcontract.ConstratMoneyPlanVO".equals(className)) {
        // 付款信息排序
        arg3 = payAddDrWhere(arg3);
        ConstratMoneyPlanVO[] svo = null;
        NCObject[] ncobjects = null;
        Collection<ConstratMoneyPlanVO> con =
            getBaseDao().retrieveByClause(ConstratMoneyPlanVO.class, arg3);
        if (con != null && con.size() > 0) {
          ncobjects = new NCObject[con.size()];
          svo = con.toArray(new ConstratMoneyPlanVO[0]);
          for (int i = 0; i < svo.length; i++) {
            ncobjects[i] = NCObject.newInstance(svo[i]);
          }
        }

        return ncobjects;
      }
      // 调用默认的表体查询方法
      return super.queryBodyAllData(arg0, arg1, arg2, arg3, arg4);
    }
  }
Exemplo n.º 7
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;
  }
Exemplo n.º 8
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);
  }