python 列表操作插件 sql语句批改
不触发实体规则和值更新事件,直接操作sql操作数据库
#引入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.ServiceHelper')
#clr.AddReference('Kingdee.BOS.KDSReportEntity')
#clr.AddReference('Kingdee.BOS.App.KDSService')
clr.AddReference('Newtonsoft.Json')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Core 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.JSON import *
from Newtonsoft.Json.Linq import *
#子页面关闭回调处理方法
def ChildFromClosed(obj):
if (obj.ReturnData == None):
return;
dictionary=obj.ReturnData;#读取子页面返回的数据,这里返回的也是字典形式
#this.View.ShowMessage(str(dictionary))
updateSql=("/*dialect*/update t_AR_receivableEntry set SFKP={0} where FENTRYID in ({1})").format(dictionary,rowIndexs); #sql语句
x=DBServiceHelper.Execute(this.Context,updateSql);
this.View.Refresh() #刷新列表
this.View.ShowMessage("批改成功!更改行数:"+str(x))
#弹出动态表单子页面的方法
def ShowFilterForm(rowIndexs):
dynamicFormShowParameter = DynamicFormShowParameter();
dynamicFormShowParameter.FormId="————";#动态表单子页面FormID
this.View.ShowForm(dynamicFormShowParameter,Action[FormResult](ChildFromClosed));#弹出动态表单
def BarItemClick(e):
global rowIndexs;
key=e.BarItemKey;
if(str(key)=="————"):#操作按钮标识
selectRowsinfo=this.ListView.SelectedRowsInfo
if(selectRowsinfo.Count<=0):
return
listEntryId=List[str]();
for row in selectRowsinfo:
objs=row.DataRow
if(objs["FDocumentStatus"]=="C"):
this.View.ShowWarnningMessage("单据已审核不允许批改!")
return
selectEntryid=str(row.EntryPrimaryKeyValue)
entitykey=str(row.EntryEntityKey)
if(selectEntryid==" " or selectEntryid==None or entitykey<>"FEntityDetail"):#批改应收单据体
this.View.ShowWarnningMessage("请在过滤里面显示单据体!")
return
listEntryId.Add(selectEntryid)
rowIndexs = str.Join(",", listEntryId.ToArray());
ShowFilterForm(rowIndexs);#弹出子页面
参考链接:https://wenku.my7c.com/article/291524092769768448?fromAction=POST_ARTICLE&lang=zh-CN&productLineId=1
动态表单(子页面)返回数据
def ButtonClick(e):
selectedDate = this.Model.GetValue("——")#子页面控件字段
this.View.ReturnToParentWindow(selectedDate)
python 列表操作插件 sql语句批改
本文2024-09-16 17:43:02发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-17500.html