Refactor code structure for int in alll ids instesd defult using long

This commit is contained in:
2026-07-15 15:35:54 +05:30
parent 6c7f53350f
commit ed2ee87c68
120 changed files with 2775 additions and 12494 deletions
+3 -3
View File
@@ -12,10 +12,10 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class AuditLog
{
public long AuditId { get; set; }
public long UserId { get; set; }
public int AuditId { get; set; }
public int UserId { get; set; }
public string EntityType { get; set; } = string.Empty;
public long EntityId { get; set; }
public int EntityId { get; set; }
public AuditAction Action { get; set; }
/// <summary>JSON change set: field→value (create/delete) or field→{old,new} (update).</summary>
public string ChangeSet { get; set; } = "{}";
+2 -2
View File
@@ -6,9 +6,9 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Batch
{
public long BatchId { get; set; }
public int BatchId { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public string BatchNo { get; set; } = string.Empty;
+2 -2
View File
@@ -6,9 +6,9 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Bin
{
public long BinId { get; set; }
public int BinId { get; set; }
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public string Code { get; set; } = string.Empty;
+2 -2
View File
@@ -6,10 +6,10 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Category
{
public long CategoryId { get; set; }
public int CategoryId { get; set; }
public string Name { get; set; } = string.Empty;
public long? ParentId { get; set; }
public int? ParentId { get; set; }
public Category? Parent { get; set; }
public ICollection<Category> Children { get; set; } = new List<Category>();
}
+5 -5
View File
@@ -10,21 +10,21 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Grn
{
public long GrnId { get; set; }
public int GrnId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long? PoId { get; set; }
public int? PoId { get; set; }
public PurchaseOrder? PurchaseOrder { get; set; }
public long VendorId { get; set; }
public int VendorId { get; set; }
public Vendor? Vendor { get; set; }
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public GrnStatus Status { get; set; } = GrnStatus.Draft;
public long CreatedBy { get; set; }
public int CreatedBy { get; set; }
public User? Creator { get; set; }
public DateTime CreatedAt { get; set; }
+7 -7
View File
@@ -10,24 +10,24 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class GrnLine
{
public long GrnLineId { get; set; }
public int GrnLineId { get; set; }
public long GrnId { get; set; }
public int GrnId { get; set; }
public Grn? Grn { get; set; }
public long? PoLineId { get; set; }
public int? PoLineId { get; set; }
public PoLine? PoLine { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long UomId { get; set; }
public int UomId { get; set; }
public Uom? Uom { get; set; }
public long? BinId { get; set; }
public int? BinId { get; set; }
public Bin? Bin { get; set; }
public long? BatchId { get; set; }
public int? BatchId { get; set; }
public Batch? Batch { get; set; }
public decimal Qty { get; set; }
+4 -4
View File
@@ -9,18 +9,18 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Item
{
public long ItemId { get; set; }
public int ItemId { get; set; }
public string Sku { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public long CategoryId { get; set; }
public int CategoryId { get; set; }
public Category? Category { get; set; }
public long BaseUomId { get; set; }
public int BaseUomId { get; set; }
public Uom? BaseUom { get; set; }
public long? DefaultVendorId { get; set; }
public int? DefaultVendorId { get; set; }
public Vendor? DefaultVendor { get; set; }
public ItemType ItemType { get; set; }
@@ -7,12 +7,12 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class ItemReorder
{
public long ReorderId { get; set; }
public int ReorderId { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public decimal ReorderPoint { get; set; }
@@ -9,9 +9,9 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class JournalEntryStub
{
public long JournalId { get; set; }
public int JournalId { get; set; }
public string SourceDocType { get; set; } = string.Empty;
public long SourceDocId { get; set; }
public int SourceDocId { get; set; }
public string DebitAccount { get; set; } = string.Empty;
public string CreditAccount { get; set; } = string.Empty;
public decimal Amount { get; set; }
@@ -8,8 +8,8 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class NumberSequence
{
public long SequenceId { get; set; }
public int SequenceId { get; set; }
public string DocType { get; set; } = string.Empty;
public int Year { get; set; }
public long LastNumber { get; set; }
public int LastNumber { get; set; }
}
+5 -5
View File
@@ -7,18 +7,18 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class PoLine
{
public long PoLineId { get; set; }
public int PoLineId { get; set; }
public long PoId { get; set; }
public int PoId { get; set; }
public PurchaseOrder? PurchaseOrder { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long UomId { get; set; }
public int UomId { get; set; }
public Uom? Uom { get; set; }
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public decimal Qty { get; set; }
@@ -11,19 +11,19 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class PurchaseOrder
{
public long PoId { get; set; }
public int PoId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long VendorId { get; set; }
public int VendorId { get; set; }
public Vendor? Vendor { get; set; }
public long? RequisitionId { get; set; }
public int? RequisitionId { get; set; }
public Requisition? Requisition { get; set; }
public PurchaseOrderStatus Status { get; set; } = PurchaseOrderStatus.Draft;
public bool ApprovalRequired { get; set; }
public long CreatedBy { get; set; }
public int CreatedBy { get; set; }
public User? Creator { get; set; }
public DateTime CreatedAt { get; set; }
@@ -9,21 +9,21 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class PurchaseReturn
{
public long ReturnId { get; set; }
public int ReturnId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long VendorId { get; set; }
public int VendorId { get; set; }
public Vendor? Vendor { get; set; }
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public long ReasonCodeId { get; set; }
public int ReasonCodeId { get; set; }
public ReasonCode? ReasonCode { get; set; }
public ReturnStatus Status { get; set; } = ReturnStatus.Posted;
public long CreatedBy { get; set; }
public int CreatedBy { get; set; }
public User? Creator { get; set; }
public DateTime CreatedAt { get; set; }
@@ -6,15 +6,15 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class PurchaseReturnLine
{
public long ReturnLineId { get; set; }
public int ReturnLineId { get; set; }
public long ReturnId { get; set; }
public int ReturnId { get; set; }
public PurchaseReturn? Return { get; set; }
public long? GrnLineId { get; set; }
public int? GrnLineId { get; set; }
public GrnLine? GrnLine { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public decimal Qty { get; set; }
@@ -8,7 +8,7 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class ReasonCode
{
public long ReasonCodeId { get; set; }
public int ReasonCodeId { get; set; }
public string Code { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public ReasonContext Context { get; set; }
@@ -8,10 +8,10 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Requisition
{
public long RequisitionId { get; set; }
public int RequisitionId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long RequestedBy { get; set; }
public int RequestedBy { get; set; }
public User? Requester { get; set; }
public RequisitionStatus Status { get; set; } = RequisitionStatus.Draft;
@@ -3,12 +3,12 @@ namespace ERPCore.Domain.Entities;
/// <summary>Requisition line (FR-PROC-01). Model: docs/10 Part C.2.</summary>
public class RequisitionLine
{
public long ReqLineId { get; set; }
public int ReqLineId { get; set; }
public long RequisitionId { get; set; }
public int RequisitionId { get; set; }
public Requisition? Requisition { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public decimal Qty { get; set; }
+2 -2
View File
@@ -8,10 +8,10 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Rfq
{
public long RfqId { get; set; }
public int RfqId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long RequisitionId { get; set; }
public int RequisitionId { get; set; }
public Requisition? Requisition { get; set; }
public RfqStatus Status { get; set; } = RfqStatus.Open;
+3 -3
View File
@@ -3,12 +3,12 @@ namespace ERPCore.Domain.Entities;
/// <summary>RFQ line — an item + quantity being quoted (FR-PROC-02). Model: docs/10 Part C.2.</summary>
public class RfqLine
{
public long RfqLineId { get; set; }
public int RfqLineId { get; set; }
public long RfqId { get; set; }
public int RfqId { get; set; }
public Rfq? Rfq { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public decimal Qty { get; set; }
+2 -2
View File
@@ -6,9 +6,9 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Serial
{
public long SerialId { get; set; }
public int SerialId { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public string SerialNo { get; set; } = string.Empty;
@@ -10,18 +10,18 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockAdjustment
{
public long AdjustmentId { get; set; }
public int AdjustmentId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public long ReasonCodeId { get; set; }
public int ReasonCodeId { get; set; }
public ReasonCode? ReasonCode { get; set; }
public AdjustmentStatus Status { get; set; } = AdjustmentStatus.Posted;
public long CreatedBy { get; set; }
public int CreatedBy { get; set; }
public User? Creator { get; set; }
public DateTime CreatedAt { get; set; }
@@ -7,17 +7,17 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockAdjustmentLine
{
public long AdjLineId { get; set; }
public int AdjLineId { get; set; }
public long AdjustmentId { get; set; }
public int AdjustmentId { get; set; }
public StockAdjustment? Adjustment { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long? BinId { get; set; }
public long? BatchId { get; set; }
public long? SerialId { get; set; }
public int? BinId { get; set; }
public int? BatchId { get; set; }
public int? SerialId { get; set; }
public decimal QtyDelta { get; set; }
}
@@ -10,16 +10,16 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockCount
{
public long CountId { get; set; }
public int CountId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public CountType CountType { get; set; }
public CountStatus Status { get; set; } = CountStatus.Draft;
public long CreatedBy { get; set; }
public int CreatedBy { get; set; }
public User? Creator { get; set; }
public DateTime CreatedAt { get; set; }
@@ -6,15 +6,15 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockCountLine
{
public long CountLineId { get; set; }
public int CountLineId { get; set; }
public long CountId { get; set; }
public int CountId { get; set; }
public StockCount? Count { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long? BinId { get; set; }
public int? BinId { get; set; }
public decimal SystemQty { get; set; }
public decimal? CountedQty { get; set; }
@@ -8,22 +8,22 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockLayer
{
public long LayerId { get; set; }
public int LayerId { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
public long? BatchId { get; set; }
public int? BatchId { get; set; }
public Batch? Batch { get; set; }
public long? SerialId { get; set; }
public int? SerialId { get; set; }
public Serial? Serial { get; set; }
/// <summary>Originating GRN line — carries the inspection hold status for this stock.</summary>
public long? GrnLineId { get; set; }
public int? GrnLineId { get; set; }
public GrnLine? GrnLine { get; set; }
public decimal QtyReceived { get; set; }
@@ -11,14 +11,14 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockLedger
{
public long LedgerId { get; set; }
public int LedgerId { get; set; }
public long ItemId { get; set; }
public long WarehouseId { get; set; }
public long? BinId { get; set; }
public long? BatchId { get; set; }
public long? SerialId { get; set; }
public long UserId { get; set; }
public int ItemId { get; set; }
public int WarehouseId { get; set; }
public int? BinId { get; set; }
public int? BatchId { get; set; }
public int? SerialId { get; set; }
public int UserId { get; set; }
public Direction Direction { get; set; }
public decimal QtyBase { get; set; }
@@ -27,6 +27,6 @@ public class StockLedger
public decimal RunningBalance { get; set; }
public string SourceDocType { get; set; } = string.Empty;
public long SourceDocId { get; set; }
public int SourceDocId { get; set; }
public DateTime CreatedAt { get; set; }
}
@@ -10,18 +10,18 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockTransfer
{
public long TransferId { get; set; }
public int TransferId { get; set; }
public string DocNo { get; set; } = string.Empty;
public long SrcWarehouseId { get; set; }
public int SrcWarehouseId { get; set; }
public Warehouse? SrcWarehouse { get; set; }
public long DestWarehouseId { get; set; }
public int DestWarehouseId { get; set; }
public Warehouse? DestWarehouse { get; set; }
public TransferStatus Status { get; set; } = TransferStatus.Draft;
public long CreatedBy { get; set; }
public int CreatedBy { get; set; }
public User? Creator { get; set; }
public DateTime CreatedAt { get; set; }
@@ -12,18 +12,18 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class StockTransferLine
{
public long TransferLineId { get; set; }
public int TransferLineId { get; set; }
public long TransferId { get; set; }
public int TransferId { get; set; }
public StockTransfer? Transfer { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long? SrcBinId { get; set; }
public long? DestBinId { get; set; }
public long? BatchId { get; set; }
public long? SerialId { get; set; }
public int? SrcBinId { get; set; }
public int? DestBinId { get; set; }
public int? BatchId { get; set; }
public int? SerialId { get; set; }
public decimal Qty { get; set; }
+1 -1
View File
@@ -6,6 +6,6 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Uom
{
public long UomId { get; set; }
public int UomId { get; set; }
public string Name { get; set; } = string.Empty;
}
@@ -7,15 +7,15 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class UomConversion
{
public long ConversionId { get; set; }
public int ConversionId { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public long FromUomId { get; set; }
public int FromUomId { get; set; }
public Uom? FromUom { get; set; }
public long ToUomId { get; set; }
public int ToUomId { get; set; }
public Uom? ToUom { get; set; }
public decimal Factor { get; set; }
+3 -3
View File
@@ -4,7 +4,7 @@ namespace ERPCore.Domain.Entities;
/// <summary>
/// Application user (FR-X-01) — a **local shadow/projection** of an AuthHex identity.
/// The local <see cref="UserId"/> (long) is what every `createdBy`/`requestedBy`/
/// The local <see cref="UserId"/> (int) is what every `createdBy`/`requestedBy`/
/// audit/ledger FK references; <see cref="AuthUserId"/> maps it to the AuthHex
/// <c>UserId</c> (GUID) and is JIT-provisioned on first authenticated request
/// (docs/10 A.4/C.7). A seeded <c>system</c> user (id 1, null AuthUserId) is the
@@ -13,9 +13,9 @@ namespace ERPCore.Domain.Entities;
public class User
{
/// <summary>Seeded fallback actor for unauthenticated/system operations.</summary>
public const long SystemUserId = 1;
public const int SystemUserId = 1;
public long UserId { get; set; }
public int UserId { get; set; }
public string Username { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public EntityStatus Status { get; set; } = EntityStatus.Active;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Vendor
{
public long VendorId { get; set; }
public int VendorId { get; set; }
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string? Terms { get; set; }
@@ -12,12 +12,12 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class VendorQuotation
{
public long QuotationId { get; set; }
public int QuotationId { get; set; }
public long RfqId { get; set; }
public int RfqId { get; set; }
public Rfq? Rfq { get; set; }
public long VendorId { get; set; }
public int VendorId { get; set; }
public Vendor? Vendor { get; set; }
public DateTime CreatedAt { get; set; }
@@ -3,12 +3,12 @@ namespace ERPCore.Domain.Entities;
/// <summary>Per-item quoted price and lead time within a <see cref="VendorQuotation"/> (docs/11 §3.2).</summary>
public class VendorQuotationLine
{
public long QuotationLineId { get; set; }
public int QuotationLineId { get; set; }
public long QuotationId { get; set; }
public int QuotationId { get; set; }
public VendorQuotation? Quotation { get; set; }
public long ItemId { get; set; }
public int ItemId { get; set; }
public Item? Item { get; set; }
public decimal UnitPrice { get; set; }
+1 -1
View File
@@ -6,7 +6,7 @@ namespace ERPCore.Domain.Entities;
/// </summary>
public class Warehouse
{
public long WarehouseId { get; set; }
public int WarehouseId { get; set; }
public string Code { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;