Базовая лабораторная №6: Исправления

This commit is contained in:
Сергей Полевой 2023-04-20 21:56:06 +04:00
parent 2893430e01
commit 550fe545f8
3 changed files with 21 additions and 50 deletions

View File

@ -28,10 +28,8 @@
/// </summary>
private void InitializeComponent()
{
this.buttonReady = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreate = new System.Windows.Forms.Button();
this.buttonToWork = new System.Windows.Forms.Button();
this.buttonPut = new System.Windows.Forms.Button();
this.buttonRefresh = new System.Windows.Forms.Button();
this.menuStrip = new System.Windows.Forms.MenuStrip();
@ -49,17 +47,6 @@
this.menuStrip.SuspendLayout();
this.SuspendLayout();
//
// buttonReady
//
this.buttonReady.Location = new System.Drawing.Point(891, 99);
this.buttonReady.Margin = new System.Windows.Forms.Padding(2);
this.buttonReady.Name = "buttonReady";
this.buttonReady.Size = new System.Drawing.Size(150, 30);
this.buttonReady.TabIndex = 3;
this.buttonReady.Text = "Заказ готов";
this.buttonReady.UseVisualStyleBackColor = true;
this.buttonReady.Click += new System.EventHandler(this.buttonReady_Click);
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
@ -82,20 +69,9 @@
this.buttonCreate.UseVisualStyleBackColor = true;
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
//
// buttonToWork
//
this.buttonToWork.Location = new System.Drawing.Point(891, 65);
this.buttonToWork.Margin = new System.Windows.Forms.Padding(2);
this.buttonToWork.Name = "buttonToWork";
this.buttonToWork.Size = new System.Drawing.Size(150, 30);
this.buttonToWork.TabIndex = 2;
this.buttonToWork.Text = "Отдать на выполнение";
this.buttonToWork.UseVisualStyleBackColor = true;
this.buttonToWork.Click += new System.EventHandler(this.buttonToWork_Click);
//
// buttonPut
//
this.buttonPut.Location = new System.Drawing.Point(891, 133);
this.buttonPut.Location = new System.Drawing.Point(891, 65);
this.buttonPut.Margin = new System.Windows.Forms.Padding(2);
this.buttonPut.Name = "buttonPut";
this.buttonPut.Size = new System.Drawing.Size(150, 30);
@ -106,7 +82,7 @@
//
// buttonRefresh
//
this.buttonRefresh.Location = new System.Drawing.Point(891, 167);
this.buttonRefresh.Location = new System.Drawing.Point(891, 99);
this.buttonRefresh.Margin = new System.Windows.Forms.Padding(2);
this.buttonRefresh.Name = "buttonRefresh";
this.buttonRefresh.Size = new System.Drawing.Size(150, 30);
@ -143,28 +119,28 @@
// componentsToolStripMenuItem
//
this.componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.componentsToolStripMenuItem.Text = "Компоненты";
this.componentsToolStripMenuItem.Click += new System.EventHandler(this.componentsToolStripMenuItem_Click);
//
// bouquetsToolStripMenuItem
//
this.bouquetsToolStripMenuItem.Name = "bouquetsToolStripMenuItem";
this.bouquetsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.bouquetsToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.bouquetsToolStripMenuItem.Text = "Букеты";
this.bouquetsToolStripMenuItem.Click += new System.EventHandler(this.bouquetsToolStripMenuItem_Click);
//
// clientsToolStripMenuItem
//
this.clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
this.clientsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.clientsToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.clientsToolStripMenuItem.Text = "Клиенты";
this.clientsToolStripMenuItem.Click += new System.EventHandler(this.clientsToolStripMenuItem_Click);
//
// implementersToolStripMenuItem
//
this.implementersToolStripMenuItem.Name = "implementersToolStripMenuItem";
this.implementersToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.implementersToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.implementersToolStripMenuItem.Text = "Исполнители";
this.implementersToolStripMenuItem.Click += new System.EventHandler(this.implementersToolStripMenuItem_Click);
//
@ -213,8 +189,6 @@
this.ClientSize = new System.Drawing.Size(1071, 401);
this.Controls.Add(this.buttonRefresh);
this.Controls.Add(this.buttonPut);
this.Controls.Add(this.buttonReady);
this.Controls.Add(this.buttonToWork);
this.Controls.Add(this.buttonCreate);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip);
@ -235,14 +209,12 @@
private DataGridView dataGridView;
private Button buttonCreate;
private Button buttonToWork;
private Button buttonPut;
private Button buttonRefresh;
private MenuStrip menuStrip;
private ToolStripMenuItem guidesToolStripMenuItem;
private ToolStripMenuItem componentsToolStripMenuItem;
private ToolStripMenuItem bouquetsToolStripMenuItem;
private Button buttonReady;
private ToolStripMenuItem reportsToolStripMenuItem;
private ToolStripMenuItem listOfBouquetsToolStripMenuItem;
private ToolStripMenuItem componentsByBouquetsToolStripMenuItem;

View File

@ -56,7 +56,7 @@ namespace FlowerShopBusinessLogic.BusinessLogics
await RunOrderInWork(implementer, orders);
await Task.Run(() =>
await Task.Run(async () =>
{
foreach (var order in orders)
{
@ -64,23 +64,22 @@ namespace FlowerShopBusinessLogic.BusinessLogics
{
_logger.LogDebug("DoWork. Worker {Id} try get order {Order}", implementer.Id, order.Id);
_orderLogic.TakeOrderInWork(new OrderBindingModel
var notOccupied = _orderLogic.TakeOrderInWork(new OrderBindingModel
{
Id = order.Id,
ImplementerId = implementer.Id
});
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
_orderLogic.DeliveryOrder(new OrderBindingModel
if (notOccupied)
{
Id = order.Id,
ImplementerId = implementer.Id
});
await Task.Delay(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
_logger.LogDebug("DoWork. Worker {Id} finish order { Order}", implementer.Id, order.Id);
_orderLogic.FinishOrder(new OrderBindingModel { Id = order.Id, ImplementerId = implementer.Id });
await Task.Delay(implementer.Qualification * _rnd.Next(10, 100));
}
}
catch (InvalidOperationException ex)
{
@ -112,16 +111,17 @@ namespace FlowerShopBusinessLogic.BusinessLogics
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
await Task.Delay(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, runOrder.Id);
_orderLogic.FinishOrder(new OrderBindingModel
{
Id = runOrder.Id
Id = runOrder.Id,
ImplementerId = implementer.Id,
});
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
await Task.Delay(implementer.Qualification * _rnd.Next(10, 100));
}
catch (InvalidOperationException ex)
{

View File

@ -1,5 +1,4 @@
using DocumentFormat.OpenXml.Office2010.Excel;
using FlowerShopContracts.BindingModels;
using FlowerShopContracts.BindingModels;
using FlowerShopContracts.BusinessLogicsContracts;
using FlowerShopContracts.SearchModels;
using FlowerShopContracts.ViewModels;