动态表单自助修改Python表单插件原创
金蝶云社区-htv
htv
124人赞赏了该文章 536次浏览 未经作者许可,禁止转载编辑于2024年07月13日 15:12:24

用来自主修改一些无关紧要的备注类信息,省的走变更单了。

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')
#导入cloud基础库中的常用实体对象(分命名空间导入,不会递归导入)
from Kingdee.BOS import *
from Kingdee.BOS.Util 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 *

def AfterBindData(e):
    this.Model.SetValue('F_xgxm','66912de32826b3');
    this.View.GetControl("F_xz").SetFocus();  
    this.View.UpdateView('F_xgxm');
    return;

def ButtonClick(e):
    key=e.Key.ToUpper();
    fid=this.View.OpenParameter.GetCustomParameter("DIC");    
    #this.View.ShowNotificationMessage(str(key)+str(fid));
    if(key=="F_BUTTON_QD".ToUpper()):
        if fid is None:return;
        xgxm=this.View.Model.GetValue("F_xgxm");
        if xgxm is None:return;
        #tt=JsonUtil.Serialize(xgxm);
        #this.View.ShowNotificationMessage(tt);
        colName=xgxm['FNumber'];
        newValue=this.View.Model.GetValue("F_xz");
        if colName=='F_zkl' and newValue is None:
            newValue='0';
        else:
            newValue="'"+newValue+"'";
        sql="update t_PUR_POOrder set "+colName+"="+newValue+" where fid="+str(fid);
        #this.View.ShowNotificationMessage(fid+newValue+colName+";"+sql);
        DBUtils.ExecuteScalar(this.Context,sql,None)
        #this.View.ReturnToParentWindow(fid);#将构建的列表数据返回父页面
        this.View.Close();


赞 124