Всё?
This commit is contained in:
parent
6a38f7046c
commit
2dc771cdb5
@ -36,7 +36,10 @@ namespace FactoryBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
return products;
|
return products;
|
||||||
}
|
}
|
||||||
|
public List<WorkpieceTimeReportViewModel> GetWorkpieces(ClientSearchModel client, ReportBindingModel model)
|
||||||
|
{
|
||||||
|
return _workpieceStorage.GetTimeReport(client, model);
|
||||||
|
}
|
||||||
public void SaveWorkpiecesToPdfFile(ClientSearchModel client, ReportBindingModel model)
|
public void SaveWorkpiecesToPdfFile(ClientSearchModel client, ReportBindingModel model)
|
||||||
{
|
{
|
||||||
_saveToPdf.CreateWorkerDoc(new WorkerPdfInfo
|
_saveToPdf.CreateWorkerDoc(new WorkerPdfInfo
|
||||||
@ -45,15 +48,16 @@ namespace FactoryBusinessLogic.BusinessLogics
|
|||||||
Title = "Список заготовок",
|
Title = "Список заготовок",
|
||||||
DateFrom = model.DateFrom!.Value,
|
DateFrom = model.DateFrom!.Value,
|
||||||
DateTo = model.DateTo!.Value,
|
DateTo = model.DateTo!.Value,
|
||||||
|
Workpieces = GetWorkpieces(client, model)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void SaveProductsToExcelFile(ReportBindingModel model, List<int> plans)
|
public void SaveProductsToExcelFile(ReportBindingModel model, List<int> ids)
|
||||||
{
|
{
|
||||||
_saveToExcel.CreateWorkerReport(new WorkerExcelInfo
|
_saveToExcel.CreateWorkerReport(new WorkerExcelInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список планов",
|
Title = "Список планов",
|
||||||
//PlanProductionProducts = GetProductsByPlanProduction(plans)
|
PlanProductionProducts = GetProductsByPlanProduction(ids)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void SaveProudctsToWordFile(ReportBindingModel model, List<int> ids)
|
public void SaveProudctsToWordFile(ReportBindingModel model, List<int> ids)
|
||||||
@ -63,7 +67,7 @@ namespace FactoryBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список планов",
|
Title = "Список планов",
|
||||||
//PlanProductionProducts = GetProductsByPlanProduction(plans)
|
PlanProductionProducts = GetProductsByPlanProduction(ids)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,41 +94,63 @@ namespace FactoryBusinessLogic.OfficePackage
|
|||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
CreateTable(new List<string> { "3cm", "5cm" });
|
CreateTable(new List<string> { "3cm", "5cm", "5cm" });
|
||||||
foreach (var report in info.Workpieces)
|
CreateRow(new PdfRowParameters
|
||||||
|
{
|
||||||
|
Texts = new List<string> { "Название изделия", "Этапы выполнения", "Станки" },
|
||||||
|
Style = "NormalTitle",
|
||||||
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
|
});
|
||||||
|
foreach (var workpiece in info.Workpieces)
|
||||||
{
|
{
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "Заготовка", "Станок" },
|
Texts = new List<string>
|
||||||
Style = "NormalTitle",
|
{
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
workpiece.WorkpieceName,
|
||||||
});
|
string.Empty,
|
||||||
CreateRow(new PdfRowParameters
|
string.Empty,
|
||||||
{
|
},
|
||||||
Texts = new List<string> { report.WorkpieceName, "" },
|
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
});
|
});
|
||||||
foreach (var machinee in report.Machines)
|
var phaseNames = workpiece.ExecutionPhases.Select(x => x.ExecutionPhaseName).ToList();
|
||||||
CreateRow(new PdfRowParameters
|
var machineNames = workpiece.Machines.Select(x => x.MachineName).ToList();
|
||||||
{
|
|
||||||
Texts = new List<string> { "", machinee },
|
if (phaseNames.Count != machineNames.Count)
|
||||||
Style = "Normal",
|
{
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
if (phaseNames.Count > machineNames.Count)
|
||||||
});
|
{
|
||||||
CreateRow(new PdfRowParameters
|
var diff = phaseNames.Count - machineNames.Count;
|
||||||
|
for (int i = 0; i < diff; i++)
|
||||||
|
{
|
||||||
|
machineNames.Add(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var diff = machineNames.Count - phaseNames.Count;
|
||||||
|
for (int i = 0; i < diff; i++)
|
||||||
|
{
|
||||||
|
phaseNames.Add(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var tupleList = machineNames.Zip(phaseNames, Tuple.Create);
|
||||||
|
foreach (var tuple in tupleList)
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "", "Этап выполнения" },
|
|
||||||
Style = "NormalTitle",
|
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
|
||||||
});
|
|
||||||
foreach (var phase in report.ExecutionPhases)
|
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "", phase },
|
Texts = new List<string>
|
||||||
|
{
|
||||||
|
string.Empty,
|
||||||
|
tuple.Item1,
|
||||||
|
tuple.Item2,
|
||||||
|
},
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SaveWorkerPdf(info);
|
SaveWorkerPdf(info);
|
||||||
}
|
}
|
||||||
|
@ -72,28 +72,37 @@ namespace FactoryBusinessLogic.OfficePackage
|
|||||||
});
|
});
|
||||||
foreach (var ppp in info.PlanProductionProducts)
|
foreach (var ppp in info.PlanProductionProducts)
|
||||||
{
|
{
|
||||||
var t = ppp.Products;
|
|
||||||
List<(string, WordTextProperties)> texts = new List<(string, WordTextProperties)>
|
List<(string, WordTextProperties)> texts = new List<(string, WordTextProperties)>
|
||||||
{
|
{
|
||||||
(ppp.ProductionName, new WordTextProperties { Bold = true, Size = "24", })
|
(ppp.ProductionName, new WordTextProperties { Bold = true, Size = "24", })
|
||||||
};
|
};
|
||||||
foreach (var product in ppp.Products)
|
CreateParagraph(new WordParagraph
|
||||||
|
{
|
||||||
|
Texts = texts,
|
||||||
|
TextProperties = new WordTextProperties
|
||||||
|
{
|
||||||
|
Size = "24",
|
||||||
|
JustificationType = WordJustificationType.Both
|
||||||
|
}
|
||||||
|
});
|
||||||
|
foreach (var product in ppp.Products)
|
||||||
{
|
{
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
texts = new List<(string, WordTextProperties)>();
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.Append(product.ProductName);
|
stringBuilder.Append(product.ProductName);
|
||||||
stringBuilder.Append(" — ");
|
stringBuilder.Append(" — ");
|
||||||
stringBuilder.Append(product.Price.ToString());
|
stringBuilder.Append(product.Price.ToString());
|
||||||
texts.Add((stringBuilder.ToString(), new WordTextProperties { Size = "24" }));
|
texts.Add((stringBuilder.ToString(), new WordTextProperties { Size = "24" }));
|
||||||
}
|
CreateParagraph(new WordParagraph
|
||||||
CreateParagraph(new WordParagraph
|
{
|
||||||
{
|
Texts = texts,
|
||||||
Texts = texts,
|
TextProperties = new WordTextProperties
|
||||||
TextProperties = new WordTextProperties
|
{
|
||||||
{
|
Size = "24",
|
||||||
Size = "24",
|
JustificationType = WordJustificationType.Both
|
||||||
JustificationType = WordJustificationType.Both
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
SaveWorkerWord(info);
|
SaveWorkerWord(info);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@ namespace FactoryContracts.BusinessLogicsContracts
|
|||||||
public interface IWorkerReportLogic
|
public interface IWorkerReportLogic
|
||||||
{
|
{
|
||||||
List<PlanProductionProductReportViewModel> GetProductsByPlanProduction(List<int> plans);
|
List<PlanProductionProductReportViewModel> GetProductsByPlanProduction(List<int> plans);
|
||||||
void SaveProudctsToWordFile(ReportBindingModel model, List<int> plans);
|
List<WorkpieceTimeReportViewModel> GetWorkpieces(ClientSearchModel client, ReportBindingModel model);
|
||||||
|
void SaveProudctsToWordFile(ReportBindingModel model, List<int> plans);
|
||||||
void SaveProductsToExcelFile(ReportBindingModel model, List<int> plans);
|
void SaveProductsToExcelFile(ReportBindingModel model, List<int> plans);
|
||||||
void SaveWorkpiecesToPdfFile(ClientSearchModel client, ReportBindingModel model);
|
void SaveWorkpiecesToPdfFile(ClientSearchModel client, ReportBindingModel model);
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ namespace FactoryContracts.StoragesContracts
|
|||||||
List<WorkpieceViewModel> GetFullList();
|
List<WorkpieceViewModel> GetFullList();
|
||||||
|
|
||||||
List<WorkpieceViewModel> GetFilteredList(WorkpieceSearchModel model);
|
List<WorkpieceViewModel> GetFilteredList(WorkpieceSearchModel model);
|
||||||
|
List<WorkpieceTimeReportViewModel> GetTimeReport(ClientSearchModel client, ReportBindingModel model);
|
||||||
|
|
||||||
|
|
||||||
WorkpieceViewModel? GetElement(WorkpieceSearchModel model);
|
WorkpieceViewModel? GetElement(WorkpieceSearchModel model);
|
||||||
|
@ -127,8 +127,9 @@ namespace FactoryDatabaseImplement.Implements
|
|||||||
{
|
{
|
||||||
using var context = new FactoryDatabase();
|
using var context = new FactoryDatabase();
|
||||||
return context.PlanProductions
|
return context.PlanProductions
|
||||||
|
.Distinct()
|
||||||
.Where(plan => ids.Contains(plan.Id))
|
.Where(plan => ids.Contains(plan.Id))
|
||||||
.Select(plan => new PlanProductionProductReportViewModel()
|
.Select(plan => new PlanProductionProductReportViewModel()
|
||||||
{
|
{
|
||||||
ProductionName = plan.ProductionName,
|
ProductionName = plan.ProductionName,
|
||||||
Products = context.WorkpieceProducts
|
Products = context.WorkpieceProducts
|
||||||
@ -136,8 +137,8 @@ namespace FactoryDatabaseImplement.Implements
|
|||||||
.Include(x => x.Workpiece)
|
.Include(x => x.Workpiece)
|
||||||
.Where(product => plan.Id == product.Product.Id)
|
.Where(product => plan.Id == product.Product.Id)
|
||||||
.Select(x => x.Product.GetViewModel)
|
.Select(x => x.Product.GetViewModel)
|
||||||
.ToList()
|
.ToList()
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,8 @@ namespace FactoryDatabaseImplement.Implements
|
|||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.Include(x => x.PlanProductions)
|
.Include(x => x.PlanProductions)
|
||||||
.ThenInclude(x => x.PlanProduction)
|
.ThenInclude(x => x.PlanProduction)
|
||||||
.Select(x => new WorkpieceTimeReportViewModel
|
.Where(x => x.DateCreate <= model.DateTo && x.DateCreate >= model.DateFrom)
|
||||||
|
.Select(x => new WorkpieceTimeReportViewModel
|
||||||
{
|
{
|
||||||
WorkpieceName = x.WorkpieceName,
|
WorkpieceName = x.WorkpieceName,
|
||||||
Machines = context.PlanProductionWorkpieces
|
Machines = context.PlanProductionWorkpieces
|
||||||
@ -119,7 +120,7 @@ namespace FactoryDatabaseImplement.Implements
|
|||||||
.Where(ppw => ppw.WorkpieceId == x.Id)
|
.Where(ppw => ppw.WorkpieceId == x.Id)
|
||||||
.Select(ppw => ppw.PlanProduction.Machines
|
.Select(ppw => ppw.PlanProduction.Machines
|
||||||
.Where(m => m.PlanProductionId == ppw.PlanProductionId)
|
.Where(m => m.PlanProductionId == ppw.PlanProductionId)
|
||||||
.Select(m => m.Machine.GetViewModel).ToList()).FirstOrDefault()!,
|
.Select(m => m.Machine.GetViewModel).ToList()).FirstOrDefault(),
|
||||||
ExecutionPhases = context.ExecutionPhases
|
ExecutionPhases = context.ExecutionPhases
|
||||||
.Where(ep => ep.PlanProductionId.HasValue)
|
.Where(ep => ep.PlanProductionId.HasValue)
|
||||||
.Include(ep => ep.PlanProduction)
|
.Include(ep => ep.PlanProduction)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using FactoryBuisinessLogic.MailWorker;
|
||||||
using FactoryBusinessLogic.BusinessLogics;
|
using FactoryBusinessLogic.BusinessLogics;
|
||||||
using FactoryContracts.BindingModels;
|
using FactoryContracts.BindingModels;
|
||||||
using FactoryContracts.BusinessLogicsContracts;
|
using FactoryContracts.BusinessLogicsContracts;
|
||||||
@ -18,14 +19,16 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private readonly WorkerLogic _logic;
|
private readonly WorkerLogic _logic;
|
||||||
private readonly IWorkerReportLogic _workerReportLogic;
|
private readonly IWorkerReportLogic _workerReportLogic;
|
||||||
private bool IsLoggedIn { get { return Client.user != null; } }
|
private readonly AbstractMailWorker _abstractMailWorker;
|
||||||
|
private bool IsLoggedIn { get { return Client.user != null; } }
|
||||||
private int UserId { get { return Client.user!.Id; } }
|
private int UserId { get { return Client.user!.Id; } }
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger, WorkerLogic logic, IWorkerReportLogic workerReportLogic)
|
public HomeController(ILogger<HomeController> logger, WorkerLogic logic, IWorkerReportLogic workerReportLogic, AbstractMailWorker abstractMailWorker)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
_workerReportLogic = workerReportLogic;
|
_workerReportLogic = workerReportLogic;
|
||||||
|
_abstractMailWorker = abstractMailWorker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
@ -238,7 +241,7 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
{
|
{
|
||||||
return Redirect("Index");
|
return Redirect("Index");
|
||||||
}
|
}
|
||||||
ViewBag.plans = _logic.GetPlanProductions(Client.user!.Id);
|
ViewBag.ids = _logic.GetPlanProductions(Client.user!.Id);
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +252,8 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
{
|
{
|
||||||
return Redirect("Index");
|
return Redirect("Index");
|
||||||
}
|
}
|
||||||
var report = _workerReportLogic.GetProductsByPlanProduction(plans);
|
ViewBag.ids = plans;
|
||||||
|
var report = _workerReportLogic.GetProductsByPlanProduction(plans);
|
||||||
return View(report);
|
return View(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,13 +292,19 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
var startDate = DateTime.Parse(startDateStr);
|
var startDate = DateTime.Parse(startDateStr);
|
||||||
var endDate = DateTime.Parse(endDateStr).AddDays(1);
|
var endDate = DateTime.Parse(endDateStr).AddDays(1);
|
||||||
|
|
||||||
var values = _logic.GetWorkpieceTime(startDate, endDate, Client.user.Id);
|
var reports = _workerReportLogic.GetWorkpieces(
|
||||||
|
new ClientSearchModel
|
||||||
ViewBag.StartDate = startDate;
|
{
|
||||||
ViewBag.EndDate = endDate;
|
Id = Client.user.Id
|
||||||
|
},
|
||||||
return View(values);
|
new ReportBindingModel
|
||||||
|
{
|
||||||
|
DateFrom = startDate,
|
||||||
|
DateTo = endDate,
|
||||||
|
});
|
||||||
|
return View(reports);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -345,6 +355,55 @@ namespace FactoryWorkerApp.Controllers
|
|||||||
_logic.CreateExecutionPhase(model);
|
_logic.CreateExecutionPhase(model);
|
||||||
return RedirectToAction("ExecutionPhases");
|
return RedirectToAction("ExecutionPhases");
|
||||||
}
|
}
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult CreateWord(List<int> ids)
|
||||||
|
{
|
||||||
|
_workerReportLogic.SaveProudctsToWordFile(
|
||||||
|
new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = "D:\\temp\\report.docx"
|
||||||
|
},
|
||||||
|
ids);
|
||||||
|
return PhysicalFile("D:\\temp\\report.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Отчет по изделиям.docx");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult CreateExcel(List<int> ids)
|
||||||
|
{
|
||||||
|
_workerReportLogic.SaveProductsToExcelFile(
|
||||||
|
new ReportBindingModel
|
||||||
|
{
|
||||||
|
FileName = "D:\\temp\\report.xlsx"
|
||||||
|
},
|
||||||
|
ids);
|
||||||
|
return PhysicalFile("D:\\temp\\report.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Отчет по изделиям.xlsx");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public IActionResult SendMail()
|
||||||
|
{
|
||||||
|
var startDateStr = HttpContext.Session.GetString("StartDate");
|
||||||
|
var endDateStr = HttpContext.Session.GetString("EndDate");
|
||||||
|
var startDate = DateTime.Parse(startDateStr);
|
||||||
|
var endDate = DateTime.Parse(endDateStr).AddDays(1);
|
||||||
|
_workerReportLogic.SaveWorkpiecesToPdfFile(
|
||||||
|
new ClientSearchModel
|
||||||
|
{
|
||||||
|
Id = Client.user.Id
|
||||||
|
},
|
||||||
|
new ReportBindingModel
|
||||||
|
{
|
||||||
|
DateFrom = startDate,
|
||||||
|
DateTo = endDate,
|
||||||
|
FileName = "D:\\temp\\report.pdf"
|
||||||
|
});
|
||||||
|
_abstractMailWorker.MailSendAsync(new MailSendInfoBindingModel
|
||||||
|
{
|
||||||
|
MailAddress = Client.user.Email,
|
||||||
|
Subject = $"Отчет по заготовкам пользователя {Client.user.Login}",
|
||||||
|
Text = $"Отчет по заготовкам с {startDate.ToShortDateString()} по {endDate.ToShortDateString()}"
|
||||||
|
});
|
||||||
|
return Redirect("Index");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ using FactoryDatabaseImplement.Implements;
|
|||||||
using FactoryWorkerApp;
|
using FactoryWorkerApp;
|
||||||
using FactoryBusinessLogic.OfficePackage;
|
using FactoryBusinessLogic.OfficePackage;
|
||||||
using FactoryBusinessLogic.OfficePackage.Implements;
|
using FactoryBusinessLogic.OfficePackage.Implements;
|
||||||
|
using FactoryBuisinessLogic.MailWorker;
|
||||||
|
using FactoryContracts.BindingModels;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@ -32,6 +34,8 @@ builder.Services.AddTransient<WorkerLogic>();
|
|||||||
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddSession(options =>
|
builder.Services.AddSession(options =>
|
||||||
{
|
{
|
||||||
@ -43,6 +47,17 @@ builder.Services.AddSession(options =>
|
|||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
||||||
|
|
||||||
|
mailSender?.MailConfig(new MailConfigBindingModel
|
||||||
|
{
|
||||||
|
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
|
||||||
|
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
|
||||||
|
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
|
||||||
|
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
|
||||||
|
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
|
||||||
|
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
|
||||||
|
});
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<div class="row">Выберите планы</div>
|
<div class="row">Выберите планы</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Планы:</div>
|
<div class="col-4">Планы:</div>
|
||||||
<select name="plans" class="form-control border border-dark rounded" multiple size="5" asp-items="@(new SelectList(ViewBag.plans, "Id", "ProductionName"))">
|
<select name="plans" class="form-control border border-dark rounded" multiple size="5" asp-items="@(new SelectList(ViewBag.ids, "Id", "ProductionName"))">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Создать отчёт</button>
|
<button type="submit" class="btn btn-primary">Создать отчёт</button>
|
||||||
|
@ -10,20 +10,12 @@
|
|||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@{
|
@{
|
||||||
//if (Model == null)
|
|
||||||
//{
|
|
||||||
// <h3 class="display-4">Авторизируйтесь</h3>
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Workpieces">Заготовки</a>
|
<a asp-action="Workpieces">Заготовки</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="PlanProductions">Планы производства</a>
|
<a asp-action="PlanProductions">Планы производства</a>
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<a asp-action="ConnectionPlanProductionWorkpiece">Привязка планов производства к заготовкам</a>
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="ExecutionPhases">Этапы выполнения</a>
|
<a asp-action="ExecutionPhases">Этапы выполнения</a>
|
||||||
|
@ -11,15 +11,10 @@
|
|||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@{
|
@{
|
||||||
if (Model == null)
|
|
||||||
{
|
|
||||||
<h3 class="display-4">Авторизируйтесь</h3>
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="PlanProduction">Создать план</a>
|
<a asp-action="PlanProduction">Создать план</a>
|
||||||
|
<a asp-action="ConnectionPlanProductionWorkpiece">Привязка планов производства к заготовкам</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
@ -9,10 +9,26 @@
|
|||||||
<h1 class="display-4">Список изделий по планам производств</h1>
|
<h1 class="display-4">Список изделий по планам производств</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<form asp-controller="ReportToWord" method="post">
|
<form asp-controller="Home" asp-action="CreateWord" method="post">
|
||||||
|
<div style="display: none;">
|
||||||
|
<select name="ids" multiple>
|
||||||
|
@foreach (var it in ViewBag.ids)
|
||||||
|
{
|
||||||
|
<option value="@(it)" selected="selected"></option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<button type="submit" class="btn btn-primary me-3">Сгенерировать отчет в Word</button>
|
<button type="submit" class="btn btn-primary me-3">Сгенерировать отчет в Word</button>
|
||||||
</form>
|
</form>
|
||||||
<form asp-controller="ReportToExcel" method="post">
|
<form asp-controller="Home" asp-action="CreateExcel" method="post">
|
||||||
|
<div style="display: none;">
|
||||||
|
<select name="ids" multiple>
|
||||||
|
@foreach (var it in ViewBag.ids)
|
||||||
|
{
|
||||||
|
<option value="@(it)" selected="selected"></option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Сгенерировать отчет в Excel</button>
|
<button type="submit" class="btn btn-primary">Сгенерировать отчет в Excel</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
<h1 class="display-4">Список заготовок за период</h1>
|
<h1 class="display-4">Список заготовок за период</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form asp-controller="Report" method="post">
|
<form asp-controller="Home" asp-action="SendMail" method="post">
|
||||||
|
<input type="hidden" name="startDate" readonly value="@(ViewBag.startDate)" />
|
||||||
|
<input type="hidden" name="endDate" readonly value="@(ViewBag.endDate)" />
|
||||||
<button type="submit" class="btn btn-primary">Отправить отчет на почту</button>
|
<button type="submit" class="btn btn-primary">Отправить отчет на почту</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -24,23 +26,23 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var workpice in Model)
|
@foreach (var workpiece in Model)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>@workpice.WorkpieceName</td>
|
<td>@workpiece.WorkpieceName</td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
@foreach (var machine in workpice.Machines)
|
@foreach (var machine in workpiece.Machines)
|
||||||
{
|
{
|
||||||
<li>@machine</li>
|
<li>@machine.MachineName</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul>
|
<ul>
|
||||||
@foreach (var phase in workpice.ExecutionPhases)
|
@foreach (var phase in workpiece.ExecutionPhases)
|
||||||
{
|
{
|
||||||
<li>@phase</li>
|
<li>@phase.PlanProductionName</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
var formData = $('#TimeReportWeb').serialize();
|
var formData = $('#TimeReportWeb').serialize();
|
||||||
|
|
||||||
$.post('/Home/TimeReportWeb', formData, function (response) {
|
$.post('/Home/TimeReportWeb', formData, function (response) {
|
||||||
window.location.href = '/Home/WorkpieceTimeReport';
|
window.location.href = '/Home/WorkpieceDateReport';
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
alert('Произошла ошибка при создании отчета.');
|
alert('Произошла ошибка при создании отчета.');
|
||||||
});
|
});
|
||||||
|
@ -33,6 +33,9 @@
|
|||||||
<th>
|
<th>
|
||||||
Цена
|
Цена
|
||||||
</th>
|
</th>
|
||||||
|
<th>
|
||||||
|
Дата
|
||||||
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Изменить заготовку
|
Изменить заготовку
|
||||||
</th>
|
</th>
|
||||||
@ -54,6 +57,9 @@
|
|||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Cost)
|
@Html.DisplayFor(modelItem => item.Cost)
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.DateCreate)
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a asp-action="Workpiece" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
<a asp-action="Workpiece" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -114,5 +114,15 @@ namespace FactoryWorkerApp
|
|||||||
{
|
{
|
||||||
return _productLogic.ReadList(null);
|
return _productLogic.ReadList(null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public List<WorkpieceTimeReportViewModel>? GetWorkpieceTime(DateTime? startDate, DateTime? endDate, int ClientId)
|
||||||
|
{
|
||||||
|
var workpieces = _workpieceLogic.ReadList(new() { DateFrom = startDate, DateTo = endDate, ClientId = ClientId });
|
||||||
|
if (workpieces == null)
|
||||||
|
return new();
|
||||||
|
List<WorkpieceTimeReportViewModel> detailTimeReports = new List<WorkpieceTimeReportViewModel>();
|
||||||
|
|
||||||
|
return detailTimeReports;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,12 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
|
|
||||||
"IPAddress": "http://localhost:5283/"
|
"IPAddress": "http://localhost:5283/",
|
||||||
|
|
||||||
|
"SmtpClientHost": "smtp.gmail.com",
|
||||||
|
"SmtpClientPort": "587",
|
||||||
|
"PopHost": "pop.gmail.com",
|
||||||
|
"PopPort": "995",
|
||||||
|
"MailLogin": "labworker83@gmail.com",
|
||||||
|
"MailPassword": "wpxc drvx lhqb uqpe"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user