Exemple #1
0
  @Override
  protected String doCheck(BusiActionParamVO<T> param) throws BusinessException {

    ActionVO actionVO = param.getLastActionVO();
    if (actionVO == null) {
      return nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
          .getStrByID("fbmcomm", "UPPFBMComm-000238") /* @res"找不到票据动作"*/;
    }

    // 2007.11.27 xwq承兑付款日期在票据到期日之后可不校验状态
    if (actionVO.getEndstatus().equals(FbmStatusConstant.HAS_DESTROY)) {
      return nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000239") /* @res"票据"*/
          + param.getBaseinfoVO().getFbmbillno()
          + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000318") /* @res"已核销,无法承兑"*/;
    }

    if (actionVO.getEndstatus().equals(FbmStatusConstant.HAS_PAY)
        || actionVO.getEndstatus().equals(FbmStatusConstant.ON_PAY)) {
      return nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000239") /* @res"票据"*/
          + param.getBaseinfoVO().getFbmbillno()
          + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000319") /* @res"在付款或已付款,无法承兑"*/;
    }

    // 校验业务日期
    if (actionVO.getActiondate().after(param.getActiondate())) {
      return param.getBaseinfoVO().getFbmbillno()
          + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000320") /* @res"的业务日期早于前一操作业务日期"*/;
    }

    // 校验付票是否审核
    RegisterVO regVO = param.getRegisterVO();
    if (regVO != null) {
      if (regVO.getVbillstatus().intValue() != IBillStatus.CHECKPASS
          && regVO.getVbillstatus().intValue() != IFBMStatus.Create) {
        throw new BusinessException(
            nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
                .getStrByID("fbmcomm", "UPPFBMComm-000321") /* @res"付票登记单状态必须为审核通过或已生成单据"*/);
      }
    }

    // 校验是否已生成划账单
    //		ICreateCorpQueryService ProductService = (ICreateCorpQueryService)
    // NCLocator.getInstance().lookup(ICreateCorpQueryService.class.getName());
    //		Hashtable productEnabled =
    // ProductService.queryProductEnabled(param.getRegisterVO().getPk_corp(),new
    // String[]{ProductCode.PROD_EP});
    //		if(((UFBoolean)productEnabled.get(ProductInfo.pro_EP)).booleanValue()){//启用了收付报才校验
    //			OuterRelationDAO relDao = new OuterRelationDAO();
    //			if(!relDao.isHjEffect(param.getPk_source())){
    //				throw  new BusinessException("付票登记的划账结算单未生成或未生效");
    //			}
    //		}

    return null;
  }
  @Override
  protected String doCheck(BusiActionParamVO<T> param) throws BusinessException {
    String commonError = commonCheck(param);
    if (commonError != null) return commonError;

    ActionVO actionVO = param.getLastActionVO();
    // 校验票据动作
    if (!(actionVO.getActioncode().equals(FbmActionConstant.AUDIT)
        && actionVO.getBilltype().equals(FbmBusConstant.BILLTYPE_GATHER)
        && actionVO.getPk_bill().equals(param.getPk_bill()))) {
      return nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000239") /* @res"票据"*/
          + param.getBaseinfoVO().getFbmbillno()
          + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
              .getStrByID("fbmcomm", "UPPFBMComm-000263") /* @res"的前一操作必须是审核收票登记单。"*/
          + BusiMessageTranslator.translateAction(param);
    }
    return null;
  }
  /**
   * 核销减少票据账
   *
   * @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);
  }