diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj
index 99ddb32..6dfd051 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/BlacksmithWorkshop.csproj
@@ -9,13 +9,17 @@
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
+
+
+
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
index 018e907..3a5ea42 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.Designer.cs
@@ -34,12 +34,16 @@
this.buttonOrderReady = new System.Windows.Forms.Button();
this.buttonIssuedOrder = new System.Windows.Forms.Button();
this.buttonRef = new System.Windows.Forms.Button();
- this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.menuStrip = new System.Windows.Forms.MenuStrip();
this.toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.workPieceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.manufactureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.workPiecesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.workPieceManufacturesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
- this.menuStrip1.SuspendLayout();
+ this.menuStrip.SuspendLayout();
this.SuspendLayout();
//
// dataGridView
@@ -102,16 +106,17 @@
this.buttonRef.UseVisualStyleBackColor = true;
this.buttonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
- // menuStrip1
+ // menuStrip
//
- this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
- this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.toolStripMenuItem});
- this.menuStrip1.Location = new System.Drawing.Point(0, 0);
- this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(1297, 28);
- this.menuStrip1.TabIndex = 6;
- this.menuStrip1.Text = "menuStrip1";
+ this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripMenuItem,
+ this.reportsToolStripMenuItem});
+ this.menuStrip.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip.Name = "menuStrip";
+ this.menuStrip.Size = new System.Drawing.Size(1297, 28);
+ this.menuStrip.TabIndex = 6;
+ this.menuStrip.Text = "menuStrip1";
//
// toolStripMenuItem
//
@@ -136,6 +141,37 @@
this.manufactureToolStripMenuItem.Text = "Изделия";
this.manufactureToolStripMenuItem.Click += new System.EventHandler(this.ManufactureToolStripMenuItem_Click);
//
+ // reportsToolStripMenuItem
+ //
+ this.reportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.workPiecesToolStripMenuItem,
+ this.workPieceManufacturesToolStripMenuItem,
+ this.ordersToolStripMenuItem});
+ this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
+ this.reportsToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
+ this.reportsToolStripMenuItem.Text = "Отчёты";
+ //
+ // workPiecesToolStripMenuItem
+ //
+ this.workPiecesToolStripMenuItem.Name = "workPiecesToolStripMenuItem";
+ this.workPiecesToolStripMenuItem.Size = new System.Drawing.Size(256, 26);
+ this.workPiecesToolStripMenuItem.Text = "Список заготовок";
+ this.workPiecesToolStripMenuItem.Click += new System.EventHandler(this.WorkPiecesToolStripMenuItem_Click);
+ //
+ // workPieceManufacturesToolStripMenuItem
+ //
+ this.workPieceManufacturesToolStripMenuItem.Name = "workPieceManufacturesToolStripMenuItem";
+ this.workPieceManufacturesToolStripMenuItem.Size = new System.Drawing.Size(256, 26);
+ this.workPieceManufacturesToolStripMenuItem.Text = "Заготовки по изделиям";
+ this.workPieceManufacturesToolStripMenuItem.Click += new System.EventHandler(this.WorkPieceManufacturesToolStripMenuItem_Click);
+ //
+ // ordersToolStripMenuItem
+ //
+ this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
+ this.ordersToolStripMenuItem.Size = new System.Drawing.Size(256, 26);
+ this.ordersToolStripMenuItem.Text = "Список заказов";
+ this.ordersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
+ //
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
@@ -147,14 +183,14 @@
this.Controls.Add(this.buttonTakeOrderInWork);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
- this.Controls.Add(this.menuStrip1);
- this.MainMenuStrip = this.menuStrip1;
+ this.Controls.Add(this.menuStrip);
+ this.MainMenuStrip = this.menuStrip;
this.Name = "FormMain";
this.Text = "Кузнечная мастерская";
this.Load += new System.EventHandler(this.FormMain_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
- this.menuStrip1.ResumeLayout(false);
- this.menuStrip1.PerformLayout();
+ this.menuStrip.ResumeLayout(false);
+ this.menuStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -168,9 +204,13 @@
private Button buttonOrderReady;
private Button buttonIssuedOrder;
private Button buttonRef;
- private MenuStrip menuStrip1;
+ private MenuStrip menuStrip;
private ToolStripMenuItem toolStripMenuItem;
private ToolStripMenuItem workPieceToolStripMenuItem;
private ToolStripMenuItem manufactureToolStripMenuItem;
+ private ToolStripMenuItem reportsToolStripMenuItem;
+ private ToolStripMenuItem workPiecesToolStripMenuItem;
+ private ToolStripMenuItem workPieceManufacturesToolStripMenuItem;
+ private ToolStripMenuItem ordersToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
index 879038a..95d8437 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.cs
@@ -1,4 +1,5 @@
-using BlacksmithWorkshopContracts.BindingModels;
+using BlacksmithWorkshopBusinessLogic.BusinessLogic;
+using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using BlacksmithWorkshopDataModels.Enums;
using Microsoft.Extensions.Logging;
@@ -20,12 +21,15 @@ namespace BlacksmithWorkshop
private readonly IOrderLogic _orderLogic;
- public FormMain(ILogger logger, IOrderLogic orderLogic)
+ private readonly IReportLogic _reportLogic;
+
+ 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 BlacksmithWorkshop
{
dataGridView.DataSource = list;
dataGridView.Columns["ManufactureId"].Visible = false;
+ dataGridView.Columns["ManufactureName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка заказов");
@@ -177,6 +182,41 @@ namespace BlacksmithWorkshop
}
}
+ private void WorkPiecesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveManufacturesToWordFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ private void WorkPieceManufacturesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportManufactureWorkPieces));
+
+ if (service is FormReportManufactureWorkPieces 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();
+ }
+ }
+
private void ButtonRef_Click(object sender, EventArgs e)
{
LoadData();
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.resx b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.resx
index 938108a..81a9e3d 100644
--- a/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.resx
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormMain.resx
@@ -57,7 +57,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
17, 17
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.Designer.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.Designer.cs
new file mode 100644
index 0000000..5892651
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.Designer.cs
@@ -0,0 +1,108 @@
+namespace BlacksmithWorkshop
+{
+ partial class FormReportManufactureWorkPieces
+ {
+ ///
+ /// 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()
+ {
+ this.buttonSaveToExcel = new System.Windows.Forms.Button();
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.ColumWorkPiece = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnManufacture = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // buttonSaveToExcel
+ //
+ this.buttonSaveToExcel.Location = new System.Drawing.Point(33, 25);
+ this.buttonSaveToExcel.Name = "buttonSaveToExcel";
+ this.buttonSaveToExcel.Size = new System.Drawing.Size(256, 29);
+ this.buttonSaveToExcel.TabIndex = 0;
+ this.buttonSaveToExcel.Text = "Сохранить в Excel";
+ this.buttonSaveToExcel.UseVisualStyleBackColor = true;
+ this.buttonSaveToExcel.Click += new System.EventHandler(this.ButtonSaveToExcel_Click);
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.ColumWorkPiece,
+ this.ColumnManufacture,
+ this.ColumnCount});
+ this.dataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.dataGridView.Location = new System.Drawing.Point(0, 73);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersWidth = 51;
+ this.dataGridView.RowTemplate.Height = 29;
+ this.dataGridView.Size = new System.Drawing.Size(800, 395);
+ this.dataGridView.TabIndex = 1;
+ //
+ // ColumWorkPiece
+ //
+ this.ColumWorkPiece.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.ColumWorkPiece.HeaderText = "Заготовка";
+ this.ColumWorkPiece.MinimumWidth = 6;
+ this.ColumWorkPiece.Name = "ColumWorkPiece";
+ //
+ // ColumnManufacture
+ //
+ this.ColumnManufacture.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.ColumnManufacture.HeaderText = "Изделие";
+ this.ColumnManufacture.MinimumWidth = 6;
+ this.ColumnManufacture.Name = "ColumnManufacture";
+ //
+ // ColumnCount
+ //
+ this.ColumnCount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.ColumnCount.HeaderText = "Количество";
+ this.ColumnCount.MinimumWidth = 6;
+ this.ColumnCount.Name = "ColumnCount";
+ //
+ // FormReportManufactureWorkPieces
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 468);
+ this.Controls.Add(this.dataGridView);
+ this.Controls.Add(this.buttonSaveToExcel);
+ this.Name = "FormReportManufactureWorkPieces";
+ this.Text = "Заготовки по изделиям";
+ this.Load += new System.EventHandler(this.FormReportManufactureWorkPieces_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Button buttonSaveToExcel;
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn ColumWorkPiece;
+ private DataGridViewTextBoxColumn ColumnManufacture;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs
new file mode 100644
index 0000000..0001b09
--- /dev/null
+++ b/BlacksmithWorkshop/BlacksmithWorkshop/FormReportManufactureWorkPieces.cs
@@ -0,0 +1,94 @@
+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 FormReportManufactureWorkPieces : Form
+ {
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportManufactureWorkPieces(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportManufactureWorkPieces_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetManufactureWorkPiece();
+
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.ManufactureName, "", "" });
+
+ foreach (var listElem in elem.WorkPieces)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
+ dataGridView.Rows.Add(Array.Empty