using TakeoutSaaS.Application.App.Inventory.Dto;
using TakeoutSaaS.Domain.Inventory.Entities;
namespace TakeoutSaaS.Application.App.Inventory;
///
/// 库存映射辅助。
///
public static class InventoryMapping
{
///
/// 映射库存 DTO。
///
public static InventoryItemDto ToDto(InventoryItem item) => new()
{
Id = item.Id,
TenantId = item.TenantId,
StoreId = item.StoreId,
ProductSkuId = item.ProductSkuId,
BatchNumber = item.BatchNumber,
QuantityOnHand = item.QuantityOnHand,
QuantityReserved = item.QuantityReserved,
SafetyStock = item.SafetyStock,
Location = item.Location,
ExpireDate = item.ExpireDate,
IsPresale = item.IsPresale,
PresaleStartTime = item.PresaleStartTime,
PresaleEndTime = item.PresaleEndTime,
PresaleCapacity = item.PresaleCapacity,
PresaleLocked = item.PresaleLocked,
MaxQuantityPerOrder = item.MaxQuantityPerOrder,
IsSoldOut = item.IsSoldOut
};
///
/// 映射批次 DTO。
///
public static InventoryBatchDto ToDto(InventoryBatch batch) => new()
{
Id = batch.Id,
StoreId = batch.StoreId,
ProductSkuId = batch.ProductSkuId,
BatchNumber = batch.BatchNumber,
ProductionDate = batch.ProductionDate,
ExpireDate = batch.ExpireDate,
Quantity = batch.Quantity,
RemainingQuantity = batch.RemainingQuantity
};
}