Compare commits

..

No commits in common. "8c299726f3e308d53ccd230e745e19d7fb42314e" and "2893430e01455efa791e250b9f91c27fd0f46a00" have entirely different histories.

4 changed files with 50 additions and 22 deletions

View File

@ -28,8 +28,10 @@
/// </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();
@ -47,6 +49,17 @@
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;
@ -69,9 +82,20 @@
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, 65);
this.buttonPut.Location = new System.Drawing.Point(891, 133);
this.buttonPut.Margin = new System.Windows.Forms.Padding(2);
this.buttonPut.Name = "buttonPut";
this.buttonPut.Size = new System.Drawing.Size(150, 30);
@ -82,7 +106,7 @@
//
// buttonRefresh
//
this.buttonRefresh.Location = new System.Drawing.Point(891, 99);
this.buttonRefresh.Location = new System.Drawing.Point(891, 167);
this.buttonRefresh.Margin = new System.Windows.Forms.Padding(2);
this.buttonRefresh.Name = "buttonRefresh";
this.buttonRefresh.Size = new System.Drawing.Size(150, 30);
@ -119,28 +143,28 @@
// componentsToolStripMenuItem
//
this.componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.componentsToolStripMenuItem.Size = new System.Drawing.Size(180, 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(149, 22);
this.bouquetsToolStripMenuItem.Size = new System.Drawing.Size(180, 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(149, 22);
this.clientsToolStripMenuItem.Size = new System.Drawing.Size(180, 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(149, 22);
this.implementersToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.implementersToolStripMenuItem.Text = "Исполнители";
this.implementersToolStripMenuItem.Click += new System.EventHandler(this.implementersToolStripMenuItem_Click);
//
@ -189,6 +213,8 @@
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);
@ -209,12 +235,14 @@
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(async () =>
await Task.Run(() =>
{
foreach (var order in orders)
{
@ -64,22 +64,23 @@ namespace FlowerShopBusinessLogic.BusinessLogics
{
_logger.LogDebug("DoWork. Worker {Id} try get order {Order}", implementer.Id, order.Id);
var notOccupied = _orderLogic.TakeOrderInWork(new OrderBindingModel
_orderLogic.TakeOrderInWork(new OrderBindingModel
{
Id = order.Id,
ImplementerId = implementer.Id
});
if (notOccupied)
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
{
await Task.Delay(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
Id = order.Id,
ImplementerId = implementer.Id
});
_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));
}
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
}
catch (InvalidOperationException ex)
{
@ -111,17 +112,16 @@ namespace FlowerShopBusinessLogic.BusinessLogics
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
await Task.Delay(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
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,
ImplementerId = implementer.Id,
Id = runOrder.Id
});
await Task.Delay(implementer.Qualification * _rnd.Next(10, 100));
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
}
catch (InvalidOperationException ex)
{

View File

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

View File

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