成本计算获取等级品自定义权重

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-23浏览:1

成本计算获取等级品自定义权重

【应用场景】

 二开插件重写成本计算过程中等级品权重获取,支持版本 PT-151005 [8.2.0.20231109]


【实现步骤】

1.继承AbstractCostCalPlugIn类,重写ReCalVarietalProductWeight方法

using Kingdee.K3.FIN.CB.App.Core.CostCal.Object;
using Kingdee.K3.FIN.CB.App.Core.CostCal.Parameters;
using Kingdee.K3.FIN.Core;
using Kingdee.K3.FIN.Core.Object.CostCal;
using System.Collections.Generic;

namespace Kingdee.K3.FIN.CB.App.Core.PlugIn
{
    /// <summary>
    /// 成本计算的插件
    /// </summary>
    public class CostCalPlugIn:AbstractCostCalPlugIn
    {
        /// <summary>
        /// 重算等级品权重
        /// </summary>
        /// <param name="seqs">产品序列对象</param>
        /// <param name="varetials">等级品</param>
        /// <param name="productingParameter">在产品计算参数类</param>
        /// <param name="weights">等级品权重</param>
        public override void ReCalVarietalProductWeight(List<ProductSeq> seqs, List<VarietalProduct> varetials, ProductingParameter productingParameter,Dictionary<ProductSeq, decimal> weights)
        {
            //按实际业务场景重新对等级品权重赋值
            decimal allcoefc = 100;
            foreach (var seq in seqs)
            {
                //废品
                if (seq.StockState == AcctgStockState.Waster)
                {
                    //设置权重
                    allcoefc = 50;
                    weights[seq] = seq.Qty * allcoefc;
                    seq.Allcoefc = allcoefc;
                }
                    //不良品
                else if (seq.StockState == AcctgStockState.Badness)
                {
                    //设置权重
                    allcoefc = 80;
                    weights[seq] = seq.Qty * allcoefc;
                    seq.Allcoefc = allcoefc;
                }
                else
                {
                    //设置权重
                    allcoefc = 100;
                    weights[seq] = seq.Qty * allcoefc;
                    seq.Allcoefc = allcoefc;
                }
            }
        }
    }
}


2.在数据库配置二开插件

通过 SELECT * FROM T_HS_APPPLUGIN WHERE FNUMBER='CBJS' 找到配置内码

再去T_HS_APPPLUGINENTRY表配置好二开插件


成本计算获取等级品自定义权重

【应用场景】 二开插件重写成本计算过程中等级品权重获取,支持版本 PT-151005 [8.2.0.20231109]【实现步骤】1.继承AbstractCostCalPlugIn...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息