order status
This commit is contained in:
parent
e0c39713ee
commit
46477a6c6f
@ -52,11 +52,6 @@ namespace ComputerShopBusinessLogic.BusinessLogics
|
|||||||
var receivings = new List<EquipmentReceivingViewModel>();
|
var receivings = new List<EquipmentReceivingViewModel>();
|
||||||
|
|
||||||
|
|
||||||
// ОШИБКА: int не содержит определения HasValue()
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
foreach(var supply in supplies)
|
foreach(var supply in supplies)
|
||||||
{
|
{
|
||||||
if (supply.ReceivingId.HasValue)
|
if (supply.ReceivingId.HasValue)
|
||||||
@ -69,7 +64,6 @@ namespace ComputerShopBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
var receivingnames = new List<string>();
|
var receivingnames = new List<string>();
|
||||||
foreach (var receiving in receivings)
|
foreach (var receiving in receivings)
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
using ComputerShopContracts.BindingModels;
|
using ComputerShopContracts.BindingModels;
|
||||||
using ComputerShopContracts.SearchModels;
|
using ComputerShopContracts.SearchModels;
|
||||||
using ComputerShopContracts.ViewModels;
|
using ComputerShopContracts.ViewModels;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace ComputerShopClientApp.Controllers
|
namespace ComputerShopClientApp.Controllers
|
||||||
@ -147,6 +149,12 @@ namespace ComputerShopClientApp.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Enter()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult GetWordFile()
|
public IActionResult GetWordFile()
|
||||||
{
|
{
|
||||||
@ -158,10 +166,37 @@ namespace ComputerShopClientApp.Controllers
|
|||||||
return new PhysicalFileResult("F:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
return new PhysicalFileResult("F:\\ReportsCourseWork\\excelfile.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpPost]
|
||||||
public IActionResult Enter()
|
public void SetInWork(int id)
|
||||||
{
|
{
|
||||||
return View();
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest($"api/main/setinwork?id={id}", id);
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void SetReady(int id)
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest($"api/main/setready?id={id}", id);
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void SetDone(int id)
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
APIClient.PostRequest($"api/main/setdone?id={id}", id);
|
||||||
|
Response.Redirect("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Заказы</h1>
|
<h1 class="display-4">Покупки</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="CreatePurchase">Создать заказ</a>
|
<a asp-action="CreatePurchase">Создать покупку</a>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -67,6 +67,20 @@
|
|||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Status)
|
@Html.DisplayFor(modelItem => item.Status)
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<form action="SetInWork" method="post">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Выполняется</button>
|
||||||
|
</form>
|
||||||
|
<form action="SetReady" method="post">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Выдан</button>
|
||||||
|
</form>
|
||||||
|
<form action="SetDone" method="post">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-danger">Готов</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -11,7 +11,7 @@ namespace ComputerShopContracts.BindingModels
|
|||||||
public class SupplyBindingModel : ISupplyModel
|
public class SupplyBindingModel : ISupplyModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int ReceivingId { get; set; }
|
public int? ReceivingId { get; set; }
|
||||||
public SupplyStatus Status { get; set; } = SupplyStatus.Неизвестен;
|
public SupplyStatus Status { get; set; } = SupplyStatus.Неизвестен;
|
||||||
|
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
|
@ -23,7 +23,7 @@ namespace ComputerShopContracts.ViewModels
|
|||||||
[DisplayName("Номер")]
|
[DisplayName("Номер")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DisplayName("Номер получения")]
|
[DisplayName("Номер получения")]
|
||||||
public int ReceivingId { get; set; }
|
public int? ReceivingId { get; set; }
|
||||||
public Dictionary<int, IOrderModel> SupplyOrders
|
public Dictionary<int, IOrderModel> SupplyOrders
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -7,7 +7,7 @@ namespace ComputerShopDataModels.Models
|
|||||||
SupplyStatus Status { get; }
|
SupplyStatus Status { get; }
|
||||||
DateTime DateCreate { get; }
|
DateTime DateCreate { get; }
|
||||||
DateTime? DateImplement { get; }
|
DateTime? DateImplement { get; }
|
||||||
int ReceivingId { get; }
|
int? ReceivingId { get; }
|
||||||
Dictionary<int, IOrderModel> SupplyOrders { get; }
|
Dictionary<int, IOrderModel> SupplyOrders { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace ComputerShopDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-QA8P9OJ;Initial Catalog=ComputerShopDatabaseCW;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-IRUVF5S\SQLEXPRESS;Initial Catalog=ComputerShopDatabaseCW;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
|
|
||||||
public int OrderId { get; set; }
|
public int OrderId { get; set; }
|
||||||
|
|
||||||
public int ReceivingId { get; set; }
|
public int? ReceivingId { get; set; }
|
||||||
public virtual EquipmentReceiving Receiving { get; set; }
|
public virtual EquipmentReceiving Receiving { get; set; }
|
||||||
|
|
||||||
private Dictionary<int, IOrderModel>? _supplyOrders =
|
private Dictionary<int, IOrderModel>? _supplyOrders =
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using ComputerShopContracts.BindingModels;
|
using ComputerShopContracts.BindingModels;
|
||||||
using ComputerShopContracts.BusinessLogicContracts;
|
using ComputerShopContracts.BusinessLogicContracts;
|
||||||
using ComputerShopContracts.SearchModels;
|
using ComputerShopContracts.SearchModels;
|
||||||
|
using ComputerShopContracts.StorageContracts;
|
||||||
using ComputerShopContracts.ViewModels;
|
using ComputerShopContracts.ViewModels;
|
||||||
|
using DocumentFormat.OpenXml.Presentation;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace ComputerShopRestApi.Controllers
|
namespace ComputerShopRestApi.Controllers
|
||||||
@ -12,12 +14,14 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IPurchaseLogic _purchase;
|
private readonly IPurchaseLogic _purchase;
|
||||||
|
private readonly IPurchaseStorage _purchaseSTR;
|
||||||
private readonly IComponentLogic _component;
|
private readonly IComponentLogic _component;
|
||||||
public MainController(ILogger<MainController> logger, IPurchaseLogic purchase, IComponentLogic component)
|
public MainController(ILogger<MainController> logger, IPurchaseLogic purchase, IComponentLogic component, IPurchaseStorage purchaseStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_purchase = purchase;
|
_purchase = purchase;
|
||||||
_component = component;
|
_component = component;
|
||||||
|
_purchaseSTR = purchaseStorage;
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public List<ComponentViewModel>? GetComponentList()
|
public List<ComponentViewModel>? GetComponentList()
|
||||||
@ -77,5 +81,68 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void SetInWork(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var puchase = _purchaseSTR.GetElement(new() { Id = id });
|
||||||
|
_purchase.TakePurchaseInWork(new()
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
ComponentId = puchase.ComponentId,
|
||||||
|
Count = puchase.Count,
|
||||||
|
Sum = puchase.Sum,
|
||||||
|
Status = puchase.Status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка изменения закупки");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void SetReady(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var puchase = _purchaseSTR.GetElement(new() { Id = id });
|
||||||
|
_purchase.FinishPurchase(new()
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
ComponentId = puchase.ComponentId,
|
||||||
|
Count = puchase.Count,
|
||||||
|
Sum = puchase.Sum,
|
||||||
|
Status = puchase.Status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка изменения закупки");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public void SetDone(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var puchase = _purchaseSTR.GetElement(new() { Id = id });
|
||||||
|
_purchase.DeliveryPurchase(new()
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
ComponentId = puchase.ComponentId,
|
||||||
|
Count = puchase.Count,
|
||||||
|
Sum = puchase.Sum,
|
||||||
|
Status = puchase.Status
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка изменения закупки");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user