默认当前用户原创
32人赞赏了该文章
426次浏览
未经作者许可,禁止转载编辑于2023年12月07日 09:23:27
单据上添加一个基础资料字段,绑定基础资料员工,设置默认当前用户的表单插件
#引入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') #导入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 * #重载cloud插件模型的主菜单按钮点击事件 empId = 0; def OnInitialize(e): userID=str(this.Context.UserId); sqlGetEmpId = (""" select E.FID, E_L.FNAME, P.FPERSONID, U.FUSERID, U.FNAME from T_SEC_USER U inner join t_BD_Person P ON (u.FLINKOBJECT = P.FPERSONID) inner join T_HR_EmpInfo E ON (P.FPERSONID = E.FPERSONID) left join T_HR_EmpInfo_L E_L ON (E.FID = E_L.FID AND E_L.FLOCALEID = 2052) where U.FUserId ={0} """).format(userID); global empId; ds = DBServiceHelper.ExecuteDataSet(this.Context,sqlGetEmpId); tab = ds.Tables[0]; empId=tab.Rows[0]["FID"] if tab.Rows.Count>0 else 0; def AfterCreateNewData(e): global empId,deptId,stuffID; this.Model.SetItemValueByID("F_VBGU_Constructor", empId, 0);#根据实际情况在此修改员工字段标识
推荐阅读