Отчет с изделиями и их компонентами
This commit is contained in:
parent
e856ffa262
commit
ef9ae7a52b
@ -29,8 +29,8 @@ namespace FurnitureAssembly
|
|||||||
dataGridView.Rows.Clear();
|
dataGridView.Rows.Clear();
|
||||||
foreach (var elem in dict)
|
foreach (var elem in dict)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
|
dataGridView.Rows.Add(new object[] { elem.FurnitureName, "", "" });
|
||||||
foreach (var listElem in elem.Furnitures)
|
foreach (var listElem in elem.Components)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,11 @@ namespace FurnitureAssemblyBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = pc.ComponentName,
|
Text = pc.FurnitureName,
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
foreach (var product in pc.Furnitures)
|
foreach (var product in pc.Components)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
|
@ -37,23 +37,23 @@ namespace FurnitureAssemblyBusinessLogic
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<ReportFurnitureComponentViewModel> GetFurnitureComponent()
|
public List<ReportFurnitureComponentViewModel> GetFurnitureComponent()
|
||||||
{
|
{
|
||||||
|
var furnitures = _furnitureStorage.GetFullList();
|
||||||
var components = _componentStorage.GetFullList();
|
var components = _componentStorage.GetFullList();
|
||||||
var products = _furnitureStorage.GetFullList();
|
|
||||||
var list = new List<ReportFurnitureComponentViewModel>();
|
var list = new List<ReportFurnitureComponentViewModel>();
|
||||||
foreach (var component in components)
|
foreach (var furniture in furnitures)
|
||||||
{
|
{
|
||||||
var record = new ReportFurnitureComponentViewModel
|
var record = new ReportFurnitureComponentViewModel
|
||||||
{
|
{
|
||||||
ComponentName = component.ComponentName,
|
FurnitureName = furniture.FurnitureName,
|
||||||
Furnitures = new List<Tuple<string, int>>(),
|
Components = new List<Tuple<string, int>>(),
|
||||||
TotalCount = 0
|
TotalCount = 0
|
||||||
};
|
};
|
||||||
foreach (var product in products)
|
foreach (var component in components)
|
||||||
{
|
{
|
||||||
if (product.FurnitureComponents.ContainsKey(component.Id))
|
if (furniture.FurnitureComponents.ContainsKey(component.Id))
|
||||||
{
|
{
|
||||||
record.Furnitures.Add(new Tuple<string, int>(product.FurnitureName, product.FurnitureComponents[component.Id].Item2));
|
record.Components.Add(new Tuple<string, int>(component.ComponentName, furniture.FurnitureComponents[component.Id].Item2));
|
||||||
record.TotalCount += product.FurnitureComponents[component.Id].Item2;
|
record.TotalCount += furniture.FurnitureComponents[component.Id].Item2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
@ -104,7 +104,7 @@ namespace FurnitureAssemblyBusinessLogic
|
|||||||
_saveToExcel.CreateReport(new ExcelInfo
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список изделий",
|
||||||
FurnitureComponents = GetFurnitureComponent()
|
FurnitureComponents = GetFurnitureComponent()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
{
|
{
|
||||||
public class ReportFurnitureComponentViewModel
|
public class ReportFurnitureComponentViewModel
|
||||||
{
|
{
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
public string FurnitureName { get; set; } = string.Empty;
|
||||||
public int TotalCount { get; set; }
|
public int TotalCount { get; set; }
|
||||||
public List<Tuple<string, int>> Furnitures { get; set; } = new();
|
public List<Tuple<string, int>> Components { get; set; } = new();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user