FruitBankHybridApp/FruitBank.Common/Entities/ShippingDocument.cs

52 lines
2.5 KiB
C#

using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
using System.Collections.ObjectModel;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true, false, false)]
[ToonDescription("Shipping document with partner, items and files", Purpose = "Supplier's delivery note or invoice for the shipment; reconciles paper data with measured reality. Populated progressively — much entered at order time, the rest as it becomes known.")]
[Table(Name = FruitBankConstClient.ShippingDocumentDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDocumentDbTableName)]
public sealed class ShippingDocument : MgEntityBase, IShippingDocument
{
public int PartnerId { get; set; }
public int? ShippingId { get; set; }
public int? PartnerDepotId { get; set; }
public string DocumentIdNumber { get; set; }
public string PdfFileName { get; set; }
public DateTime ShippingDate { get; set; } = DateTime.Now;
public string Country { get; set; }
public int TotalPallets { get; set; }
public bool IsAllMeasured { get; set; }
public string Comment { get; set; }
[Association(ThisKey = nameof(ShippingId), OtherKey = nameof(Shipping.Id), CanBeNull = true)]
public Shipping? Shipping{ get; set; }
[Association(ThisKey = nameof(PartnerId), OtherKey = nameof(Partner.Id), CanBeNull = true)]
public Partner? Partner { get; set; }
// Csak az EKÁER felrakodási címhez kell. SZÁNDÉKOSAN nincs benne semelyik alapértelmezett loadRelations-ben:
// kizárólag a generálás/reconciliation kéri explicit `LoadWith(sd => sd.PartnerDepot)`-tal, így a többi
// lekérdezést/sorosítást nem terheli (betöltetlenül null marad). Legacy szállítólevélnél PartnerDepotId = null.
[Association(ThisKey = nameof(PartnerDepotId), OtherKey = nameof(PartnerDepot.Id), CanBeNull = true)]
public PartnerDepot? PartnerDepot { get; set; }
[Association(ThisKey = nameof(Id), OtherKey = nameof(ShippingItem.ShippingDocumentId), CanBeNull = true)]
public List<ShippingItem>? ShippingItems { get; set; }
[Association(ThisKey = nameof(Id), OtherKey = nameof(FruitBank.Common.Entities.ShippingDocumentToFiles.ShippingDocumentId), CanBeNull = true)]
public List<ShippingDocumentToFiles>? ShippingDocumentToFiles { get; set; }
[SkipValuesOnUpdate]
public DateTime Created { get; set; }
public DateTime Modified { get; set; }
}