diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj
index 21732a7..eb9a45f 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj
@@ -20,11 +20,13 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
+
+
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
index 4889d10..cb3c202 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
@@ -32,6 +32,10 @@
this.справочникиToolStripMenuItem1 = 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.ComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.ComponentsManufactueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.OrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonnTakeOrderInWork = new System.Windows.Forms.Button();
@@ -46,7 +50,8 @@
//
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.справочникиToolStripMenuItem1});
+ this.справочникиToolStripMenuItem1,
+ this.отчётыToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(920, 28);
@@ -76,6 +81,37 @@
this.кузнечныеИзделияToolStripMenuItem.Text = "КузнечныеИзделия";
this.кузнечныеИзделияToolStripMenuItem.Click += new System.EventHandler(this.КузнечныеИзделияToolStripMenuItem_Click);
//
+ // отчётыToolStripMenuItem
+ //
+ this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.ComponentsToolStripMenuItem,
+ this.ComponentsManufactueToolStripMenuItem,
+ this.OrdersToolStripMenuItem});
+ this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
+ this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
+ this.отчётыToolStripMenuItem.Text = "Отчёты";
+ //
+ // ComponentsToolStripMenuItem
+ //
+ this.ComponentsToolStripMenuItem.Name = "ComponentsToolStripMenuItem";
+ this.ComponentsToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
+ this.ComponentsToolStripMenuItem.Text = "Список компонентов";
+ this.ComponentsToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
+ //
+ // ComponentsManufactueToolStripMenuItem
+ //
+ this.ComponentsManufactueToolStripMenuItem.Name = "ComponentsManufactueToolStripMenuItem";
+ this.ComponentsManufactueToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
+ this.ComponentsManufactueToolStripMenuItem.Text = "Компоненты по изделиям";
+ this.ComponentsManufactueToolStripMenuItem.Click += new System.EventHandler(this.ComponentsManufactueToolStripMenuItem_Click);
+ //
+ // OrdersToolStripMenuItem
+ //
+ this.OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
+ this.OrdersToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
+ this.OrdersToolStripMenuItem.Text = "Список заказов";
+ this.OrdersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
+ //
// dataGridView
//
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight;
@@ -172,5 +208,9 @@
private Button buttonRef;
private ToolStripMenuItem компонентыToolStripMenuItem;
private ToolStripMenuItem кузнечныеИзделияToolStripMenuItem;
+ private ToolStripMenuItem отчётыToolStripMenuItem;
+ private ToolStripMenuItem ComponentsToolStripMenuItem;
+ private ToolStripMenuItem ComponentsManufactueToolStripMenuItem;
+ private ToolStripMenuItem OrdersToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
index 5665d5a..089135f 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
@@ -1,4 +1,5 @@
-using BlacksmithWorkshopContracts.BindingModels;
+using BlacksmithWorkshopBusinessLogic.BusinessLogics;
+using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using BlacksmithWorkshopDataModel.Enums;
using Microsoft.Extensions.Logging;
@@ -19,13 +20,14 @@ namespace BlacksmithWorkshop
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
- public FormMain(ILogger logger, IOrderLogic orderLogic)
+ IReportLogic _reportLogic;
+ public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
LoadData();
-
+ _reportLogic = reportLogic;
}
private void FormMain_Load(object sender, EventArgs e)
@@ -200,6 +202,40 @@ namespace BlacksmithWorkshop
LoadData();
}
-
+
+ private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveComponentsToWordFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
+ MessageBoxIcon.Information);
+ }
+
+ }
+
+ private void ComponentsManufactueToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service =
+Program.ServiceProvider?.GetService(typeof(FormReportManufactureComponents));
+ if (service is FormReportManufactureComponents 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/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.Designer.cs
new file mode 100644
index 0000000..3884194
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.Designer.cs
@@ -0,0 +1,105 @@
+namespace BlacksmithWorkshop
+{
+ partial class FormReportManufactureComponents
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ dataGridView = new DataGridView();
+ buttonSaveToExcel = new Button();
+ ColumnManufacture = new DataGridViewTextBoxColumn();
+ ColumnComponent = new DataGridViewTextBoxColumn();
+ ColumnCount = new DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.BackgroundColor = SystemColors.ButtonFace;
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnManufacture, ColumnComponent, ColumnCount });
+ dataGridView.Dock = DockStyle.Bottom;
+ dataGridView.Location = new Point(0, 76);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.RowTemplate.Height = 29;
+ dataGridView.Size = new Size(564, 437);
+ dataGridView.TabIndex = 0;
+ //
+ // buttonSaveToExcel
+ //
+ buttonSaveToExcel.Location = new Point(23, 23);
+ buttonSaveToExcel.Name = "buttonSaveToExcel";
+ buttonSaveToExcel.Size = new Size(166, 29);
+ buttonSaveToExcel.TabIndex = 1;
+ buttonSaveToExcel.Text = "Сохранить в Excel";
+ buttonSaveToExcel.UseVisualStyleBackColor = true;
+ buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
+ //
+ // ColumnManufacture
+ //
+ ColumnManufacture.HeaderText = "Изделие";
+ ColumnManufacture.MinimumWidth = 6;
+ ColumnManufacture.Name = "ColumnManufacture";
+ ColumnManufacture.Width = 125;
+ //
+ // ColumnComponent
+ //
+ ColumnComponent.HeaderText = "Компонент";
+ ColumnComponent.MinimumWidth = 6;
+ ColumnComponent.Name = "ColumnComponent";
+ ColumnComponent.Width = 125;
+ //
+ // ColumnCount
+ //
+ ColumnCount.HeaderText = "Количество";
+ ColumnCount.MinimumWidth = 6;
+ ColumnCount.Name = "ColumnCount";
+ ColumnCount.Width = 125;
+ //
+ // FormReportManufactureComponents
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(564, 513);
+ Controls.Add(buttonSaveToExcel);
+ Controls.Add(dataGridView);
+ Name = "FormReportManufactureComponents";
+ Text = "FormReportManufactureComponents";
+ Load += FormReportManufactureComponents_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonSaveToExcel;
+ private DataGridViewTextBoxColumn ColumnManufacture;
+ private DataGridViewTextBoxColumn ColumnComponent;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.cs
new file mode 100644
index 0000000..e519cbf
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureComponents.cs
@@ -0,0 +1,96 @@
+using BlacksmithWorkshopContracts.BindingModels;
+using BlacksmithWorkshopContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace BlacksmithWorkshop
+{
+ public partial class FormReportManufactureComponents : Form
+ {
+
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+ public FormReportManufactureComponents(ILogger
+ logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+
+ }
+ private void FormReportManufactureComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetManufactureComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.ManufactureName,
+"", "" });
+ foreach (var listElem in elem.Components)
+ {
+ dataGridView.Rows.Add(new object[] { "",
+listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "",
+elem.TotalCount });
+ dataGridView.Rows.Add(Array.Empty