Python 列表操作--修改单据内容
### 列表插件python用法,转载参考
```python
#参考代码:
##****************************保存服务插件*******************
#引入clr运行库
import clr
#添加对cloud插件开发的常用组件的引用
clr.AddReference('System')
clr.AddReference('System.Data')
clr.AddReference('Kingdee.BOS')
clr.AddReference('Kingdee.BOS.Core')
clr.AddReference('Kingdee.BOS.App')
clr.AddReference('Kingdee.BOS.DataEntity')
clr.AddReference('Kingdee.BOS.Contracts')
clr.AddReference('Kingdee.BOS.ServiceHelper')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core import *
from Kingdee.BOS.Contracts import *
from Kingdee.BOS.Orm.DataEntity import *
from Kingdee.BOS.DataEntity 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 *
#作者:Jack
#来源:金蝶云社区
#原文链接:https://wenku.my7c.com/article/139314926954577664
#著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
def BarItemClick(e):
if e.BarItemKey == 'tb_list':
pkIds = List[object]()
#fentryid = ''
fids=''
if (this.ListView.SelectedRowsInfo == null or this.ListView.SelectedRowsInfo.Count == 0):
this.View.ShowMessage("没有选择任何数据,请先选择!")
return
a = this.ListView.SelectedRowsInfo #获取选中行
for i in range(len(a)):
# 单据体内码
#fentryid = fentryid + ',' + str(a[i].EntryPrimaryKeyValue)
#单据头内码
#fid = fentryid + ',' + str(a[i].PrimaryKeyValue)
#fid = str(a[i].PrimaryKeyValue)
#formMetadata = MetaDataServiceHelper.Load(this.Context,
#BusinessDataServiceHelper.loadSingle(fentryid)
fid = a[i].PrimaryKeyValue
fids = fids + '/' + str(fid)
pkIds.Add(fid)
#this.View.ShowMessage(fids) # 调试
# 二开案例.列表插件.列表调用保存操作
# https://wenku.my7c.com/article/139314926954577664 1/1
# foreach (var dataObject in dataObjects)
#{
#// 修改采购订单的变更原因
#dataObject["ChangeReason"] = "666";
# }
#formId = this.BusinessInfo.GetForm().Id
#meta = MetaDataServiceHelper.Load(this.Context, formId);
billObjects = BusinessDataServiceHelper.Load(this.Context, pkIds.ToArray(),this.View.BillBusinessInfo.GetDynamicObjectType())
#saveRslt = BusinessDataServiceHelper.Save(this.Context, this.View.BillBusinessInfo, billObjects, None, "Save")
saveRslt = BusinessDataServiceHelper.Save(this.Context, this.View.BillBusinessInfo, billObjects)
#raise Exception("问题出问题了,请打开单据检查单据字段")
if (saveRslt == True):
this.View.ShowMessage("保存成功!")
else:
this.View.ShowMessage("出错,保存不成功!")
```
老是,这个如何在表单插件实现呢,比如添加一个复选框,
Python 列表操作--修改单据内容
### 列表插件python用法,转载参考```python#参考代码:##****************************保存服务插件*******************#引入clr运行库imp...
点击下载文档
本文2024-09-16 17:19:10发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-14933.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章