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
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m48s
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
using CMSMicroservice.Domain.Common;
|
||||
using CMSMicroservice.Domain.Enums;
|
||||
using CMSMicroservice.Domain.Entities.DiscountShop;
|
||||
|
||||
namespace CMSMicroservice.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// موجودی کالا در انبار
|
||||
/// </summary>
|
||||
public class InventoryItem : BaseAuditableEntity
|
||||
{
|
||||
// ========== شناسه محصول (یکی از دو فیلد زیر پر است) ==========
|
||||
|
||||
/// <summary>
|
||||
/// شناسه محصول فروشگاه معمولی
|
||||
/// </summary>
|
||||
public long? ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// محصول فروشگاه معمولی
|
||||
/// </summary>
|
||||
public Product? Product { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه محصول فروشگاه تخفیفی
|
||||
/// </summary>
|
||||
public long? DiscountProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// محصول فروشگاه تخفیفی
|
||||
/// </summary>
|
||||
public DiscountProduct? DiscountProduct { get; set; }
|
||||
|
||||
// ========== نوع محصول ==========
|
||||
|
||||
/// <summary>
|
||||
/// نوع محصول (معمولی یا تخفیفی)
|
||||
/// </summary>
|
||||
public ProductType ProductType { get; set; }
|
||||
|
||||
// ========== موجودی ==========
|
||||
|
||||
/// <summary>
|
||||
/// موجودی فعلی (منبع اصلی)
|
||||
/// </summary>
|
||||
public int Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار رزرو شده برای سفارشات pending
|
||||
/// </summary>
|
||||
public int ReservedQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// موجودی قابل فروش (محاسباتی)
|
||||
/// </summary>
|
||||
public int AvailableQuantity => Quantity - ReservedQuantity;
|
||||
|
||||
// ========== تنظیمات انبار ==========
|
||||
|
||||
/// <summary>
|
||||
/// آستانه هشدار کمموجودی
|
||||
/// </summary>
|
||||
public int LowStockThreshold { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// نقطه سفارش مجدد
|
||||
/// </summary>
|
||||
public int ReorderPoint { get; set; } = 5;
|
||||
|
||||
/// <summary>
|
||||
/// حداکثر موجودی مجاز
|
||||
/// </summary>
|
||||
public int MaxStockLevel { get; set; } = 1000;
|
||||
|
||||
// ========== آمار ==========
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ آخرین ورود کالا
|
||||
/// </summary>
|
||||
public DateTime? LastRestockedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تاریخ آخرین فروش
|
||||
/// </summary>
|
||||
public DateTime? LastSoldAt { get; set; }
|
||||
|
||||
// ========== انبار (برای آینده) ==========
|
||||
|
||||
/// <summary>
|
||||
/// شناسه انبار (پیشفرض: انبار اصلی)
|
||||
/// </summary>
|
||||
public long WarehouseId { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// انبار
|
||||
/// </summary>
|
||||
public Warehouse? Warehouse { get; set; }
|
||||
|
||||
// ========== Navigation Properties ==========
|
||||
|
||||
/// <summary>
|
||||
/// حرکات انبار مرتبط با این آیتم
|
||||
/// </summary>
|
||||
public ICollection<StockMovement> StockMovements { get; set; } = new List<StockMovement>();
|
||||
}
|
||||
@@ -38,6 +38,11 @@ public class ManualPayment : BaseAuditableEntity
|
||||
/// </summary>
|
||||
public string? ReferenceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مسیر تصویر فیش واریزی (اختیاری)
|
||||
/// </summary>
|
||||
public string? ImagePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت تایید
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using CMSMicroservice.Domain.Common;
|
||||
using CMSMicroservice.Domain.Enums;
|
||||
|
||||
namespace CMSMicroservice.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// حرکات انبار (تاریخچه تغییرات موجودی)
|
||||
/// </summary>
|
||||
public class StockMovement : BaseAuditableEntity
|
||||
{
|
||||
// ========== ارتباط با InventoryItem ==========
|
||||
|
||||
/// <summary>
|
||||
/// شناسه آیتم انبار
|
||||
/// </summary>
|
||||
public long InventoryItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آیتم انبار
|
||||
/// </summary>
|
||||
public InventoryItem InventoryItem { get; set; } = null!;
|
||||
|
||||
// ========== نوع حرکت ==========
|
||||
|
||||
/// <summary>
|
||||
/// نوع حرکت انبار
|
||||
/// </summary>
|
||||
public StockMovementType MovementType { get; set; }
|
||||
|
||||
// ========== مقادیر ==========
|
||||
|
||||
/// <summary>
|
||||
/// مقدار تغییر (مثبت برای ورود، منفی برای خروج)
|
||||
/// </summary>
|
||||
public int Quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// موجودی قبل از این حرکت
|
||||
/// </summary>
|
||||
public int QuantityBefore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// موجودی بعد از این حرکت
|
||||
/// </summary>
|
||||
public int QuantityAfter { get; set; }
|
||||
|
||||
// ========== مراجع ==========
|
||||
|
||||
/// <summary>
|
||||
/// شناسه سفارش (برای فروش/برگشت در فروشگاه معمولی)
|
||||
/// </summary>
|
||||
public long? OrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه سفارش تخفیفی (برای فروش/برگشت در فروشگاه تخفیفی)
|
||||
/// </summary>
|
||||
public long? DiscountOrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// شماره مرجع (مثل شماره فاکتور ورود کالا)
|
||||
/// </summary>
|
||||
public string? ReferenceNumber { get; set; }
|
||||
|
||||
// ========== توضیحات ==========
|
||||
|
||||
/// <summary>
|
||||
/// یادداشت و توضیحات اضافی
|
||||
/// </summary>
|
||||
public string? Note { get; set; }
|
||||
|
||||
// ========== کاربر ==========
|
||||
|
||||
/// <summary>
|
||||
/// شناسه کاربری که این عملیات را انجام داده
|
||||
/// </summary>
|
||||
public long? PerformedByUserId { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using CMSMicroservice.Domain.Common;
|
||||
|
||||
namespace CMSMicroservice.Domain.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// انبار (برای آینده - چند انبار)
|
||||
/// </summary>
|
||||
public class Warehouse : BaseAuditableEntity
|
||||
{
|
||||
// ========== اطلاعات اصلی ==========
|
||||
|
||||
/// <summary>
|
||||
/// نام انبار
|
||||
/// </summary>
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// کد انبار
|
||||
/// </summary>
|
||||
public string Code { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// آدرس انبار
|
||||
/// </summary>
|
||||
public string? Address { get; set; }
|
||||
|
||||
// ========== تنظیمات ==========
|
||||
|
||||
/// <summary>
|
||||
/// انبار پیشفرض سیستم
|
||||
/// </summary>
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// وضعیت فعال/غیرفعال
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
// ========== Navigation Properties ==========
|
||||
|
||||
/// <summary>
|
||||
/// آیتمهای موجودی در این انبار
|
||||
/// </summary>
|
||||
public ICollection<InventoryItem> InventoryItems { get; set; } = new List<InventoryItem>();
|
||||
}
|
||||
Reference in New Issue
Block a user