From cb29ffb24cf8002679c6cb1b8c910fd8de6ba858 Mon Sep 17 00:00:00 2001 From: Safgerd Date: Mon, 10 Apr 2023 10:11:26 +0400 Subject: [PATCH] =?UTF-8?q?LabWork06=5FBase:=20=D0=9B=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=81=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0,=20=D1=84=D0=B8=D0=BA=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutomobilePlant/FormMain.Designer.cs | 342 ++++++++---------- .../BusinessLogics/WorkModeling.cs | 33 +- 2 files changed, 176 insertions(+), 199 deletions(-) diff --git a/AutomobilePlant/AutomobilePlant/FormMain.Designer.cs b/AutomobilePlant/AutomobilePlant/FormMain.Designer.cs index 636331c..038e381 100644 --- a/AutomobilePlant/AutomobilePlant/FormMain.Designer.cs +++ b/AutomobilePlant/AutomobilePlant/FormMain.Designer.cs @@ -28,198 +28,174 @@ /// private void InitializeComponent() { - this.menuStrip = new System.Windows.Forms.MenuStrip(); - 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.buttonCreateOrder = new System.Windows.Forms.Button(); - this.buttonSetToWork = new System.Windows.Forms.Button(); - this.buttonSetToDone = new System.Windows.Forms.Button(); - this.buttonSetToFinish = new System.Windows.Forms.Button(); - this.buttonUpdate = 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.menuStrip = new System.Windows.Forms.MenuStrip(); + 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.buttonCreateOrder = new System.Windows.Forms.Button(); + this.buttonSetToFinish = new System.Windows.Forms.Button(); + this.buttonUpdate = 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(1436, 28); - this.menuStrip.TabIndex = 0; - this.menuStrip.Text = "Справочники"; - // - // справочникиToolStripMenuItem - // - this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(1436, 28); + this.menuStrip.TabIndex = 0; + this.menuStrip.Text = "Справочники"; + // + // справочникиToolStripMenuItem + // + this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.компонентыToolStripMenuItem, this.автомобилиToolStripMenuItem, this.клиентыToolStripMenuItem, this.исполнителиToolStripMenuItem}); - this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; - this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24); - this.справочникиToolStripMenuItem.Text = "Справочники"; - // - // компонентыToolStripMenuItem - // - this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; - this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(185, 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(185, 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(182, 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(185, 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.Name = "справочникиToolStripMenuItem"; + this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24); + this.справочникиToolStripMenuItem.Text = "Справочники"; + // + // компонентыToolStripMenuItem + // + this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; + this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(185, 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(185, 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(185, 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(185, 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.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(304, 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(304, 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(304, 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(12, 31); - this.dataGridView.Name = "dataGridView"; - this.dataGridView.RowHeadersWidth = 51; - this.dataGridView.RowTemplate.Height = 29; - this.dataGridView.Size = new System.Drawing.Size(1188, 407); - this.dataGridView.TabIndex = 1; - // - // buttonCreateOrder - // - this.buttonCreateOrder.Location = new System.Drawing.Point(1220, 42); - this.buttonCreateOrder.Name = "buttonCreateOrder"; - this.buttonCreateOrder.Size = new System.Drawing.Size(194, 29); - this.buttonCreateOrder.TabIndex = 2; - this.buttonCreateOrder.Text = "Создать заказ"; - this.buttonCreateOrder.UseVisualStyleBackColor = true; - this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click); - // - // buttonSetToWork - // - this.buttonSetToWork.Location = new System.Drawing.Point(1220, 77); - this.buttonSetToWork.Name = "buttonSetToWork"; - this.buttonSetToWork.Size = new System.Drawing.Size(194, 29); - this.buttonSetToWork.TabIndex = 3; - this.buttonSetToWork.Text = "Отдать на выполнение"; - this.buttonSetToWork.UseVisualStyleBackColor = true; - this.buttonSetToWork.Click += new System.EventHandler(this.ButtonSetToWork_Click); - // - // buttonSetToDone - // - this.buttonSetToDone.Location = new System.Drawing.Point(1220, 112); - this.buttonSetToDone.Name = "buttonSetToDone"; - this.buttonSetToDone.Size = new System.Drawing.Size(194, 29); - this.buttonSetToDone.TabIndex = 4; - this.buttonSetToDone.Text = "Заказ готов"; - this.buttonSetToDone.UseVisualStyleBackColor = true; - this.buttonSetToDone.Click += new System.EventHandler(this.ButtonSetToDone_Click); - // - // buttonSetToFinish - // - this.buttonSetToFinish.Location = new System.Drawing.Point(1220, 147); - this.buttonSetToFinish.Name = "buttonSetToFinish"; - this.buttonSetToFinish.Size = new System.Drawing.Size(194, 29); - this.buttonSetToFinish.TabIndex = 5; - this.buttonSetToFinish.Text = "Заказ выдан"; - this.buttonSetToFinish.UseVisualStyleBackColor = true; - this.buttonSetToFinish.Click += new System.EventHandler(this.ButtonSetToFinish_Click); - // - // buttonUpdate - // - this.buttonUpdate.Location = new System.Drawing.Point(1220, 409); - this.buttonUpdate.Name = "buttonUpdate"; - this.buttonUpdate.Size = new System.Drawing.Size(194, 29); - this.buttonUpdate.TabIndex = 6; - this.buttonUpdate.Text = "Обновить"; - this.buttonUpdate.UseVisualStyleBackColor = true; - this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click); - // - // запускРаботToolStripMenuItem - // - this.запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem"; - this.запускРаботToolStripMenuItem.Size = new System.Drawing.Size(114, 24); - this.запускРаботToolStripMenuItem.Text = "Запуск работ"; - this.запускРаботToolStripMenuItem.Click += new System.EventHandler(this.запускРаботToolStripMenuItem_Click); - // - // FormMain - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1436, 450); - this.Controls.Add(this.buttonUpdate); - this.Controls.Add(this.buttonSetToFinish); - this.Controls.Add(this.buttonSetToDone); - this.Controls.Add(this.buttonSetToWork); - this.Controls.Add(this.buttonCreateOrder); - this.Controls.Add(this.dataGridView); - this.Controls.Add(this.menuStrip); - this.MainMenuStrip = this.menuStrip; - 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(); - this.ResumeLayout(false); - this.PerformLayout(); + 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(304, 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(304, 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(304, 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(114, 24); + 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(12, 31); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowHeadersWidth = 51; + this.dataGridView.RowTemplate.Height = 29; + this.dataGridView.Size = new System.Drawing.Size(1188, 407); + this.dataGridView.TabIndex = 1; + // + // buttonCreateOrder + // + this.buttonCreateOrder.Location = new System.Drawing.Point(1220, 42); + this.buttonCreateOrder.Name = "buttonCreateOrder"; + this.buttonCreateOrder.Size = new System.Drawing.Size(194, 29); + this.buttonCreateOrder.TabIndex = 2; + this.buttonCreateOrder.Text = "Создать заказ"; + this.buttonCreateOrder.UseVisualStyleBackColor = true; + this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click); + // + // buttonSetToFinish + // + this.buttonSetToFinish.Location = new System.Drawing.Point(1220, 147); + this.buttonSetToFinish.Name = "buttonSetToFinish"; + this.buttonSetToFinish.Size = new System.Drawing.Size(194, 29); + this.buttonSetToFinish.TabIndex = 5; + this.buttonSetToFinish.Text = "Заказ выдан"; + this.buttonSetToFinish.UseVisualStyleBackColor = true; + this.buttonSetToFinish.Click += new System.EventHandler(this.ButtonSetToFinish_Click); + // + // buttonUpdate + // + this.buttonUpdate.Location = new System.Drawing.Point(1220, 409); + this.buttonUpdate.Name = "buttonUpdate"; + this.buttonUpdate.Size = new System.Drawing.Size(194, 29); + this.buttonUpdate.TabIndex = 6; + this.buttonUpdate.Text = "Обновить"; + this.buttonUpdate.UseVisualStyleBackColor = true; + this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click); + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1436, 450); + this.Controls.Add(this.buttonUpdate); + this.Controls.Add(this.buttonSetToFinish); + this.Controls.Add(this.buttonCreateOrder); + this.Controls.Add(this.dataGridView); + this.Controls.Add(this.menuStrip); + this.MainMenuStrip = this.menuStrip; + 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(); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -231,8 +207,6 @@ private ToolStripMenuItem автомобилиToolStripMenuItem; private DataGridView dataGridView; private Button buttonCreateOrder; - private Button buttonSetToWork; - private Button buttonSetToDone; private Button buttonSetToFinish; private Button buttonUpdate; private ToolStripMenuItem отчетыToolStripMenuItem; diff --git a/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/WorkModeling.cs b/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/WorkModeling.cs index 6bc8385..daacb29 100644 --- a/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/WorkModeling.cs +++ b/AutomobilePlant/AutomobilePlantBusinessLogic/BusinessLogics/WorkModeling.cs @@ -56,7 +56,7 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics } await RunOrderInWork(implementer, orders); - await Task.Run(() => + await Task.Run( async() => { foreach (var order in orders) { @@ -64,21 +64,24 @@ namespace AutomobilePlantBusinessLogic.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 - }); - // отдыхаем - Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); + // делаем работу + await Task.Delay(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count); + _logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id); + _orderLogic.DeliveryOrder(new OrderBindingModel + { + Id = order.Id, + ImplementerId = implementer.Id + }); + // отдыхаем + await Task.Delay(implementer.Qualification * _rnd.Next(10, 100)); + } } // кто-то мог уже перехватить заказ, игнорируем ошибку catch (InvalidOperationException ex) @@ -111,15 +114,15 @@ namespace AutomobilePlantBusinessLogic.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 }); - // отдыхаем - Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); + // отдыхаем + await Task.Delay(implementer.Qualification * _rnd.Next(10, 100)); } // заказа может не быть, просто игнорируем ошибку catch (InvalidOperationException ex)