Implement Inventory Management Service with CRUD operations for warehouses and inventory items, stock operations, and bulk processing capabilities.
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s

This commit is contained in:
masoodafar-web
2026-01-02 00:45:37 +03:30
parent f0117eb1d5
commit 1cf501711f
50 changed files with 10699 additions and 101 deletions
@@ -0,0 +1,102 @@
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; }
}