业务场景:
采购入库单 下推生成 应付单(采购费用发票),应付单审核后自动与上游的入库单进行费用分摊
具体开发内容:
针对com.kingdee.eas.fi.ap.app.OtherBillControllerBean 类进行二开
1.应付单审核自动分摊
在应付单com.kingdee.eas.fi.ap.app.OtherBillControllerBean #_audit 审核方法后增加调用采购费用分摊操作:
List list = WriteOffCommonFacadeFactory.getLocalInstance(ctx).manualWriteOff(wfParams);
分摊成功返回单据id,分摊失败返回null
参数为 WriteOffCommonParams ,需要设置如下信息:
WriteOffCommonParams wfParams = new WriteOffCommonParams();
wfParams.setMainList(List); //ArrayList<WriteOffCommonInfo> 应付单的信息
wfParams.setSecList(List); //ArrayList<WriteOffCommonInfo> 入库单的信息
// WriteOffCommonInfo需要设置billId(单据id)、entryId(分录id);
wfParams.setCompanyId(String); //财务组织
wfParams.setBizDate(Date); //当前时间
//下面参数无需修改,上面根据实际情况获取
wfParams.setMappingEntryId("wYhiUUhzQ8StVX+9X/tbOpVAboA="); //匹配方案id,这里id为按关联关系分摊
wfParams.setMainEntryIdField("entry.id");
wfParams.setSecEntryIdField("entry.id");
wfParams.put("upQueryFilter", new FilterInfo());
wfParams.put("downQueryFilter", new FilterInfo());
wfParams.setStrategy("expenseApportion");
wfParams.put("apportionStd", "entry.qty");
wfParams.put("isSubContract", false);
wfParams.setMainEntityId("48DA3A71");
wfParams.setSecEntityId("783061E3");
wfParams.put("isAutoWriteOff", false);
wfParams.setMainQueryName("com.kingdee.eas.fi.ap.app.OtherBillQuery");
wfParams.setSecQueryName("com.kingdee.eas.scm.im.inv.PurInWarehsQuery");
2.应付单反审核自动取消分摊
在应付单 com.kingdee.eas.fi.ap.app.OtherBillControllerBean#_unpassAudit 和
com.kingdee.eas.fi.ap.app.OtherBillControllerBean#_unAudit 反审核方法后增加调用取消分摊操作:
ExpenseApportionFacadeFactory.getLocalInstance(ctx).deleteExpenseApportion(ids);
//参数为 String[] 费用分摊记录单头id
费用分摊记录单头id 可以通过应付单联查 T_CL_ExpenseApportion (费用分摊清单)和
T_CL_EXPENSEAPPORTIONENTRY (费用分摊清单分录)获取
推荐阅读