From 2dcf714ab4a009b8aafeab73782b89f4b2ed6554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Tue, 6 Jan 2026 16:07:26 +0300 Subject: [PATCH] Devexpress Report Designer --- api/Erp.Platform.DbMigrator.Dockerfile | 4 ++ api/Erp.Platform.HttpApi.Host.Dockerfile | 5 +++ .../Seeds/MenusData.json | 7 +++ .../CustomReportDesignerController.cs | 43 +++++++++++++++++++ .../PlatformHttpApiHostModule.cs | 15 ++++++- .../views/report/DevexpressReportDesigner.tsx | 35 +++++++++++++++ .../views/report/DevexpressReportViewer.tsx | 6 ++- 7 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 api/src/Erp.Platform.HttpApi.Host/Controllers/CustomReportDesignerController.cs create mode 100644 ui/src/views/report/DevexpressReportDesigner.tsx diff --git a/api/Erp.Platform.DbMigrator.Dockerfile b/api/Erp.Platform.DbMigrator.Dockerfile index 6793b2cf..26427d8c 100644 --- a/api/Erp.Platform.DbMigrator.Dockerfile +++ b/api/Erp.Platform.DbMigrator.Dockerfile @@ -20,6 +20,10 @@ COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/Erp. COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/Erp.SqlQueryManager.Domain.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/" COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/Erp.SqlQueryManager.Domain.Shared.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/" COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/Erp.SqlQueryManager.EntityFrameworkCore.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/" +COPY "modules/Erp.Reports/Erp.Reports.Application.Contracts/Erp.Reports.Application.Contracts.csproj" "modules/Erp.Reports/Erp.Reports.Application.Contracts/" +COPY "modules/Erp.Reports/Erp.Reports.Domain/Erp.Reports.Domain.csproj" "modules/Erp.Reports/Erp.Reports.Domain/" +COPY "modules/Erp.Reports/Erp.Reports.Domain.Shared/Erp.Reports.Domain.Shared.csproj" "modules/Erp.Reports/Erp.Reports.Domain.Shared/" +COPY "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/Erp.Reports.EntityFrameworkCore.csproj" "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/" COPY "src/Erp.Platform.Application.Contracts/Erp.Platform.Application.Contracts.csproj" "src/Erp.Platform.Application.Contracts/" COPY "src/Erp.Platform.DbMigrator/Erp.Platform.DbMigrator.csproj" "src/Erp.Platform.DbMigrator/" COPY "src/Erp.Platform.Domain/Erp.Platform.Domain.csproj" "src/Erp.Platform.Domain/" diff --git a/api/Erp.Platform.HttpApi.Host.Dockerfile b/api/Erp.Platform.HttpApi.Host.Dockerfile index 523b2fbb..e48d9d85 100644 --- a/api/Erp.Platform.HttpApi.Host.Dockerfile +++ b/api/Erp.Platform.HttpApi.Host.Dockerfile @@ -36,6 +36,11 @@ COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Application.Contracts/Erp. COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/Erp.SqlQueryManager.Domain.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain/" COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/Erp.SqlQueryManager.Domain.Shared.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.Domain.Shared/" COPY "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/Erp.SqlQueryManager.EntityFrameworkCore.csproj" "modules/Erp.SqlQueryManager/Erp.SqlQueryManager.EntityFrameworkCore/" +COPY "modules/Erp.Reports/Erp.Reports.Application/Erp.Reports.Application.csproj" "modules/Erp.Reports/Erp.Reports.Application/" +COPY "modules/Erp.Reports/Erp.Reports.Application.Contracts/Erp.Reports.Application.Contracts.csproj" "modules/Erp.Reports/Erp.Reports.Application.Contracts/" +COPY "modules/Erp.Reports/Erp.Reports.Domain/Erp.Reports.Domain.csproj" "modules/Erp.Reports/Erp.Reports.Domain/" +COPY "modules/Erp.Reports/Erp.Reports.Domain.Shared/Erp.Reports.Domain.Shared.csproj" "modules/Erp.Reports/Erp.Reports.Domain.Shared/" +COPY "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/Erp.Reports.EntityFrameworkCore.csproj" "modules/Erp.Reports/Erp.Reports.EntityFrameworkCore/" COPY "src/Erp.Platform.Application/Erp.Platform.Application.csproj" "src/Erp.Platform.Application/" COPY "src/Erp.Platform.Application.Contracts/Erp.Platform.Application.Contracts.csproj" "src/Erp.Platform.Application.Contracts/" COPY "src/Erp.Platform.Domain/Erp.Platform.Domain.csproj" "src/Erp.Platform.Domain/" diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json index 75ea0af3..3bbb8f07 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json +++ b/api/src/Erp.Platform.DbMigrator/Seeds/MenusData.json @@ -461,6 +461,13 @@ "componentPath": "@/views/report/DevexpressReportViewer", "routeType": "protected", "authority": [] + }, + { + "key": "admin.devexpressReportDesigner", + "path": "/admin/reports/reportdesigner", + "componentPath": "@/views/report/DevexpressReportDesigner", + "routeType": "protected", + "authority": [] } ], "Menus": [ diff --git a/api/src/Erp.Platform.HttpApi.Host/Controllers/CustomReportDesignerController.cs b/api/src/Erp.Platform.HttpApi.Host/Controllers/CustomReportDesignerController.cs new file mode 100644 index 00000000..443d7477 --- /dev/null +++ b/api/src/Erp.Platform.HttpApi.Host/Controllers/CustomReportDesignerController.cs @@ -0,0 +1,43 @@ +using DevExpress.AspNetCore.Reporting.ReportDesigner; +using DevExpress.AspNetCore.Reporting.ReportDesigner.Native.Services; +using DevExpress.DataAccess.Sql; +using DevExpress.XtraReports.Web.ReportDesigner; +using DevExpress.XtraReports.Web.ReportDesigner.Services; +using Microsoft.AspNetCore.Mvc; + +namespace Erp.Platform.Controllers; + +public class CustomReportDesignerController : ReportDesignerController +{ + public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService) + : base(controllerService) + { + } + + [HttpPost("[action]")] + public IActionResult GetDesignerModel( + [FromForm] string reportUrl, + [FromServices] IReportDesignerModelBuilder designerModelBuilder, + [FromForm] ReportDesignerSettingsBase designerModelSettings) + { + var ds = new SqlDataSource("SqlServer"); + + SelectQuery query = SelectQueryFluentBuilder + .AddTable("Sas_T_Sector") + .SelectAllColumnsFromTable() + .Build("Sas_T_Sector"); + ds.Queries.Add(query); + ds.RebuildResultSchema(); + + var designerModel = designerModelBuilder.Report(reportUrl) + .DataSources(dataSources => + { + dataSources.Add("SqlServer", ds); + }) + .BuildModel(); + + designerModel.Assign(designerModelSettings); + + return DesignerModel(designerModel); + } +} diff --git a/api/src/Erp.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs b/api/src/Erp.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs index 6543b28b..da46ee2e 100644 --- a/api/src/Erp.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs +++ b/api/src/Erp.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs @@ -280,7 +280,20 @@ public class PlatformHttpApiHostModule : AbpModule options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = "Erp Platform Api", Version = "v1" }); - options.DocInclusionPredicate((docName, description) => true); + options.DocInclusionPredicate((docName, description) => + { + // DevExpress reporting controller'larını Swagger'dan hariç tut + if (description.ActionDescriptor.RouteValues.TryGetValue("controller", out var controllerName)) + { + if (controllerName == "CustomReportDesigner" || + controllerName == "CustomWebDocumentViewer" || + controllerName == "QueryBuilder") + { + return false; + } + } + return true; + }); options.CustomSchemaIds(type => type.FullName); }); } diff --git a/ui/src/views/report/DevexpressReportDesigner.tsx b/ui/src/views/report/DevexpressReportDesigner.tsx new file mode 100644 index 00000000..06c20630 --- /dev/null +++ b/ui/src/views/report/DevexpressReportDesigner.tsx @@ -0,0 +1,35 @@ +import React from 'react' +import { Container } from '@/components/shared' +import { Helmet } from 'react-helmet' +import { useLocalization } from '@/utils/hooks/useLocalization' +import ReportDesigner, { RequestOptions } from 'devexpress-reporting-react/dx-report-designer' +import '@devexpress/analytics-core/dist/css/dx-analytics.common.css' +import '@devexpress/analytics-core/dist/css/dx-analytics.light.css' +import '@devexpress/analytics-core/dist/css/dx-querybuilder.css' +import 'devexpress-reporting/dist/css/dx-webdocumentviewer.css' +import 'devexpress-reporting/dist/css/dx-reportdesigner.css' +import { useParams } from 'react-router-dom' + +const DevexpressReportDesigner: React.FC = () => { + const { translate } = useLocalization() + const params = useParams() + + return ( + + + + + + + + ) +} + +export default DevexpressReportDesigner diff --git a/ui/src/views/report/DevexpressReportViewer.tsx b/ui/src/views/report/DevexpressReportViewer.tsx index 76beb61b..0b281ea7 100644 --- a/ui/src/views/report/DevexpressReportViewer.tsx +++ b/ui/src/views/report/DevexpressReportViewer.tsx @@ -7,9 +7,11 @@ import 'devextreme/dist/css/dx.light.css' import '@devexpress/analytics-core/dist/css/dx-analytics.common.css' import '@devexpress/analytics-core/dist/css/dx-analytics.light.css' import 'devexpress-reporting/dist/css/dx-webdocumentviewer.css' +import { useParams } from 'react-router-dom' const DevexpressReportViewer: React.FC = () => { const { translate } = useLocalization() + const params = useParams() return ( @@ -19,8 +21,8 @@ const DevexpressReportViewer: React.FC = () => { defaultTitle="Erp Platform" > - - + + )