diff --git a/Mango.Nop.Core/Entities/MgStockTaking.cs b/Mango.Nop.Core/Entities/MgStockTaking.cs new file mode 100644 index 0000000..658c88d --- /dev/null +++ b/Mango.Nop.Core/Entities/MgStockTaking.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.Design; +using AyCode.Interfaces.Entities; +using AyCode.Interfaces.TimeStampInfo; +using LinqToDB.Mapping; + +namespace Mango.Nop.Core.Entities; + +public interface IMgStockTaking : IEntityInt, ITimeStampInfo +{ + public DateTime StartDateTime { get; set; } + public bool IsClosed { get; set; } +} + +public abstract class MgStockTaking : MgEntityBase, IMgStockTaking where TStockTakingItem : class, IMgStockTakingItem +{ + public DateTime StartDateTime { get; set; } + public bool IsClosed { get; set; } + + [Association(ThisKey = nameof(Id), OtherKey = nameof(IMgStockTakingItem.StockTakingId), CanBeNull = true)] + public List? StockTakingItems { get; set; } + + public int Creator { get; set; } + public DateTime Created { get; set; } + public DateTime Modified { get; set; } +} \ No newline at end of file diff --git a/Mango.Nop.Core/Entities/MgStockTakingItem.cs b/Mango.Nop.Core/Entities/MgStockTakingItem.cs new file mode 100644 index 0000000..9c297bb --- /dev/null +++ b/Mango.Nop.Core/Entities/MgStockTakingItem.cs @@ -0,0 +1,41 @@ +using AyCode.Interfaces.Entities; +using AyCode.Interfaces.TimeStampInfo; +using LinqToDB; +using LinqToDB.Mapping; +using Mango.Nop.Core.Dtos; +using Mango.Nop.Core.Interfaces; + +namespace Mango.Nop.Core.Entities; + +public interface IMgStockTakingItem : IEntityInt, ITimeStampInfo +{ + public int StockTakingId { get; set; } + public int ProductId { get; set; } + + public bool IsMeasured { get; set; } + + public int OriginalStockQuantity { get; set; } + public int MeasuredStockQuantity { get; set; } +} + +public abstract class MgStockTakingItem : MgEntityBase, IMgStockTakingItem + where TStockTaking : class, IMgStockTaking where TProduct : class, IMgProductDto +{ + public int StockTakingId { get; set; } + public int ProductId { get; set; } + + public bool IsMeasured { get; set; } + + public int OriginalStockQuantity { get; set; } + public int MeasuredStockQuantity { get; set; } + + [Association(ThisKey = nameof(StockTakingId), OtherKey = nameof(IMgStockTaking.Id), CanBeNull = true)] + public TStockTaking? StockTaking{ get; set; } + + [Association(ThisKey = nameof(ProductId), OtherKey = nameof(IMgProductDto.Id), CanBeNull = true)] + public TProduct? Product { get; set; } + + public DateTime Created { get; set; } + public DateTime Modified { get; set; } + +} \ No newline at end of file diff --git a/Mango.Nop.Core/Mango.Nop.Core.csproj b/Mango.Nop.Core/Mango.Nop.Core.csproj index 046d84e..1a90099 100644 --- a/Mango.Nop.Core/Mango.Nop.Core.csproj +++ b/Mango.Nop.Core/Mango.Nop.Core.csproj @@ -13,7 +13,7 @@ - + diff --git a/Mango.Nop.Data/Mango.Nop.Data.csproj b/Mango.Nop.Data/Mango.Nop.Data.csproj index 93cdd2e..9107cd9 100644 --- a/Mango.Nop.Data/Mango.Nop.Data.csproj +++ b/Mango.Nop.Data/Mango.Nop.Data.csproj @@ -12,7 +12,7 @@ - + diff --git a/Mango.Nop.Services/Mango.Nop.Services.csproj b/Mango.Nop.Services/Mango.Nop.Services.csproj index 32f7a1f..d39ae7f 100644 --- a/Mango.Nop.Services/Mango.Nop.Services.csproj +++ b/Mango.Nop.Services/Mango.Nop.Services.csproj @@ -11,7 +11,7 @@ - +