From c55649ea00bd9e3fe99cf49af8d26345d419cd0f Mon Sep 17 00:00:00 2001 From: platoff aeeee Date: Wed, 8 May 2024 02:58:48 +0400 Subject: [PATCH] 4lablab --- .../FormMain.Designer.cs | 65 ++++++++++--------- .../FurnitureAssemblyView/FormMain.cs | 44 ++++++++++++- .../FormReportFurnitureWorkPieces.Designer.cs | 1 + .../FormReportFurnitureWorkPieces.resx | 9 --- .../FurnitureAssemblyView.csproj | 2 +- .../FurnitureAssemblyView/Program.cs | 10 +++ .../FurnitureAssemblyView/ReportOrders.rdlc | 1 + 7 files changed, 89 insertions(+), 43 deletions(-) create mode 100644 FurnitureAssembly/FurnitureAssemblyView/ReportOrders.rdlc diff --git a/FurnitureAssembly/FurnitureAssemblyView/FormMain.Designer.cs b/FurnitureAssembly/FurnitureAssemblyView/FormMain.Designer.cs index 34cc74c..bb3ebd7 100644 --- a/FurnitureAssembly/FurnitureAssemblyView/FormMain.Designer.cs +++ b/FurnitureAssembly/FurnitureAssemblyView/FormMain.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyView/FormMain.cs b/FurnitureAssembly/FurnitureAssemblyView/FormMain.cs index fcbb570..52fe99c 100644 --- a/FurnitureAssembly/FurnitureAssemblyView/FormMain.cs +++ b/FurnitureAssembly/FurnitureAssemblyView/FormMain.cs @@ -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 logger, IOrderLogic orderLogic) + public FormMain(ILogger 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(); + } + } } } diff --git a/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.Designer.cs b/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.Designer.cs index b4072aa..81f2840 100644 --- a/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.Designer.cs +++ b/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.Designer.cs @@ -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); diff --git a/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.resx b/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.resx index 5f4020a..06768e1 100644 --- a/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.resx +++ b/FurnitureAssembly/FurnitureAssemblyView/FormReportFurnitureWorkPieces.resx @@ -66,13 +66,4 @@ True - - True - - - True - - - True - \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyView/FurnitureAssemblyView.csproj b/FurnitureAssembly/FurnitureAssemblyView/FurnitureAssemblyView.csproj index e1cef5d..672a1f6 100644 --- a/FurnitureAssembly/FurnitureAssemblyView/FurnitureAssemblyView.csproj +++ b/FurnitureAssembly/FurnitureAssemblyView/FurnitureAssemblyView.csproj @@ -15,8 +15,8 @@ - + diff --git a/FurnitureAssembly/FurnitureAssemblyView/Program.cs b/FurnitureAssembly/FurnitureAssemblyView/Program.cs index 505b971..8d08995 100644 --- a/FurnitureAssembly/FurnitureAssemblyView/Program.cs +++ b/FurnitureAssembly/FurnitureAssemblyView/Program.cs @@ -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(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -51,6 +59,8 @@ namespace FurnitureAssemblyView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/FurnitureAssembly/FurnitureAssemblyView/ReportOrders.rdlc b/FurnitureAssembly/FurnitureAssemblyView/ReportOrders.rdlc new file mode 100644 index 0000000..5f28270 --- /dev/null +++ b/FurnitureAssembly/FurnitureAssemblyView/ReportOrders.rdlc @@ -0,0 +1 @@ + \ No newline at end of file