Exemplo n.º 1
0
  /**
   * 将收付款单据VO转换为票据处理的参数对象
   *
   * @param param
   * @return
   */
  public static ArapBillParamVO buildBillParam(
      SettlementAggVO param, SettlementBodyVO item, int row) throws BusinessException {

    SettlementHeadVO vo = (SettlementHeadVO) param.getParentVO();
    ArapBillParamVO arapParam = new ArapBillParamVO();
    String djdl = vo.getDef11(); // 取得前面getClass中放置的单据大类,临时存储
    String djlxbm = vo.getPk_tradetype(); // 具体的单据小类

    arapParam = new ArapBillParamVO();
    if (item.getNotenumber() != null) {
      arapParam.setFbmbillno(item.getNotenumber().trim());
    }
    arapParam.setPk_curr(item.getPk_currtype());
    arapParam.setDjrq(vo.getBusi_billdate()); // 业务单据日期

    arapParam.setMemo(item.getMemo()); // 摘要

    // 金额合并处理

    Map<String, UFDouble> mapMoneyy = null;
    Map<String, UFDouble> mapMoneyf = null;
    Map<String, UFDouble> mapMoneyb = null;
    mapMoneyy = sumMoney((SettlementBodyVO[]) param.getChildrenVO(), djdl, YB);
    mapMoneyf = sumMoney((SettlementBodyVO[]) param.getChildrenVO(), djdl, FB);
    mapMoneyb = sumMoney((SettlementBodyVO[]) param.getChildrenVO(), djdl, BB);
    arapParam.setMoneyy(mapMoneyy.get(arapParam.getFbmbillno()));
    arapParam.setMoneyf(mapMoneyf.get(arapParam.getFbmbillno()));
    arapParam.setMoneyb(mapMoneyb.get(arapParam.getFbmbillno()));

    arapParam.setFrate(item.getFracrate()); // 辅币汇率
    arapParam.setBrate(item.getLocalrate()); // 本币汇率

    arapParam.setPk_bill_h(vo.getPrimaryKey());
    arapParam.setPk_bill_b(item.getPrimaryKey());
    arapParam.setOuterbilltype(djlxbm); // 单据类型编码
    arapParam.setOuterdjdl(djdl); // 设置单据大类
    arapParam.setRow(row + 1);
    // arapParam.setSkbankacc(item.getSkyhzh());// 收款银行账号
    // arapParam.setFkbankacc(item.getFkyhzh());// 付款银行账号
    arapParam.setVoperator(vo.getPk_billoperator()); // 录入人
    arapParam.setDoperatdate(vo.getBusi_billdate()); // 录入日期,取单据日期
    arapParam.setVeffector(vo.getPk_signer()); // 生效人,取确认人(签字人)
    arapParam.setDeffectdate(vo.getSigndate()); // 生效日期
    arapParam.setPk_plansubj(item.getPk_plansubj());

    String pk_corp = vo.getPk_corp();

    CommonDAO dao = new CommonDAO();
    String pk_cust = dao.queryCustByCorp(pk_corp);

    if (pk_cust == null) {
      throw new BusinessException(
          nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000224") /* @res"公司未对应客商" */);
    }
    arapParam.setCurrentunit(pk_cust); // 本方单位,取公司对应客商

    arapParam.setTradertype(item.getTradertype()); // 对方类型

    if (item.getTradertype() != 0) {
      throw new BusinessException(
          nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcode112", "UPPFBMCODE112-000037") /*@res "使用票据进行结算往来对象必须是客商"*/);
    }
    arapParam.setOtherunit(item.getPk_trader()); // 对方单位,取伙伴编码

    arapParam.setPk_corp(pk_corp);

    // 查询票据基本信息VO
    if (arapParam.getFbmbillno() != null && arapParam.getFbmbillno().length() > 0) {
      BaseInfoBO baseBO = new BaseInfoBO();
      arapParam.setBaseinfoVO(baseBO.queryByFbmbillno(arapParam.getFbmbillno()));
      // 查询票据最新动作VO
      ActionQueryDAO actionDao = new ActionQueryDAO();
      arapParam.setNewActionVO(actionDao.queryNewestByFbmBillno(arapParam.getFbmbillno(), pk_corp));
      if (arapParam.getPk_busbill() == null) {
        arapParam.setPk_busbill(arapParam.getNewActionVO().getPk_source());
      }
      // 查询当前单据关联
      OuterRelationDAO relDao = new OuterRelationDAO();
      arapParam.setOuterVO(relDao.queryBypk_b(item.getPrimaryKey()));
    }
    return arapParam;
  }
Exemplo n.º 2
0
  /**
   * 核销减少票据账
   *
   * @param billvo
   * @param tally_corp
   * @param tallyman
   * @param tallydate
   * @throws BusinessException
   */
  public void addCMPBill4Destory(
      HYBillVO billvo, String tally_corp, String tallyman, UFDate tallydate)
      throws BusinessException {
    if (!isTogatherWithCMP(tally_corp)) {
      return;
    }

    RegisterVO headvo = (RegisterVO) billvo.getParentVO();

    // 付票退票核销
    ActionQueryDAO actionDAO = new ActionQueryDAO();
    ActionVO newActionVO =
        actionDAO.queryNewestByPk_baseinfo(headvo.getPk_baseinfo(), headvo.getPk_corp());
    if (newActionVO.getActioncode().equals(FbmActionConstant.AUDIT)
        && newActionVO.getBilltype().equals(FbmBusConstant.BILLTYPE_RETURN)) {
      // 如果没有在fbm_outer表里,说明付票没有走收付报,而是直接已付票打勾,返回
      SuperVO[] outers =
          FBMProxy.getUifService()
              .queryByCondition(
                  OuterVO.class,
                  "isnull(dr,0)=0 and pk_billtypecode='36GL' and pk_busibill='"
                      + headvo.getPrimaryKey()
                      + "'");
      if (outers == null || outers.length == 0) {
        return;
      }
    } else if (newActionVO.getActioncode().equals(FbmActionConstant.AUDIT)
        && newActionVO.getBilltype().equals(FbmBusConstant.BILLTYPE_GATHER)) {
      SuperVO[] outers =
          FBMProxy.getUifService()
              .queryByCondition(
                  OuterVO.class,
                  "isnull(dr,0)=0 and pk_billtypecode='36GA' and pk_busibill='"
                      + newActionVO.getPk_source()
                      + "'");
      if (outers == null || outers.length == 0) {
        return;
      }
    }

    SettlementBodyVO[] rvo = new SettlementBodyVO[1];
    initSettlementBodyVO(rvo, headvo);
    CommonDAO commonDAO = new CommonDAO();
    BaseinfoVO baseVO = commonDAO.queryBaseinfoByPK(headvo.getPk_baseinfo());
    rvo[0].setPk_corp(tally_corp);
    rvo[0].setPk_currtype(baseVO.getPk_curr());
    rvo[0].setTallydate(tallydate);
    rvo[0].setSigndate(tallydate);
    rvo[0].setFundformcode(CmpConst.BILL_DEPOSIT);
    rvo[0].setBilldate(tallydate);
    rvo[0].setPay(baseVO.getMoneyy());
    rvo[0].setFundsflag(CmpConst.CASH_FLOW_OUT);
    rvo[0].setDirection(CmpConst.Direction_Pay);
    rvo[0].setPk_notetype(baseVO.getFbmbilltype());
    // suzhzh 201106171021595038 回写票据号
    rvo[0].setNotenumber(baseVO.getFbmbillno());
    // add by ouyangzhb 2011-06-24 回写票据类型
    rvo[0].setPk_notetype(baseVO.getFbmbilltype());
    rvo[0].setTradertype(CmpConst.TradeObjType_KeShang); // 对方为客商
    rvo[0].setPk_trader(baseVO.getReceiveunit());
    rvo[0].setPk_oppaccount(baseVO.getReceivebankacc());
    buildOppInfo(rvo[0]);

    rvo[0].setMemo(
        nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
            .getStrByID("36201505", "UPP36201505-000006") /* @res"核销付票登记单开票业务"*/);
    rvo[0].setFracrate(headvo.getFrate()); // 辅币汇率
    rvo[0].setLocalrate(headvo.getBrate()); // 本币汇率
    fillCurrKeyValue(rvo[0]);

    getBankTallyService().writeBankacc(rvo);
  }