在产品分配标准二次开发
【业务场景】
系统默认的在产品分配标准无法满足业务需求时,可以按自己的需求新增产品分配标准
【插件开发教程及示例】
一、操作步骤
继承类 AbstractProductCostAcctg,重写方法 CostAcctg
在方法CostAcctg里做在产品计算
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Kingdee.K3.FIN.CB.App.Core.CostCal.Parameters; using Kingdee.K3.FIN.Core.Parameters; using Kingdee.K3.FIN.Core.Object.Acctg; using Kingdee.K3.FIN.Core; using Kingdee.K3.FIN.Core.Object.CostCal; using Kingdee.K3.FIN.CB.App.Core.CostCal.Object; using Kingdee.BOS; using Kingdee.BOS.Resource; using Kingdee.BOS.Core.Util; using Kingdee.K3.FIN.App.Core.OutAcctg; using Kingdee.BOS.Orm.DataEntity; using Kingdee.K3.FIN.App.Core; namespace Kingdee.K3.FIN.CB.App.Core.CostCal.Cal { /// <summary> /// 自定义在产品分配标准 /// </summary> public class TestCostCal : AbstractProductCostAcctg { /// <summary> /// 在产品计算 对内接口 /// </summary> /// <param name="ctx">上下文</param> /// <param name="parameters">核算参数</param> /// <param name="productingParameter">在产品计算参数</param> protected override void CostAcctg(ProductingParameter productingParameter) { base.CostAcctg(productingParameter); foreach (var material in productingParameter.CurrProductionInfo.MatterialResults) { foreach (var rec in material.Value) { //获取当前的成本项目费用项 string strKey = CostCalAmount.GetDicKey(this.CurrExpenseResult.CostItemId, this.CurrExpenseResult.ExpensesItemId); if (rec.Value.ExpenseDetails.DicExpenseDetails.ContainsKey(strKey)) { //计算子项完工和期末在制数量 rec.Value成本计算子项物料明细对象 this.CalCompleteQty(productingParameter, rec.Value); //计算子项完工和期末在制金额 rec.Value成本计算子项物料明细对象 this.AmountDistribute(productingParameter, rec.Value); } } } } private void CalCompleteQty(ProductingParameter productingParameter,CostCalMaterial rec) { //不需要重算数量(需要设置为true,不设置的情况下,后续逻辑会按子项物料金额来反算数量) rec.IsNotBackCalQty = true; //本期投入数量 decimal inputQty = rec.SumCurrInputQty; //按业务需求计算完工和期末在制数量 rec.EndQty = 0; rec.CompleteQty = 0; } protected virtual void AmountDistribute(ProductingParameter productingParameter, CostCalMaterial rec) { //获取当前计算的对象 var details = (from r in rec.ExpenseDetails where r.CostItemId == this.CurrExpenseResult.CostItemId && r.ExpensesItemId == this.CurrExpenseResult.ExpensesItemId select r); foreach (var detail in details) { //本期投入总投入金额 decimal inputAmount = detail.SumCurrInputAmount; //按业务需求计算完工金额和期末在制金额 decimal endAmount = 0; decimal completeAmount = 0; //将金额写入对象 this.CalCompleteAmount(rec, detail, completeAmount); this.CalEndAmount(rec, detail, endAmount); } } } }
3.数据库配置插件信息
二开配置插入数据时 FENTRYID 要从10000开始,避免后续升级和标准产品新增的出现冲突
4.配置BOSIDE对应字段枚举值
在产品分配标准二次开发
【业务场景】系统默认的在产品分配标准无法满足业务需求时,可以按自己的需求新增产品分配标准【插件开发教程及示例】一、操作步骤继承类 A...
点击下载文档
本文2024-09-23 02:16:07发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-151302.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章