This commit is contained in:
platoff aeeee 2024-05-08 02:58:48 +04:00
parent d70ec5993b
commit c55649ea00
7 changed files with 89 additions and 43 deletions

View File

@ -38,10 +38,10 @@
this.toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.workPieceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.furnitureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокКомпонентовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.компонентыПоИзделиямToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.workPiecesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.workPieceFurnituresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip.SuspendLayout();
this.SuspendLayout();
@ -117,7 +117,7 @@
this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem,
this.отчётыToolStripMenuItem});
this.reportsToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
@ -137,44 +137,47 @@
// workPieceToolStripMenuItem
//
this.workPieceToolStripMenuItem.Name = "workPieceToolStripMenuItem";
this.workPieceToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.workPieceToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.workPieceToolStripMenuItem.Text = "Заготовки";
this.workPieceToolStripMenuItem.Click += new System.EventHandler(this.WorkPieceToolStripMenuItem_Click);
//
// furnitureToolStripMenuItem
//
this.furnitureToolStripMenuItem.Name = "furnitureToolStripMenuItem";
this.furnitureToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.furnitureToolStripMenuItem.Size = new System.Drawing.Size(130, 22);
this.furnitureToolStripMenuItem.Text = "Изделия";
this.furnitureToolStripMenuItem.Click += new System.EventHandler(this.FurnitureToolStripMenuItem_Click);
//
// отчётыToolStripMenuItem
// reportsToolStripMenuItem
//
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.списокКомпонентовToolStripMenuItem,
this.компонентыПоИзделиямToolStripMenuItem,
this.списокЗаказовToolStripMenuItem});
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчётыToolStripMenuItem.Text = "Отчеты";
this.reportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.workPiecesToolStripMenuItem,
this.workPieceFurnituresToolStripMenuItem,
this.ordersToolStripMenuItem});
this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
this.reportsToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.reportsToolStripMenuItem.Text = "Отчеты";
//
// списокКомпонентовToolStripMenuItem
// workPiecesToolStripMenuItem
//
this.списокКомпонентовToolStripMenuItem.Name = "списокКомпонентовToolStripMenuItem";
this.списокКомпонентовToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.списокКомпонентовToolStripMenuItem.Text = "Список компонентов";
this.workPiecesToolStripMenuItem.Name = "workPiecesToolStripMenuItem";
this.workPiecesToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.workPiecesToolStripMenuItem.Text = "Список компонентов";
this.workPiecesToolStripMenuItem.Click += new System.EventHandler(this.WorkPiecesToolStripMenuItem_Click);
//
// компонентыПоИзделиямToolStripMenuItem
// workPieceFurnituresToolStripMenuItem
//
this.компонентыПоИзделиямToolStripMenuItem.Name = омпонентыПоИзделиямToolStripMenuItem";
this.компонентыПоИзделиямToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.компонентыПоИзделиямToolStripMenuItem.Text = "Компоненты по изделиям";
this.workPieceFurnituresToolStripMenuItem.Name = "workPieceFurnituresToolStripMenuItem";
this.workPieceFurnituresToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.workPieceFurnituresToolStripMenuItem.Text = "Компоненты по изделиям";
this.workPieceFurnituresToolStripMenuItem.Click += new System.EventHandler(this.WorkPieceFurnituresToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
// ordersToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.ordersToolStripMenuItem.Text = "Список заказов";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
//
// FormMain
//
@ -213,9 +216,9 @@
private ToolStripMenuItem toolStripMenuItem;
private ToolStripMenuItem workPieceToolStripMenuItem;
private ToolStripMenuItem furnitureToolStripMenuItem;
private ToolStripMenuItem отчётыToolStripMenuItem;
private ToolStripMenuItem списокКомпонентовToolStripMenuItem;
private ToolStripMenuItem компонентыПоИзделиямToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private ToolStripMenuItem reportsToolStripMenuItem;
private ToolStripMenuItem workPiecesToolStripMenuItem;
private ToolStripMenuItem workPieceFurnituresToolStripMenuItem;
private ToolStripMenuItem ordersToolStripMenuItem;
}
}

View File

@ -1,4 +1,5 @@
using FurnitureAssemblyContracts.BindingModels;
using FurnitureAssemblyBusinessLogic.BussinessLogic;
using FurnitureAssemblyContracts.BindingModels;
using FurnitureAssemblyContracts.BusinessLogicsContracts;
using FurnitureAssemblyDataModels.Enums;
using Microsoft.Extensions.Logging;
@ -19,13 +20,16 @@ namespace FurnitureAssemblyView
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
private readonly IReportLogic _reportLogic;
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportLogic;
}
private void FormMain_Load(object sender, EventArgs e)
@ -45,6 +49,7 @@ namespace FurnitureAssemblyView
{
dataGridView.DataSource = list;
dataGridView.Columns["FurnitureId"].Visible = false;
dataGridView.Columns["FurnitureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка заказов");
@ -181,5 +186,40 @@ namespace FurnitureAssemblyView
{
LoadData();
}
private void WorkPiecesToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveFurnituresToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void WorkPieceFurnituresToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportFurnitureWorkPieces));
if (service is FormReportFurnitureWorkPieces form)
{
form.ShowDialog();
}
}
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
}
}

View File

@ -86,6 +86,7 @@
this.Controls.Add(this.dataGridView);
this.Name = "FormReportFurnitureWorkPieces";
this.Text = "Заготовки по изделиям";
this.Load += new System.EventHandler(this.FormReportFurnitureWorkPieces_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);

View File

@ -66,13 +66,4 @@
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnWorkPiece.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnFurniture.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -15,8 +15,8 @@
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Reporting.WinForms.v11" Version="1.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.17" />
</ItemGroup>
<ItemGroup>

View File

@ -1,4 +1,7 @@
using FurnitureAssemblyBusinessLogic.BussinessLogic;
using FurnitureAssemblyBusinessLogic.OfficePackage;
using FurnitureAssemblyBusinessLogic.OfficePackage.HelperModels;
using FurnitureAssemblyBusinessLogic.OfficePackage.Implements;
using FurnitureAssemblyContracts.BusinessLogicsContracts;
using FurnitureAssemblyContracts.StoragesContracts;
using FurnitureAssemblyDatabaseImplement.Implements;
@ -43,6 +46,11 @@ namespace FurnitureAssemblyView
services.AddTransient<IWorkPieceLogic, WorkPieceLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IFurnitureLogic, FurnitureLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<FormMain>();
services.AddTransient<FormWorkPiece>();
@ -51,6 +59,8 @@ namespace FurnitureAssemblyView
services.AddTransient<FormFurniture>();
services.AddTransient<FormFurnitures>();
services.AddTransient<FormFurnitureWorkPiece>();
services.AddTransient<FormReportFurnitureWorkPieces>();
services.AddTransient<FormReportOrders>();
}
}
}

View File

@ -0,0 +1 @@