Update modello dati x gestione costing + drivers
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using static EgwCoreLib.Lux.Core.Enums;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
|
||||
/// <summary>
|
||||
/// Classe delle offerte commerciali
|
||||
/// </summary>
|
||||
[Table("sales_offer")]
|
||||
public class OfferModel
|
||||
{
|
||||
@@ -68,7 +70,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
public string DictPresel { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Validità offerta
|
||||
/// Validità Offerta
|
||||
/// </summary>
|
||||
public DateTime ValidUntil { get; set; } = DateTime.Now.AddMonths(1);
|
||||
|
||||
@@ -151,20 +153,6 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
get => (TotalCost > 0 && TotalPrice > TotalCost) ? (TotalPrice - TotalCost) / TotalPrice : 0;
|
||||
}
|
||||
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// ID Ordine (nullo se non c'è ordine)
|
||||
/// </summary>
|
||||
public int? OrderID { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione Ordine
|
||||
/// </summary>
|
||||
[ForeignKey("OrderID")]
|
||||
public virtual OrderModel? OrderNav { get; set; } = null;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione Customer
|
||||
/// </summary>
|
||||
@@ -177,7 +165,6 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
[ForeignKey("DealerID")]
|
||||
public virtual DealerModel DealerNav { get; set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione alle righe offerta
|
||||
/// </summary>
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
// </Auto-Generated>
|
||||
namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
{
|
||||
|
||||
[Table("sales_offer_row")]
|
||||
public class OfferRowModel
|
||||
{
|
||||
@@ -67,17 +66,27 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
/// </summary>
|
||||
public double BomPrice { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Costo produzione Fase/Step (RockBottom)
|
||||
/// Costo produzione Fase/Step (RockBottom): somma dei WorkCost da ItemSteps
|
||||
/// </summary>
|
||||
public double StepCost { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Prezzo produzione Fase/Step (scontabile)
|
||||
/// Prezzo produzione Fase/Step (scontabile): somma dei WorkPrice da ItemSteps
|
||||
/// </summary>
|
||||
public double StepPrice { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// LeadTime puro (tempo di lavorazione): somma dei LeadTime da ItemSteps
|
||||
/// </summary>
|
||||
|
||||
public double StepLeadTime { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// FlowTime totale (tempo di attraversamento): somma dei FlowTime da ItemSteps
|
||||
/// </summary>
|
||||
|
||||
public double StepFlowTime { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Costo Totale Risorsa (BOM + Fase)
|
||||
/// </summary>
|
||||
@@ -144,17 +153,21 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
/// </summary>
|
||||
public long FileSize { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco StepDTO (Fasi) per la stima tempi / costi
|
||||
/// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali
|
||||
/// </summary>
|
||||
public string ItemSteps { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// BOM serializzata per la produzione dell'item
|
||||
/// </summary>
|
||||
public string ItemBOM { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Lista dei Job Cost Drivers calcolati dall'engine (necessari x calcolo Steps)
|
||||
/// </summary>
|
||||
public string ItemJCD { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Elenco StepDTO (Fasi Costificate, sommabili) per la stima tempi / costi
|
||||
/// </summary>
|
||||
public string ItemSteps { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Validazione dati BOM (Inteso come gruppi tutti trovati/esistenti)
|
||||
/// </summary>
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
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;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
|
||||
/// <summary>
|
||||
/// Classe degli ordini commerciali
|
||||
/// </summary>
|
||||
@@ -26,6 +19,11 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
[Key]
|
||||
public int OrderID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Environment della richiesta
|
||||
/// </summary>
|
||||
public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
|
||||
/// <summary>
|
||||
/// Offerta correlata
|
||||
/// </summary>
|
||||
@@ -52,7 +50,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
[NotMapped]
|
||||
public string OrderCode
|
||||
{
|
||||
get => $"{RefYear:00}.{RefNum:00000}.{RefRev:00}";
|
||||
get => $"PO.{RefYear:00}.{RefNum:00000}.{RefRev:00}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -111,6 +109,53 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
/// </summary>
|
||||
public OrderStates OrderState { get; set; } = OrderStates.Created;
|
||||
|
||||
/// <summary>
|
||||
/// Sconto applicato (deve essere < del MAX)
|
||||
/// </summary>
|
||||
public double Discount { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Numero Item compresi
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public double NumItems
|
||||
{
|
||||
get => OrderRowNav?.Sum(x => x.Qty) ?? 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// Numero Item compresi
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public int NumRows
|
||||
{
|
||||
get => OrderRowNav?.Count ?? 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// Costo totale offerta (rock bottom)
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public double TotalCost
|
||||
{
|
||||
get => OrderRowNav?.Sum(x => x.TotalCost) ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prezzo totale offerta (compreso di amrginalità)
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public double TotalPrice
|
||||
{
|
||||
get => OrderRowNav?.Sum(x => x.TotalPrice) ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sconto massimo applicabile
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public double MaxDiscount
|
||||
{
|
||||
get => (TotalCost > 0 && TotalPrice > TotalCost) ? (TotalPrice - TotalCost) / TotalPrice : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione Customer
|
||||
/// </summary>
|
||||
@@ -128,5 +173,10 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
/// </summary>
|
||||
[ForeignKey("OfferID")]
|
||||
public virtual OfferModel OfferNav { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione alle righe ordine
|
||||
/// </summary>
|
||||
public virtual ICollection<OrderRowModel> OrderRowNav { get; set; } = new List<OrderRowModel>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
using EgwCoreLib.Lux.Data.DbModel.Items;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
|
||||
[Table("sales_order_row")]
|
||||
public class OrderRowModel
|
||||
{
|
||||
@@ -29,10 +22,22 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
public int OrderID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Riga Ordine
|
||||
/// Riga Ordine (per ordinamento)
|
||||
/// </summary>
|
||||
public int RowNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Environment della richiesta
|
||||
/// </summary>
|
||||
public EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS Envir { get; set; } = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Campo salvato dell'UID da codice DataMatrix calcolato
|
||||
/// inizia per SOR = SalesOfferRow
|
||||
/// </summary>
|
||||
public string OrderRowUID { get; set; } = "POR.25.0123ABCD";
|
||||
|
||||
/// <summary>
|
||||
/// Codice calcolato Ordine ANNO.NUMERO
|
||||
/// inizia per PO = PurchaseOrder
|
||||
@@ -40,7 +45,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
[NotMapped]
|
||||
public string OrderRowCode
|
||||
{
|
||||
get => $"PO{OrderRowID:000000}.{RowNum:000}";
|
||||
get => $"POR.{Inserted:yy}.{OrderRowID:X8}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -48,16 +53,16 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
/// </summary>
|
||||
public int? SellingItemID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Quantità della risorsa
|
||||
/// </summary>
|
||||
public double Qty { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Costo dei componeti BOM (RockBottom)
|
||||
/// </summary>
|
||||
public double BomCost { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Margine percentuale standard
|
||||
/// </summary>
|
||||
public double Qty { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Prezzo dei componeti BOM (scontabile)
|
||||
/// </summary>
|
||||
@@ -74,6 +79,17 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
/// </summary>
|
||||
public double StepPrice { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// LeadTime puro (tempo di lavorazione): somma dei LeadTime da ItemSteps
|
||||
/// </summary>
|
||||
|
||||
public double StepLeadTime { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// FlowTime totale (tempo di attraversamento): somma dei FlowTime da ItemSteps
|
||||
/// </summary>
|
||||
|
||||
public double StepFlowTime { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Costo Totale Risorsa (BOM + Fase)
|
||||
/// </summary>
|
||||
@@ -125,11 +141,46 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
public string SerStruct { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Elenco StepDTO (Fasi) per la stima tempi / costi
|
||||
/// potrebbe contenere anche altre info accessorie x definire dati logistico/gestionali
|
||||
/// Nomi risorsa file associato alla riga offerta (es per BTL)
|
||||
/// URI come risorsa dentro folder offerta/riga-offerta/guid
|
||||
/// </summary>
|
||||
public string FileResource { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Nomi file originale associato alla riga offerta (es per BTL)
|
||||
/// </summary>
|
||||
public string FileName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Dimensione del file (per visualizzazione rapida)
|
||||
/// </summary>
|
||||
public long FileSize { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// BOM serializzata per la produzione dell'item
|
||||
/// </summary>
|
||||
public string ItemBOM { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Lista dei Job Cost Drivers calcolati dall'engine (necessari x calcolo Steps)
|
||||
/// </summary>
|
||||
public string ItemJCD { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Elenco StepDTO (Fasi Costificate, sommabili) per la stima tempi / costi
|
||||
/// </summary>
|
||||
public string ItemSteps { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Validazione dati BOM (Inteso come gruppi tutti trovati/esistenti)
|
||||
/// </summary>
|
||||
public bool BomOk { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Validazione livello item per Costo e range dimensione
|
||||
/// </summary>
|
||||
public bool ItemOk { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Note libere
|
||||
/// </summary>
|
||||
@@ -154,6 +205,16 @@ namespace EgwCoreLib.Lux.Data.DbModel.Sales
|
||||
/// </summary>
|
||||
public DateTime Modified { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Indica che è in attesa aggiornamento BOM
|
||||
/// </summary>
|
||||
public bool AwaitBom { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indica che è in attesa aggiornamento Price
|
||||
/// </summary>
|
||||
public bool AwaitPrice { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Navigazione Order
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user