python 表单插件 仅下推选中的单据体数据行 ,留记备查原创
金蝶云社区-静听一语
静听一语
110人赞赏了该文章 493次浏览 未经作者许可,禁止转载编辑于2024年08月29日 11:13:13

效果、C#参考:https://vip.kingdee.com/article/158708?productLineId=1&lang=zh-CN


#引入clr运行库
import clr
#添加对cloud插件开发的常用组件的引用
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.DataEntity')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.App.Core')
clr.AddReference('Kingdee.BOS.ServiceHelper')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Core.DependencyRules import *
from Kingdee.BOS.Core.Bill import *
from Kingdee.BOS.Core.DynamicForm.PlugIn import *
from Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel import *
from System import *
from System.Data import *
from Kingdee.BOS.App.Data import *
from System.Collections.Generic import List
from Kingdee.BOS.ServiceHelper import *
from Kingdee.BOS.Core.DynamicForm import *
from Kingdee.BOS.Core.Metadata.EntityElement import *
from Kingdee.BOS.Core.Metadata.FieldElement import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.BOS.Core.List import *


def OnGetConvertRule(e):
    if e.ConvertOperation == FormOperationEnum.Push:
        primary_key_value = str(this.View.Model.GetPKValue())
        entity = this.View.BillBusinessInfo.GetEntity("FSaleOrderEntry")#单据体标识
        entry_grid = this.View.GetControl("FSaleOrderEntry")
        selected_row_indices = entry_grid.GetSelectedRows()
        selected_rows = List[ListSelectedRow]()
        rows = this.Model.GetEntityDataObject(entity)
        for row_index in selected_row_indices:
            active_row = rows[row_index]
            entity_id = str(active_row["id"])
            if entity_id == "0":
                 continue
            new_selected_row = ListSelectedRow(primary_key_value, entity_id, 0this.View.BusinessInfo.GetForm().Id)
            new_selected_row.EntryEntityKey = "FSaleOrderEntry"
            selected_rows.Add(new_selected_row)
        e.SelectedRows = selected_rows.ToArray()

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