LabWork04_hard :<
This commit is contained in:
parent
478eb1d5da
commit
450a1d6313
@ -37,14 +37,18 @@
|
|||||||
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.DataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.CreateOrderButton = new System.Windows.Forms.Button();
|
this.CreateOrderButton = new System.Windows.Forms.Button();
|
||||||
this.TakeOrderInWorkButton = new System.Windows.Forms.Button();
|
this.TakeOrderInWorkButton = new System.Windows.Forms.Button();
|
||||||
this.OrderReadyButton = new System.Windows.Forms.Button();
|
this.OrderReadyButton = new System.Windows.Forms.Button();
|
||||||
this.IssuedOrderButton = new System.Windows.Forms.Button();
|
this.IssuedOrderButton = new System.Windows.Forms.Button();
|
||||||
this.UpdateListButton = new System.Windows.Forms.Button();
|
this.UpdateListButton = new System.Windows.Forms.Button();
|
||||||
this.ButtonAddReinforcedInShop = new System.Windows.Forms.Button();
|
|
||||||
this.SellReinforcedButton = 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.MenuStrip.SuspendLayout();
|
this.MenuStrip.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -90,13 +94,18 @@
|
|||||||
//
|
//
|
||||||
this.магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
this.магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||||
this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||||
|
this.магазиныToolStripMenuItem.Text = "Магазины";
|
||||||
|
this.магазиныToolStripMenuItem.Click += new System.EventHandler(this.магазиныToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// отчетыToolStripMenuItem
|
// отчетыToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.отчетыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
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,
|
||||||
|
this.списокГруппЗаказовToolStripMenuItem});
|
||||||
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
this.отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||||
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
|
this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
|
||||||
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
this.отчетыToolStripMenuItem.Text = "Отчеты";
|
||||||
@ -122,6 +131,27 @@
|
|||||||
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
|
||||||
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click);
|
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
|
// DataGridView
|
||||||
//
|
//
|
||||||
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
@ -188,16 +218,6 @@
|
|||||||
this.UpdateListButton.UseVisualStyleBackColor = true;
|
this.UpdateListButton.UseVisualStyleBackColor = true;
|
||||||
this.UpdateListButton.Click += new System.EventHandler(this.UpdateListButton_Click);
|
this.UpdateListButton.Click += new System.EventHandler(this.UpdateListButton_Click);
|
||||||
//
|
//
|
||||||
// ButtonAddReinforcedInShop
|
|
||||||
//
|
|
||||||
this.ButtonAddReinforcedInShop.Location = new System.Drawing.Point(905, 228);
|
|
||||||
this.ButtonAddReinforcedInShop.Name = "ButtonAddReinforcedInShop";
|
|
||||||
this.ButtonAddReinforcedInShop.Size = new System.Drawing.Size(125, 42);
|
|
||||||
this.ButtonAddReinforcedInShop.TabIndex = 7;
|
|
||||||
this.ButtonAddReinforcedInShop.Text = "Пополнение магазина";
|
|
||||||
this.ButtonAddReinforcedInShop.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonAddReinforcedInShop.Click += new System.EventHandler(this.ButtonAddReinforcedInShop_Click);
|
|
||||||
//
|
|
||||||
// SellReinforcedButton
|
// SellReinforcedButton
|
||||||
//
|
//
|
||||||
this.SellReinforcedButton.Location = new System.Drawing.Point(905, 276);
|
this.SellReinforcedButton.Location = new System.Drawing.Point(905, 276);
|
||||||
@ -208,11 +228,33 @@
|
|||||||
this.SellReinforcedButton.UseVisualStyleBackColor = true;
|
this.SellReinforcedButton.UseVisualStyleBackColor = true;
|
||||||
this.SellReinforcedButton.Click += new System.EventHandler(this.SellReinforcedButton_Click);
|
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
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1209, 450);
|
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.UpdateListButton);
|
||||||
this.Controls.Add(this.IssuedOrderButton);
|
this.Controls.Add(this.IssuedOrderButton);
|
||||||
this.Controls.Add(this.OrderReadyButton);
|
this.Controls.Add(this.OrderReadyButton);
|
||||||
@ -250,7 +292,11 @@
|
|||||||
private Button OrderReadyButton;
|
private Button OrderReadyButton;
|
||||||
private Button IssuedOrderButton;
|
private Button IssuedOrderButton;
|
||||||
private Button UpdateListButton;
|
private Button UpdateListButton;
|
||||||
public Button ButtonAddReinforcedInShop;
|
|
||||||
public Button SellReinforcedButton;
|
public Button SellReinforcedButton;
|
||||||
|
private Button buttonSellReinforced;
|
||||||
|
private Button buttonAddReinforcedInShop;
|
||||||
|
private ToolStripMenuItem списокМагазиновToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem магазиныСИзделиямиToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem списокГруппЗаказовToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PrecastConcretePlant;
|
||||||
using PrecastConcretePlantBusinessLogic.BusinessLogic;
|
using PrecastConcretePlantBusinessLogic.BusinessLogic;
|
||||||
using PrecastConcretePlantContracts.BindingModels;
|
using PrecastConcretePlantContracts.BindingModels;
|
||||||
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
using PrecastConcretePlantContracts.BusinessLogicsContracts;
|
||||||
@ -201,23 +202,6 @@ namespace PrecastConcretePlantView
|
|||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
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 SellReinforcedButton_Click(object sender, EventArgs e)
|
private void SellReinforcedButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -259,5 +243,60 @@ namespace PrecastConcretePlantView
|
|||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
141
PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs
generated
Normal file
141
PrecastConcretePlant/PrecastConcretePlant/FormReportGroupOrders.Designer.cs
generated
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
namespace PrecastConcretePlant
|
||||||
|
{
|
||||||
|
partial class FormReportGroupOrders
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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.dateTimePickerTo = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.labelTo = new System.Windows.Forms.Label();
|
||||||
|
this.dateTimePickerFrom = new System.Windows.Forms.DateTimePicker();
|
||||||
|
this.labelFrom = new System.Windows.Forms.Label();
|
||||||
|
this.panel.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel
|
||||||
|
//
|
||||||
|
this.panel.Controls.Add(this.buttonToPdf);
|
||||||
|
this.panel.Controls.Add(this.buttonMake);
|
||||||
|
this.panel.Controls.Add(this.dateTimePickerTo);
|
||||||
|
this.panel.Controls.Add(this.labelTo);
|
||||||
|
this.panel.Controls.Add(this.dateTimePickerFrom);
|
||||||
|
this.panel.Controls.Add(this.labelFrom);
|
||||||
|
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(4, 3, 4, 3);
|
||||||
|
this.panel.Name = "panel";
|
||||||
|
this.panel.Size = new System.Drawing.Size(1031, 40);
|
||||||
|
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(878, 8);
|
||||||
|
this.buttonToPdf.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.buttonToPdf.Name = "buttonToPdf";
|
||||||
|
this.buttonToPdf.Size = new System.Drawing.Size(139, 27);
|
||||||
|
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(476, 8);
|
||||||
|
this.buttonMake.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.buttonMake.Name = "buttonMake";
|
||||||
|
this.buttonMake.Size = new System.Drawing.Size(139, 27);
|
||||||
|
this.buttonMake.TabIndex = 4;
|
||||||
|
this.buttonMake.Text = "Сформировать";
|
||||||
|
this.buttonMake.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonMake.Click += new System.EventHandler(this.ButtonMake_Click);
|
||||||
|
//
|
||||||
|
// dateTimePickerTo
|
||||||
|
//
|
||||||
|
this.dateTimePickerTo.Location = new System.Drawing.Point(237, 7);
|
||||||
|
this.dateTimePickerTo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.dateTimePickerTo.Name = "dateTimePickerTo";
|
||||||
|
this.dateTimePickerTo.Size = new System.Drawing.Size(163, 23);
|
||||||
|
this.dateTimePickerTo.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// labelTo
|
||||||
|
//
|
||||||
|
this.labelTo.AutoSize = true;
|
||||||
|
this.labelTo.Location = new System.Drawing.Point(208, 10);
|
||||||
|
this.labelTo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
|
this.labelTo.Name = "labelTo";
|
||||||
|
this.labelTo.Size = new System.Drawing.Size(21, 15);
|
||||||
|
this.labelTo.TabIndex = 2;
|
||||||
|
this.labelTo.Text = "по";
|
||||||
|
//
|
||||||
|
// dateTimePickerFrom
|
||||||
|
//
|
||||||
|
this.dateTimePickerFrom.Location = new System.Drawing.Point(37, 7);
|
||||||
|
this.dateTimePickerFrom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.dateTimePickerFrom.Name = "dateTimePickerFrom";
|
||||||
|
this.dateTimePickerFrom.Size = new System.Drawing.Size(163, 23);
|
||||||
|
this.dateTimePickerFrom.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// labelFrom
|
||||||
|
//
|
||||||
|
this.labelFrom.AutoSize = true;
|
||||||
|
this.labelFrom.Location = new System.Drawing.Point(14, 10);
|
||||||
|
this.labelFrom.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
|
this.labelFrom.Name = "labelFrom";
|
||||||
|
this.labelFrom.Size = new System.Drawing.Size(15, 15);
|
||||||
|
this.labelFrom.TabIndex = 0;
|
||||||
|
this.labelFrom.Text = "С";
|
||||||
|
//
|
||||||
|
// FormReportOrders
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1031, 647);
|
||||||
|
this.Controls.Add(this.panel);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
|
this.Name = "FormReportOrders";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "Заказы";
|
||||||
|
this.panel.ResumeLayout(false);
|
||||||
|
this.panel.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Panel panel;
|
||||||
|
private System.Windows.Forms.Button buttonToPdf;
|
||||||
|
private System.Windows.Forms.Button buttonMake;
|
||||||
|
private System.Windows.Forms.DateTimePicker dateTimePickerTo;
|
||||||
|
private System.Windows.Forms.Label labelTo;
|
||||||
|
private System.Windows.Forms.DateTimePicker dateTimePickerFrom;
|
||||||
|
private System.Windows.Forms.Label labelFrom;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
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<FormReportGroupOrders> 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)
|
||||||
|
{
|
||||||
|
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dataSource = _logic.GetGroupOrders(new ReportBindingModel
|
||||||
|
{
|
||||||
|
DateFrom = dateTimePickerFrom.Value,
|
||||||
|
DateTo = dateTimePickerTo.Value
|
||||||
|
});
|
||||||
|
var source = new ReportDataSource("DataSetOrders", dataSource);
|
||||||
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
|
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
||||||
|
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
||||||
|
reportViewer.LocalReport.SetParameters(parameters);
|
||||||
|
|
||||||
|
reportViewer.RefreshReport();
|
||||||
|
_logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка заказов на период");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonToPdf_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logic.SaveOrdersToPdfFile(new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = dialog.FileName,
|
||||||
|
DateFrom = dateTimePickerFrom.Value,
|
||||||
|
DateTo = dateTimePickerTo.Value
|
||||||
|
});
|
||||||
|
_logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
113
PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.Designer.cs
generated
Normal file
113
PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
namespace PrecastConcretePlant
|
||||||
|
{
|
||||||
|
partial class FormReportShopReinforcedies
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -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<FormReportShopReinforcedies> 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<object>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка списка изделий по компонентам");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSaveToExcel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using var dialog = new SaveFileDialog { Filter = "xlsx|*.xlsx" };
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_logic.SaveShopReinforcedToExcelFile(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -8,6 +8,7 @@ using PrecastConcretePlantBusinessLogic.PrecastConcretePlantBusinessLogic.Busine
|
|||||||
using PrecastConcretePlantDatabaseImplement.Implements;
|
using PrecastConcretePlantDatabaseImplement.Implements;
|
||||||
using PrecastConcretePlantBusinessLogic.OfficePackage.Implements;
|
using PrecastConcretePlantBusinessLogic.OfficePackage.Implements;
|
||||||
using PrecastConcretePlantBusinessLogic.OfficePackage;
|
using PrecastConcretePlantBusinessLogic.OfficePackage;
|
||||||
|
using PrecastConcretePlant;
|
||||||
|
|
||||||
namespace PrecastConcretePlantView
|
namespace PrecastConcretePlantView
|
||||||
{
|
{
|
||||||
@ -41,10 +42,12 @@ namespace PrecastConcretePlantView
|
|||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
|
services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
services.AddTransient<IShopLogic, ShopLogic>();
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
services.AddTransient<IShopLogic, ShopLogic>();
|
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormComponent>();
|
services.AddTransient<FormComponent>();
|
||||||
services.AddTransient<FormComponents>();
|
services.AddTransient<FormComponents>();
|
||||||
@ -52,6 +55,14 @@ namespace PrecastConcretePlantView
|
|||||||
services.AddTransient<FormReinforced>();
|
services.AddTransient<FormReinforced>();
|
||||||
services.AddTransient<FormReinforcedComponent>();
|
services.AddTransient<FormReinforcedComponent>();
|
||||||
services.AddTransient<FormReinforceds>();
|
services.AddTransient<FormReinforceds>();
|
||||||
|
services.AddTransient<FormReinforcedShop>();
|
||||||
|
services.AddTransient<FormShops>();
|
||||||
|
services.AddTransient<FormShop>();
|
||||||
|
services.AddTransient<FormSellReinforced>();
|
||||||
|
services.AddTransient<FormReportShopReinforcedies>();
|
||||||
|
services.AddTransient<FormReportReinforcedComponents>();
|
||||||
|
services.AddTransient<FormReportGroupOrders>();
|
||||||
|
services.AddTransient<FormReportOrder>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,16 +17,18 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
private readonly IComponentStorage _componentStorage;
|
private readonly IComponentStorage _componentStorage;
|
||||||
private readonly IReinforcedStorage _reinforcedStorage;
|
private readonly IReinforcedStorage _reinforcedStorage;
|
||||||
|
private readonly IShopStorage _shopStorage;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
private readonly AbstractSaveToExcel _saveToExcel;
|
private readonly AbstractSaveToExcel _saveToExcel;
|
||||||
private readonly AbstractSaveToWord _saveToWord;
|
private readonly AbstractSaveToWord _saveToWord;
|
||||||
private readonly AbstractSaveToPdf _saveToPdf;
|
private readonly AbstractSaveToPdf _saveToPdf;
|
||||||
public ReportLogic(IReinforcedStorage reinforcedStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
public ReportLogic(IReinforcedStorage reinforcedStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, IShopStorage shopStorage, AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||||
{
|
{
|
||||||
_reinforcedStorage = reinforcedStorage;
|
_reinforcedStorage = reinforcedStorage;
|
||||||
_componentStorage = componentStorage;
|
_componentStorage = componentStorage;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
_saveToExcel = saveToExcel;
|
_saveToExcel = saveToExcel;
|
||||||
|
_shopStorage = shopStorage;
|
||||||
_saveToWord = saveToWord;
|
_saveToWord = saveToWord;
|
||||||
_saveToPdf = saveToPdf;
|
_saveToPdf = saveToPdf;
|
||||||
}
|
}
|
||||||
@ -81,12 +83,12 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
|
|||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список документов",
|
Title = "Список документов",
|
||||||
Reinforceds = _reinforcedStorage.GetFullList()
|
Reinforcedies = _reinforcedStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void SaveReinforcedComponentToExcelFile(ReportBindingModel model)
|
public void SaveReinforcedComponentToExcelFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToExcel.CreateReport(new ExcelInfo
|
_saveToExcel.CreateReportReinforced(new ExcelInfoReinforced
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список документов",
|
Title = "Список документов",
|
||||||
@ -96,7 +98,7 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
|
|||||||
|
|
||||||
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
public void SaveOrdersToPdfFile(ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToPdf.CreateDoc(new PdfInfo
|
_saveToPdf.CreateDocOrders(new PdfInfoOrders
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список заказов",
|
Title = "Список заказов",
|
||||||
@ -106,5 +108,79 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ReportShopReinforcedViewModel> GetShopReinforcedies()
|
||||||
|
{
|
||||||
|
var shops = _shopStorage.GetFullList();
|
||||||
|
|
||||||
|
var reinforcedies = _reinforcedStorage.GetFullList();
|
||||||
|
|
||||||
|
var list = new List<ReportShopReinforcedViewModel>();
|
||||||
|
|
||||||
|
foreach (var shop in shops)
|
||||||
|
{
|
||||||
|
var record = new ReportShopReinforcedViewModel
|
||||||
|
{
|
||||||
|
ShopName = shop.Name,
|
||||||
|
Reinforcedies = new List<Tuple<string, int>>(),
|
||||||
|
TotalCount = 0
|
||||||
|
};
|
||||||
|
foreach (var reinforced in reinforcedies)
|
||||||
|
{
|
||||||
|
if (shop.ShopReinforcedies.ContainsKey(reinforced.Id))
|
||||||
|
{
|
||||||
|
record.Reinforcedies.Add(new(reinforced.ReinforcedName, shop.ShopReinforcedies[reinforced.Id].Item2));
|
||||||
|
record.TotalCount += shop.ShopReinforcedies[reinforced.Id].Item2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
record.Workload = record.TotalCount / (double)shop.ReinforcedMaxCount;
|
||||||
|
list.Add(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
public List<ReportGroupOrdersViewModel> GetGroupOrders(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
return _orderStorage.GetFullList()
|
||||||
|
.GroupBy(x => x.DateCreate.Date)
|
||||||
|
.Select(x => new ReportGroupOrdersViewModel
|
||||||
|
{
|
||||||
|
Date = x.Key,
|
||||||
|
Count = x.Count(),
|
||||||
|
Sum = x.Sum(y => y.Sum)
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SaveShopsTableToWordFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToWord.CreateDocTable(new WordInfoTable
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список магазинов",
|
||||||
|
Shops = _shopStorage.GetFullList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveGroupOrdersToPdfFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToPdf.CreateDoc(new PdfInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список сгруппированных заказов по датам",
|
||||||
|
DateFrom = model.DateFrom!.Value,
|
||||||
|
DateTo = model.DateTo!.Value,
|
||||||
|
Orders = GetGroupOrders(model)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveShopReinforcedToExcelFile(ReportBindingModel model)
|
||||||
|
{
|
||||||
|
_saveToExcel.CreateReportShop(new ExcelInfo
|
||||||
|
{
|
||||||
|
FileName = model.FileName,
|
||||||
|
Title = "Список магазинов",
|
||||||
|
ShopReinforcedies = GetShopReinforcedies()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,10 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
public abstract class AbstractSaveToExcel
|
public abstract class AbstractSaveToExcel
|
||||||
{
|
{
|
||||||
public void CreateReport(ExcelInfo info)
|
public void CreateReportShop(ExcelInfo info)
|
||||||
{
|
{
|
||||||
CreateExcel(info);
|
CreateExcel(info);
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
@ -20,11 +21,99 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
Text = info.Title,
|
Text = info.Title,
|
||||||
StyleInfo = ExcelStyleInfoType.Title
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
});
|
});
|
||||||
|
|
||||||
MergeCells(new ExcelMergeParameters
|
MergeCells(new ExcelMergeParameters
|
||||||
{
|
{
|
||||||
CellFromName = "A1",
|
CellFromName = "A1",
|
||||||
CellToName = "C1"
|
CellToName = "C1"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
uint rowIndex = 2;
|
||||||
|
foreach (var pc in info.ShopReinforcedies)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = pc.ShopName,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
rowIndex++;
|
||||||
|
|
||||||
|
foreach (var (Shop, Count) in pc.Reinforcedies)
|
||||||
|
{
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "B",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = Shop,
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||||
|
});
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = Count.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||||
|
});
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = "Итого",
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = pc.TotalCount.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
rowIndex++;
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = "Загруженность",
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "C",
|
||||||
|
RowIndex = rowIndex,
|
||||||
|
Text = pc.Workload.ToString(),
|
||||||
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
|
});
|
||||||
|
rowIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveExcel(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateReportReinforced(ExcelInfoReinforced info)
|
||||||
|
{
|
||||||
|
CreateExcel(new() { FileName = info.FileName });
|
||||||
|
|
||||||
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
|
{
|
||||||
|
ColumnName = "A",
|
||||||
|
RowIndex = 1,
|
||||||
|
Text = info.Title,
|
||||||
|
StyleInfo = ExcelStyleInfoType.Title
|
||||||
|
});
|
||||||
|
|
||||||
|
MergeCells(new ExcelMergeParameters
|
||||||
|
{
|
||||||
|
CellFromName = "A1",
|
||||||
|
CellToName = "C1"
|
||||||
|
});
|
||||||
|
|
||||||
uint rowIndex = 2;
|
uint rowIndex = 2;
|
||||||
foreach (var pc in info.ReinforcedComponents)
|
foreach (var pc in info.ReinforcedComponents)
|
||||||
{
|
{
|
||||||
@ -36,15 +125,17 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
foreach (var (Component, Count) in pc.Components)
|
|
||||||
|
foreach (var (Reinforced, Count) in pc.Components)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "B",
|
ColumnName = "B",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = Component,
|
Text = Reinforced,
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||||
});
|
});
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "C",
|
ColumnName = "C",
|
||||||
@ -52,8 +143,10 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
Text = Count.ToString(),
|
Text = Count.ToString(),
|
||||||
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
StyleInfo = ExcelStyleInfoType.TextWithBorder
|
||||||
});
|
});
|
||||||
|
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
@ -70,12 +163,32 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
SaveExcel(info);
|
|
||||||
|
SaveExcel(new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Создание excel-файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
protected abstract void CreateExcel(ExcelInfo info);
|
protected abstract void CreateExcel(ExcelInfo info);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавляем новую ячейку в лист
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cellParameters"></param>
|
||||||
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
protected abstract void InsertCellInWorksheet(ExcelCellParameters excelParams);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Объединение ячеек
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mergeParameters"></param>
|
||||||
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
protected abstract void MergeCells(ExcelMergeParameters excelParams);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение файла
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
protected abstract void SaveExcel(ExcelInfo info);
|
protected abstract void SaveExcel(ExcelInfo info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,47 +13,79 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
public void CreateDoc(PdfInfo info)
|
public void CreateDoc(PdfInfo info)
|
||||||
{
|
{
|
||||||
CreatePdf(info);
|
CreatePdf(info);
|
||||||
|
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||||
CreateParagraph(new PdfParagraph
|
CreateParagraph(new PdfParagraph
|
||||||
{
|
{
|
||||||
Text = info.Title,
|
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
CreateParagraph(new PdfParagraph
|
|
||||||
{
|
|
||||||
Text = $"с{info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "4cm" });
|
|
||||||
|
CreateTable(new List<string> { "3cm", "4cm", "5cm" });
|
||||||
|
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма", "Статус" },
|
Texts = new List<string> { "Дата", "Количество", "Сумма" },
|
||||||
Style = "NormalTitle",
|
Style = "NormalTitle",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var order in info.Orders)
|
foreach (var order in info.Orders)
|
||||||
{
|
{
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.ReinforcedName, order.Sum.ToString(), order.Status },
|
Texts = new List<string> { order.Date.ToShortDateString(), order.Count.ToString(), order.Sum.ToString() },
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
|
||||||
|
|
||||||
|
SavePdf(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateDocOrders(PdfInfoOrders info)
|
||||||
|
{
|
||||||
|
CreatePdf(info);
|
||||||
|
CreateParagraph(new PdfParagraph { Text = info.Title, Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center });
|
||||||
CreateParagraph(new PdfParagraph
|
CreateParagraph(new PdfParagraph
|
||||||
{
|
{
|
||||||
Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t",
|
Text = $"с {info.DateFrom.ToShortDateString()} по {info.DateTo.ToShortDateString()}",
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Right
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" });
|
||||||
|
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус заказа", "Сумма" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var order in info.Orders)
|
||||||
|
{
|
||||||
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.ReinforcedName, Convert.ToString(order.Status), order.Sum.ToString() },
|
||||||
|
Style = "Normal",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
|
});
|
||||||
|
}
|
||||||
|
CreateParagraph(new PdfParagraph { Text = $"Итого: {info.Orders.Sum(x => x.Sum)}\t", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Right });
|
||||||
|
|
||||||
SavePdf(info);
|
SavePdf(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void CreatePdf(PdfInfo info);
|
protected abstract void CreatePdf(PdfInfo info);
|
||||||
|
|
||||||
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
protected abstract void CreateParagraph(PdfParagraph paragraph);
|
||||||
|
|
||||||
protected abstract void CreateTable(List<string> columns);
|
protected abstract void CreateTable(List<string> columns);
|
||||||
|
|
||||||
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
protected abstract void CreateRow(PdfRowParameters rowParameters);
|
||||||
|
|
||||||
protected abstract void SavePdf(PdfInfo info);
|
protected abstract void SavePdf(PdfInfo info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,10 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
public abstract class AbstractSaveToWord
|
public abstract class AbstractSaveToWord
|
||||||
{
|
{
|
||||||
public void CreateDoc(WordInfo info)
|
public void CreateDocTable(WordInfoTable info)
|
||||||
{
|
{
|
||||||
CreateWord(info);
|
CreateWord(info);
|
||||||
|
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||||
@ -22,14 +23,48 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
foreach (var reinforced in info.Reinforceds)
|
|
||||||
|
CreateTable(new()
|
||||||
|
{
|
||||||
|
("Название", 3000),
|
||||||
|
("Дата", null),
|
||||||
|
("Адрес открытия", 4500),
|
||||||
|
},
|
||||||
|
info.Shops
|
||||||
|
.Select(x => new List<string>
|
||||||
|
{
|
||||||
|
x.Name,
|
||||||
|
Convert.ToString(x.DateOpening),
|
||||||
|
x.Address,
|
||||||
|
})
|
||||||
|
.ToList());
|
||||||
|
|
||||||
|
SaveWord(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateDoc(WordInfo info)
|
||||||
|
{
|
||||||
|
CreateWord(new() { FileName = info.FileName });
|
||||||
|
|
||||||
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Center
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (var reinforced in info.Reinforcedies)
|
||||||
{
|
{
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)>
|
Texts = new List<(string, WordTextProperties)>
|
||||||
{(reinforced.ReinforcedName + " - ", new WordTextProperties { Size = "24", Bold = true}),
|
{
|
||||||
(reinforced.Price.ToString(), new WordTextProperties { Size = "24", })},
|
(reinforced.ReinforcedName , new WordTextProperties { Size = "24", Bold = true}),
|
||||||
|
(" - цена: " + reinforced.Price.ToString(), new WordTextProperties { Size = "24" })
|
||||||
|
},
|
||||||
TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
Size = "24",
|
Size = "24",
|
||||||
@ -37,10 +72,15 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
SaveWord(info);
|
|
||||||
|
SaveWord(new());
|
||||||
}
|
}
|
||||||
protected abstract void CreateWord(WordInfo info);
|
|
||||||
|
protected abstract void CreateWord(WordInfoTable info);
|
||||||
|
|
||||||
protected abstract void CreateParagraph(WordParagraph paragraph);
|
protected abstract void CreateParagraph(WordParagraph paragraph);
|
||||||
protected abstract void SaveWord(WordInfo info);
|
|
||||||
|
protected abstract void CreateTable(List<(string, int?)> nameAndWidthColumns, List<List<string>> rows);
|
||||||
|
protected abstract void SaveWord(WordInfoTable info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<ReportReinforcedComponentViewModel> ReinforcedComponents { get; set; } = new();
|
public List<ReportShopReinforcedViewModel> ShopReinforcedies { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
using PrecastConcretePlantContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class ExcelInfoReinforced
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public List<ReportReinforcedComponentViewModel> ReinforcedComponents
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = new();
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,6 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
|||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public DateTime DateFrom { get; set; }
|
public DateTime DateFrom { get; set; }
|
||||||
public DateTime DateTo { get; set; }
|
public DateTime DateTo { get; set; }
|
||||||
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
public List<ReportGroupOrdersViewModel> Orders { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
using PrecastConcretePlantContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class PdfInfoOrders
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public DateTime DateFrom { get; set; }
|
||||||
|
public DateTime DateTo { get; set; }
|
||||||
|
public List<ReportOrdersViewModel> Orders { get; set; } = new();
|
||||||
|
|
||||||
|
public static implicit operator PdfInfo(PdfInfoOrders orders)
|
||||||
|
{
|
||||||
|
return new PdfInfo()
|
||||||
|
{
|
||||||
|
DateFrom = orders.DateFrom,
|
||||||
|
DateTo = orders.DateTo,
|
||||||
|
FileName = orders.FileName,
|
||||||
|
Title = orders.Title
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,7 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
|||||||
{
|
{
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string Title { get; set; } = string.Empty;
|
public string Title { get; set; } = string.Empty;
|
||||||
public List<ReinforcedViewModel> Reinforceds { get; set; } = new();
|
public List<ReinforcedViewModel> Reinforcedies { get; set; } = new();
|
||||||
|
public List<ReinforcedViewModel> Shops { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
using PrecastConcretePlantContracts.ViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels
|
||||||
|
{
|
||||||
|
public class WordInfoTable
|
||||||
|
{
|
||||||
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public List<ShopViewModel> Shops { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -3,26 +3,22 @@ using DocumentFormat.OpenXml.Packaging;
|
|||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
using PrecastConcretePlantBusinessLogic.OfficePackage.HelperEnums;
|
using PrecastConcretePlantBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels;
|
using PrecastConcretePlantBusinessLogic.OfficePackage.HelperModels;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
|
||||||
using Document = DocumentFormat.OpenXml.Wordprocessing.Document;
|
|
||||||
using Text = DocumentFormat.OpenXml.Wordprocessing.Text;
|
|
||||||
|
|
||||||
namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
||||||
{
|
{
|
||||||
public class SaveToWord : AbstractSaveToWord
|
public class SaveToWord : AbstractSaveToWord
|
||||||
{
|
{
|
||||||
private WordprocessingDocument? _wordDocument;
|
private WordprocessingDocument? _wordDocument;
|
||||||
|
|
||||||
private Body? _docBody;
|
private Body? _docBody;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
private static JustificationValues
|
/// Получение типа выравнивания
|
||||||
GetJustificationValues(WordJustificationType type)
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||||
{
|
{
|
||||||
return type switch
|
return type switch
|
||||||
{
|
{
|
||||||
@ -32,54 +28,68 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Настройки страницы
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
private static SectionProperties CreateSectionProperties()
|
private static SectionProperties CreateSectionProperties()
|
||||||
{
|
{
|
||||||
var properties = new SectionProperties();
|
var properties = new SectionProperties();
|
||||||
|
|
||||||
var pageSize = new PageSize
|
var pageSize = new PageSize
|
||||||
{
|
{
|
||||||
Orient = PageOrientationValues.Portrait
|
Orient = PageOrientationValues.Portrait
|
||||||
};
|
};
|
||||||
|
|
||||||
properties.AppendChild(pageSize);
|
properties.AppendChild(pageSize);
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ParagraphProperties?
|
/// <summary>
|
||||||
CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
/// Задание форматирования для абзаца
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paragraphProperties"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||||
{
|
{
|
||||||
if (paragraphProperties == null)
|
if (paragraphProperties == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var properties = new ParagraphProperties();
|
var properties = new ParagraphProperties();
|
||||||
|
|
||||||
properties.AppendChild(new Justification()
|
properties.AppendChild(new Justification()
|
||||||
{
|
{
|
||||||
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
||||||
});
|
});
|
||||||
|
|
||||||
properties.AppendChild(new SpacingBetweenLines
|
properties.AppendChild(new SpacingBetweenLines
|
||||||
{
|
{
|
||||||
LineRule = LineSpacingRuleValues.Auto
|
LineRule = LineSpacingRuleValues.Auto
|
||||||
});
|
});
|
||||||
|
|
||||||
properties.AppendChild(new Indentation());
|
properties.AppendChild(new Indentation());
|
||||||
|
|
||||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||||
{
|
{
|
||||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
paragraphMarkRunProperties.AppendChild(new FontSize { Val = paragraphProperties.Size });
|
||||||
{
|
|
||||||
Val =
|
|
||||||
paragraphProperties.Size
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
properties.AppendChild(paragraphMarkRunProperties);
|
properties.AppendChild(paragraphMarkRunProperties);
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateWord(WordInfo info)
|
protected override void CreateWord(WordInfoTable info)
|
||||||
{
|
{
|
||||||
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
||||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||||
mainPart.Document = new Document();
|
mainPart.Document = new Document();
|
||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
_docBody = mainPart.Document.AppendChild(new Body());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CreateParagraph(WordParagraph paragraph)
|
protected override void CreateParagraph(WordParagraph paragraph)
|
||||||
{
|
{
|
||||||
if (_docBody == null || paragraph == null)
|
if (_docBody == null || paragraph == null)
|
||||||
@ -89,9 +99,11 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
var docParagraph = new Paragraph();
|
var docParagraph = new Paragraph();
|
||||||
|
|
||||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||||
|
|
||||||
foreach (var run in paragraph.Texts)
|
foreach (var run in paragraph.Texts)
|
||||||
{
|
{
|
||||||
var docRun = new Run();
|
var docRun = new Run();
|
||||||
|
|
||||||
var properties = new RunProperties();
|
var properties = new RunProperties();
|
||||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||||
if (run.Item2.Bold)
|
if (run.Item2.Bold)
|
||||||
@ -99,24 +111,66 @@ namespace PrecastConcretePlantBusinessLogic.OfficePackage.Implements
|
|||||||
properties.AppendChild(new Bold());
|
properties.AppendChild(new Bold());
|
||||||
}
|
}
|
||||||
docRun.AppendChild(properties);
|
docRun.AppendChild(properties);
|
||||||
docRun.AppendChild(new Text
|
|
||||||
{
|
docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve });
|
||||||
Text = run.Item1,
|
|
||||||
Space = SpaceProcessingModeValues.Preserve
|
|
||||||
});
|
|
||||||
docParagraph.AppendChild(docRun);
|
docParagraph.AppendChild(docRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
_docBody.AppendChild(docParagraph);
|
_docBody.AppendChild(docParagraph);
|
||||||
}
|
}
|
||||||
protected override void SaveWord(WordInfo info)
|
|
||||||
|
protected override void SaveWord(WordInfoTable info)
|
||||||
{
|
{
|
||||||
if (_docBody == null || _wordDocument == null)
|
if (_docBody == null || _wordDocument == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_docBody.AppendChild(CreateSectionProperties());
|
_docBody.AppendChild(CreateSectionProperties());
|
||||||
|
|
||||||
_wordDocument.MainDocumentPart!.Document.Save();
|
_wordDocument.MainDocumentPart!.Document.Save();
|
||||||
|
|
||||||
_wordDocument.Close();
|
_wordDocument.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static TableCell GetTableCell(string text, int? widthCell = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
TableCell cell = new(new Paragraph(new Run(new Text(text))));
|
||||||
|
if (widthCell != null)
|
||||||
|
{
|
||||||
|
cell.Append(new TableCellProperties()
|
||||||
|
{
|
||||||
|
TableCellWidth = new() { Width = widthCell.ToString() }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateTable(List<(string, int?)> nameAndWidthColumns, List<List<string>> rows)
|
||||||
|
{
|
||||||
|
if (_docBody == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Table table = new();
|
||||||
|
TableProperties tblProp = new TableProperties(
|
||||||
|
new TableBorders(
|
||||||
|
new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 },
|
||||||
|
new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.BasicBlackDashes), Size = 3 }
|
||||||
|
)
|
||||||
|
);
|
||||||
|
table.AppendChild(tblProp);
|
||||||
|
|
||||||
|
table.Append(new TableRow(nameAndWidthColumns.Select(x => GetTableCell(x.Item1, x.Item2))));
|
||||||
|
|
||||||
|
table.Append(rows.Select(x => new TableRow(x.Select(y => GetTableCell(y)))));
|
||||||
|
|
||||||
|
_docBody.Append(table);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,15 @@ namespace PrecastConcretePlantContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
public interface IReportLogic
|
public interface IReportLogic
|
||||||
{
|
{
|
||||||
|
List<ReportShopReinforcedViewModel> GetShopReinforcedies();
|
||||||
List<ReportReinforcedComponentViewModel> GetReinforcedComponents();
|
List<ReportReinforcedComponentViewModel> GetReinforcedComponents();
|
||||||
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
List<ReportOrdersViewModel> GetOrders(ReportBindingModel model);
|
||||||
|
List<ReportGroupOrdersViewModel> GetGroupOrders(ReportBindingModel model);
|
||||||
void SaveReinforcedsToWordFile(ReportBindingModel model);
|
void SaveReinforcedsToWordFile(ReportBindingModel model);
|
||||||
void SaveReinforcedComponentToExcelFile(ReportBindingModel model);
|
void SaveReinforcedComponentToExcelFile(ReportBindingModel model);
|
||||||
void SaveOrdersToPdfFile(ReportBindingModel model);
|
void SaveOrdersToPdfFile(ReportBindingModel model);
|
||||||
|
void SaveShopsTableToWordFile(ReportBindingModel model);
|
||||||
|
void SaveShopReinforcedToExcelFile(ReportBindingModel model);
|
||||||
|
void SaveGroupOrdersToPdfFile(ReportBindingModel model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PrecastConcretePlantContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportGroupOrdersViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
|
public double Sum { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PrecastConcretePlantContracts.ViewModels
|
||||||
|
{
|
||||||
|
public class ReportShopReinforcedViewModel
|
||||||
|
{
|
||||||
|
public string ShopName { get; set; } = string.Empty;
|
||||||
|
public int TotalCount { get; set; }
|
||||||
|
public List<Tuple<string, int>> Reinforcedies { get; set; } = new();
|
||||||
|
public double Workload { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user