Example #1
0
  // 维护持票单位内部账户余额
  private int doHoldUnitAccont(PfParameterVO vo) throws BusinessException {
    AggregatedValueObject billvo = vo.m_preValueVo;
    ReckonVO reckvo = (ReckonVO) billvo.getParentVO();
    String accont = reckvo.getInacc();
    UFDouble reckmoney = reckvo.getReckonmoneysum();
    BaseDAO basebo = new BaseDAO();
    String sql = null;
    if (reckmoney.compareTo(new UFDouble(0)) > 0) {
      sql =
          "update bd_accid set currmny = currmny + "
              + reckmoney
              + " where pk_accid = '"
              + accont
              + "'";
    } else if (reckmoney.compareTo(new UFDouble(0)) < 0) {
      sql =
          "update bd_accid set currmny = currmny + "
              + reckmoney
              + " where pk_accid = '"
              + accont
              + "' and currmny >= "
              + reckmoney.abs();
    }
    int ret = 0;

    if (sql != null) {
      ret = basebo.executeUpdate(sql);
    }
    return ret;
  }
Example #2
0
  /*
   * 备注:平台编写规则类
   * 接口执行类
   */
  public Object runComClass(PfParameterVO vo) throws BusinessException {
    try {
      super.m_tmpVo = vo;
      String pk_corp = InvocationInfoProxy.getInstance().getCorpCode();
      procActionFlow(vo);
      Object retObj =
          runClass(
              "nc.bs.trade.comstatus.BillApprove",
              "approveBill",
              "nc.vo.pub.AggregatedValueObject:36GK",
              vo,
              m_keyHas,
              m_methodReturnHas);

      if (retObj != null) {
        m_methodReturnHas.put("approveBill", retObj);
      }

      // 领用单出库时维护清算户数据,要是票据已经领用了就不能再清算。
      //		ReckonBVO[] reckonBVOs = (ReckonBVO[])vo.m_preValueVo.getChildrenVO();
      //		HYPubBO hyPubBO = new HYPubBO();
      //		for(int i = 0; i < reckonBVOs.length; i++) {
      //			String condition = " exists (select 1 from fbm_accountdetail a,fbm_action b where
      // a.reason = '"
      //			 +FbmBusConstant.ACCOUNT_REASON_CENTER_USE +"' and pk_detail = '"
      // +reckonBVOs[i].getPk_detail()
      //			 + "' and b.isnew = 'Y' and isnull(a.dr,0) = 0 and isnull(b.dr,0) = 0 and b.endstatus =
      // '"
      //			 +FbmStatusConstant.REGISTER + "' and fbm_register.pk_source = a.pk_register "
      //			 +" and b.pk_source = fbm_register.pk_register )";
      //			RegisterVO[] registerVO = (RegisterVO[])hyPubBO.queryByCondition(RegisterVO.class,
      // condition);
      //			if(registerVO.length > 0 ) {
      //                throw new BusinessException("票据 " + reckonBVOs[i].getFbmbillno() +
      // "已经内部领用,不能清算!");
      //			}
      //		}
      if (retObj instanceof HYBillVO) {
        Integer vbillstatus =
            (Integer) ((HYBillVO) retObj).getParentVO().getAttributeValue(ReckonVO.VBILLSTATUS);
        if (vbillstatus.intValue() == nc.vo.trade.pub.IBillStatus.CHECKPASS) {
          insertReckonReceipt(vo);
          // if(doHoldUnitAccont(vo) < 0 )
          // throw new
          // BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("fbmcomm","UPPFBMComm-000363")/* @res"持票单位内部账户余额不足,不能审批!"*/);
          changeAccountDetailLiquidFlag(vo);

          // 检查受理日期
          ReckonVO reckonVO = (ReckonVO) ((HYBillVO) retObj).getParentVO();
          ICommon commonInterface = (ICommon) NCLocator.getInstance().lookup(ICommon.class);
          UFDate dhandledate = commonInterface.getAutoProcessDate(reckonVO.getPk_corp());
          if (dhandledate != null) {
            if (reckonVO.getDapprovedate().after(dhandledate)) {
              throw new BusinessException(
                  nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
                      .getStrByID("3620add", "UPP3620ADD-000175") /*
																		 * @res
																		 * "审核日期大于受理日期,无法写内部账户账"
																		 */);
            }

            String businessno = commonInterface.getBusinessNo("36LW", pk_corp, null, null);
            // 更新受理日期字段
            reckonVO.setDealdate(dhandledate);
            reckonVO.setBusinessno(businessno);
            ((HYBillVO) retObj).setParentVO(reckonVO);
            new BaseDAO().updateVO(reckonVO, new String[] {ReckonVO.DEALDATE, "businessno"});

            ((HYBillVO) retObj)
                .setParentVO(
                    new HYPubBO().queryByPrimaryKey(ReckonVO.class, reckonVO.getPrimaryKey()));
          }

          // 记内部账户账
          ReckonVOToAccDetail reckonAccdetailSrv = new ReckonVOToAccDetail();
          reckonAccdetailSrv.addAccDetail(
              (HYBillVO) retObj, vo.m_operator, new UFDate(vo.m_currentDate));
        }
      }

      return retObj;

    } catch (Exception ex) {
      if (ex instanceof BusinessException) throw (BusinessException) ex;
      else throw new PFBusinessException(ex.getMessage(), ex);
    }
  }