110 lines
2.8 KiB
C#
110 lines
2.8 KiB
C#
using Distribution.Models;
|
|
|
|
namespace Distribution.Features.Stock;
|
|
|
|
// Shared pagination wrapper
|
|
public record PagedResponse<T>(int Page, int PageSize, int Total, List<T> Items);
|
|
|
|
// Balance
|
|
public record StockBalanceResponse(
|
|
Guid ItemId,
|
|
string ItemName,
|
|
Guid LocationId,
|
|
LocationType LocationType,
|
|
decimal Quantity,
|
|
DateTime UpdatedAt,
|
|
string LocationName);
|
|
|
|
public record StockTotalResponse(
|
|
Guid ItemId,
|
|
string ItemName,
|
|
decimal TotalQuantity,
|
|
List<StockBalanceResponse> Breakdown);
|
|
|
|
public record LowStockItemResponse(
|
|
Guid ItemId,
|
|
string ItemName,
|
|
Guid LocationId,
|
|
string LocationName,
|
|
decimal Quantity,
|
|
decimal ReorderLevel);
|
|
|
|
// Movement
|
|
public record StockMovementResponse(
|
|
Guid Id,
|
|
Guid ItemId,
|
|
string ItemName,
|
|
Guid? FromLocationId,
|
|
LocationType? FromLocationType,
|
|
Guid? ToLocationId,
|
|
LocationType? ToLocationType,
|
|
decimal Quantity,
|
|
MovementType Type,
|
|
string? ReasonCode,
|
|
Guid? ReferenceId,
|
|
DateTime CreatedAt,
|
|
Guid CreatedBy,
|
|
string? FromLocationName,
|
|
string? ToLocationName,
|
|
Guid? BatchId = null,
|
|
string? BatchNumber = null,
|
|
DateTime? BatchExpiryDate = null,
|
|
Guid? SerialId = null,
|
|
string? SerialNumber = null);
|
|
|
|
// Write requests
|
|
public record TransferRequest(
|
|
Guid ItemId,
|
|
Guid FromLocationId,
|
|
LocationType FromLocationType,
|
|
Guid ToLocationId,
|
|
LocationType ToLocationType,
|
|
decimal Quantity,
|
|
Guid? ReferenceId);
|
|
|
|
public record DamageRequest(
|
|
Guid ItemId,
|
|
Guid LocationId,
|
|
LocationType LocationType,
|
|
decimal Quantity,
|
|
string ReasonCode);
|
|
|
|
public record CustomerReturnRequest(
|
|
Guid ItemId,
|
|
Guid VehicleId,
|
|
decimal Quantity,
|
|
Guid? ReferenceId);
|
|
|
|
public record AdjustmentRequest(
|
|
Guid ItemId,
|
|
Guid LocationId,
|
|
LocationType LocationType,
|
|
decimal Quantity,
|
|
string ReasonCode,
|
|
// TEMPORARY: required while auth doesn't resolve a logged-in user server-side — see testbug.md #28.
|
|
Guid? AdjustedByUserId = null);
|
|
|
|
// Movements are an immutable ledger — quantity, locations, and type can never change once recorded
|
|
// (the running stock balance is the sum of all movements). Only the free-text reason/note is editable.
|
|
public record UpdateMovementReasonRequest(string ReasonCode);
|
|
|
|
// Movement report filters
|
|
public record MovementFilter(
|
|
Guid? LocationId = null,
|
|
Guid? ItemId = null,
|
|
MovementType? Type = null,
|
|
DateTime? From = null,
|
|
DateTime? To = null,
|
|
Guid? ReferenceId = null,
|
|
Guid? BatchId = null,
|
|
Guid? SerialId = null,
|
|
Guid? CreatedBy = null,
|
|
string? ReasonCode = null);
|
|
|
|
public record MovementSummary(
|
|
decimal OpeningQuantity,
|
|
decimal QuantityIn,
|
|
decimal QuantityOut,
|
|
decimal ClosingQuantity,
|
|
decimal CurrentBalance);
|