From 0fd354bc1fcecc071046dcb8fe8494a9f5dd0779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=9C=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0=D1=84=D0=B5=D0=B5=D0=B2?= Date: Mon, 18 Nov 2024 20:15:31 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B1=D0=BE=D0=B3=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BB=20=D0=B7=D0=B5=D0=BC=D0=BB=D1=8E=20=D0=B7=D0=B0=20?= =?UTF-8?q?=D1=81=D0=B5=D0=BC=D1=8C=20=D0=B4=D0=BD=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- COP_25/Forms/Forms.csproj | 7 +- Cop_25/BusinessLogic/BusinessLogic.csproj | 6 +- Cop_25/Contracts/Contracts.csproj | 6 +- Cop_25/Controls/Controls.csproj | 4 +- .../DatabaseImplement.csproj | 3 +- Cop_25/Forms/FormMain.Designer.cs | 9 +- Cop_25/Forms/FormMain.cs | 83 +++++++++++++------ Cop_25/Forms/FormMain.resx | 8 +- Cop_25/Models/Models.csproj | 3 +- 9 files changed, 89 insertions(+), 40 deletions(-) diff --git a/COP_25/Forms/Forms.csproj b/COP_25/Forms/Forms.csproj index b652946..5817159 100644 --- a/COP_25/Forms/Forms.csproj +++ b/COP_25/Forms/Forms.csproj @@ -2,7 +2,7 @@ WinExe - net6.0-windows7.0 + net8.0-windows7.0 enable true enable @@ -19,12 +19,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + diff --git a/Cop_25/BusinessLogic/BusinessLogic.csproj b/Cop_25/BusinessLogic/BusinessLogic.csproj index 92782f1..6d6b3da 100644 --- a/Cop_25/BusinessLogic/BusinessLogic.csproj +++ b/Cop_25/BusinessLogic/BusinessLogic.csproj @@ -1,12 +1,16 @@  - net6.0-windows + net8.0-windows7.0 enable true enable + + + + diff --git a/Cop_25/Contracts/Contracts.csproj b/Cop_25/Contracts/Contracts.csproj index a4cf9ba..6ebdd69 100644 --- a/Cop_25/Contracts/Contracts.csproj +++ b/Cop_25/Contracts/Contracts.csproj @@ -1,12 +1,16 @@  - net6.0-windows + net8.0-windows7.0 enable true enable + + + + diff --git a/Cop_25/Controls/Controls.csproj b/Cop_25/Controls/Controls.csproj index 0dc1095..718968f 100644 --- a/Cop_25/Controls/Controls.csproj +++ b/Cop_25/Controls/Controls.csproj @@ -1,7 +1,7 @@  - net6.0-windows7.0 + net8.0-windows7.0 enable true enable @@ -12,7 +12,7 @@ - + diff --git a/Cop_25/DatabaseImplement/DatabaseImplement.csproj b/Cop_25/DatabaseImplement/DatabaseImplement.csproj index 4627e9a..c0b3b69 100644 --- a/Cop_25/DatabaseImplement/DatabaseImplement.csproj +++ b/Cop_25/DatabaseImplement/DatabaseImplement.csproj @@ -1,7 +1,7 @@  - net6.0-windows + net8.0-windows7.0 enable true enable @@ -14,6 +14,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Cop_25/Forms/FormMain.Designer.cs b/Cop_25/Forms/FormMain.Designer.cs index 55c0392..1189c90 100644 --- a/Cop_25/Forms/FormMain.Designer.cs +++ b/Cop_25/Forms/FormMain.Designer.cs @@ -41,7 +41,9 @@ редактироватьtoolStripMenuItem = new ToolStripMenuItem(); controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable(); largeTextComponent = new Controls.LargeTextComponent(components); - componentDocumentWithChartPieWord = new ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieWord(components); + pieChartWord1 = new CustomComponents.NonViewComponents.PieChartWord(components); + componentDocumentWithTableMultiHeaderExcel1 = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel(components); + excelHardTable1 = new NotVisualComponent.ExcelHardTable(components); menuStrip1.SuspendLayout(); SuspendLayout(); // @@ -102,6 +104,7 @@ excelОтчётToolStripMenuItem.Name = "excelОтчётToolStripMenuItem"; excelОтчётToolStripMenuItem.Size = new Size(98, 24); excelОтчётToolStripMenuItem.Text = "Excel отчёт"; + excelОтчётToolStripMenuItem.Click += excelОтчётToolStripMenuItem_Click; // // wordДиаграммаToolStripMenuItem // @@ -155,6 +158,8 @@ private ToolStripMenuItem редактироватьtoolStripMenuItem; private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable; private Controls.LargeTextComponent largeTextComponent; - private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieWord componentDocumentWithChartPieWord; + private CustomComponents.NonViewComponents.PieChartWord pieChartWord1; + private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel componentDocumentWithTableMultiHeaderExcel1; + private NotVisualComponent.ExcelHardTable excelHardTable1; } } \ No newline at end of file diff --git a/Cop_25/Forms/FormMain.cs b/Cop_25/Forms/FormMain.cs index 65d1e25..1626ebb 100644 --- a/Cop_25/Forms/FormMain.cs +++ b/Cop_25/Forms/FormMain.cs @@ -1,12 +1,13 @@ -using ComponentsLibraryNet60.DocumentWithChart; -using ComponentsLibraryNet60.Models; -using Contracts.BindlingModels; +using Contracts.BindlingModels; using Contracts.BusinessLogicContracts; using Contracts.ViewModels; using Controls; using ControlsLibraryNet60.Data; using ControlsLibraryNet60.Models; using CustomComponents; +using CustomComponents.NonViewComponents.Enums; +using CustomComponents.NonViewComponents.SupportClasses; +using CustomComponents.NonViewComponents; using System; using System.Collections.Generic; using System.ComponentModel; @@ -16,7 +17,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; - +using DatabaseImplement.Models; +using ComponentsLibraryNet60.DocumentWithTable; +using ComponentsLibraryNet60.Models; +using NotVisualComponent.Models; +using NotVisualComponent; namespace Forms { public partial class FormMain : Form @@ -139,35 +144,59 @@ namespace Forms saveFileDialog.ShowDialog(); string path = saveFileDialog.FileName + ".docx"; var list = _dlogic.ReadList(null); - var data = new List<(int Date, double Value)> { }; - string header = "График доставок известной даты\n"; - var chart = new Dictionary> { }; - int index = 1; - foreach (var type in _dtlogic.ReadList(null)!) + var data = list + .Where(x => x.DeliveryDate != "Даты доставки нет") + .GroupBy(x => x.DeliveryType) + .Select(g => (type: g.Key, Value: g.Count())) + .ToList(); + + var categoriesX = data.Select(d => d.type).ToList(); + var valuesY = data.Select(d => (double)d.Value).ToList(); + + var series = new List { - int sum = 0; - foreach (var item in list) + new() { - if (item.DeliveryType == type.Name) - { - sum++; - } + SeriesName = "Количество доставок", + ValuesY = valuesY, + Color = Color.FromArgb(100, 150, 200) } - header += $"{index} - {type.Name}\n"; - if (sum != 0) data.Add((index, sum)); - index++; - } - chart.Add("ИП", data); - var conf = new ComponentDocumentWithChartConfig + }; + pieChartWord1.CreateDiagramDocument(new PieChartData() + { + FileName = path, + DocumentTitle = "Диаграмма", + DiagramTitle = "Количество доставок по типам", + LegendLayout = PieChartLegendAlign.Bottom, + CategoriesX = categoriesX, + SeriesData = series + }); + MessageBox.Show("Отчет готов"); + } + + private void excelОтчётToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveFileDialog saveFileDialog = new SaveFileDialog(); + saveFileDialog.ShowDialog(); + string path = saveFileDialog.FileName + ".xlsx"; + var list = _dlogic.ReadList(null); + + excelHardTable1.CreateDoc(new TableWithHeaderConfig { FilePath = path, - Header = header, - ChartTitle = "Диаграмма по типам доставок", - LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom, - Data = chart, - }; - componentDocumentWithChartPieWord.CreateDoc(conf); + Header = "Deliveryies", + ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (20, 5), (10, 0), (15, 0), }, + Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)> + { + (0, 0, "Id", "Id"), + (1, 0, "FCs", "FCs"), + (2, 0, "DeliveryType", "DeliveryType"), + (3, 0, "DeliveryDate", "DeliveryDate"), + }, + Data = list + }); MessageBox.Show("Отчет готов"); + } } } diff --git a/Cop_25/Forms/FormMain.resx b/Cop_25/Forms/FormMain.resx index 07702fd..6d55eb3 100644 --- a/Cop_25/Forms/FormMain.resx +++ b/Cop_25/Forms/FormMain.resx @@ -123,7 +123,13 @@ 153, 17 - + 348, 17 + + 504, 17 + + + 17, 58 + \ No newline at end of file diff --git a/Cop_25/Models/Models.csproj b/Cop_25/Models/Models.csproj index f6b8234..b218184 100644 --- a/Cop_25/Models/Models.csproj +++ b/Cop_25/Models/Models.csproj @@ -1,7 +1,7 @@  - net6.0-windows + net8.0-windows7.0 enable true enable @@ -9,6 +9,7 @@ +