FruitBankHybridApp/FruitBank.Common/Entities/Shipping.cs

47 lines
2.3 KiB
C#

using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using AyCode.Interfaces.EntityComment;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true, false, false)]
[ToonDescription("Shipping record with documents and measurement tracking", Purpose = "Inbound delivery event (truck arrival) at the warehouse. Created early and filled progressively — carrier, truck and trailer are assigned later.")]
[Table(Name = FruitBankConstClient.ShippingDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDbTableName)]
public sealed class Shipping : MgEntityBase, IShipping, IEntityComment
{
public int? CargoPartnerId { get; set; }
public int? CargoTruckId { get; set; }
public int? CargoTrailerId { get; set; }
public DateTime ShippingDate { get; set; } = DateTime.Now;
public string LicencePlate { get; set; }
public bool IsAllMeasured { get; set; }
public string? Comment { get; set; } = string.Empty;
public string? CargoCompany { get; set; }
public DateTime? MeasuredDate { get; set; }
[ToonDescription(Purpose = "Carrier (transport company); assigned later, null until known. Supplier is separate — see ShippingDocument.Partner.")]
[Association(ThisKey = nameof(CargoPartnerId), OtherKey = nameof(CargoPartner.Id), CanBeNull = true)]
public CargoPartner CargoPartner { get; set; }
[ToonDescription(Purpose = "Tractor unit (CargoTruck, IsTrailer=false) from the carrier's fleet; assigned later, null until known.")]
[Association(ThisKey = nameof(CargoTruckId), OtherKey = nameof(CargoTruck.Id), CanBeNull = true)]
public CargoTruck CargoTruck { get; set; }
[ToonDescription(Purpose = "Trailer (CargoTruck table, IsTrailer=true); optional, assigned later — null if none or not yet known.")]
[Association(ThisKey = nameof(CargoTrailerId), OtherKey = nameof(CargoTruck.Id), CanBeNull = true)]
public CargoTruck CargoTrailer { get; set; }
[Association(ThisKey = nameof(Id), OtherKey = nameof(ShippingDocument.ShippingId), CanBeNull = true)]
public List<ShippingDocument>? ShippingDocuments { get; set; }
[SkipValuesOnUpdate]
public DateTime Created { get; set; }
public DateTime Modified { get; set; }
}