K3BOS单据插件触发字段值更新事件

新单的字段在插件里可以在任何时机手工在代码里触发Action,具体可调用BillCtl对象的DoAction方法,DoAction参数定义如下:

@dct 字段模板

@dctFld 字段值对象

@lRow 若为单据头字段,则传入-1;若为单据体字段,则传入对应行

@sActionName action类型 字段类Action为“FAction”,保存规则为“FSaveRule”等等

@dctSkipFields 值更新事件中避免被更新的字段

@sAppointedAction 指定执行的Action,例如只执行携带基础资料属性的action,那就传入"TakeBaseData"

Public Function DoAction(ByVal dct As KFO.Dictionary, _

ByVal dctFld As KFO.Dictionary, _

ByVal lRow As Long, _

Optional ByVal ItemObj As Object, _

Optional ByVal sActionName As String = "FAction", _

Optional ByVal dctSkipFields As KFO.Dictionary, _

Optional ByVal sAppointedAction As String)

 

插件中代码示例:

    Dim sPKey As String

    Dim lIndex As Long

    Dim dct As KFO.Dictionary

    Dim dctFld As KFO.Dictionary

    '根据字段关键字FKey,获取字段模板对象dct

    Set dct = m_BillInterface.GetFieldInfoByKey("FSumAmount", sPKey, lIndex)

    '根据字段模板获取字段值对象dctFld

    Set dctFld = m_BillInterface.GetDataFld(dct) '如FSumAmount为单据体字段则需要传入获取那一行的数据对象GetDataFld(dct,1)

    '指定执行字段FSumAmount的公式计算ACTION("Calculate")

    Call m_BillInterface.BillCtl.DoAction(dct, dctFld, -1, , "FAction", , "Calculate")

posted @ 2021-09-23 15:13  放放的Blog  阅读(668)  评论(0编辑  收藏  举报