102 lines
3.1 KiB
C#
102 lines
3.1 KiB
C#
using MediatR;
|
|
|
|
namespace CMSMicroservice.Application.Features.InventoryItems.Commands;
|
|
|
|
/// <summary>
|
|
/// Command برای ایجاد آیتم موجودی جدید
|
|
/// </summary>
|
|
public record CreateInventoryItemCommand : IRequest<long>
|
|
{
|
|
public long? ProductId { get; init; }
|
|
public long? DiscountProductId { get; init; }
|
|
public long WarehouseId { get; init; }
|
|
public int Quantity { get; init; }
|
|
public int MinQuantity { get; init; }
|
|
public int MaxQuantity { get; init; }
|
|
public bool IsActive { get; init; } = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command برای آپدیت آیتم موجودی
|
|
/// </summary>
|
|
public record UpdateInventoryItemCommand : IRequest<bool>
|
|
{
|
|
public long Id { get; init; }
|
|
public int? Quantity { get; init; }
|
|
public int? MinQuantity { get; init; }
|
|
public int? MaxQuantity { get; init; }
|
|
public long? WarehouseId { get; init; }
|
|
public bool? IsActive { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command برای آپدیت کردن موجودی یک آیتم
|
|
/// </summary>
|
|
public record UpdateInventoryQuantityCommand : IRequest<bool>
|
|
{
|
|
public long Id { get; init; }
|
|
public int NewQuantity { get; init; }
|
|
public string? ReferenceNumber { get; init; }
|
|
public long? PerformedByUserId { get; init; }
|
|
public string? Note { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command برای رزرو کردن موجودی
|
|
/// </summary>
|
|
public record ReserveInventoryCommand : IRequest<bool>
|
|
{
|
|
public long Id { get; init; }
|
|
public int Quantity { get; init; }
|
|
public long? OrderId { get; init; }
|
|
public long? DiscountOrderId { get; init; }
|
|
public string? ReferenceNumber { get; init; }
|
|
public long? PerformedByUserId { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command برای آزاد کردن موجودی رزرو شده
|
|
/// </summary>
|
|
public record ReleaseReservedInventoryCommand : IRequest<bool>
|
|
{
|
|
public long Id { get; init; }
|
|
public int Quantity { get; init; }
|
|
public long? OrderId { get; init; }
|
|
public long? DiscountOrderId { get; init; }
|
|
public string? ReferenceNumber { get; init; }
|
|
public long? PerformedByUserId { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command برای کم کردن موجودی (فروش)
|
|
/// </summary>
|
|
public record ReduceInventoryCommand : IRequest<bool>
|
|
{
|
|
public long Id { get; init; }
|
|
public int Quantity { get; init; }
|
|
public long? OrderId { get; init; }
|
|
public long? DiscountOrderId { get; init; }
|
|
public string? ReferenceNumber { get; init; }
|
|
public long? PerformedByUserId { get; init; }
|
|
public bool FromReserved { get; init; } = true; // آیا از موجودی رزرو شده کم شود؟
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command برای اضافه کردن موجودی (خرید)
|
|
/// </summary>
|
|
public record IncreaseInventoryCommand : IRequest<bool>
|
|
{
|
|
public long Id { get; init; }
|
|
public int Quantity { get; init; }
|
|
public string? ReferenceNumber { get; init; }
|
|
public long? PerformedByUserId { get; init; }
|
|
public string? Note { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command برای حذف آیتم موجودی
|
|
/// </summary>
|
|
public record DeleteInventoryItemCommand : IRequest<bool>
|
|
{
|
|
public long Id { get; init; }
|
|
} |