diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs index e07bf37..ce4055a 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs +++ b/PrecastConcretePlant/PrecastConcretePlant/FormMain.Designer.cs @@ -33,25 +33,36 @@ 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.ButtonAddReinforcedInShop = 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(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).BeginInit(); this.SuspendLayout(); // // MenuStrip // + this.MenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.СправочникиToolStripMenuItem}); + this.СправочникиToolStripMenuItem, + this.отчетыToolStripMenuItem}); this.MenuStrip.Location = new System.Drawing.Point(0, 0); this.MenuStrip.Name = "MenuStrip"; - this.MenuStrip.Size = new System.Drawing.Size(1042, 24); + this.MenuStrip.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3); + this.MenuStrip.Size = new System.Drawing.Size(1209, 30); this.MenuStrip.TabIndex = 0; this.MenuStrip.Text = "menuStrip1"; // @@ -62,44 +73,102 @@ this.КомпонентыToolStripMenuItem, this.магазиныToolStripMenuItem}); this.СправочникиToolStripMenuItem.Name = "СправочникиToolStripMenuItem"; - this.СправочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20); + this.СправочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24); this.СправочникиToolStripMenuItem.Text = "Cправочники"; // // ИзделияToolStripMenuItem // this.ИзделияToolStripMenuItem.Name = "ИзделияToolStripMenuItem"; - this.ИзделияToolStripMenuItem.Size = new System.Drawing.Size(145, 22); + this.ИзделияToolStripMenuItem.Size = new System.Drawing.Size(224, 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(145, 22); + this.КомпонентыToolStripMenuItem.Size = new System.Drawing.Size(224, 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(145, 22); + 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.Name = "отчетыToolStripMenuItem"; + this.отчетыToolStripMenuItem.Size = new System.Drawing.Size(73, 24); + this.отчетыToolStripMenuItem.Text = "Отчеты"; + // + // списокДокументов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); + // + // списокМагазинов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; - this.DataGridView.Location = new System.Drawing.Point(0, 27); + this.DataGridView.Location = new System.Drawing.Point(0, 36); + this.DataGridView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.DataGridView.Name = "DataGridView"; + this.DataGridView.RowHeadersWidth = 51; this.DataGridView.RowTemplate.Height = 25; - this.DataGridView.Size = new System.Drawing.Size(881, 421); + this.DataGridView.Size = new System.Drawing.Size(1007, 561); this.DataGridView.TabIndex = 1; // // CreateOrderButton // - this.CreateOrderButton.Location = new System.Drawing.Point(905, 27); + this.CreateOrderButton.Location = new System.Drawing.Point(1034, 36); + this.CreateOrderButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.CreateOrderButton.Name = "CreateOrderButton"; - this.CreateOrderButton.Size = new System.Drawing.Size(125, 33); + this.CreateOrderButton.Size = new System.Drawing.Size(143, 44); this.CreateOrderButton.TabIndex = 2; this.CreateOrderButton.Text = "Создать заказ"; this.CreateOrderButton.UseVisualStyleBackColor = true; @@ -107,9 +176,10 @@ // // TakeOrderInWorkButton // - this.TakeOrderInWorkButton.Location = new System.Drawing.Point(905, 66); + this.TakeOrderInWorkButton.Location = new System.Drawing.Point(1034, 88); + this.TakeOrderInWorkButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.TakeOrderInWorkButton.Name = "TakeOrderInWorkButton"; - this.TakeOrderInWorkButton.Size = new System.Drawing.Size(125, 39); + this.TakeOrderInWorkButton.Size = new System.Drawing.Size(143, 52); this.TakeOrderInWorkButton.TabIndex = 3; this.TakeOrderInWorkButton.Text = "Отдать на выполнение"; this.TakeOrderInWorkButton.UseVisualStyleBackColor = true; @@ -117,9 +187,10 @@ // // OrderReadyButton // - this.OrderReadyButton.Location = new System.Drawing.Point(905, 111); + this.OrderReadyButton.Location = new System.Drawing.Point(1034, 148); + this.OrderReadyButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.OrderReadyButton.Name = "OrderReadyButton"; - this.OrderReadyButton.Size = new System.Drawing.Size(125, 33); + this.OrderReadyButton.Size = new System.Drawing.Size(143, 44); this.OrderReadyButton.TabIndex = 4; this.OrderReadyButton.Text = "Заказ готов"; this.OrderReadyButton.UseVisualStyleBackColor = true; @@ -127,9 +198,10 @@ // // IssuedOrderButton // - this.IssuedOrderButton.Location = new System.Drawing.Point(905, 150); + this.IssuedOrderButton.Location = new System.Drawing.Point(1034, 200); + this.IssuedOrderButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.IssuedOrderButton.Name = "IssuedOrderButton"; - this.IssuedOrderButton.Size = new System.Drawing.Size(125, 33); + this.IssuedOrderButton.Size = new System.Drawing.Size(143, 44); this.IssuedOrderButton.TabIndex = 5; this.IssuedOrderButton.Text = "Заказ выдан"; this.IssuedOrderButton.UseVisualStyleBackColor = true; @@ -137,24 +209,15 @@ // // UpdateListButton // - this.UpdateListButton.Location = new System.Drawing.Point(905, 189); + this.UpdateListButton.Location = new System.Drawing.Point(1034, 252); + this.UpdateListButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.UpdateListButton.Name = "UpdateListButton"; - this.UpdateListButton.Size = new System.Drawing.Size(125, 33); + this.UpdateListButton.Size = new System.Drawing.Size(143, 44); this.UpdateListButton.TabIndex = 6; this.UpdateListButton.Text = "Обновить список"; this.UpdateListButton.UseVisualStyleBackColor = true; 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 // this.SellReinforcedButton.Location = new System.Drawing.Point(905, 276); @@ -165,13 +228,33 @@ 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(7F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1042, 450); - this.Controls.Add(this.SellReinforcedButton); - this.Controls.Add(this.ButtonAddReinforcedInShop); + 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); @@ -180,8 +263,10 @@ this.Controls.Add(this.DataGridView); this.Controls.Add(this.MenuStrip); this.MainMenuStrip = this.MenuStrip; + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.Name = "FormMain"; this.Text = "Завод ЖБИ"; + this.Load += new System.EventHandler(this.FormMain_Load); this.MenuStrip.ResumeLayout(false); this.MenuStrip.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.DataGridView)).EndInit(); @@ -196,14 +281,22 @@ 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; private Button OrderReadyButton; private Button IssuedOrderButton; private Button UpdateListButton; - private Button ButtonAddReinforcedInShop; - private ToolStripMenuItem магазиныToolStripMenuItem; - private Button SellReinforcedButton; + 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 b9a1692..53ba19f 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs +++ b/PrecastConcretePlant/PrecastConcretePlant/FormMain.cs @@ -1,5 +1,7 @@  using Microsoft.Extensions.Logging; +using PrecastConcretePlant; +using PrecastConcretePlantBusinessLogic.BusinessLogic; using PrecastConcretePlantContracts.BindingModels; using PrecastConcretePlantContracts.BusinessLogicsContracts; using PrecastConcretePlantDataModels.Enums; @@ -20,12 +22,13 @@ namespace PrecastConcretePlantView private readonly ILogger _logger; private readonly IOrderLogic _orderLogic; - - public FormMain(ILogger logger, IOrderLogic orderLogic) + private readonly IReportLogic _reportLogic; + public FormMain(ILogger logger, IOrderLogic orderLogic, IReportLogic reportLogic) { InitializeComponent(); _logger = logger; _orderLogic = orderLogic; + _reportLogic = reportLogic; LoadData(); } @@ -199,7 +202,86 @@ namespace PrecastConcretePlantView LoadData(); } - private void ButtonAddReinforcedInShop_Click(object sender, EventArgs e) + + 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.SaveReinforcedsToWordFile(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(FormReportReinforcedComponents)); + if (service is FormReportReinforcedComponents form) + { + form.ShowDialog(); + } + } + + private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormReportOrder)); + if (service is FormReportOrder 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.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) @@ -216,15 +298,5 @@ namespace PrecastConcretePlantView form.ShowDialog(); } } - - private void SellReinforcedButton_Click(object sender, EventArgs e) - { - var service = Program.ServiceProvider?.GetService(typeof(FormSellReinforced)); - - if (service is FormSellReinforced form) - { - form.ShowDialog(); - } - } } } 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/FormReportOrder.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportOrder.Designer.cs new file mode 100644 index 0000000..0d2e2e5 --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportOrder.Designer.cs @@ -0,0 +1,131 @@ +namespace PrecastConcretePlantView +{ + partial class FormReportOrder + { + /// + /// 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.buttonCreateToPdf = new System.Windows.Forms.Button(); + this.buttonCreateReport = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.dateTimePickerEnd = new System.Windows.Forms.DateTimePicker(); + this.dateTimePickerStart = new System.Windows.Forms.DateTimePicker(); + this.panel.SuspendLayout(); + this.SuspendLayout(); + // + // panel + // + this.panel.Controls.Add(this.buttonCreateToPdf); + this.panel.Controls.Add(this.buttonCreateReport); + this.panel.Controls.Add(this.label2); + this.panel.Controls.Add(this.label1); + this.panel.Controls.Add(this.dateTimePickerEnd); + this.panel.Controls.Add(this.dateTimePickerStart); + this.panel.Dock = System.Windows.Forms.DockStyle.Top; + this.panel.Location = new System.Drawing.Point(0, 0); + this.panel.Name = "panel"; + this.panel.Size = new System.Drawing.Size(984, 69); + this.panel.TabIndex = 0; + // + // buttonCreateToPdf + // + this.buttonCreateToPdf.Location = new System.Drawing.Point(782, 39); + this.buttonCreateToPdf.Name = "buttonCreateToPdf"; + this.buttonCreateToPdf.Size = new System.Drawing.Size(190, 27); + this.buttonCreateToPdf.TabIndex = 5; + this.buttonCreateToPdf.Text = "PDF"; + this.buttonCreateToPdf.UseVisualStyleBackColor = true; + this.buttonCreateToPdf.Click += new System.EventHandler(this.buttonCreateToPdf_Click); + // + // buttonCreateReport + // + this.buttonCreateReport.Location = new System.Drawing.Point(554, 39); + this.buttonCreateReport.Name = "buttonCreateReport"; + this.buttonCreateReport.Size = new System.Drawing.Size(190, 27); + this.buttonCreateReport.TabIndex = 4; + this.buttonCreateReport.Text = "Сформировать"; + this.buttonCreateReport.UseVisualStyleBackColor = true; + this.buttonCreateReport.Click += new System.EventHandler(this.buttonCreateReport_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(369, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(56, 20); + this.label2.TabIndex = 3; + this.label2.Text = "Конец:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(87, 6); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(64, 20); + this.label1.TabIndex = 2; + this.label1.Text = "Начало:"; + // + // dateTimePickerEnd + // + this.dateTimePickerEnd.Location = new System.Drawing.Point(307, 39); + this.dateTimePickerEnd.Name = "dateTimePickerEnd"; + this.dateTimePickerEnd.Size = new System.Drawing.Size(187, 27); + this.dateTimePickerEnd.TabIndex = 1; + // + // dateTimePickerStart + // + this.dateTimePickerStart.Location = new System.Drawing.Point(35, 39); + this.dateTimePickerStart.Name = "dateTimePickerStart"; + this.dateTimePickerStart.Size = new System.Drawing.Size(187, 27); + this.dateTimePickerStart.TabIndex = 0; + // + // FormReportOrder + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(984, 450); + this.Controls.Add(this.panel); + this.Name = "FormReportOrder"; + this.Text = "Заказы"; + this.panel.ResumeLayout(false); + this.panel.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private Panel panel; + private DateTimePicker dateTimePickerEnd; + private DateTimePicker dateTimePickerStart; + private Button buttonCreateToPdf; + private Button buttonCreateReport; + private Label label2; + private Label label1; + } +} \ No newline at end of file diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportOrder.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportOrder.cs new file mode 100644 index 0000000..bdded8c --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportOrder.cs @@ -0,0 +1,94 @@ +using PrecastConcretePlantContracts.BindingModels; +using PrecastConcretePlantContracts.BusinessLogicsContracts; +using Microsoft.Extensions.Logging; +using Microsoft.Reporting.WinForms; + +namespace PrecastConcretePlantView +{ + public partial class FormReportOrder : Form + { + private readonly ReportViewer reportViewer; + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportOrder(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + reportViewer = new ReportViewer + { + Dock = DockStyle.Fill + }; + reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); + Controls.Clear(); + Controls.Add(reportViewer); + Controls.Add(panel); + } + + private void buttonCreateReport_Click(object sender, EventArgs e) + { + if (dateTimePickerStart.Value.Date >= dateTimePickerEnd.Value.Date) + { + MessageBox.Show("Дата начала должна быть меньше даты окончания","Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + try + { + var dataSource = _logic.GetOrders(new ReportBindingModel + { + DateFrom = dateTimePickerStart.Value, + DateTo = dateTimePickerEnd.Value + }); + var source = new ReportDataSource("DataSetOrders", dataSource); + reportViewer.LocalReport.DataSources.Clear(); + reportViewer.LocalReport.DataSources.Add(source); + var parameters = new[] { new ReportParameter("ReportParameterPeriod", $"c{ dateTimePickerStart.Value.ToShortDateString()} по {dateTimePickerEnd.Value.ToShortDateString()}") }; + reportViewer.LocalReport.SetParameters(parameters); + reportViewer.RefreshReport(); + _logger.LogInformation("Загрузка списка заказов на период {From}-{ To}", dateTimePickerStart.Value.ToShortDateString(), dateTimePickerEnd.Value.ToShortDateString()); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка заказов на период"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + + } + + private void buttonCreateToPdf_Click(object sender, EventArgs e) + { + if (dateTimePickerStart.Value.Date >= dateTimePickerEnd.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 = dateTimePickerStart.Value, + DateTo = dateTimePickerEnd.Value + }); + _logger.LogInformation("Сохранение списка заказов на период { From} -{ To}", dateTimePickerStart.Value.ToShortDateString(),dateTimePickerEnd.Value.ToShortDateString()); + 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/FormReportOrder.resx b/PrecastConcretePlant/PrecastConcretePlant/FormReportOrder.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportOrder.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/FormReportReinforcedComponents.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportReinforcedComponents.Designer.cs new file mode 100644 index 0000000..658263a --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportReinforcedComponents.Designer.cs @@ -0,0 +1,110 @@ +namespace PrecastConcretePlantView +{ + partial class FormReportReinforcedComponents + { + /// + /// 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.dataGridView = new System.Windows.Forms.DataGridView(); + this.Blank = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Document = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.buttonSaveToExcel = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView + // + this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Blank, + this.Document, + this.Count}); + this.dataGridView.Location = new System.Drawing.Point(12, 37); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowHeadersWidth = 51; + this.dataGridView.RowTemplate.Height = 29; + this.dataGridView.Size = new System.Drawing.Size(776, 401); + this.dataGridView.TabIndex = 0; + // + // Blank + // + this.Blank.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.Blank.HeaderText = "Бланк"; + this.Blank.MinimumWidth = 6; + this.Blank.Name = "Blank"; + // + // Document + // + this.Document.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.Document.HeaderText = "Документ"; + this.Document.MinimumWidth = 6; + this.Document.Name = "Document"; + // + // Count + // + this.Count.HeaderText = "Количество"; + this.Count.MinimumWidth = 6; + this.Count.Name = "Count"; + this.Count.Width = 125; + // + // buttonSaveToExcel + // + this.buttonSaveToExcel.Location = new System.Drawing.Point(12, 2); + this.buttonSaveToExcel.Name = "buttonSaveToExcel"; + this.buttonSaveToExcel.Size = new System.Drawing.Size(220, 29); + this.buttonSaveToExcel.TabIndex = 1; + this.buttonSaveToExcel.Text = "Сохранить в Excel"; + this.buttonSaveToExcel.UseVisualStyleBackColor = true; + this.buttonSaveToExcel.Click += new System.EventHandler(this.buttonSaveToExcel_Click); + // + // FormReportReinforcedComponents + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.buttonSaveToExcel); + this.Controls.Add(this.dataGridView); + this.Name = "FormReportReinforcedComponents"; + this.Text = "Бланки по документам"; + this.Load += new System.EventHandler(this.FormReportReinforcedComponents_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private DataGridView dataGridView; + private DataGridViewTextBoxColumn Blank; + private DataGridViewTextBoxColumn Document; + private DataGridViewTextBoxColumn Count; + private Button buttonSaveToExcel; + } +} \ No newline at end of file diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportReinforcedComponents.cs b/PrecastConcretePlant/PrecastConcretePlant/FormReportReinforcedComponents.cs new file mode 100644 index 0000000..e173bf1 --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportReinforcedComponents.cs @@ -0,0 +1,85 @@ +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 PrecastConcretePlantView +{ + public partial class FormReportReinforcedComponents : Form + { + private readonly ILogger _logger; + private readonly IReportLogic _logic; + + public FormReportReinforcedComponents(ILogger logger, IReportLogic logic) + { + InitializeComponent(); + _logger = logger; + _logic = logic; + } + + private void FormReportReinforcedComponents_Load(object sender, EventArgs e) + { + try + { + var dict = _logic.GetReinforcedComponents(); + if (dict != null) + { + dataGridView.Rows.Clear(); + foreach (var elem in dict) + { + dataGridView.Rows.Add(new object[] { elem.ReinforcedName, "", "" }); + foreach (var listElem in elem.Components) + { + dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); + } + dataGridView.Rows.Add(new object[] { "Итого", "", elem.TotalCount }); + dataGridView.Rows.Add(Array.Empty()); + } + } + _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.SaveReinforcedComponentToExcelFile(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/FormReportReinforcedComponents.resx b/PrecastConcretePlant/PrecastConcretePlant/FormReportReinforcedComponents.resx new file mode 100644 index 0000000..0908e41 --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportReinforcedComponents.resx @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + True + + + True + + + True + + + True + + + True + + + True + + \ 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()); + } + } + _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); + } + } + } + } +} diff --git a/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.resx b/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/FormReportShopReinforcedies.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/PrecastConcretePlantView.csproj b/PrecastConcretePlant/PrecastConcretePlant/PrecastConcretePlantView.csproj index 8b758c4..5d26368 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/PrecastConcretePlantView.csproj +++ b/PrecastConcretePlant/PrecastConcretePlant/PrecastConcretePlantView.csproj @@ -30,6 +30,7 @@ + diff --git a/PrecastConcretePlant/PrecastConcretePlant/Program.cs b/PrecastConcretePlant/PrecastConcretePlant/Program.cs index f73c7ca..7f1461d 100644 --- a/PrecastConcretePlant/PrecastConcretePlant/Program.cs +++ b/PrecastConcretePlant/PrecastConcretePlant/Program.cs @@ -6,6 +6,9 @@ using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; using PrecastConcretePlantBusinessLogic.PrecastConcretePlantBusinessLogic.BusinessLogic; using PrecastConcretePlantDatabaseImplement.Implements; +using PrecastConcretePlantBusinessLogic.OfficePackage.Implements; +using PrecastConcretePlantBusinessLogic.OfficePackage; +using PrecastConcretePlant; namespace PrecastConcretePlantView { @@ -38,7 +41,13 @@ namespace PrecastConcretePlantView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -48,8 +57,12 @@ namespace PrecastConcretePlantView services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } diff --git a/PrecastConcretePlant/PrecastConcretePlant/Properties/Resources.Designer.cs b/PrecastConcretePlant/PrecastConcretePlant/Properties/Resources.Designer.cs deleted file mode 100644 index 5110396..0000000 --- a/PrecastConcretePlant/PrecastConcretePlant/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Этот код создан программой. -// Исполняемая версия:4.0.30319.42000 -// -// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае -// повторной генерации кода. -// -//------------------------------------------------------------------------------ - -namespace PrecastConcretePlantView.Properties { - using System; - - - /// - /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. - /// - // Этот класс создан автоматически классом StronglyTypedResourceBuilder - // с помощью такого средства, как ResGen или Visual Studio. - // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen - // с параметром /str или перестройте свой проект VS. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrecastConcretePlantView.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Перезаписывает свойство CurrentUICulture текущего потока для всех - /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/PrecastConcretePlant/PrecastConcretePlant/Properties/Resources.resx b/PrecastConcretePlant/PrecastConcretePlant/Properties/Resources.resx deleted file mode 100644 index 1af7de1..0000000 --- a/PrecastConcretePlant/PrecastConcretePlant/Properties/Resources.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/Properties/launchSettings.json b/PrecastConcretePlant/PrecastConcretePlant/Properties/launchSettings.json deleted file mode 100644 index 8a978ef..0000000 --- a/PrecastConcretePlant/PrecastConcretePlant/Properties/launchSettings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "profiles": { - "SoftwareInstallationView": { - "commandName": "Project" - } - } -} \ No newline at end of file diff --git a/PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc b/PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc new file mode 100644 index 0000000..5977266 --- /dev/null +++ b/PrecastConcretePlant/PrecastConcretePlant/ReportGroupOrders.rdlc @@ -0,0 +1,463 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + 10791c83-cee8-4a38-bbd0-245fc17cefb3 + + + + + + ConfectioneryContractsViewModels + /* Local Query */ + + + + Id + System.Int32 + + + Date + System.DateTime + + + Count + System.Int32 + + + Sum + System.Double + + + + ConfectioneryContracts.ViewModels + ReportOrdersViewModel + ConfectioneryContracts.ViewModels.ReportOrdersViewModel, ConfectioneryContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + + + + + + + true + true + + + + + =Parameters!ReportParameterPeriod.Value + + + + + + + ReportParameterPeriod + 1cm + 1cm + 12.40104cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Заказы + + + + + + + 1cm + 12.40104cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + 3.21438cm + + + 3.53188cm + + + 4.35209cm + + + + + 0.6cm + + + + + true + true + + + + + Дата создания + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Количество заказов + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Сумма + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + =Fields!Date.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Count.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.48391cm + 0.55245cm + 1.2cm + 11.09835cm + 2 + + + + + + true + true + + + + + Итого: + + + + + + + 4cm + 6.6508cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + + + + + 4cm + 9.1508cm + 0.6cm + 2.5cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 5.72875cm + + + + + + + ReportParameterPeriod + 1cm + 1cm + 21cm + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Заказы + + + + + + + 1cm + 21cm + 1 + + + Middle + 2pt + 2pt + 2pt + 2pt + + + + + + + 2.5cm + + + 3.21438cm + + + 8.23317cm + + + 2.5cm + + + 2.5cm + + + + + 0.6cm + + + + + true + true + + + + + Номер + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Дата создания + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Железобетонные изделия + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Сумма + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Статус + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.6cm + + + + + true + true + + + + + =Fields!Id.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!DateCreate.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!ReinforcedName.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Sum.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Status.Value + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DataSetOrders + 2.48391cm + 0.55245cm + 1.2cm + 18.94755cm + 2 + + + + + + true + true + + + + + Итого: + + + + + + + 4cm + 12cm + 0.6cm + 2.5cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Sum(Fields!Sum.Value, "DataSetOrders") + + + + + + + 4cm + 14.5cm + 0.6cm + 2.5cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + 5.72875cm +