From a72db9a3e5d09eac21724fad3ae652c98485d306 Mon Sep 17 00:00:00 2001 From: Yunusov_Niyaz Date: Wed, 24 Apr 2024 16:05:04 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B0=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CarRepairShop/FormMain.Designer.cs | 35 +++++++------------ .../BusinessLogics/WorkModeling.cs | 18 ++++------ 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/CarRepairShop/CarRepairShop/FormMain.Designer.cs b/CarRepairShop/CarRepairShop/FormMain.Designer.cs index 24a793e..217d730 100644 --- a/CarRepairShop/CarRepairShop/FormMain.Designer.cs +++ b/CarRepairShop/CarRepairShop/FormMain.Designer.cs @@ -33,19 +33,18 @@ компонентыToolStripMenuItem = new ToolStripMenuItem(); ремонтToolStripMenuItem = new ToolStripMenuItem(); клиентыToolStripMenuItem = new ToolStripMenuItem(); - запускРаботToolStripMenuItem = new ToolStripMenuItem(); исполнителиToolStripMenuItem = new ToolStripMenuItem(); отчётыToolStripMenuItem = new ToolStripMenuItem(); списокКомпонентовToolStripMenuItem = new ToolStripMenuItem(); компонентыПоРемонтуToolStripMenuItem = new ToolStripMenuItem(); списокЗаказовToolStripMenuItem = new ToolStripMenuItem(); + запускРаботToolStripMenuItem1 = new ToolStripMenuItem(); dataGridView = new DataGridView(); buttonCreateOrder = new Button(); buttonTakeOrderInWork = new Button(); buttonOrderReady = new Button(); buttonIssuedOrder = new Button(); buttonRefresh = new Button(); - запускРаботToolStripMenuItem1 = new ToolStripMenuItem(); menuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); SuspendLayout(); @@ -62,7 +61,7 @@ // // справочникиToolStripMenuItem // - справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, ремонтToolStripMenuItem, клиентыToolStripMenuItem, запускРаботToolStripMenuItem, исполнителиToolStripMenuItem }); + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, ремонтToolStripMenuItem, клиентыToolStripMenuItem, исполнителиToolStripMenuItem }); справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; справочникиToolStripMenuItem.Size = new Size(117, 24); справочникиToolStripMenuItem.Text = "Справочники"; @@ -70,35 +69,28 @@ // компонентыToolStripMenuItem // компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem"; - компонентыToolStripMenuItem.Size = new Size(185, 26); + компонентыToolStripMenuItem.Size = new Size(224, 26); компонентыToolStripMenuItem.Text = "Компоненты"; компонентыToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click; // // ремонтToolStripMenuItem // ремонтToolStripMenuItem.Name = "ремонтToolStripMenuItem"; - ремонтToolStripMenuItem.Size = new Size(185, 26); + ремонтToolStripMenuItem.Size = new Size(224, 26); ремонтToolStripMenuItem.Text = "Ремонт"; ремонтToolStripMenuItem.Click += RepairToolStripMenuItem_Click; // // клиентыToolStripMenuItem // клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; - клиентыToolStripMenuItem.Size = new Size(185, 26); + клиентыToolStripMenuItem.Size = new Size(224, 26); клиентыToolStripMenuItem.Text = "Клиенты"; клиентыToolStripMenuItem.Click += ClientsToolStripMenuItem_Click; // - // запускРаботToolStripMenuItem - // - запускРаботToolStripMenuItem.Name = "запускРаботToolStripMenuItem"; - запускРаботToolStripMenuItem.Size = new Size(185, 26); - запускРаботToolStripMenuItem.Text = "Запуск работ"; - запускРаботToolStripMenuItem.Click += StartingWorkToolStripMenuItem_Click; - // // исполнителиToolStripMenuItem // исполнителиToolStripMenuItem.Name = "исполнителиToolStripMenuItem"; - исполнителиToolStripMenuItem.Size = new Size(185, 26); + исполнителиToolStripMenuItem.Size = new Size(224, 26); исполнителиToolStripMenuItem.Text = "Исполнители"; исполнителиToolStripMenuItem.Click += ImplementersToolStripMenuItem_Click; // @@ -130,6 +122,13 @@ списокЗаказовToolStripMenuItem.Text = "Список заказов"; списокЗаказовToolStripMenuItem.Click += ListOrderToolStripMenuItem_Click; // + // запускРаботToolStripMenuItem1 + // + запускРаботToolStripMenuItem1.Name = "запускРаботToolStripMenuItem1"; + запускРаботToolStripMenuItem1.Size = new Size(114, 24); + запускРаботToolStripMenuItem1.Text = "Запуск работ"; + запускРаботToolStripMenuItem1.Click += StartingWorkToolStripMenuItem_Click; + // // dataGridView // dataGridView.AllowUserToAddRows = false; @@ -192,13 +191,6 @@ buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.Click += ButtonRef_Click; // - // запускРаботToolStripMenuItem1 - // - запускРаботToolStripMenuItem1.Name = "запускРаботToolStripMenuItem1"; - запускРаботToolStripMenuItem1.Size = new Size(114, 24); - запускРаботToolStripMenuItem1.Text = "Запуск работ"; - запускРаботToolStripMenuItem1.Click += StartingWorkToolStripMenuItem_Click; - // // FormMain // AutoScaleDimensions = new SizeF(8F, 20F); @@ -240,7 +232,6 @@ private ToolStripMenuItem компонентыПоРемонтуToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem клиентыToolStripMenuItem; - private ToolStripMenuItem запускРаботToolStripMenuItem; private ToolStripMenuItem исполнителиToolStripMenuItem; private ToolStripMenuItem запускРаботToolStripMenuItem1; } diff --git a/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/WorkModeling.cs b/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/WorkModeling.cs index ae8d6ff..b02c6e7 100644 --- a/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/WorkModeling.cs +++ b/CarRepairShop/CarRepairShopBusinessLogic/BusinessLogics/WorkModeling.cs @@ -57,18 +57,18 @@ namespace CarRepairShopBusinessLogic.BusinessLogics try { _logger.LogDebug("DoWork. Worker {Id} try get order { Order}", implementer.Id, order.Id); - _orderLogic.TakeOrderInWork(new OrderBindingModel + _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = order.Id, ImplementerId = implementer.Id }); - Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, - 1000) * order.Count); + Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count); _logger.LogDebug("DoWork. Worker {Id} finish order { Order}", implementer.Id, order.Id); - _orderLogic.FinishOrder(new OrderBindingModel + _orderLogic.FinishOrder(new OrderBindingModel { Id = order.Id }); + Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); } catch (InvalidOperationException ex) { @@ -79,7 +79,6 @@ namespace CarRepairShopBusinessLogic.BusinessLogics _logger.LogError(ex, "Error while do work"); throw; } - Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100)); } }); } @@ -101,12 +100,9 @@ namespace CarRepairShopBusinessLogic.BusinessLogics { return; } - _logger.LogDebug("DoWork. Worker {Id} back to order {Order}", - implementer.Id, runOrder.Id); - Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * - runOrder.Count); - _logger.LogDebug("DoWork. Worker {Id} finish order {Order}", - implementer.Id, runOrder.Id); + _logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id); + Thread.Sleep(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