一登陆系统自动打开某个单据或者某个列表(主控台小部件开发)
一登陆系统自动打开某个单据或者某个列表
场景描述:用户一登陆系统自动打开某个单据或者某个列表,一工序计划为例。
第一步:用管理员登录定制主页
第二步:为该主页绑定用户
第三步:用户登录后选择对应的主页,下次登录就不必设置
第四步:插件编写
新建动态表单
编写代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Kingdee.BOS;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Bill;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Core.SqlBuilder;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
namespace HL.K3.TwoPhase.Business.Plugin
{
[Description("工序汇报布局小插件")]
[Kingdee.BOS.Util.HotUpdate]
public class ShowBillList : AbstractDynamicFormPlugIn
{
public override void OnInitialize(InitializeEventArgs e)
{
string pageId = Guid.NewGuid().ToString();
ListSelBillShowParameter showParam = new ListSelBillShowParameter();
showParam.FormId = "SFC_OperationPlanning";
//para.ParentPageId = this.View.PageId;
//按照当前用户对应的生产组织,生产部门进行过滤
string userName=Convert.ToString(this.Context.UserName);
string FNAME = string.Format("FNAME='{0}'", userName);//用户名称
DynamicObjectCollection objs = this.GetQueryDatas("BD_Empinfo", FNAME, new string[] { "FWORKORGID", "FPostDept" });
Int64 FWORKORGID = Convert.ToInt64(objs[0][0]);
Int64 FPostDept = Convert.ToInt64(objs[0][1]);
showParam.ListFilterParameter.Filter =string.Format("FDOCUMENTSTATUS='{0}' and FPROORGID='{1}' and FPRODEPARTMENTID = '{2}' ", "C", FWORKORGID ,FPostDept);//过滤条件
showParam.OpenStyle.ShowType = ShowType.MainNewTabPage;
showParam.PageId = pageId;
// showParam.IsShowQuickFilter = true;
showParam.CustomParams.Add("ShowFilterRow","true");//添加首行过滤
this.View.ShowForm(showParam);
}
/// <summary>
/// 根据条件及业务对象来获取数据,推荐使用
/// </summary>
/// <param name="FormId">业务对象ID</param>
/// <param name="Value">过滤条件拼接</param>
/// <param name="GetDate">需要获取的值(BOS里面字段标识)</param>
/// <returns></returns>
public DynamicObjectCollection GetQueryDatas(String FormId, String Value, String[] GetDate)
{
QueryBuilderParemeter paramCatalog = new QueryBuilderParemeter()
{
FormId = FormId,
FilterClauseWihtKey = String.Format(" {0} ", Value),
SelectItems = SelectorItemInfo.CreateItems(GetDate),
};
DynamicObjectCollection dyDatas = QueryServiceHelper.GetDynamicObjectCollection(this.Context, paramCatalog);
return dyDatas;
}
}
}
3.动态表单挂载插件(挂表单插件即可)
一登陆系统自动打开某个单据或者某个列表(主控台小部件开发)
本文2024-09-16 18:42:44发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-23912.html