二开-清除对应基础资料缓存/通过插件触发对应实体服务规则
一,清除对应基础资料镜像模型缓存-结合视图使用
public override void EndOperationTransaction(EndOperationTransactionArgs e) { if (this.FormOperation.Operation != "Save" || !this.OperationResult.IsSuccess) return; // 加载镜像模型的元数据 IMetaDataService metaService = ServiceHelper.GetService<IMetaDataService>(); //清除镜像模型的缓存 FormMetadata meta = metaService.Load(this.Context, formId) as FormMetadata; using (DataEntityCacheManager cacheManager = new DataEntityCacheManager(this.Context, meta.BusinessInfo.GetDynamicObjectType())) { //对应内码 var RouterOperSeq = e.DataEntitys.Select(o => o["RouteOperSeq"] as DynamicObjectCollection).FirstOrDefault().ToList(); var ids = RouterOperSeq.Select(p => p["id"].ToString()).ToList(); if (ids.Count > 0) { cacheManager.RemoveCacheByPrimaryKeys(ids); } } }
二,操作服务插件创建视图,调用实体服务规则计算工时
var billView = this.CreateView("QPUB_BL_Parameter") as DynamicWebFormView; billView.RuleContainer.RaiseDataChanged("F_BL_ENGPROCESS", billView.Model.DataObject, new BOSActionExecuteContext(billView)); /// <summary> /// 创建单据视图 /// </summary> /// <param name="ctx"></param> /// <param name="metaData"></param> /// <returns></returns> private IDynamicFormView CreateView(string formId) { FormMetadata metadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, formId); var OpenParameter = CreateOpenParameter(this.Context, metadata); var Provider = metadata.BusinessInfo.GetForm().GetFormServiceProvider(true); string importViewClass = "Kingdee.BOS.Web.Import.ImportBillView,Kingdee.BOS.Web"; Type type = Type.GetType(importViewClass); IDynamicFormView view = (IDynamicFormView)Activator.CreateInstance(type); ((IDynamicFormViewService)view).Initialize(OpenParameter, Provider); return view; } /// <summary> /// 创建输入参数 /// </summary> /// <param name="ctx"></param> /// <param name="metaData"></param> /// <returns></returns> private BillOpenParameter CreateOpenParameter(Context ctx, FormMetadata metaData) { Form form = metaData.BusinessInfo.GetForm(); BillOpenParameter openPara = new BillOpenParameter(form.Id, metaData.GetLayoutInfo().Id); openPara = new BillOpenParameter(form.Id, string.Empty); openPara.Context = ctx; openPara.ServiceName = form.FormServiceName; openPara.PageId = Guid.NewGuid().ToString(); // 单据 openPara.FormMetaData = metaData; openPara.LayoutId = metaData.GetLayoutInfo().Id; // 操作相关参数 openPara.Status = OperationStatus.ADDNEW; openPara.PkValue = null; openPara.CreateFrom = CreateFrom.Default; openPara.ParentId = 0; openPara.GroupId = ""; openPara.DefaultBillTypeId = null; openPara.DefaultBusinessFlowId = null; // 修改主业务组织无须用户确认 openPara.SetCustomParameter("ShowConfirmDialogWhenChangeOrg", false); // 插件 List<AbstractDynamicFormPlugIn> plugins = form.CreateFormPlugIns(); openPara.SetCustomParameter(FormConst.PlugIns, plugins); return openPara; }
二开-清除对应基础资料缓存/通过插件触发对应实体服务规则
一,清除对应基础资料镜像模型缓存-结合视图使用 public override void EndOperationTransaction(EndOperationTransactionArgs e) { if ...
点击下载文档
本文2024-09-16 18:26:20发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-22143.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章