金蝶云星空——插件按钮点击打开各种表单方式

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.CommonFilter;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Core.WNReport;


namespace JDSample.FormPlugIn.DynamicForm
{
    [Description("打开各种界面")]
    public class S160405ShowFormEdit : AbstractDynamicFormPlugIn
    {
        public override void AfterBarItemClick(AfterBarItemClickEventArgs e)
        {
            if (e.BarItemKey.EqualsIgnoreCase("tbShowDynamicForm"))
            {
                // 打开动态表单界面
                // using Kingdee.BOS.Core.DynamicForm;
                string pageId = Guid.NewGuid().ToString();
                DynamicFormShowParameter showParameter = new DynamicFormShowParameter();
                showParameter.FormId = "a6fe71c4beda4f7baf60411c4b5f3b3e";
                showParameter.PageId = pageId;
                //showParameter.OpenStyle.ShowType = ShowType.InContainer;
                //showParameter.OpenStyle.TagetKey = "FTab_P2";
                this.View.ShowForm(showParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowInventoryQuery"))
            {
                // 打开即时库存查询界面,传入过滤条件
                DynamicFormShowParameter inventoryQueryShowParameter = new DynamicFormShowParameter();
                inventoryQueryShowParameter.FormId = "STK_InventoryQuery";
                inventoryQueryShowParameter.PageId = Guid.NewGuid().ToString();
                inventoryQueryShowParameter.CustomParams.Add("QueryMode", "1");
                inventoryQueryShowParameter.CustomParams.Add("NeedReturnData", "0");
                inventoryQueryShowParameter.CustomParams.Add("QueryOrgId", "100003");
                inventoryQueryShowParameter.CustomParams.Add("StockOrgIds", "100003");
                inventoryQueryShowParameter.CustomParams.Add("QueryFilter", " FMaterialId.FNumber = '1.01.001' and FStockId.FNumber = 'CK001' ");
                this.View.ShowForm(inventoryQueryShowParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowBill"))
            {
                // 打开单据维护界面:以打开销售订单100001为例
                // using Kingdee.BOS.Core.Bill;
                string pageId = Guid.NewGuid().ToString();
                BillShowParameter showParameter = new BillShowParameter();
                showParameter.FormId = "SAL_SaleOrder";
                showParameter.OpenStyle.ShowType = ShowType.MainNewTabPage;
                showParameter.PageId = pageId;
                showParameter.Status = OperationStatus.EDIT;
                // 传入需要修改的销售订单内码,演示代码直接固定写死为100001
                showParameter.PKey = "100001";


                this.View.ShowForm(showParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowList"))
            {
                // 打开单据列表界面:以打开物料F8查询列表为例
                // using Kingdee.BOS.Core.List;
                string pageId = Guid.NewGuid().ToString();
                ListShowParameter showParameter = new ListShowParameter();
                showParameter.FormId = "BD_Material";
                showParameter.PageId = pageId;
                showParameter.UseOrgId = this.Context.CurrentOrganizationInfo.ID;
                showParameter.IsLookUp = true;
                showParameter.ListFilterParameter.Filter = "";
                this.View.ShowForm(showParameter);


                // 打开单据联查列表:以联查销售订单为例
                string billNo = Convert.ToString(this.Model.GetValue("FBillNo"));
                string fldName = "销售合同号字段标识";
                
                IRegularFilterParameter filterParameter = new ListRegularFilterParameter();
                filterParameter.Filter = string.Format(" {0} = '{1}' ", fldName, billNo); ;
                filterParameter.SelectEntitys = new List<string>() { "FSaleOrderEntry" };


                var listTrackParameter = new ListTrackBillShowParameter();
                listTrackParameter.FormId = "SAL_SaleOrder";
                listTrackParameter.PageId = Guid.NewGuid().ToString();
                listTrackParameter.IsShowFilter = false;
                listTrackParameter.ListFilterParameter = filterParameter;


                this.View.ShowForm(listTrackParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowSQLReport"))
            {
                // 打开直接SQL报表
                // using Kingdee.BOS.Core.Report;
                string pageId = Guid.NewGuid().ToString();
                SQLReportShowParameter showParameter = new SQLReportShowParameter();
                showParameter.FormId = "a9e51595c6c1433ebb623c8e340f7b5b";
                showParameter.PageId = pageId;
                this.View.ShowForm(showParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowSysReport"))
            {
                // 打开简单系统账表
                // using Kingdee.BOS.Core.Report;
                string pageId = Guid.NewGuid().ToString();
                SysReportShowParameter showParameter = new SysReportShowParameter();
                showParameter.FormId = "c3329ed2a55c4c31b9420d104f29af9b";
                showParameter.PageId = pageId;
                showParameter.IsShowFilter = true;
                this.View.ShowForm(showParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowMoveReport"))
            {
                // 打开分页账表
                // using Kingdee.BOS.Core.Report;
                string pageId = Guid.NewGuid().ToString();
                MoveReportShowParameter showParameter = new MoveReportShowParameter();
                showParameter.FormId = "c3329ed2a55c4c31b9420d104f29af8b";
                showParameter.PageId = pageId;
                this.View.ShowForm(showParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowTreeReport"))
            {
                // 打开树形账表
                // using Kingdee.BOS.Core.Report;
                string pageId = Guid.NewGuid().ToString();
                TreeReportShowParameter showParameter = new TreeReportShowParameter();
                showParameter.FormId = "c3329ed2a55c4c31b9420d104f29af7b";
                showParameter.PageId = pageId;
                this.View.ShowForm(showParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowPivotGridReport"))
            {
                // 打开透视表
                // using Kingdee.BOS.Core.Report;
                string pageId = Guid.NewGuid().ToString();
                CrossReportShowParameter showParameter = new CrossReportShowParameter();
                showParameter.FormId = "c3329ed2a55c4c31b9420d104f29ae59";
                showParameter.PageId = pageId;
                this.View.ShowForm(showParameter);
            }
            else if (e.BarItemKey.EqualsIgnoreCase("tbShowWNSQLReport"))
            {
                // 打开万能报表(SQL增强报表是一种万能报表)
                // using Kingdee.BOS.Core.WNReport;
                string pageId = Guid.NewGuid().ToString();
                WNReportShowParameter showParameter = new WNReportShowParameter();
                showParameter.FormId = "c3329ed2a55c4c31b9420d104f29ae69";
                showParameter.PageId = pageId;
                showParameter.ReporType = Kingdee.BOS.Core.Enums.BOSEnums.Enu_DevReportType.SqlOver;// SQL增强报表
                this.View.ShowForm(showParameter);
            }
        }
    }
}

原文链接:https://vip.kingdee.com/article/76601446266810624?productLineId=1&lang=zh-CN

posted @ 2024-10-18 14:27  shanzm  阅读(21)  评论(0编辑  收藏  举报
TOP