Пример #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
  /**
   * 更新需求填报子表VO的方法
   *
   * @param planVO 计划填报的主表VO
   * @param planItemProdVO 计划填报的子表VO
   * @param keyPlanItemList 要插入主键列表
   * @return ReqItemProdVO 需求填报的子表VO
   * @author liweiqiang 2009-11-16
   */
  private ReqItemProdVO setReqItemProdVO(
      PlanVO planVO, PlanItemProdVO planItemProdVO, String[] keyPlanItemList) {

    ReqItemProdVO reqItemProdVO = new ReqItemProdVO();

    // 计划类型
    reqItemProdVO.setPlan_type(planVO.getPlan_type());
    // 计划方式
    reqItemProdVO.setPlan_mode(planVO.getPlan_mode());
    // 采购品种类型
    reqItemProdVO.setStock_type(planVO.getStock_type());
    // 产品ID
    reqItemProdVO.setPk_da_prod_id(planItemProdVO.getPk_prod_id());
    // 产品编码
    reqItemProdVO.setProd_code(planItemProdVO.getProd_code());
    // 产品名称
    reqItemProdVO.setProd_name(planItemProdVO.getProd_name());
    // 产品分类ID
    reqItemProdVO.setPk_prod_cate(planItemProdVO.getProd_type());
    // // 产品分类名称
    // reqItemProdVO.setProd_cate_name();
    // 产品规格
    reqItemProdVO.setProd_module(planItemProdVO.getProd_spec());
    // 项目名称
    reqItemProdVO.setProj_name(planItemProdVO.getProj_name());
    // 需求说明
    reqItemProdVO.setProj_req_desc(planItemProdVO.getReq_desc());
    // 数量
    UFDouble quantity = planItemProdVO.getAftermod_quantity();

    if (quantity != null) {
      if (quantity.getDouble() > 0) {
        reqItemProdVO.setQuantity(quantity);
      } else {
        reqItemProdVO.setQuantity(planItemProdVO.getQuantity());
      }
    } else {
      reqItemProdVO.setQuantity(planItemProdVO.getQuantity());
    }

    // 单价
    reqItemProdVO.setUnit_price(planItemProdVO.getUnit_price());
    // 单位
    reqItemProdVO.setPk_unit(planItemProdVO.getPk_unit());
    // 金额
    reqItemProdVO.setAmount(planItemProdVO.getAmount());
    // 来源单据主表ID(计划单ID)
    reqItemProdVO.setPk_bill_src(planItemProdVO.getPk_jh_plan_main());
    // 来源单据子表ID
    reqItemProdVO.setPk_bill_item_src(planItemProdVO.getPk_jh_plan_item_prod());
    // 来源单据类型
    reqItemProdVO.setBill_type_src(planVO.getBill_type());

    // 单据状态
    reqItemProdVO.setStatus(VOStatus.NEW);

    // 需求变更增加有关说明 2009-12-23 lwq
    reqItemProdVO.setReq_say(planItemProdVO.getReq_say());

    return reqItemProdVO;
  }
Пример #3
0
  /**
   * 复制计划填报的供应商到采购需求
   *
   * @param aggReqVO 需求填报的aggvo
   * @author liweiqiang 2009-11-16
   * @throws BusinessException
   */
  private void setSupplier(AggReqVO aggReqVO) throws BusinessException {

    // 计划填报主表Id
    String keyPlanMain;
    // 计划填报子表Id
    String keyPlanItemProd;

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

    // 供应商管理
    ReqProdSupplierVO reqProdSupplierVO;
    // 插入需求填报的值
    ArrayList<ReqProdSupplierVO> list = new ArrayList<ReqProdSupplierVO>();

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

    IReqQueryService reqQueryService = NCLocator.getInstance().lookup(IReqQueryService.class);

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

      for (int i = 0; i < reqApplyItemList.length; i++) {
        reqItemProdVO = (ReqItemProdVO) reqApplyItemList[i];

        // 取得计划填报主表Id
        keyPlanMain = reqItemProdVO.getPk_bill_src();
        // 取得计划填报子表Id
        keyPlanItemProd = reqItemProdVO.getPk_bill_item_src();

        List<PlanProdItemSupVO> reqAcceptSupList =
            reqQueryService.getPlanProdItemSupVO(keyPlanMain, keyPlanItemProd);

        PlanProdItemSupVO[] PlanProdItemSupVO =
            (PlanProdItemSupVO[]) reqAcceptSupList.toArray(new PlanProdItemSupVO[0]);

        for (int j = 0; j < PlanProdItemSupVO.length; j++) {

          reqProdSupplierVO = new ReqProdSupplierVO();
          // 采购需求单主键ID
          reqProdSupplierVO.setPk_xq_req_main(reqItemProdVO.getPk_xq_req_main());
          // 采购需求单明细ID
          reqProdSupplierVO.setPk_xq_req_item_prod(reqItemProdVO.getPk_xq_req_item_prod());
          // 供应商ID
          reqProdSupplierVO.setPk_supplier_id(PlanProdItemSupVO[j].getPk_supplier());
          // 供应商编码
          reqProdSupplierVO.setSupplier_code(PlanProdItemSupVO[j].getSupplier_code());
          // 供应商名称
          reqProdSupplierVO.setSupplier_name(PlanProdItemSupVO[j].getSupplier_name());
          // 供应商类型
          reqProdSupplierVO.setSupplier_type(PlanProdItemSupVO[j].getSupplier_type());
          // 推荐理由
          reqProdSupplierVO.setReason(PlanProdItemSupVO[j].getReason());
          // 备注
          reqProdSupplierVO.setMemo(PlanProdItemSupVO[j].getMemo());
          // 产品ID
          reqProdSupplierVO.setPk_prod(PlanProdItemSupVO[j].getPk_prod());
          // 产品编码
          reqProdSupplierVO.setProd_code(PlanProdItemSupVO[j].getProd_code());
          // 产品名称
          reqProdSupplierVO.setProd_name(PlanProdItemSupVO[j].getProd_name());
          // 来源单据主表ID
          reqProdSupplierVO.setPk_bill_src(reqItemProdVO.getPk_bill_src());
          // 来源单据子表ID
          reqProdSupplierVO.setPk_bill_item_src(reqItemProdVO.getPk_bill_item_src());
          // 来源单据类型
          reqProdSupplierVO.setBill_type_src(reqItemProdVO.getBill_type_src());
          // 单据状态
          reqProdSupplierVO.setStatus(VOStatus.NEW);

          list.add(reqProdSupplierVO);
        }
      }

      if (list != null && list.size() != 0) {
        // 将封装的产品档案VO数组转换为NCObject数组
        NCObject[] objList =
            Ds2NCObjectUtil.wrapVOsToNCObjects(
                (CircularlyAccessibleValueObject[])
                    list.toArray(new CircularlyAccessibleValueObject[0]));

        // 调用super.save方法保存
        super.save(objList, null);
      }
    }
  }
Пример #4
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);
  }