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..08b204e
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/ReportFurnitureComponentsForm.Designer.cs
@@ -0,0 +1,104 @@
+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()
+ {
+ this.ButtonSaveToExcel = new System.Windows.Forms.Button();
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.Component = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Furniture = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // ButtonSaveToExcel
+ //
+ this.ButtonSaveToExcel.Location = new System.Drawing.Point(12, 31);
+ this.ButtonSaveToExcel.Name = "ButtonSaveToExcel";
+ this.ButtonSaveToExcel.Size = new System.Drawing.Size(166, 27);
+ 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.Component,
+ this.Furniture,
+ this.Count});
+ this.dataGridView.Location = new System.Drawing.Point(12, 80);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(600, 358);
+ this.dataGridView.TabIndex = 1;
+ //
+ // Component
+ //
+ this.Component.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.Component.HeaderText = "Компонент";
+ this.Component.Name = "Component";
+ //
+ // Furniture
+ //
+ this.Furniture.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.Furniture.HeaderText = "Изделие";
+ this.Furniture.Name = "Furniture";
+ //
+ // Count
+ //
+ this.Count.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
+ this.Count.HeaderText = "Количество";
+ this.Count.Name = "Count";
+ this.Count.Width = 97;
+ //
+ // FormReportFurnitureComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(627, 450);
+ this.Controls.Add(this.dataGridView);
+ this.Controls.Add(this.ButtonSaveToExcel);
+ this.Name = "FormReportFurnitureComponents";
+ this.Text = "Компоненты по изделиям";
+ this.Load += new System.EventHandler(this.FormReportProductComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.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