бог создал землю за семь дней

This commit is contained in:
Леонид Малафеев 2024-11-18 20:15:31 +04:00
parent 8e1c9fddf3
commit 0fd354bc1f
9 changed files with 89 additions and 40 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows7.0</TargetFramework> <TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
@ -19,12 +19,11 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.1.1" /> <PackageReference Include="NotVisualComponent2" Version="1.0.0" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" />
<PackageReference Include="WinFormsLibrary" Version="1.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" />
<ProjectReference Include="..\Controls\Controls.csproj" /> <ProjectReference Include="..\Controls\Controls.csproj" />
<ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" /> <ProjectReference Include="..\DatabaseImplement\DatabaseImplement.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Contracts\Contracts.csproj" /> <ProjectReference Include="..\Contracts\Contracts.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -1,12 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Models\Models.csproj" /> <ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0-windows7.0</TargetFramework> <TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
@ -12,7 +12,7 @@
<PackageReference Include="CreateVisualComponent" Version="1.0.0" /> <PackageReference Include="CreateVisualComponent" Version="1.0.0" />
<PackageReference Include="CustomComponentsTest" Version="1.0.0" /> <PackageReference Include="CustomComponentsTest" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.35" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.35" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" /> <PackageReference Include="NotVisualComponent2" Version="1.0.0" />
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="6.1.1" /> <PackageReference Include="PDFsharp-MigraDoc-GDI" Version="6.1.1" />
</ItemGroup> </ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
@ -14,6 +14,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.29" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.29" />
</ItemGroup> </ItemGroup>

View File

@ -41,7 +41,9 @@
редактироватьtoolStripMenuItem = new ToolStripMenuItem(); редактироватьtoolStripMenuItem = new ToolStripMenuItem();
controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable(); controlDataTreeTable = new ControlsLibraryNet60.Data.ControlDataTreeTable();
largeTextComponent = new Controls.LargeTextComponent(components); 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(); menuStrip1.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
@ -102,6 +104,7 @@
excelОтчётToolStripMenuItem.Name = "excelОтчётToolStripMenuItem"; excelОтчётToolStripMenuItem.Name = "excelОтчётToolStripMenuItem";
excelОтчётToolStripMenuItem.Size = new Size(98, 24); excelОтчётToolStripMenuItem.Size = new Size(98, 24);
excelОтчётToolStripMenuItem.Text = "Excel отчёт"; excelОтчётToolStripMenuItem.Text = "Excel отчёт";
excelОтчётToolStripMenuItem.Click += excelОтчётToolStripMenuItem_Click;
// //
// wordДиаграммаToolStripMenuItem // wordДиаграммаToolStripMenuItem
// //
@ -155,6 +158,8 @@
private ToolStripMenuItem редактироватьtoolStripMenuItem; private ToolStripMenuItem редактироватьtoolStripMenuItem;
private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable; private ControlsLibraryNet60.Data.ControlDataTreeTable controlDataTreeTable;
private Controls.LargeTextComponent largeTextComponent; private Controls.LargeTextComponent largeTextComponent;
private ComponentsLibraryNet60.DocumentWithChart.ComponentDocumentWithChartPieWord componentDocumentWithChartPieWord; private CustomComponents.NonViewComponents.PieChartWord pieChartWord1;
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderExcel componentDocumentWithTableMultiHeaderExcel1;
private NotVisualComponent.ExcelHardTable excelHardTable1;
} }
} }

View File

@ -1,12 +1,13 @@
using ComponentsLibraryNet60.DocumentWithChart; using Contracts.BindlingModels;
using ComponentsLibraryNet60.Models;
using Contracts.BindlingModels;
using Contracts.BusinessLogicContracts; using Contracts.BusinessLogicContracts;
using Contracts.ViewModels; using Contracts.ViewModels;
using Controls; using Controls;
using ControlsLibraryNet60.Data; using ControlsLibraryNet60.Data;
using ControlsLibraryNet60.Models; using ControlsLibraryNet60.Models;
using CustomComponents; using CustomComponents;
using CustomComponents.NonViewComponents.Enums;
using CustomComponents.NonViewComponents.SupportClasses;
using CustomComponents.NonViewComponents;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -16,7 +17,11 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using DatabaseImplement.Models;
using ComponentsLibraryNet60.DocumentWithTable;
using ComponentsLibraryNet60.Models;
using NotVisualComponent.Models;
using NotVisualComponent;
namespace Forms namespace Forms
{ {
public partial class FormMain : Form public partial class FormMain : Form
@ -139,35 +144,59 @@ namespace Forms
saveFileDialog.ShowDialog(); saveFileDialog.ShowDialog();
string path = saveFileDialog.FileName + ".docx"; string path = saveFileDialog.FileName + ".docx";
var list = _dlogic.ReadList(null); var list = _dlogic.ReadList(null);
var data = new List<(int Date, double Value)> { }; var data = list
string header = "График доставок известной даты\n"; .Where(x => x.DeliveryDate != "Даты доставки нет")
var chart = new Dictionary<string, List<(int Date, double Value)>> { }; .GroupBy(x => x.DeliveryType)
int index = 1; .Select(g => (type: g.Key, Value: g.Count()))
foreach (var type in _dtlogic.ReadList(null)!) .ToList();
var categoriesX = data.Select(d => d.type).ToList();
var valuesY = data.Select(d => (double)d.Value).ToList();
var series = new List<SeriesData>
{ {
int sum = 0; new()
foreach (var item in list)
{ {
if (item.DeliveryType == type.Name) SeriesName = "Количество доставок",
ValuesY = valuesY,
Color = Color.FromArgb(100, 150, 200)
}
};
pieChartWord1.CreateDiagramDocument(new PieChartData()
{ {
sum++; FileName = path,
DocumentTitle = "Диаграмма",
DiagramTitle = "Количество доставок по типам",
LegendLayout = PieChartLegendAlign.Bottom,
CategoriesX = categoriesX,
SeriesData = series
});
MessageBox.Show("Отчет готов");
} }
}
header += $"{index} - {type.Name}\n"; private void excelОтчётToolStripMenuItem_Click(object sender, EventArgs e)
if (sum != 0) data.Add((index, sum)); {
index++; SaveFileDialog saveFileDialog = new SaveFileDialog();
} saveFileDialog.ShowDialog();
chart.Add("ИП", data); string path = saveFileDialog.FileName + ".xlsx";
var conf = new ComponentDocumentWithChartConfig var list = _dlogic.ReadList(null);
excelHardTable1.CreateDoc(new TableWithHeaderConfig<DeliveryViewModel>
{ {
FilePath = path, FilePath = path,
Header = header, Header = "Deliveryies",
ChartTitle = "Диаграмма по типам доставок", ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (20, 5), (10, 0), (15, 0), },
LegendLocation = ComponentsLibraryNet60.Models.Location.Bottom, Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
Data = chart, {
}; (0, 0, "Id", "Id"),
componentDocumentWithChartPieWord.CreateDoc(conf); (1, 0, "FCs", "FCs"),
(2, 0, "DeliveryType", "DeliveryType"),
(3, 0, "DeliveryDate", "DeliveryDate"),
},
Data = list
});
MessageBox.Show("Отчет готов"); MessageBox.Show("Отчет готов");
} }
} }
} }

View File

@ -123,7 +123,13 @@
<metadata name="largeTextComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="largeTextComponent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value> <value>153, 17</value>
</metadata> </metadata>
<metadata name="componentDocumentWithChartPieWord.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="pieChartWord1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>348, 17</value> <value>348, 17</value>
</metadata> </metadata>
<metadata name="componentDocumentWithTableMultiHeaderExcel1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>504, 17</value>
</metadata>
<metadata name="excelHardTable1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 58</value>
</metadata>
</root> </root>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
@ -9,6 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.35" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.35" />
<PackageReference Include="NotVisualComponent2" Version="1.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>