在一个数据中心的某单据点击任何菜单操作,访问另外一个数据中心中的单据A,并且能够引入引出。
插件代码:
2. 在L采购订单的表单插件中注册插件
3. 点击L采购订单任何按钮,显示单据A列表,如下图:
4. 具体代码:
using System;
using System.Data;
using System.ComponentModel;
using System.Collections.Generic;
using Kingdee.BOS.Core;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.ServiceFacade.KDServiceFx;
using Kingdee.BOS.Web.Core;
namespace Kingdee.BOS.TestPlugIn.FormPlugin
{
[HotUpdate]
[Description("显示跨数据中心单据A")]
public class ShowCrossBillAPlugIn : AbstractBillPlugIn
{
public override void BarItemClick(BarItemClickEventArgs e)
{
if (e.BarItemKey == "" || true)
{
var lstParam = new ListShowParameter();
lstParam.FormId = "KKK_BillA"; //另外一个数据中心的表单formId
lstParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
lstParam.Context = DataCenterService.GetDataCenterContextByID("5f191f0ff4b034"); //另外一个数据中心id
lstParam.Context.UserId = 100008; //另外一个数据的用户内码
lstParam.Context.CurrentOrganizationInfo = this.View.Context.CurrentOrganizationInfo;
lstParam.Context.ConsolePageId = this.View.Context.ConsolePageId;
//把会话信息保存在全局缓存和通用会话中
KDServiceSession kdSession = new KDServiceSession(lstParam.Context.SessionId);
kdSession.AppContext = lstParam.Context;
GlobalCacheManager.TryAdd(lstParam.Context.UserToken, kdSession);
CommonSession.AddOrUpdateContext(lstParam.Context.UserToken, lstParam.Context);
this.View.ShowForm(lstParam);
this.View.SendDynamicFormAction(this.View);
}
}
}
}
推荐阅读