QQ:929412592 

[Epicor原创] 如何在Epicor二次开发中 多途径使用 SSRS 报表

本文为原创,转载请注明:[Epicor原创] - 博客园 - 辉创1989 - 如何在Epicor二次开发中 多途径使用 SSRS 报表

一、在客户化界面中调用Epicor自带的SSRS报表窗口:

  下面是我在销售订单追踪界面做的一个案列,首先要想在其他功能界面用代码调用Epicor的SSRS窗口,要对比下图添加Dll引用

  

  之后就是我的案例代码:  

// **************************************************
// Custom code for SalesOrderTrackerForm
// Created: 2017-09-27 09:38:35 By 张昭辉 QQ : 929412592
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
//---------------------------------------------------------------//
using System.IO;
using Epicor.ServiceModel.Channels;
using Erp.Adapters;
using Ice.Adapters;
using Ice.BO;
using Ice.UI;
using Ice.Core;
using Ice.Contracts;
using Ice.Proxy.Lib;
using Ice.Lib.BOReader;
using Ice.Lib.Report;

public class Script
{
    // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
    // Begin Wizard Added Module Level Variables **
    private Ice.Core.Session Session;

    // End Wizard Added Module Level Variables **

    // Add Custom Module Level Variables Here **

    public void InitializeCustomCode()
    {
        // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
        // Begin Wizard Added Variable Initialization
        this.Session = (Ice.Core.Session)this.oTrans.Session;

        // End Wizard Added Variable Initialization

        // Begin Wizard Added Custom Method Calls

        // End Wizard Added Custom Method Calls
    }

    public void DestroyCustomCode()
    {
        // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
        // Begin Wizard Added Object Disposal

        // End Wizard Added Object Disposal

        // Begin Custom Code Disposal

        // End Custom Code Disposal
    }

    public string GetSSRSURL()
    {
        DataSet set = WCFServiceSupport.CreateImpl<BOReaderImpl>(this.Session, ImplBase<BOReaderSvcContract>.UriPath).GetRows("Ice:BO:Company", "Company = '" + this.Session.CompanyID + "'", "SSRSURL");
        if (set.Tables.Contains("Company") && !string.IsNullOrEmpty((string) set.Tables["Company"].Rows[0][0]))
        {
            return (string) set.Tables["Company"].Rows[0][0];
        }
        return "";
    }

    private void SalesOrderTrackerForm_Load(object sender, EventArgs args)
    {
        // Add Event Handler Code
        string rptPath = "/EPICOR10/reports/CustomReports/PackJobPic/PackJobPic_Base";
        string url = GetSSRSURL() + "?Report=" + rptPath;
        new EpiSSRSBrowser(rptPath, url).Show();
    }
}
查看代码

 

posted @ 2017-10-20 15:07  辉创1989  阅读(1600)  评论(0编辑  收藏  举报