working excel report

This commit is contained in:
strwbrry1 2024-12-24 18:49:58 +04:00
parent 496d4a0f77
commit 37facf0620
2 changed files with 16 additions and 13 deletions

View File

@ -52,18 +52,19 @@ namespace ProjectPublishing.Reports
CountOut = (int?)null
})
.Union(
_orderRepository
.ReadOrders() // тут где-то
.Where(x => x.OrderDate >= startDate && x.OrderDate <= endDate && x.Materials.Any(y => y.MaterialsId == materialId))
.SelectMany(order => order.Materials
.Where(m => m.MaterialsId == materialId)
.Select(m => new {
MaterialId = m.MaterialsId,
Date = order.OrderDate,
CountIn = (int?)null,
CountOut = (int?)m.Amount
})))
.OrderBy(x => x.Date);
_orderRepository
.ReadOrders() // тут где-то
.Where(x => x.OrderDate >= startDate && x.OrderDate <= endDate.AddDays(1) && x.Materials.Any(y => y.MaterialsId == materialId))
.SelectMany(order => order.Materials
.Where(m => m.MaterialsId == materialId)
.Select(m => new
{
MaterialId = m.MaterialsId,
Date = order.OrderDate,
CountIn = (int?)null,
CountOut = (int?)m.Amount
})))
.OrderBy(x => x.Date);
_logger.LogDebug("Объединенные данные в отчет: {json}", JsonConvert.SerializeObject(data));
return new List<string[]> { item }
.Union(

View File

@ -87,7 +87,9 @@ WHERE Id=@id";
{
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
var querySelect = @"
SELECT o.*, ma.MaterialId
SELECT o.*,
ma.MaterialId as MaterialsId,
ma.Amount as MaterialsAmount
FROM PrintingOrder o
LEFT JOIN OrderMaterials ma ON o.Id = ma.OrderId
"; // возможно сюда фикс