反写插件--反写前事件(BeforeTrackBusinessFlow)原创
金蝶云社区-eris
eris
19人赞赏了该文章 278次浏览 未经作者许可,禁止转载编辑于2024年04月08日 09:25:01

一、说明

1、触发时机

1)反写引擎运行前触发,反写插件的第一个事件。

2、主要作用

取消反写运行,特别注意如果第一次取消反写,会导致没有关联和反写值。

一般用在已审核的单据再次保存或暂存运行反写的情况。

3、参数说明

BeforeTrackBusinessFlowEventArgs,属性包括

1)Cancel 默认false; 设置true,取消反写运行

二、示例

1、说明

在审核中,已审核,重新审核则取消保存操作运行反写

2、C#插件代码

using System;
using System.ComponentModel;
using Kingdee.BOS.Core.BusinessFlow.PlugIn;
using Kingdee.BOS.Core.BusinessFlow.PlugIn.Args;
namespace Kingdee.BOS.TestPlugIn.BillABillB
{
    [Description("反写插件")]
    [Kingdee.BOS.Util.HotUpdate]
    public class BillBWriteBackPlugIn2 : AbstractBusinessFlowServicePlugIn
    {
        public override void BeforeTrackBusinessFlow(BeforeTrackBusinessFlowEventArgs e)
        {
            //假如:审核中,已审核,重新审核则取消保存操作运行反写
            base.BeforeTrackBusinessFlow(e);
            if (this.OperationNumber == "Save")
            {
                var status = this.DynamicObjects[0]["DocumentStatus"];
                if (status == "B" || status == "C" || status == "D")
                {
                    e.Cancel = true;
                }
            }
        }
    }
}

3、python插件代码

def BeforeTrackBusinessFlow(e):
    if(this.OperationNumber=="Save" and this.DynamicObjects[0]["DocumentStatus"] in ['B','C','D']):
        e.Cancel = True


图标赞 19
19人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!

您的鼓励与嘉奖将成为创作者们前进的动力,如果觉得本文还不错,可以给予作者创作打赏哦!

请选择打赏金币数 *

10金币20金币30金币40金币50金币60金币
可用金币: 0