37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System.ComponentModel;
|
|
|
|
namespace ProductionInCehOTP.Entities;
|
|
|
|
public class PlanWork
|
|
{
|
|
public int Id { get; private set; }
|
|
[DisplayName("Запланированное количество готовой продукции")]
|
|
public int Plan { get; private set; }
|
|
|
|
[DisplayName("Дата установки плана")]
|
|
public DateTime Date { get; private set; }
|
|
|
|
public int WorkerId { get; private set; }
|
|
|
|
[Browsable(false)]
|
|
public IEnumerable<PlanWorkForProduct> PlanWorkForProducts { get; set; } = [];
|
|
|
|
[DisplayName("Установленный план")]
|
|
public string Manufacture => PlanWorkForProducts != null ?
|
|
string.Join(", ", PlanWorkForProducts.Select(x => $"{x.ProductId},{x.Count} ")) :
|
|
string.Empty;
|
|
|
|
public static PlanWork CreatePlanWork(int id,int workerId, int Plan, DateTime Date, IEnumerable<PlanWorkForProduct> planWorkForProducts)
|
|
{
|
|
return new PlanWork { Id = id,WorkerId = workerId, Plan = Plan, Date = Date, PlanWorkForProducts = planWorkForProducts };
|
|
}
|
|
|
|
public void SetPlanWorkForProduct(IEnumerable<PlanWorkForProduct> planWorkForProducts)
|
|
{
|
|
if (planWorkForProducts != null && planWorkForProducts.Any())
|
|
{
|
|
PlanWorkForProducts = planWorkForProducts;
|
|
}
|
|
}
|
|
}
|