Заказы готовы, максимум осталось дату завершения добавить

This commit is contained in:
the 2024-06-23 22:32:43 +04:00
parent c87d686110
commit ac6ab33e2c
2 changed files with 42 additions and 1 deletions

View File

@ -34,6 +34,7 @@
товарыToolStripMenuItem = new ToolStripMenuItem(); товарыToolStripMenuItem = new ToolStripMenuItem();
поставщикиToolStripMenuItem = new ToolStripMenuItem(); поставщикиToolStripMenuItem = new ToolStripMenuItem();
buttonSupplyStatusArriving = new Button(); buttonSupplyStatusArriving = new Button();
buttonSupplyStatusCompleted = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
SuspendLayout(); SuspendLayout();
@ -90,11 +91,22 @@
buttonSupplyStatusArriving.UseVisualStyleBackColor = true; buttonSupplyStatusArriving.UseVisualStyleBackColor = true;
buttonSupplyStatusArriving.Click += buttonSupplyStatusArriving_Click; buttonSupplyStatusArriving.Click += buttonSupplyStatusArriving_Click;
// //
// buttonSupplyStatusCompleted
//
buttonSupplyStatusCompleted.Location = new Point(707, 125);
buttonSupplyStatusCompleted.Name = "buttonSupplyStatusCompleted";
buttonSupplyStatusCompleted.Size = new Size(154, 23);
buttonSupplyStatusCompleted.TabIndex = 4;
buttonSupplyStatusCompleted.Text = "Поставка завершена";
buttonSupplyStatusCompleted.UseVisualStyleBackColor = true;
buttonSupplyStatusCompleted.Click += buttonSupplyStatusCompleted_Click;
//
// FormMain // FormMain
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(901, 384); ClientSize = new Size(901, 384);
Controls.Add(buttonSupplyStatusCompleted);
Controls.Add(buttonSupplyStatusArriving); Controls.Add(buttonSupplyStatusArriving);
Controls.Add(buttonCreateSupply); Controls.Add(buttonCreateSupply);
Controls.Add(dataGridView); Controls.Add(dataGridView);
@ -118,5 +130,6 @@
private ToolStripMenuItem товарыToolStripMenuItem; private ToolStripMenuItem товарыToolStripMenuItem;
private ToolStripMenuItem поставщикиToolStripMenuItem; private ToolStripMenuItem поставщикиToolStripMenuItem;
private Button buttonSupplyStatusArriving; private Button buttonSupplyStatusArriving;
private Button buttonSupplyStatusCompleted;
} }
} }

View File

@ -96,7 +96,35 @@ namespace WinFormsApp
}, SupplyStatus.Arriving); }, SupplyStatus.Arriving);
if (!operationResult) if (!operationResult)
{ {
//throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
}
LoadData();
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка передачи заказа в работу");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
private void buttonSupplyStatusCompleted_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
Guid id = (Guid)dataGridView.SelectedRows[0].Cells["Id"].Value;
_logger.LogInformation("Поставка No{id}. Меняется статус", id);
try
{
var operationResult = _supplyLogic.StatusUpdate(new SupplyBindingModel
{
Id = id,
Status = (SupplyStatus)dataGridView.SelectedRows[0].Cells["Status"].Value
}, SupplyStatus.Completed);
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
} }
LoadData(); LoadData();
} }