diff --git a/FurnitureAssembly/FurnitureAssembly/FurnitureAssemblyView.csproj b/FurnitureAssembly/FurnitureAssembly/FurnitureAssemblyView.csproj
index 027102c..0467864 100644
--- a/FurnitureAssembly/FurnitureAssembly/FurnitureAssemblyView.csproj
+++ b/FurnitureAssembly/FurnitureAssembly/FurnitureAssemblyView.csproj
@@ -9,13 +9,14 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
+
+
+
+
@@ -27,4 +28,10 @@
+
+
+ Always
+
+
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/MainForm.Designer.cs b/FurnitureAssembly/FurnitureAssembly/MainForm.Designer.cs
index 5daac66..2716560 100644
--- a/FurnitureAssembly/FurnitureAssembly/MainForm.Designer.cs
+++ b/FurnitureAssembly/FurnitureAssembly/MainForm.Designer.cs
@@ -38,6 +38,10 @@
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.FurnituresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.FurnituresComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
buttonReady = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip.SuspendLayout();
@@ -107,7 +111,8 @@
//
this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.справочникиToolStripMenuItem});
+ this.справочникиToolStripMenuItem,
+ this.отчетыToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1530, 33);
@@ -137,6 +142,37 @@
this.изделияToolStripMenuItem.Text = "Изделия";
this.изделияToolStripMenuItem.Click += new System.EventHandler(this.изделияToolStripMenuItem_Click);
//
+ // отчетыToolStripMenuItem
+ //
+ this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.FurnituresToolStripMenuItem,
+ this.FurnituresComponentsToolStripMenuItem,
+ this.списокЗаказовToolStripMenuItem});
+ this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
+ this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(88, 29);
+ this.отчетыToolStripMenuItem.Text = "Отчеты";
+ //
+ // FurnituresToolStripMenuItem
+ //
+ this.FurnituresToolStripMenuItem.Name = "FurnituresToolStripMenuItem";
+ this.FurnituresToolStripMenuItem.Size = new System.Drawing.Size(325, 34);
+ this.FurnituresToolStripMenuItem.Text = "Список изделий";
+ this.FurnituresToolStripMenuItem.Click += new System.EventHandler(this.FurnituresToolStripMenuItem_Click);
+ //
+ // FurnituresComponentsToolStripMenuItem
+ //
+ this.FurnituresComponentsToolStripMenuItem.Name = "FurnituresComponentsToolStripMenuItem";
+ this.FurnituresComponentsToolStripMenuItem.Size = new System.Drawing.Size(325, 34);
+ this.FurnituresComponentsToolStripMenuItem.Text = "Изделия по компонентам";
+ this.FurnituresComponentsToolStripMenuItem.Click += new System.EventHandler(this.FurnituresComponentsToolStripMenuItem_Click);
+ //
+ // списокЗаказовToolStripMenuItem
+ //
+ this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
+ this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(325, 34);
+ this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
+ this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
@@ -172,5 +208,9 @@
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem компонентыToolStripMenuItem;
private ToolStripMenuItem изделияToolStripMenuItem;
+ private ToolStripMenuItem отчетыToolStripMenuItem;
+ private ToolStripMenuItem FurnituresToolStripMenuItem;
+ private ToolStripMenuItem FurnituresComponentsToolStripMenuItem;
+ private ToolStripMenuItem списокЗаказовToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/MainForm.cs b/FurnitureAssembly/FurnitureAssembly/MainForm.cs
index ec37db9..009f391 100644
--- a/FurnitureAssembly/FurnitureAssembly/MainForm.cs
+++ b/FurnitureAssembly/FurnitureAssembly/MainForm.cs
@@ -19,13 +19,13 @@ namespace FurnitureAssemblyView
{
private readonly ILogger _logger;
private readonly IOrderLogic _orderLogic;
-
- public MainForm(ILogger logger, IOrderLogic orderLogic)
+ private readonly IReportLogic _reportLogic;
+ public MainForm(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic)
{
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
-
+ _reportLogic = reportLogic;
}
private void MainForm_Load(object sender, EventArgs e)
@@ -91,14 +91,21 @@ namespace FurnitureAssemblyView
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
try
{
+ var resStatus = Enum.TryParse(Convert.ToString(dataGridView.SelectedRows[0].Cells["Status"].Value), true, out OrderStatus status);
+ //var data = dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString();
+ if (!resStatus)
+ {
+ throw new Exception("Неверный формат статуса");
+ }
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel {
Id = id,
FurnitureId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["FurnitureId"].Value),
- Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
+ Status = status,
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
});
+ //var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
@@ -186,5 +193,40 @@ namespace FurnitureAssemblyView
{
LoadData();
}
+
+ private void FurnituresToolStripMenuItem_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 FurnituresComponentsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+
+ var service =
+ Program.ServiceProvider?.GetService(typeof(ReportFurnitureComponentsForm));
+ if (service is ReportFurnitureComponentsForm form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service =
+ Program.ServiceProvider?.GetService(typeof(ReportOrdersForm));
+ if (service is ReportOrdersForm form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
diff --git a/FurnitureAssembly/FurnitureAssembly/MainForm.resx b/FurnitureAssembly/FurnitureAssembly/MainForm.resx
index 1eca966..fc8b52e 100644
--- a/FurnitureAssembly/FurnitureAssembly/MainForm.resx
+++ b/FurnitureAssembly/FurnitureAssembly/MainForm.resx
@@ -63,4 +63,7 @@
17, 17
+
+ 25
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/Program.cs b/FurnitureAssembly/FurnitureAssembly/Program.cs
index b934d9a..993b18f 100644
--- a/FurnitureAssembly/FurnitureAssembly/Program.cs
+++ b/FurnitureAssembly/FurnitureAssembly/Program.cs
@@ -3,10 +3,12 @@ using Microsoft.Extensions.DependencyInjection;
using FurnitureAssemblyDatabaseImplement.Implements;
using FurnitureAssemblyBusinessLogic.BusinessLogics;
using FurnitureAssemblyContracts.BusinessLogicsContracts;
-using AbstractShopBusinessLogic.BusinessLogics;
+using FurnitureAssemblyBusinessLogic.BusinessLogics;
using NLog.Extensions.Logging;
using FurnitureAssemblyView;
using Microsoft.Extensions.Logging;
+using FurnitureAssemblyBusinessLogic.OfficePackage;
+using FurnitureAssemblyBusinessLogic.OfficePackage.Implements;
namespace FurnitureAssembly
{
@@ -39,6 +41,7 @@ namespace FurnitureAssembly
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -46,6 +49,13 @@ namespace FurnitureAssembly
services.AddTransient();
services.AddTransient();
services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
diff --git a/FurnitureAssembly/FurnitureAssembly/ReportFurnitureComponentsForm.Designer.cs b/FurnitureAssembly/FurnitureAssembly/ReportFurnitureComponentsForm.Designer.cs
new file mode 100644
index 0000000..ee053b3
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/ReportFurnitureComponentsForm.Designer.cs
@@ -0,0 +1,107 @@
+namespace FurnitureAssemblyView
+{
+ partial class ReportFurnitureComponentsForm
+ {
+ ///
+ /// 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()
+ {
+ ButtonSaveToExcel = new Button();
+ dataGridView = new DataGridView();
+ Component = new DataGridViewTextBoxColumn();
+ Furniture = new DataGridViewTextBoxColumn();
+ Count = new DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // ButtonSaveToExcel
+ //
+ ButtonSaveToExcel.Location = new Point(14, 41);
+ ButtonSaveToExcel.Margin = new Padding(3, 4, 3, 4);
+ ButtonSaveToExcel.Name = "ButtonSaveToExcel";
+ ButtonSaveToExcel.Size = new Size(190, 36);
+ ButtonSaveToExcel.TabIndex = 0;
+ ButtonSaveToExcel.Text = "Сохранить в Excel";
+ ButtonSaveToExcel.UseVisualStyleBackColor = true;
+ ButtonSaveToExcel.Click += ButtonSaveToExcel_Click;
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { Component, Furniture, Count });
+ dataGridView.Location = new Point(14, 107);
+ dataGridView.Margin = new Padding(3, 4, 3, 4);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.RowTemplate.Height = 25;
+ dataGridView.Size = new Size(686, 477);
+ dataGridView.TabIndex = 1;
+ //
+ // Component
+ //
+ Component.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ Component.HeaderText = "Изделие";
+ Component.MinimumWidth = 6;
+ Component.Name = "Component";
+ //
+ // Furniture
+ //
+ Furniture.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ Furniture.HeaderText = "Компонент";
+ Furniture.MinimumWidth = 6;
+ Furniture.Name = "Furniture";
+ //
+ // Count
+ //
+ Count.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader;
+ Count.HeaderText = "Количество";
+ Count.MinimumWidth = 6;
+ Count.Name = "Count";
+ Count.Width = 119;
+ //
+ // ReportFurnitureComponentsForm
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(717, 600);
+ Controls.Add(dataGridView);
+ Controls.Add(ButtonSaveToExcel);
+ Margin = new Padding(3, 4, 3, 4);
+ Name = "ReportFurnitureComponentsForm";
+ Text = "Компоненты по изделиям";
+ Load += FormReportProductComponents_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Button ButtonSaveToExcel;
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn Component;
+ private DataGridViewTextBoxColumn Furniture;
+ private DataGridViewTextBoxColumn Count;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/ReportFurnitureComponentsForm.cs b/FurnitureAssembly/FurnitureAssembly/ReportFurnitureComponentsForm.cs
new file mode 100644
index 0000000..e3ed9ac
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/ReportFurnitureComponentsForm.cs
@@ -0,0 +1,92 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using System.Windows.Forms;
+using FurnitureAssemblyDataModels.Enums;
+using FurnitureAssembly;
+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 FurnitureAssemblyView
+{
+ public partial class ReportFurnitureComponentsForm : Form
+ {
+
+ private readonly ILogger _logger;
+ private readonly IReportLogic _logic;
+
+ public ReportFurnitureComponentsForm(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+
+ private void FormReportProductComponents_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetFurnitureComponent();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.FurnitureName, "", "" });
+ 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