106 lines
4.8 KiB
C#
106 lines
4.8 KiB
C#
using Distribution.Models;
|
|
|
|
namespace Distribution.Features.Warehouse;
|
|
|
|
// ── Repository projections ─────────────────────────────────────────────────
|
|
|
|
public record WarehouseBalanceRow(
|
|
Guid ItemId, string Sku, string Name, string Category, string? Brand, string Uom,
|
|
decimal? ReorderLevel, decimal? CostPrice, decimal? SalePrice,
|
|
Guid? BatchId, string? BatchNumber, DateTime? ExpiryDate,
|
|
decimal Quantity, DateTime UpdatedAt);
|
|
|
|
public record WarehouseMovementRow(
|
|
Guid Id, Guid ItemId, string ItemName, string Sku,
|
|
Guid? FromLocationId, LocationType? FromLocationType,
|
|
Guid? ToLocationId, LocationType? ToLocationType,
|
|
decimal Quantity, MovementType Type, string? ReasonCode, Guid? ReferenceId,
|
|
DateTime CreatedAt, Guid CreatedBy);
|
|
|
|
public record WarehouseLastOutboundRow(Guid ItemId, DateTime LastOutboundAt);
|
|
|
|
public record WarehouseGrnTotals(int Count, int Accepted, int Rejected);
|
|
|
|
public record WarehouseVehicleStockRow(
|
|
Guid VehicleId, string RegNumber, string NumberPlate, bool IsLinked, decimal Units, int Skus);
|
|
|
|
// ── Response ───────────────────────────────────────────────────────────────
|
|
|
|
public record DashboardPeriod(DateTime From, DateTime To);
|
|
|
|
public record DashboardKpis(
|
|
decimal StockValueCost, decimal StockValueSale, decimal TotalUnits, int SkuCount,
|
|
int LowStockCount, int OutOfStockCount, int NearExpiryCount, int ExpiredCount,
|
|
decimal UnitsIn, decimal UnitsOut);
|
|
|
|
public record DashboardBatch(Guid BatchId, string? BatchNumber, DateTime? ExpiryDate, decimal Quantity);
|
|
|
|
public record DashboardStockRow(
|
|
Guid ItemId, string Sku, string Name, string Category, string? Brand, string Uom,
|
|
decimal Quantity, decimal? ReorderLevel, string Status,
|
|
decimal CostValue, decimal SaleValue, DateTime UpdatedAt, List<DashboardBatch> Batches);
|
|
|
|
public record DashboardCategoryStock(string Category, decimal Units, decimal Value);
|
|
|
|
public record DashboardExpiringBatch(
|
|
Guid ItemId, string ItemName, string? BatchNumber, DateTime ExpiryDate, decimal Quantity, string Status);
|
|
|
|
public record DashboardDailyPoint(string Date, decimal In, decimal Out);
|
|
|
|
public record DashboardMovementTypeRow(MovementType Type, string Direction, decimal Units, int Count);
|
|
|
|
public record DashboardLedgerRow(
|
|
Guid Id, DateTime CreatedAt, Guid ItemId, string ItemName, string Sku,
|
|
MovementType Type, string Direction, decimal Quantity,
|
|
string FromName, string ToName, Guid? ReferenceId, string? ReferenceKind,
|
|
string? ReasonCode, string CreatedByName);
|
|
|
|
public record DashboardGrnRow(
|
|
Guid Id, DateTime ReceivedAt, Guid? PurchaseOrderId, string? SupplierName,
|
|
int AcceptedQuantity, int RejectedQuantity, decimal CostValue);
|
|
|
|
public record DashboardInbound(
|
|
int GrnCount, int AcceptedUnits, int RejectedUnits, decimal RejectionRatePercent, List<DashboardGrnRow> RecentGrns);
|
|
|
|
public record DashboardLoadingSheetRow(
|
|
Guid Id, Guid RideId, string VehiclePlate, LoadingSheetStatus Status,
|
|
DateTime PopulatedAt, DateTime? ConfirmedAt, int Lines, decimal Units);
|
|
|
|
public record DashboardOutbound(
|
|
decimal UnitsDispatched, decimal PendingDispatchUnits, List<DashboardLoadingSheetRow> RecentLoadingSheets);
|
|
|
|
public record DashboardVehicle(
|
|
Guid VehicleId, string RegNumber, string NumberPlate, bool IsLinked, decimal Units, int Skus);
|
|
|
|
public record DashboardClaimRow(Guid Id, DateTime CreatedAt, string? SupplierName, string Details, decimal Units);
|
|
|
|
public record DashboardLosses(
|
|
decimal PurchaseReturnUnits, decimal DamageUnits, decimal NegativeAdjustmentUnits,
|
|
decimal PositiveAdjustmentUnits, int OpenClaimCount, List<DashboardClaimRow> OpenClaims);
|
|
|
|
public record DashboardTopMover(Guid ItemId, string Sku, string Name, decimal UnitsOut);
|
|
|
|
public record DashboardDeadStock(
|
|
Guid ItemId, string Sku, string Name, decimal Quantity, decimal CostValue, DateTime? LastOutboundAt);
|
|
|
|
public record DashboardLinkedVehicle(Guid Id, string RegNumber, string NumberPlate, bool IsPrimary);
|
|
|
|
public record WarehouseDashboardResponse(
|
|
WarehouseResponse Warehouse,
|
|
List<DashboardLinkedVehicle> LinkedVehicles,
|
|
DashboardPeriod Period,
|
|
int DeadStockDays,
|
|
DashboardKpis Kpis,
|
|
List<DashboardStockRow> Stock,
|
|
List<DashboardCategoryStock> StockByCategory,
|
|
List<DashboardExpiringBatch> ExpiringBatches,
|
|
List<DashboardDailyPoint> DailyMovement,
|
|
List<DashboardMovementTypeRow> MovementByType,
|
|
List<DashboardLedgerRow> Ledger,
|
|
DashboardInbound Inbound,
|
|
DashboardOutbound Outbound,
|
|
List<DashboardVehicle> Vehicles,
|
|
DashboardLosses Losses,
|
|
List<DashboardTopMover> TopMovers,
|
|
List<DashboardDeadStock> DeadStock);
|