Aggiunta migrazione e modello dati raw da deserializzare
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
using EgwCoreLib.Lux.Core.Generic;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Sales;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static EgwCoreLib.Lux.Core.Enums;
|
||||
|
||||
namespace EgwCoreLib.Lux.Data.DbModel.Production
|
||||
@@ -43,21 +39,38 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori dei prod workgroup stimati gestito come JSON nativo
|
||||
/// Valore effettivo serializzato dei WorkgroupList
|
||||
/// </summary>
|
||||
public List<ProdMachineDetailDto> WorkGroupList { get; set; } = new();
|
||||
public string WorkGroupListRaw { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Elenco valori dei prod workgroup stimati gestito come JSON serializzato/deserializzato al volo
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public Dictionary<string, ProdMachineDetailDto> WorkGroupList
|
||||
{
|
||||
get
|
||||
{
|
||||
Dictionary<string, ProdMachineDetailDto> answ = new();
|
||||
if (!string.IsNullOrEmpty(WorkGroupListRaw))
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<Dictionary<string, ProdMachineDetailDto>>(WorkGroupListRaw) ?? new();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Num parts complessivamente incluse
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public int NumParts => WorkGroupList?.Sum(x => x.NumParts) ?? 0;
|
||||
public int NumParts => WorkGroupList?.Sum(x => x.Value.NumParts) ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tempo stimato complessivo
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public double TotalEstimTime => WorkGroupList?.Sum(x => x.Time) ?? 0;
|
||||
public double TotalEstimTime => WorkGroupList?.Sum(x => x.Value.Time) ?? 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -65,8 +78,8 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public List<string> PlantList => WorkGroupList?
|
||||
.Select(x => x.ProdPlantCod)
|
||||
.Distinct()
|
||||
.Select(x => x.Key)
|
||||
.Distinct()
|
||||
.ToList() ?? new List<string>();
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user