员工任岗二开字段审核后同步到员工-分录员工任岗信息,用python脚本实现
【应用场景】
员工任岗二开字段审核后同步到员工-分录员工任岗信息,用python脚本实现。
【实现步骤】
<1>扩展员工,在分录员工任刚信息里新增二开字段:测试文本
<2>扩展员工任刚单据,在单据头新增测试文本字段。
<3>员工任岗,打开操作列表,搜索审核,注册python脚本。脚本见附件
:脚本仅需需改截图处
【功能验证】
<1>员工任岗审核后,数据同步到员工上。
ptython脚本
import clr clr.AddReference("mscorlib") clr.AddReference('System') clr.AddReference('System.Data') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') clr.AddReference('Kingdee.BOS.App.Core') clr.AddReference('Kingdee.BOS.App') clr.AddReference('Kingdee.BOS.DataEntity') clr.AddReference('Kingdee.BOS.ServiceHelper') clr.AddReference('Kingdee.BOS.Contracts') clr.AddReference('Kingdee.K3.Core') from System import * from System.Data import * from System.Collections import * from System.Collections.Generic import * from System import StringComparison from Kingdee.BOS.Log import Logger from Kingdee.BOS import * from Kingdee.BOS.Util import * from Kingdee.BOS.App.Core import * from Kingdee.BOS.App.Data import * from Kingdee.BOS.Core.Bill.PlugIn import * from Kingdee.BOS.Core.Const import * from Kingdee.BOS.ServiceHelper import * from Kingdee.BOS.Core.DynamicForm.PlugIn.Args import * def OnPreparePropertys(e): e.FieldKeys.Add("FTempStaffId"); e.FieldKeys.Add("FEmpInfoId"); e.FieldKeys.Add("FText");#测试文本标识,如有其他字段,也需要在这里添加 def EndOperationTransaction(e): ids = List[str](); for billObj in e.DataEntitys: empinfoId=billObj["TempStaffId"];#员工-分录任岗信息ID txtValue = billObj["FText"];#测试文本的绑定实体属性 Logger.Info("日志cs1",str(empinfoId)) Logger.Info("日志cs2",txtValue) sql = "update T_BD_STAFFTEMP set FTEXT1 = '{0}' where FENTRYID = {1} ".format(txtValue , str(empinfoId)); Logger.Info("日志",sql) DBUtils.Execute(this.Context,sql); ids.Add(str(billObj["EmpInfoId_Id"]));#员工ID if len(ids) > 0 : Logger.Info("日志aa", str(len(ids)) + JsonUtil.Serialize(e.DataEntitys)) ClearCacheByPrimaryKeys(this.Context, "BD_Empinfo", ids); #清除员工单据的缓存 def ClearCacheByPrimaryKeys(ctx, formId, keys): if keys == None or len(keys) == 0: return False metadata = FormMetaDataCache.GetCachedFormMetaData(ctx, formId) if metadata == None: return False cacheManager = DataEntityCacheManager(ctx, metadata.BusinessInfo.GetDynamicObjectType()) cacheManager.RemoveCacheByPrimaryKeys(keys) CacheUtil.ClearCache(ctx.DBId + formId, CacheRegionConst.BOS_QuickBaseDataCache) return True
员工任岗二开字段审核后同步到员工-分录员工任岗信息,用python脚本实现
本文2024-09-23 03:42:20发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-160564.html