Compare commits

..

2 Commits

4 changed files with 22 additions and 50 deletions

View File

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

View File

@ -56,7 +56,7 @@ namespace FlowerShopBusinessLogic.BusinessLogics
await RunOrderInWork(implementer, orders); await RunOrderInWork(implementer, orders);
await Task.Run(() => await Task.Run(async () =>
{ {
foreach (var order in orders) 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); _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, Id = order.Id,
ImplementerId = implementer.Id ImplementerId = implementer.Id
}); });
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count); if (notOccupied)
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
_orderLogic.DeliveryOrder(new OrderBindingModel
{ {
Id = order.Id, await Task.Delay(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
ImplementerId = implementer.Id
});
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) catch (InvalidOperationException ex)
{ {
@ -112,16 +111,17 @@ namespace FlowerShopBusinessLogic.BusinessLogics
_logger.LogDebug("DoWork. Worker {Id} back to 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); await Task.Delay(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} finish order {Order}", implementer.Id, runOrder.Id);
_orderLogic.FinishOrder(new OrderBindingModel _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) 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.BusinessLogicsContracts;
using FlowerShopContracts.SearchModels; using FlowerShopContracts.SearchModels;
using FlowerShopContracts.ViewModels; using FlowerShopContracts.ViewModels;

View File

@ -13,6 +13,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\FlowerShopBusinessLogic\FlowerShopBusinessLogic.csproj" /> <ProjectReference Include="..\FlowerShopBusinessLogic\FlowerShopBusinessLogic.csproj" />
<ProjectReference Include="..\FlowerShopContracts\FlowerShopContracts.csproj" />
<ProjectReference Include="..\FlowerShopDatabaseImplement\FlowerShopDatabaseImplement.csproj" /> <ProjectReference Include="..\FlowerShopDatabaseImplement\FlowerShopDatabaseImplement.csproj" />
</ItemGroup> </ItemGroup>