EAS固定资产获取本期实提折旧额原创
金蝶云社区-来自行星的稻米
来自行星的稻米
0人赞赏了该文章 364次浏览 未经作者许可,禁止转载编辑于2023年04月02日 22:54:42

EAS提供FaDepCalFacade来获取EAS固定资产折旧数据 ,先通过FaDepCalFacadeFactory.getLocalInstance(ctx).isNeedDep校验是否可以进行折旧,再通过FaDepCalFacadeFactory.getLocalInstance(ctx).calOneCardDep来获取一张卡片的折旧数据

返回值是一个map数据,取key=1获取到的值即是本期折旧数据

下面是代码实现参考

   protected BigDecimal getPreDecTTerm(FaCurCardInfo curCardInfo,Context ctx) throws BOSException

   {

     BigDecimal result = new BigDecimal(0);

     try

     {

       FaCurCardCollection cards = new FaCurCardCollection();

       cards.add(curCardInfo);

       if (!(FaDepCalFacadeFactory.getLocalInstance(ctx).isNeedDep(cards))) {

         return result;

       }

 

       if ((curCardInfo.getAssetCat().getDepreciationPolicy().getDeprRule() != FaDepreciationRuleEnum.YES_REGARDLESS_USESTATUS) && (((curCardInfo.getAssetCat().getDepreciationPolicy().getDeprRule() != FaDepreciationRuleEnum.DECIDE_BY_USESTATUS) || (!(curCardInfo.getUseStatus().isIsDepreciation())))))

       {

         return result;

       }

 

       HashMap map = FaDepCalFacadeFactory.getLocalInstance(ctx).calOneCardDep(curCardInfo.getId().toString());

       if ((map != null) && ((BigDecimal)map.get(new Integer(1)) != null))

         result = (BigDecimal)map.get(new Integer(1));

     } catch (Exception e) {

       throw new BOSException(e);

     }

     return result;

   }

   

      protected FaCurCardInfo getCurCardInfo(String curCardID,Context ctx) throws BOSException

      {

        FaCurCardInfo curCardInfo = new FaCurCardInfo();

        try {

          SelectorItemCollection sic = getFaDefPropertySelectors(getCurCardSelectors(),ctx);

          curCardInfo = FaCurCardFactory.getLocalInstance(ctx).getFaCurCardInfo(new ObjectUuidPK(curCardID), sic);

        } catch (Exception e) {

           throw new BOSException(e);

        }

        return curCardInfo;

      }

   

   public SelectorItemCollection getCurCardSelectors() {

        SelectorItemCollection sic = new SelectorItemCollection();

        sic.add(new SelectorItemInfo("*"));

        sic.add(new SelectorItemInfo("measureUnit.name"));

        sic.add(new SelectorItemInfo("assetCat.name"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.OldChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.TotalDeprChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.DevalueChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.LeaveValueChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.ChargeAccoutChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.UsedLifeChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.DeprMethodChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.EvaluateChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.CostCenterChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.UseStatusChange"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.TailDispose"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.StartDeprTime"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.DeprRule"));

        sic.add(new SelectorItemInfo("deprMethod.period"));

        sic.add(new SelectorItemInfo("deprMethod.isCustom"));

        sic.add(new SelectorItemInfo("deprMethod.depValuePolicy"));

        sic.add(new SelectorItemInfo("deprMethod.isWorkload"));

        sic.add(new SelectorItemInfo("deprMethod.id"));

        sic.add(new SelectorItemInfo("deprMethod.name"));

        sic.add(new SelectorItemInfo("deprMethod.number"));

        sic.add(new SelectorItemInfo("assetCat.DepreciationPolicy.StartDeprTime"));

        sic.add(new SelectorItemInfo("useStatus.isDepreciation"));

        sic.add(new SelectorItemInfo("assetCat.calcuByEvaluate"));

        sic.add(new SelectorItemInfo("evalDeprMode.period"));

        sic.add(new SelectorItemInfo("evalDeprMode.number"));

        sic.add(new SelectorItemInfo("evalDeprMode.name"));

        sic.add(new SelectorItemInfo("evalDeprMode.depValuePolicy"));

        sic.add(new SelectorItemInfo("evalDeprMode.isWorkload"));

        sic.add(new SelectorItemInfo("evalDeprMode.isCustom"));

        sic.add(new SelectorItemInfo("evalDeprMode.id"));

        return sic;

      }

   

      public static SelectorItemCollection getFaDefPropertySelectors(SelectorItemCollection sic,Context ctx)

      {

        EntityObjectInfo pv = FaDefMetaUtil.loadEntity("com.kingdee.eas.fi.fa.def.app.FaDefPropertyValue",ctx);

        PropertyCollection propertyCol = pv.getProperties();

    

        if (propertyCol.size() > 0) {

          for (int i = 0; i < propertyCol.size(); ++i) {

            PropertyInfo info = propertyCol.get(i);

            if (info instanceof LinkPropertyInfo) {

              sic.add("propertyValue." + info.getName() + ".id");

              sic.add("propertyValue." + info.getName() + ".number");

              sic.add("propertyValue." + info.getName() + ".name");

            } else {

              sic.add("propertyValue." + info.getName());

            }

          }

        }

        sic.add("propertyValue.id");

        return sic;

      }


赞 0