插件中记录上机操作日志原创
10人赞赏了该文章
1,350次浏览
编辑于2022年05月07日 16:37:18
一、Web层表单插件,列表插件的写法
下面代码以表单插件为例:
using System; using System.Collections.Generic; using System.Linq; using System.ComponentModel; using Kingdee.BOS.Util; using Kingdee.BOS.ServiceHelper; using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.Log; namespace Kingdee.BOS.TestPlugIn22.FormPlugin { [HotUpdate] [Description("表单测试插件")] public class TestFormPlugIn : AbstractDynamicFormPlugIn { public override void BarItemClick(BarItemClickEventArgs e) { base.BarItemClick(e); List<LogObject> logObjs = new List<LogObject>(); var log = new LogObject() //创建日志对象 { Description = "具体描述", OperateName = "操作名称", ObjectTypeId = this.View.BillBusinessInfo.GetForm().Id, //业务对象formId SubSystemId = this.View.BillBusinessInfo.GetForm().SubsysId, //表单所在的子系统 Environment = OperatingEnvironment.BizOperate //操作场景 }; logObjs.Add(log); //批量写日志 LogServiceHelper.BatchWriteLog(this.Context, logObjs); //单个写日志 LogServiceHelper.WriteLog(this.Context, log); } } }
二、APP层的操作插件,反写插件,转换插件和账表取数插件的写法
下面代码以操作插件为例
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel; using Kingdee.BOS.Util; using Kingdee.BOS.Core.DynamicForm; using Kingdee.BOS.Core.DynamicForm.PlugIn; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.Log; using Kingdee.BOS.Contracts; namespace Kingdee.BOS.TestPlugIn.FormOperationPlugIn { [HotUpdate] [Description("操作插件测试插件")] public class OperationTestPlugIn : AbstractOperationServicePlugIn { public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e) { base.AfterExecuteOperationTransaction(e); var logService = Kingdee.BOS.App.ServiceHelper.GetService<ILogService>(); List<LogObject> logObjs = new List<LogObject>(); var log = new LogObject() //创建日志对象 { Description = "具体描述", OperateName = "操作名称", ObjectTypeId = this.BusinessInfo.GetForm().Id, //业务对象formId SubSystemId = this.BusinessInfo.GetForm().SubsysId, //表单所在的子系统 Environment = OperatingEnvironment.BizOperate //操作场景 }; logObjs.Add(log); //批量写日志 logService.BatchWriteLog(this.Context, logObjs); //单个写日志 logService.WriteLog(this.Context, log); } } }
赞 10
10人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!
推荐阅读