fix relation in DatabaseImplement, some implements in StorekeeperApp
This commit is contained in:
parent
45b70d2f5c
commit
b31646b7a8
@ -6,7 +6,7 @@ using FactoryContracts.StoragesContracts;
|
||||
using FactoryContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace FactoryBuisinessLogic.BusinessLogics
|
||||
namespace FactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class MachineLogic : IMachineLogic
|
||||
{
|
||||
@ -33,6 +33,18 @@ namespace FactoryBuisinessLogic.BusinessLogics
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MachineViewModel>? ReadListByIds(List<int> ids)
|
||||
{
|
||||
_logger.LogInformation("ReadListByIds.");
|
||||
var list = _machineStorage.GetListByIds(ids);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadListByIds. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
public MachineViewModel? ReadElement(MachineSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
|
@ -6,7 +6,7 @@ using FactoryContracts.StoragesContracts;
|
||||
using FactoryContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace FactoryBuisinessLogic.BusinessLogics
|
||||
namespace FactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class ProductLogic : IProductLogic
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ using FactoryContracts.StoragesContracts;
|
||||
using FactoryContracts.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace FactoryBuisinessLogic.BusinessLogics
|
||||
namespace FactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class RequirementLogic : IRequirementLogic
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using FactoryContracts.SearchModels;
|
||||
using FactoryContracts.StoragesContracts;
|
||||
using FactoryContracts.ViewModels;
|
||||
|
||||
namespace FactoryBuisinessLogic.BusinessLogics
|
||||
namespace FactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class StorekeeperReportLogic : IStorekeeperReportLogic
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using FactoryContracts.SearchModels;
|
||||
using FactoryContracts.StoragesContracts;
|
||||
using FactoryContracts.ViewModels;
|
||||
|
||||
namespace FactoryBuisinessLogic.BusinessLogics
|
||||
namespace FactoryBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class WorkerReportLogic : IWorkerReportLogic
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ namespace FactoryContracts.BindingModels
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
public ExecutionPhaseStatus Status { get; set; } = ExecutionPhaseStatus.Неизвестен;
|
||||
public int ClientId { get; set; }
|
||||
public int? PlanProductionId { get; set; }
|
||||
public int PlanProductionId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ namespace FactoryContracts.BusinessLogicsContracts
|
||||
{
|
||||
List<MachineViewModel>? ReadList(MachineSearchModel? model);
|
||||
|
||||
List<MachineViewModel>? ReadListByIds(List<int> ids);
|
||||
|
||||
MachineViewModel? ReadElement(MachineSearchModel model);
|
||||
|
||||
bool Create(MachineBindingModel model);
|
||||
|
@ -10,6 +10,8 @@ namespace FactoryContracts.StoragesContracts
|
||||
|
||||
List<MachineViewModel> GetFilteredList(MachineSearchModel model);
|
||||
|
||||
List<MachineViewModel> GetListByIds(List<int> ids);
|
||||
|
||||
List<MachinePeriodReportViewModel> GetMachinesByPeriod(ClientSearchModel client, ReportBindingModel model);
|
||||
|
||||
MachineViewModel? GetElement(MachineSearchModel model);
|
||||
|
@ -9,7 +9,7 @@ namespace FactoryContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ClientId { get; set; }
|
||||
public int? PlanProductionId { get; set; }
|
||||
public int PlanProductionId { get; set; }
|
||||
|
||||
[DisplayName("ФИО исполнителя")]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
|
@ -9,6 +9,6 @@ namespace FactoryDataModels.Models
|
||||
string ImplementerFIO { get; }
|
||||
ExecutionPhaseStatus Status { get; }
|
||||
int ClientId { get; }
|
||||
int? PlanProductionId { get; }
|
||||
int PlanProductionId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
double Cost { get; }
|
||||
|
||||
int ClientId { get; }
|
||||
DateTime DateCreate { get; }
|
||||
|
||||
Dictionary<int, (IProductModel, int)> WorkpieceProducts { get; }
|
||||
}
|
||||
|
@ -23,8 +23,4 @@
|
||||
<ProjectReference Include="..\FactoryContracts\FactoryContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -42,6 +42,18 @@ namespace FactoryDatabaseImplement.Implements
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<MachineViewModel> GetListByIds(List<int> ids)
|
||||
{
|
||||
using var context = new FactoryDatabase();
|
||||
return context.Machines
|
||||
.Include(x => x.Client)
|
||||
.Include (x => x.PlanProductions)
|
||||
.ThenInclude (x => x.PlanProduction)
|
||||
.Where(x => ids.Any(y => x.Id == y))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public MachineViewModel? GetElement(MachineSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.MachineName) && !model.Id.HasValue)
|
||||
|
@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace FactoryDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(FactoryDatabase))]
|
||||
[Migration("20240528111521_InitCreate")]
|
||||
[Migration("20240528130831_InitCreate")]
|
||||
partial class InitCreate
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -71,8 +71,7 @@ namespace FactoryDatabaseImplement.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("PlanProductionId")
|
||||
.IsRequired()
|
||||
b.Property<int>("PlanProductionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Status")
|
@ -69,8 +69,7 @@ namespace FactoryDatabaseImplement.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("PlanProductionId")
|
||||
.IsRequired()
|
||||
b.Property<int>("PlanProductionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Status")
|
||||
|
@ -12,11 +12,11 @@ namespace FactoryDatabaseImplement.Models
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public int ClientId { get; private set; }
|
||||
public virtual Client Client { get; private set; } = new();
|
||||
public virtual Client Client { get; private set; }
|
||||
|
||||
[Required]
|
||||
public int? PlanProductionId { get; private set; }
|
||||
public virtual PlanProduction PlanProduction { get; private set; } = new();
|
||||
public int PlanProductionId { get; private set; }
|
||||
public virtual PlanProduction PlanProduction { get; private set; }
|
||||
|
||||
[Required]
|
||||
public string ExecutionPhaseName { get; private set; } = string.Empty;
|
||||
|
@ -13,7 +13,7 @@ namespace FactoryDatabaseImplement.Models
|
||||
[Required]
|
||||
public int ClientId { get; private set; }
|
||||
|
||||
public virtual Client Client { get; private set; } = new();
|
||||
public virtual Client Client { get; private set; }
|
||||
|
||||
[Required]
|
||||
public string MachineName { get; private set; } = string.Empty;
|
||||
|
@ -15,8 +15,8 @@ namespace FactoryDatabaseImplement.Models
|
||||
[Required]
|
||||
public int Count { get; set; }
|
||||
|
||||
public virtual PlanProduction PlanProduction { get; set; } = new();
|
||||
public virtual PlanProduction PlanProduction { get; set; }
|
||||
|
||||
public virtual Machine Machine { get; set; } = new();
|
||||
public virtual Machine Machine { get; set; }
|
||||
}
|
||||
}
|
@ -13,12 +13,12 @@ namespace FactoryDatabaseImplement.Models
|
||||
[Required]
|
||||
public int ClientId { get; private set; }
|
||||
|
||||
public virtual Client Client { get; private set; } = new();
|
||||
public virtual Client Client { get; private set; }
|
||||
|
||||
[Required]
|
||||
public int RequirementId { get; private set; }
|
||||
|
||||
public virtual Requirement Requirement { get; private set; } = new();
|
||||
public virtual Requirement Requirement { get; private set; }
|
||||
|
||||
[Required]
|
||||
public string ProductName { get; private set; } = string.Empty;
|
||||
|
@ -13,7 +13,7 @@ namespace FactoryDatabaseImplement.Models
|
||||
[Required]
|
||||
public int ClientId { get; private set; }
|
||||
|
||||
public virtual Client Client { get; private set; } = new();
|
||||
public virtual Client Client { get; private set; }
|
||||
|
||||
[Required]
|
||||
public string RequirementName { get; private set; } = string.Empty;
|
||||
@ -25,7 +25,7 @@ namespace FactoryDatabaseImplement.Models
|
||||
public int Lifetime { get; private set; }
|
||||
|
||||
[ForeignKey("RequirementId")]
|
||||
public virtual Product Product { get; private set; } = new();
|
||||
public virtual Product Product { get; private set; }
|
||||
|
||||
public static Requirement Create(RequirementBindingModel model)
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace FactoryDatabaseImplement.Models
|
||||
public string WorkpieceName { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public int ClientId { get; set; }
|
||||
public virtual Client Client { get; set; } = new Client();
|
||||
public virtual Client Client { get; set; }
|
||||
[Required]
|
||||
public string Material { get; set; } = string.Empty;
|
||||
|
||||
|
12
Factory/FactoryRestApi/Controllers/StorekeeperController.cs
Normal file
12
Factory/FactoryRestApi/Controllers/StorekeeperController.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace FactoryRestApi.Controllers
|
||||
{
|
||||
public class StorekeeperController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
13
Factory/FactoryRestApi/FactoryRestApi.csproj
Normal file
13
Factory/FactoryRestApi/FactoryRestApi.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
25
Factory/FactoryRestApi/Program.cs
Normal file
25
Factory/FactoryRestApi/Program.cs
Normal file
@ -0,0 +1,25 @@
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
31
Factory/FactoryRestApi/Properties/launchSettings.json
Normal file
31
Factory/FactoryRestApi/Properties/launchSettings.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:65510",
|
||||
"sslPort": 44345
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"FactoryRestApi": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7230;http://localhost:5003",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
Factory/FactoryRestApi/appsettings.Development.json
Normal file
8
Factory/FactoryRestApi/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
Factory/FactoryRestApi/appsettings.json
Normal file
9
Factory/FactoryRestApi/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
9
Factory/FactoryStorekeeperApp/Client.cs
Normal file
9
Factory/FactoryStorekeeperApp/Client.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using FactoryContracts.ViewModels;
|
||||
|
||||
namespace FactoryStorekeeperApp
|
||||
{
|
||||
public static class Client
|
||||
{
|
||||
public static ClientViewModel? client { get; set; }
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using FactoryContracts.BusinessLogicsContracts;
|
||||
using FactoryContracts.SearchModels;
|
||||
using FactoryContracts.ViewModels;
|
||||
using FactoryDataModels.Enums;
|
||||
using FactoryDataModels.Models;
|
||||
using FactoryStorekepeerApp.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -12,13 +13,18 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IClientLogic clientLogic;
|
||||
private readonly IMachineLogic machineLogic;
|
||||
private readonly IRequirementLogic requirementLogic;
|
||||
private readonly IProductLogic productLogic;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger, IRequirementLogic requirementLogic, IProductLogic productLogic, IMachineLogic machineLogic)
|
||||
private bool IsLoggedIn { get { return Client.client != null; } }
|
||||
private int UserId { get { return Client.client!.Id; } }
|
||||
|
||||
public HomeController(ILogger<HomeController> logger, IClientLogic clientLogic, IRequirementLogic requirementLogic, IProductLogic productLogic, IMachineLogic machineLogic)
|
||||
{
|
||||
_logger = logger;
|
||||
this.clientLogic = clientLogic;
|
||||
this.requirementLogic = requirementLogic;
|
||||
this.productLogic = productLogic;
|
||||
this.machineLogic = machineLogic;
|
||||
@ -26,6 +32,10 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
@ -38,32 +48,78 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Enter()
|
||||
{
|
||||
if (IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Index");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Enter(string login, string password)
|
||||
{
|
||||
var existsClient = clientLogic.ReadElement(new ClientSearchModel { Login = login, Password = password });
|
||||
|
||||
if (existsClient != null)
|
||||
{
|
||||
Client.client = existsClient;
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Register()
|
||||
{
|
||||
if (IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Index");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult Register(string login, string email, string password, string passwordConfirm)
|
||||
{
|
||||
if (!password.Equals(passwordConfirm))
|
||||
{
|
||||
return Error();
|
||||
}
|
||||
clientLogic.Create(new ClientBindingModel
|
||||
{
|
||||
Email = email,
|
||||
Login = login,
|
||||
Password = password,
|
||||
Role = ClientRole.Кладовщик
|
||||
});
|
||||
return Redirect("~/Home/Index");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Machines()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(machineLogic.ReadList(null));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Machine()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void Machine(string machinename, DateTime exploitationstartdate, int lifetime)
|
||||
public IActionResult Machine(string machinename, DateTime exploitationstartdate, int lifetime)
|
||||
{
|
||||
var element = machineLogic.ReadElement(new MachineSearchModel
|
||||
{
|
||||
MachineName = machinename,
|
||||
ClientId = Client.client.Id,
|
||||
});
|
||||
if (element == null) {
|
||||
machineLogic.Create(new MachineBindingModel
|
||||
@ -71,6 +127,7 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
MachineName = machinename,
|
||||
ExploitationStartDate = exploitationstartdate,
|
||||
Lifetime = lifetime,
|
||||
ClientId = Client.client.Id,
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -80,35 +137,47 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
MachineName = machinename,
|
||||
ExploitationStartDate = exploitationstartdate,
|
||||
Lifetime = lifetime,
|
||||
ClientId = Client.client.Id,
|
||||
});
|
||||
}
|
||||
Redirect("~/Home/Machines");
|
||||
return Redirect("~/Home/Machines");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Products()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(productLogic.ReadList(null));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Product()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Enter();
|
||||
}
|
||||
return View(machineLogic.ReadList(null));
|
||||
}
|
||||
[HttpPost]
|
||||
public void Product(string productname, int price, List<MachineViewModel> machinetable)
|
||||
public void Product(string productname, int price, List<int> machines)
|
||||
{
|
||||
var element = productLogic.ReadElement(new ProductSearchModel
|
||||
{
|
||||
ProductName = productname,
|
||||
ClientId = Client.client.Id,
|
||||
});
|
||||
var machineList = machineLogic.ReadListByIds(machines);
|
||||
if (element == null)
|
||||
{
|
||||
productLogic.Create(new ProductBindingModel
|
||||
{
|
||||
ProductName = productname,
|
||||
Price = price,
|
||||
ProductMachines = machinetable.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel),
|
||||
ProductMachines = machineList.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel),
|
||||
ClientId = Client.client.Id,
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -117,7 +186,8 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
{
|
||||
ProductName = productname,
|
||||
Price = price,
|
||||
ProductMachines = machinetable.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel),
|
||||
ProductMachines = machineList.ToDictionary(recPC => recPC.Id, recPC => recPC as IMachineModel),
|
||||
ClientId = Client.client.Id,
|
||||
});
|
||||
}
|
||||
Redirect("~/Home/Products");
|
||||
@ -125,23 +195,39 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Requirements()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(requirementLogic.ReadList(null));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult Requirement()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Reports()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult MachinePeriodReport()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
List<MachinePeriodReportViewModel> reports = new List<MachinePeriodReportViewModel>
|
||||
{
|
||||
new MachinePeriodReportViewModel
|
||||
@ -163,6 +249,10 @@ namespace FactoryStorekeeperApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult PlanProductionByProductReport()
|
||||
{
|
||||
if (!IsLoggedIn)
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
List<ProductPlanProductionReportViewModel> productPlanProductions = new List<ProductPlanProductionReportViewModel>
|
||||
{
|
||||
new ProductPlanProductionReportViewModel
|
||||
|
@ -1,4 +1,4 @@
|
||||
using FactoryBuisinessLogic.BusinessLogics;
|
||||
using FactoryBusinessLogic.BusinessLogics;
|
||||
using FactoryContracts.BusinessLogicsContracts;
|
||||
using FactoryContracts.StoragesContracts;
|
||||
using FactoryDatabaseImplement.Implements;
|
||||
@ -6,17 +6,17 @@ using FactoryDatabaseImplement.Implements;
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<IMachineLogic, MachineLogic>();
|
||||
builder.Services.AddTransient<IProductLogic, ProductLogic>();
|
||||
builder.Services.AddTransient<IRequirementLogic, RequirementLogic>();
|
||||
builder.Services.AddTransient<IStorekeeperReportLogic, StorekeeperReportLogic>();
|
||||
|
||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
builder.Services.AddTransient<IMachineStorage, MachineStorage>();
|
||||
builder.Services.AddTransient<IProductStorage, ProductStorage>();
|
||||
builder.Services.AddTransient<IRequirementStorage, RequirementStorage>();
|
||||
|
||||
//builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
|
@ -14,27 +14,9 @@
|
||||
<div class="col-4">Цена:</div>
|
||||
<div class="col-8"><input type="number" id="price" name="price"/></div>
|
||||
</div>
|
||||
<div class="table-responsive-sm">
|
||||
<div class="row">
|
||||
<div class="col-4">Станки:</div>
|
||||
<table id="machinetable" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Название</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var machine in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" id="machines" name="machines" value="@machine.Id" />
|
||||
</td>
|
||||
<td>@machine.MachineName</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<select id="machines" name="machines" class="form-control border border-dark rounded" multiple size="5" asp-items="@(new SelectList(Model, "Id", "MachineName"))"></select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
|
@ -1,6 +1,5 @@
|
||||
using FactoryContracts.BusinessLogicsContracts;
|
||||
using FactoryBusinessLogic.BusinessLogics;
|
||||
using FactoryBuisinessLogic.BusinessLogics;
|
||||
using FactoryContracts.StoragesContracts;
|
||||
using FactoryDatabaseImplement.Implements;
|
||||
using FactoryWorkerApp;
|
||||
|
Loading…
Reference in New Issue
Block a user