diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs
index 6fd7fc9..c6423dd 100644
--- a/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs
@@ -32,16 +32,23 @@
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.отчеты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.списокМагазиновToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.магазиныСИзделиямиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.списокГруппЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DataGridView = new System.Windows.Forms.DataGridView();
this.CreateOrderButton = new System.Windows.Forms.Button();
this.TakeOrderInWorkButton = new System.Windows.Forms.Button();
this.OrderReadyButton = new System.Windows.Forms.Button();
this.IssuedOrderButton = new System.Windows.Forms.Button();
this.UpdateListButton = new System.Windows.Forms.Button();
+ this.SellReinforcedButton = new System.Windows.Forms.Button();
+ this.buttonSellReinforced = new System.Windows.Forms.Button();
+ this.buttonAddReinforcedInShop = new System.Windows.Forms.Button();
this.КлиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
@@ -56,7 +63,7 @@
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
this.MenuStrip.Name = "MenuStrip";
this.MenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
- this.MenuStrip.Size = new System.Drawing.Size(1191, 30);
+ this.MenuStrip.Size = new System.Drawing.Size(1209, 30);
this.MenuStrip.TabIndex = 0;
this.MenuStrip.Text = "menuStrip1";
//
@@ -84,12 +91,22 @@
this.КомпонентыToolStripMenuItem.Text = "Компоненты";
this.КомпонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
//
+ // магазиныToolStripMenuItem
+ //
+ this.магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
+ this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
+ this.магазиныToolStripMenuItem.Text = "Магазины";
+ this.магазиныToolStripMenuItem.Click += new System.EventHandler(this.магазиныToolStripMenuItem_Click);
+ //
// отчетыToolStripMenuItem
//
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.списокДокументовToolStripMenuItem,
this.компонентыПоДокументамToolStripMenuItem,
- this.списокЗаказовToolStripMenuItem});
+ this.списокЗаказовToolStripMenuItem,
+ this.списокМагазиновToolStripMenuItem,
+ this.магазиныСИзделиямиToolStripMenuItem,
+ this.списокГруппЗаказовToolStripMenuItem});
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
this.отчетыToolStripMenuItem.Text = "Отчеты";
@@ -115,6 +132,27 @@
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click);
//
+ // списокМагазиновToolStripMenuItem
+ //
+ this.списокМагазиновToolStripMenuItem.Name = "списокМагазиновToolStripMenuItem";
+ this.списокМагазиновToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
+ this.списокМагазиновToolStripMenuItem.Text = "Список магазинов";
+ this.списокМагазиновToolStripMenuItem.Click += new System.EventHandler(this.списокМагазиновToolStripMenuItem_Click);
+ //
+ // магазиныСИзделиямиToolStripMenuItem
+ //
+ this.магазиныСИзделиямиToolStripMenuItem.Name = "магазиныСИзделиямиToolStripMenuItem";
+ this.магазиныСИзделиямиToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
+ this.магазиныСИзделиямиToolStripMenuItem.Text = "Магазины с изделиями";
+ this.магазиныСИзделиямиToolStripMenuItem.Click += new System.EventHandler(this.магазиныСИзделиямиToolStripMenuItem_Click);
+ //
+ // списокГруппЗаказовToolStripMenuItem
+ //
+ this.списокГруппЗаказовToolStripMenuItem.Name = "списокГруппЗаказовToolStripMenuItem";
+ this.списокГруппЗаказовToolStripMenuItem.Size = new System.Drawing.Size(292, 26);
+ this.списокГруппЗаказовToolStripMenuItem.Text = "Список групп заказов";
+ this.списокГруппЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокГруппЗаказовToolStripMenuItem_Click);
+ //
// DataGridView
//
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@@ -188,11 +226,43 @@
this.КлиентыToolStripMenuItem.Text = "Клиенты";
this.КлиентыToolStripMenuItem.Click += new System.EventHandler(this.КлиентыToolStripMenuItem_Click);
//
+ // SellReinforcedButton
+ //
+ this.SellReinforcedButton.Location = new System.Drawing.Point(905, 276);
+ this.SellReinforcedButton.Name = "SellReinforcedButton";
+ this.SellReinforcedButton.Size = new System.Drawing.Size(125, 29);
+ this.SellReinforcedButton.TabIndex = 8;
+ this.SellReinforcedButton.Text = "Продать изделие";
+ this.SellReinforcedButton.UseVisualStyleBackColor = true;
+ this.SellReinforcedButton.Click += new System.EventHandler(this.SellReinforcedButton_Click);
+ //
+ // buttonSellReinforced
+ //
+ this.buttonSellReinforced.Location = new System.Drawing.Point(1034, 303);
+ this.buttonSellReinforced.Name = "buttonSellReinforced";
+ this.buttonSellReinforced.Size = new System.Drawing.Size(143, 45);
+ this.buttonSellReinforced.TabIndex = 7;
+ this.buttonSellReinforced.Text = "Продать изделие";
+ this.buttonSellReinforced.UseVisualStyleBackColor = true;
+ this.buttonSellReinforced.Click += new System.EventHandler(this.buttonSellReinforced_Click);
+ //
+ // buttonAddReinforcedInShop
+ //
+ this.buttonAddReinforcedInShop.Location = new System.Drawing.Point(1034, 354);
+ this.buttonAddReinforcedInShop.Name = "buttonAddReinforcedInShop";
+ this.buttonAddReinforcedInShop.Size = new System.Drawing.Size(143, 55);
+ this.buttonAddReinforcedInShop.TabIndex = 8;
+ this.buttonAddReinforcedInShop.Text = "Пополнение магазина";
+ this.buttonAddReinforcedInShop.UseVisualStyleBackColor = true;
+ this.buttonAddReinforcedInShop.Click += new System.EventHandler(this.buttonAddReinforcedInShop_Click);
+ //
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1191, 600);
+ this.ClientSize = new System.Drawing.Size(1209, 450);
+ this.Controls.Add(this.buttonAddReinforcedInShop);
+ this.Controls.Add(this.buttonSellReinforced);
this.Controls.Add(this.UpdateListButton);
this.Controls.Add(this.IssuedOrderButton);
this.Controls.Add(this.OrderReadyButton);
@@ -219,6 +289,11 @@
private ToolStripMenuItem СправочникиToolStripMenuItem;
private ToolStripMenuItem ИзделияToolStripMenuItem;
private ToolStripMenuItem КомпонентыToolStripMenuItem;
+ private ToolStripMenuItem магазиныToolStripMenuItem;
+ private ToolStripMenuItem отчетыToolStripMenuItem;
+ private ToolStripMenuItem списокДокументовToolStripMenuItem;
+ private ToolStripMenuItem компонентыПоДокументамToolStripMenuItem;
+ private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private DataGridView DataGridView;
private Button CreateOrderButton;
private Button TakeOrderInWorkButton;
@@ -230,5 +305,11 @@
private ToolStripMenuItem компонентыПоДокументамToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private ToolStripMenuItem КлиентыToolStripMenuItem;
+ public Button SellReinforcedButton;
+ private Button buttonSellReinforced;
+ private Button buttonAddReinforcedInShop;
+ private ToolStripMenuItem списокМагазиновToolStripMenuItem;
+ private ToolStripMenuItem магазиныСИзделиямиToolStripMenuItem;
+ private ToolStripMenuItem списокГруппЗаказовToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs b/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs
index 516f77d..d43492b 100644
--- a/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs
@@ -1,4 +1,6 @@
-using Microsoft.Extensions.Logging;
+
+using Microsoft.Extensions.Logging;
+using PrecastConcretePlant;
using PrecastConcretePlantBusinessLogic.BusinessLogic;
using PrecastConcretePlantContracts.BindingModels;
using PrecastConcretePlantContracts.BusinessLogicsContracts;
@@ -159,7 +161,7 @@ namespace PrecastConcretePlantView
try
{
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
- {
+ {
Id = id,
});
@@ -185,12 +187,23 @@ namespace PrecastConcretePlantView
LoadData();
}
+
+ private void SellReinforcedButton_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormSellReinforced));
+
+ if (service is FormSellReinforced form)
+ {
+ form.ShowDialog();
+ }
+ }
+
private void списокДокументовToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
- _reportLogic.SaveReinforcediesToWordFile(new ReportBindingModel
+ _reportLogic.SaveReinforcedsToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
@@ -216,6 +229,61 @@ namespace PrecastConcretePlantView
}
}
+ private void списокМагазиновToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ _reportLogic.SaveShopsTableToWordFile(new ReportBindingModel { FileName = dialog.FileName });
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
+ private void магазиныСИзделиямиToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportShopReinforcedies));
+ if (service is FormReportShopReinforcedies form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void списокГруппЗаказовToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupOrders));
+ if (service is FormReportGroupOrders form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonSellReinforced_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormSellReinforced));
+ if (service is FormSellReinforced form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonAddReinforcedInShop_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormReinforcedShop));
+ if (service is FormReinforcedShop form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormShops));
+ if (service is FormShops form)
+ {
+ form.ShowDialog();
+ }
+ }
+
private void КлиентыToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.Designer.cs
new file mode 100644
index 0000000..ece5061
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.Designer.cs
@@ -0,0 +1,151 @@
+namespace PrecastConcretePlantView
+{
+ partial class FormReinforcedShop
+ {
+ ///
+ /// 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.comboBoxShop = new System.Windows.Forms.ComboBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.comboBoxReinforced = new System.Windows.Forms.ComboBox();
+ this.numericUpDownCount = new System.Windows.Forms.NumericUpDown();
+ this.buttonSave = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit();
+ this.SuspendLayout();
+ //
+ // comboBoxShop
+ //
+ this.comboBoxShop.FormattingEnabled = true;
+ this.comboBoxShop.Location = new System.Drawing.Point(214, 17);
+ this.comboBoxShop.Name = "comboBoxShop";
+ this.comboBoxShop.Size = new System.Drawing.Size(222, 23);
+ this.comboBoxShop.TabIndex = 3;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(84, 20);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(124, 15);
+ this.label1.TabIndex = 2;
+ this.label1.Text = "Выбранный магазин:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(12, 47);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(196, 15);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Изделие которое нужно добавить:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(133, 73);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(75, 15);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "Количество:";
+ //
+ // comboBoxReinforced
+ //
+ this.comboBoxReinforced.FormattingEnabled = true;
+ this.comboBoxReinforced.Location = new System.Drawing.Point(214, 44);
+ this.comboBoxReinforced.Name = "comboBoxReinforced";
+ this.comboBoxReinforced.Size = new System.Drawing.Size(222, 23);
+ this.comboBoxReinforced.TabIndex = 6;
+ //
+ // numericUpDownCount
+ //
+ this.numericUpDownCount.Location = new System.Drawing.Point(215, 71);
+ this.numericUpDownCount.Maximum = new decimal(new int[] {
+ 1410065408,
+ 2,
+ 0,
+ 0});
+ this.numericUpDownCount.Name = "numericUpDownCount";
+ this.numericUpDownCount.Size = new System.Drawing.Size(221, 23);
+ this.numericUpDownCount.TabIndex = 7;
+ //
+ // buttonSave
+ //
+ this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonSave.Location = new System.Drawing.Point(280, 123);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(75, 23);
+ this.buttonSave.TabIndex = 8;
+ this.buttonSave.Text = "Сохранить";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonCancel.Location = new System.Drawing.Point(361, 123);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(75, 23);
+ this.buttonCancel.TabIndex = 9;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // FormReinforcedShop
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(448, 158);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonSave);
+ this.Controls.Add(this.numericUpDownCount);
+ this.Controls.Add(this.comboBoxReinforced);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.comboBoxShop);
+ this.Controls.Add(this.label1);
+ this.Name = "FormReinforcedShop";
+ this.Text = "Пополнение магазина";
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private ComboBox comboBoxShop;
+ private Label label1;
+ private Label label2;
+ private Label label3;
+ private ComboBox comboBoxReinforced;
+ private NumericUpDown numericUpDownCount;
+ private Button buttonSave;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.cs
new file mode 100644
index 0000000..e8122ce
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.cs
@@ -0,0 +1,100 @@
+using Microsoft.Extensions.Logging;
+using PrecastConcretePlantContracts.BusinessLogicsContracts;
+using PrecastConcretePlantContracts.ViewModels;
+using System;
+using System.Collections;
+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 PrecastConcretePlantView
+{
+ public partial class FormReinforcedShop : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IShopLogic _shopLogic;
+ private readonly IReinforcedLogic _reinforcedLogic;
+ private readonly List? _listShops;
+ private readonly List? _listReinforcedies;
+
+ public FormReinforcedShop(ILogger logger, IShopLogic shopLogic, IReinforcedLogic reinforcedLogic)
+ {
+ InitializeComponent();
+ _shopLogic = shopLogic;
+ _reinforcedLogic = reinforcedLogic;
+ _logger = logger;
+ _listShops = shopLogic.ReadList(null);
+ if (_listShops != null)
+ {
+ comboBoxShop.DisplayMember = "Name";
+ comboBoxShop.ValueMember = "Id";
+ comboBoxShop.DataSource = _listShops;
+ comboBoxShop.SelectedItem = null;
+ }
+
+ _listReinforcedies = reinforcedLogic.ReadList(null);
+ if (_listReinforcedies != null)
+ {
+ comboBoxReinforced.DisplayMember = "ReinforcedName";
+ comboBoxReinforced.ValueMember= "Id";
+ comboBoxReinforced.DataSource = _listReinforcedies;
+ comboBoxReinforced.SelectedItem = null;
+ }
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (comboBoxShop.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите магазин", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (comboBoxReinforced.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Добавление изделия в магазин");
+ try
+ {
+ var reinforced = _reinforcedLogic.ReadElement(new()
+ {
+ Id = (int)comboBoxReinforced.SelectedValue
+ });
+ if (reinforced == null)
+ {
+ throw new Exception("Не найдено изделие. Дополнительная информация в логах.");
+ }
+ var resultOperation = _shopLogic.AddReinforced(
+ model: new() { Id = (int)comboBoxShop.SelectedValue },
+ reinforced: reinforced,
+ count: (int)numericUpDownCount.Value
+ );
+ if (!resultOperation)
+ {
+ throw new Exception("Ошибка при добавлении. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение",
+ MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.resx b/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReinforcedShop.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs
new file mode 100644
index 0000000..87b354b
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs
@@ -0,0 +1,92 @@
+namespace PrecastConcretePlant
+{
+ partial class FormReportGroupOrders
+ {
+ ///
+ /// 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.panel = new System.Windows.Forms.Panel();
+ this.buttonToPdf = new System.Windows.Forms.Button();
+ this.buttonMake = new System.Windows.Forms.Button();
+ this.panel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // panel
+ //
+ this.panel.Controls.Add(this.buttonToPdf);
+ this.panel.Controls.Add(this.buttonMake);
+ this.panel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.panel.Location = new System.Drawing.Point(0, 0);
+ this.panel.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
+ this.panel.Name = "panel";
+ this.panel.Size = new System.Drawing.Size(1178, 53);
+ this.panel.TabIndex = 0;
+ //
+ // buttonToPdf
+ //
+ this.buttonToPdf.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonToPdf.Location = new System.Drawing.Point(1003, 11);
+ this.buttonToPdf.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
+ this.buttonToPdf.Name = "buttonToPdf";
+ this.buttonToPdf.Size = new System.Drawing.Size(159, 36);
+ this.buttonToPdf.TabIndex = 5;
+ this.buttonToPdf.Text = "В Pdf";
+ this.buttonToPdf.UseVisualStyleBackColor = true;
+ this.buttonToPdf.Click += new System.EventHandler(this.ButtonToPdf_Click);
+ //
+ // buttonMake
+ //
+ this.buttonMake.Location = new System.Drawing.Point(544, 11);
+ this.buttonMake.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
+ this.buttonMake.Name = "buttonMake";
+ this.buttonMake.Size = new System.Drawing.Size(159, 36);
+ this.buttonMake.TabIndex = 4;
+ this.buttonMake.Text = "Сформировать";
+ this.buttonMake.UseVisualStyleBackColor = true;
+ this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
+ //
+ // FormReportGroupOrders
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1178, 863);
+ this.Controls.Add(this.panel);
+ this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
+ this.Name = "FormReportGroupOrders";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Заказы";
+ this.panel.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Panel panel;
+ private System.Windows.Forms.Button buttonToPdf;
+ private System.Windows.Forms.Button buttonMake;
+ }
+}
\ No newline at end of file
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.cs
new file mode 100644
index 0000000..69c2bac
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.cs
@@ -0,0 +1,71 @@
+using PrecastConcretePlantContracts.BindingModels;
+using PrecastConcretePlantContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using Microsoft.Reporting.WinForms;
+
+namespace PrecastConcretePlant
+{
+ public partial class FormReportGroupOrders : Form
+ {
+ private readonly ReportViewer reportViewer;
+
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportGroupOrders(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ reportViewer = new ReportViewer
+ {
+ Dock = DockStyle.Fill
+ };
+ reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportGroupOrders.rdlc", FileMode.Open));
+ Controls.Clear();
+ Controls.Add(reportViewer);
+ Controls.Add(panel);
+ }
+
+ private void ButtonMake_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var dataSource = _logic.GetGroupOrders();
+ var source = new ReportDataSource("DataSetOrders", dataSource);
+ reportViewer.LocalReport.DataSources.Clear();
+ reportViewer.LocalReport.DataSources.Add(source);
+ reportViewer.RefreshReport();
+ _logger.LogInformation("Загрузка списка заказов на весь период по датам");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonToPdf_Click(object sender, EventArgs e)
+ {
+ using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ _logic.SaveGroupOrdersToPdfFile(new ReportBindingModel
+ {
+ FileName = dialog.FileName
+ });
+ _logger.LogInformation("Сохранение списка заказов на весь период по датам");
+ MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения списка заказов на период");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+}
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.resx b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.Designer.cs
new file mode 100644
index 0000000..5d38bfe
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.Designer.cs
@@ -0,0 +1,113 @@
+namespace PrecastConcretePlant
+{
+ partial class FormReportShopReinforcedies
+ {
+ ///
+ /// 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();
+ ColumnShop = new DataGridViewTextBoxColumn();
+ ColumnPastry = new DataGridViewTextBoxColumn();
+ ColumnCount = new DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.AllowUserToAddRows = false;
+ dataGridView.AllowUserToDeleteRows = false;
+ dataGridView.AllowUserToOrderColumns = true;
+ dataGridView.AllowUserToResizeColumns = false;
+ dataGridView.AllowUserToResizeRows = false;
+ dataGridView.BackgroundColor = SystemColors.ControlLightLight;
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShop, ColumnPastry, ColumnCount });
+ dataGridView.Dock = DockStyle.Bottom;
+ dataGridView.Location = new Point(0, 47);
+ dataGridView.Margin = new Padding(4, 3, 4, 3);
+ dataGridView.MultiSelect = false;
+ dataGridView.Name = "dataGridView";
+ dataGridView.ReadOnly = true;
+ dataGridView.RowHeadersVisible = false;
+ dataGridView.Size = new Size(616, 510);
+ dataGridView.TabIndex = 0;
+ //
+ // buttonSaveToExcel
+ //
+ buttonSaveToExcel.Location = new Point(14, 14);
+ buttonSaveToExcel.Margin = new Padding(4, 3, 4, 3);
+ buttonSaveToExcel.Name = "buttonSaveToExcel";
+ buttonSaveToExcel.Size = new Size(186, 27);
+ buttonSaveToExcel.TabIndex = 1;
+ buttonSaveToExcel.Text = "Сохранить в Excel";
+ buttonSaveToExcel.UseVisualStyleBackColor = true;
+ buttonSaveToExcel.Click += ButtonSaveToExcel_Click;
+ //
+ // ColumnShop
+ //
+ ColumnShop.HeaderText = "Магазин";
+ ColumnShop.Name = "ColumnShop";
+ ColumnShop.ReadOnly = true;
+ ColumnShop.Width = 200;
+ //
+ // ColumnPastry
+ //
+ ColumnPastry.HeaderText = "Изделие";
+ ColumnPastry.Name = "ColumnPastry";
+ ColumnPastry.ReadOnly = true;
+ ColumnPastry.Width = 200;
+ //
+ // ColumnCount
+ //
+ ColumnCount.HeaderText = "Количество";
+ ColumnCount.Name = "ColumnCount";
+ ColumnCount.ReadOnly = true;
+ //
+ // FormReportShopPastries
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(616, 557);
+ Controls.Add(buttonSaveToExcel);
+ Controls.Add(dataGridView);
+ Margin = new Padding(4, 3, 4, 3);
+ Name = "FormReportShopPastries";
+ Text = "Изделия с компонентами";
+ Load += FormReportShopReinforcedies_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DataGridView dataGridView;
+ private System.Windows.Forms.Button buttonSaveToExcel;
+ private DataGridViewTextBoxColumn ColumnShop;
+ private DataGridViewTextBoxColumn ColumnPastry;
+ private DataGridViewTextBoxColumn ColumnCount;
+ }
+}
\ No newline at end of file
diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.cs
new file mode 100644
index 0000000..07645a0
--- /dev/null
+++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.cs
@@ -0,0 +1,80 @@
+using PrecastConcretePlantContracts.BindingModels;
+using PrecastConcretePlantContracts.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 PrecastConcretePlant
+{
+ public partial class FormReportShopReinforcedies : Form
+ {
+ private readonly ILogger _logger;
+
+ private readonly IReportLogic _logic;
+
+ public FormReportShopReinforcedies(ILogger logger, IReportLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormReportShopReinforcedies_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ var dict = _logic.GetShopReinforcedies();
+ if (dict != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var elem in dict)
+ {
+ dataGridView.Rows.Add(new object[] { elem.ShopName, "", "" });
+ foreach (var listElem in elem.Reinforcedies)
+ {
+ dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
+ }
+ dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount });
+ dataGridView.Rows.Add(new object[] { "Загруженность", "", Math.Round(elem.Workload * 100, 2).ToString() + "%" });
+ dataGridView.Rows.Add(Array.Empty