54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
|
|
using ProductionInCehOTP.Entities.Enums;
|
|
using System.ComponentModel;
|
|
|
|
namespace ProductionInCehOTP.Entities;
|
|
|
|
public class Material
|
|
{
|
|
public int Id { get; private set; }
|
|
|
|
[DisplayName("Материал")]
|
|
public NameOfMaterials Name { get; private set; }
|
|
|
|
[DisplayName("Номеер поставки")]
|
|
public int ArrivalMaterialID { get; private set; }
|
|
|
|
|
|
|
|
[Browsable(false)]
|
|
public IEnumerable<MaterialForProduct> MaterialForProducts { get; set; } = [];
|
|
|
|
[DisplayName("Количество переданного")]
|
|
public string CountToProduct => MaterialForProducts != null ?
|
|
string.Join(", ", MaterialForProducts.Select(x => $"{x.ProductID},{x.Count} ")) :
|
|
string.Empty;
|
|
|
|
|
|
|
|
[DisplayName("Дата передачи в производство")]
|
|
public DateTime DateArrivalToProduct { get; private set; }
|
|
|
|
public static Material TransferMaterial(int id, NameOfMaterials name, int arrivalMaterialsID, DateTime dateArrivalToProduct,IEnumerable<MaterialForProduct> materialForProducts )
|
|
{
|
|
return new Material
|
|
{
|
|
Id = id,
|
|
Name = name,
|
|
ArrivalMaterialID = arrivalMaterialsID,
|
|
DateArrivalToProduct = dateArrivalToProduct,
|
|
MaterialForProducts = materialForProducts
|
|
};
|
|
}
|
|
|
|
public void SetMaterialForProduct(IEnumerable<MaterialForProduct> materialForProducts)
|
|
{
|
|
if(materialForProducts != null && materialForProducts.Any())
|
|
{
|
|
MaterialForProducts = materialForProducts;
|
|
}
|
|
}
|
|
|
|
}
|
|
|