2024-11-23 23:26:39 +03:00
|
|
|
|
|
|
|
|
|
using ProductionInCehOTP.Entities.Enums;
|
2024-12-11 14:26:44 +03:00
|
|
|
|
using System.ComponentModel;
|
2024-11-23 23:26:39 +03:00
|
|
|
|
|
|
|
|
|
namespace ProductionInCehOTP.Entities;
|
2024-11-12 19:18:35 +03:00
|
|
|
|
|
|
|
|
|
public class Material
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; private set; }
|
2024-12-11 14:26:44 +03:00
|
|
|
|
|
|
|
|
|
[DisplayName("Материал")]
|
2024-11-23 23:26:39 +03:00
|
|
|
|
public NameOfMaterials Name { get; private set; }
|
2024-12-11 14:26:44 +03:00
|
|
|
|
|
|
|
|
|
[DisplayName("Номеер поставки")]
|
2024-11-28 10:57:27 +03:00
|
|
|
|
public int ArrivalMaterialID { get; private set; }
|
2024-12-11 14:26:44 +03:00
|
|
|
|
|
|
|
|
|
[DisplayName("Количество переданного")]
|
|
|
|
|
|
|
|
|
|
public string CountToProduct => MaterialForProducts != null ?
|
|
|
|
|
string.Join(", ", MaterialForProducts.Select(x => $"{x.Name}{x.Count}")) :
|
|
|
|
|
string.Empty;
|
|
|
|
|
|
|
|
|
|
[Browsable(false)]
|
2024-11-23 23:26:39 +03:00
|
|
|
|
public IEnumerable<MaterialForProduct> MaterialForProducts { get; private set; }
|
2024-12-10 00:09:57 +03:00
|
|
|
|
|
2024-12-11 14:26:44 +03:00
|
|
|
|
[DisplayName("Дата передачи в производство")]
|
2024-12-10 00:09:57 +03:00
|
|
|
|
public DateTime DateArrivalToProduct { get; private set; }
|
2024-12-11 14:26:44 +03:00
|
|
|
|
|
2024-12-11 11:11:00 +03:00
|
|
|
|
public static Material TransferMaterial(int id, NameOfMaterials name, int arrivalMaterialsID, DateTime dateArrivalToProduct,IEnumerable<MaterialForProduct> materialForProducts )
|
2024-11-12 19:18:35 +03:00
|
|
|
|
{
|
|
|
|
|
return new Material
|
|
|
|
|
{
|
|
|
|
|
Id = id,
|
|
|
|
|
Name = name,
|
2024-11-28 10:57:27 +03:00
|
|
|
|
ArrivalMaterialID = arrivalMaterialsID,
|
2024-12-11 11:11:00 +03:00
|
|
|
|
DateArrivalToProduct = dateArrivalToProduct,
|
|
|
|
|
MaterialForProducts = materialForProducts
|
2024-11-12 19:18:35 +03:00
|
|
|
|
};
|
|
|
|
|
}
|
2024-12-11 00:42:59 +03:00
|
|
|
|
|
2024-12-11 14:26:44 +03:00
|
|
|
|
public void SetMaterialForProduct(IEnumerable<MaterialForProduct> materialForProducts)
|
2024-12-11 00:42:59 +03:00
|
|
|
|
{
|
2024-12-11 14:26:44 +03:00
|
|
|
|
if(materialForProducts != null && materialForProducts.Any())
|
2024-12-11 00:42:59 +03:00
|
|
|
|
{
|
2024-12-11 14:26:44 +03:00
|
|
|
|
MaterialForProducts = materialForProducts;
|
|
|
|
|
}
|
2024-12-11 00:42:59 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 19:18:35 +03:00
|
|
|
|
}
|
|
|
|
|
|