예제 #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;
  }
예제 #2
0
  public void addCMPBank(HYBillVO billvo, String tally_corp, String tallyman, UFDate tallydate)
      throws BusinessException {
    if (!isTogatherWithCMP(tally_corp)) {
      return;
    }

    RegisterVO vo = (RegisterVO) billvo.getParentVO();
    List<SettlementBodyVO> retList = new ArrayList<SettlementBodyVO>();

    CommonDAO commonDAO = new CommonDAO();
    BaseinfoVO baseVO = commonDAO.queryBaseinfoByPK(vo.getPk_baseinfo());
    SettlementBodyVO rvo = new SettlementBodyVO();

    rvo.setPk_corp(tally_corp); // 公司
    rvo.setSystemcode(ProductInfo.pro_FBM); // 来源系统
    rvo.setPk_bill(vo.getPrimaryKey()); // 业务单据主键

    rvo.setBillcode(vo.getVbillno()); // 单据编号
    rvo.setBilldate(vo.getInvoicedate()); // 业务日期取实际放款日期
    rvo.setTallystatus(new Integer(CMPaccStatus.SUCCESSACCOUNT.getStatus())); // 记账状态,设置为结算成功日期
    rvo.setTallydate(vo.getInvoicedate());
    rvo.setSigndate(vo.getInvoicedate());
    rvo.setFundformcode(CmpConst.BANK_DEPOSIT); // 银行存款

    String selfAcc = baseVO.getPaybankacc();

    UFDouble securitymoney =
        vo.getSecuritymoney() == null ? new UFDouble(0) : vo.getSecuritymoney();
    rvo.setPay(vo.getPoundagemoney().add(securitymoney));

    UFDouble securitymoneyf =
        vo.getSecuritymoneyf() == null ? new UFDouble(0) : vo.getSecuritymoneyf();
    rvo.setPayfrac(vo.getPoundagemoneyf().add(securitymoneyf));

    UFDouble securitymoneyb =
        vo.getSecuritymoneyb() == null ? new UFDouble(0) : vo.getSecuritymoneyb();
    rvo.setPaylocal(vo.getPoundagemoneyb().add(securitymoneyb)); //
    rvo.setFundsflag(CmpConst.CASH_FLOW_OUT); // 资金流向(0 资金流入1 资金流出2 转账出)
    rvo.setDirection(
        CmpConst.Direction_Pay); // CmpConst.Direction_Receive=0收款;CmpConst.Direction_Receive=1付款;

    rvo.setPk_account(selfAcc); // 本方帐
    rvo.setPk_currtype(baseVO.getPk_curr()); // 币种
    rvo.setFracrate(vo.getFrate()); // 辅币汇率
    rvo.setLocalrate(vo.getBrate()); // 本币汇率
    rvo.setTradertype(CmpConst.TradeObjType_Bank); // 对方类型为银行
    rvo.setPk_trader(baseVO.getPaybank());
    // suzhzh 201106171021595038 回写票据号
    rvo.setNotenumber(baseVO.getFbmbillno());
    // add by ouyangzhb 2011-06-24 回写票据类型
    rvo.setPk_notetype(baseVO.getFbmbilltype());
    buildOppInfo(rvo);

    rvo.setPk_billtype(vo.getPk_billtypecode());
    rvo.setMemo(vo.getNote());
    retList.add(rvo);

    // 处理保证金
    if (FbmBusConstant.ASSURETYPE_BAIL.equals(vo.getImpawnmode())) {

      BankaccbasVO bankaccvo =
          (BankaccbasVO)
              FBMProxy.getUAPQuery().retrieveByPK(BankaccbasVO.class, vo.getSecurityaccount());

      SettlementBodyVO rvo1 = new SettlementBodyVO();
      rvo1.setPk_corp(tally_corp); // 公司
      rvo1.setSystemcode(ProductInfo.pro_FBM); // 来源系统
      rvo1.setPk_bill(vo.getPrimaryKey()); // 业务单据主键
      rvo1.setPk_account(bankaccvo.getPrimaryKey());
      rvo1.setBillcode(vo.getVbillno()); // 单据编号
      rvo1.setBilldate(vo.getInvoicedate()); // 业务日期取实际放款日期
      rvo1.setTallydate(vo.getInvoicedate());
      rvo1.setSigndate(vo.getInvoicedate());
      rvo1.setTallystatus(new Integer(CMPaccStatus.SUCCESSACCOUNT.getStatus())); // 记账状态,设置为结算成功日期
      rvo1.setFundformcode(1); // 银行存款

      selfAcc = null;

      selfAcc = vo.getSecurityaccount();
      rvo1.setReceive(vo.getSecuritymoney());
      rvo1.setReceivefrac(vo.getSecuritymoneyf());
      rvo1.setReceivelocal(vo.getSecuritymoneyb()); //
      rvo1.setFundsflag(CmpConst.CASH_FLOW_IN); // 资金流向(0 资金流入1 资金流出2 转账出)
      rvo1.setDirection(
          CmpConst
              .Direction_Receive); // CmpConst.Direction_Receive=0收款;CmpConst.Direction_Receive=1付款;

      rvo1.setPk_account(selfAcc); // 本方帐
      rvo1.setPk_currtype(baseVO.getPk_curr()); // 币种
      rvo1.setFracrate(vo.getFrate()); // 辅币汇率
      rvo1.setLocalrate(vo.getBrate()); // 本币汇率
      rvo1.setTradertype(CmpConst.TradeObjType_Bank); // 对方类型为银行
      rvo1.setPk_trader(baseVO.getPaybank());
      // suzhzh 201106171021595038 回写票据号
      rvo1.setNotenumber(baseVO.getFbmbillno());
      // add by ouyangzhb 2011-06-24 回写票据类型
      rvo.setPk_notetype(baseVO.getFbmbilltype());
      buildOppInfo(rvo1);

      rvo1.setPk_billtype(vo.getPk_billtypecode());
      rvo1.setMemo(vo.getNote());
      retList.add(rvo1);
    }

    getBankTallyService()
        .writeBankacc((SettlementBodyVO[]) retList.toArray(new SettlementBodyVO[0]));
  }