Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 175 additions & 0 deletions Core/Resgrid.Localization/Areas/User/Inventory/Inventory.ar.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.de.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.el.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.en.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.es.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.fr.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.it.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.pl.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.sv.resx

Large diffs are not rendered by default.

176 changes: 175 additions & 1 deletion Core/Resgrid.Localization/Areas/User/Inventory/Inventory.uk.resx

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Core/Resgrid.Model/Checklists/ChecklistWorkflowPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ public static class ChecklistWorkflowPayload
(int)WorkflowTriggerEventType.ChecklistCompleted, (int)WorkflowTriggerEventType.ChecklistFailed,
(int)WorkflowTriggerEventType.ChecklistMissed, (int)WorkflowTriggerEventType.WorkOrderCreated,
(int)WorkflowTriggerEventType.WorkOrderStatusChanged, (int)WorkflowTriggerEventType.WorkOrderAssigned,
(int)WorkflowTriggerEventType.ChecklistScheduleChanged, (int)WorkflowTriggerEventType.ChecklistOccurrenceSkipped,
22, 58, 59, 60, 64, 66
});
(int)WorkflowTriggerEventType.ChecklistScheduleChanged, (int)WorkflowTriggerEventType.ChecklistOccurrenceSkipped
}.Concat(Resgrid.Model.Inventories.InventoryWorkflowPayload.Triggers).ToArray());
private static readonly string[] Identifiers = { "CompletionId", "DefinitionId", "VersionId", "ItemId", "ScheduleId", "OccurrenceId" };
private static bool IsStructuralTarget(int type, string target) =>
type >= 0 && type <= 2 && int.TryParse(target, out var numeric) && numeric > 0
Expand Down
8 changes: 6 additions & 2 deletions Core/Resgrid.Model/Inventories/InventoryContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ public sealed class InventoryPosting
public string ReferenceId { get; set; }
public string ReversesTransactionId { get; set; }
public string IssuanceId { get; set; }
[Newtonsoft.Json.JsonProperty(NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string UsageId { get; set; }
[Newtonsoft.Json.JsonProperty(NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public InventoryUsageType? UsageType { get; set; }
[Newtonsoft.Json.JsonProperty(NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PurchaseOrderItemId { get; set; }
[Newtonsoft.Json.JsonProperty(NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string CountItemId { get; set; }
public string Note { get; set; }
public decimal? UnitCost { get; set; }
}
public sealed class InventoryCommand { public string RequestId { get; set; } public List<InventoryPosting> Lines { get; set; } = new(); }
public sealed class InventoryResult { public string OperationId { get; set; } public bool AwaitingWitness { get; set; } public List<string> TransactionIds { get; set; } = new(); public List<long> OutboxIds { get; set; } = new(); public string TransferId { get; set; } public string IssuanceId { get; set; } public string AssetId { get; set; } public List<string> IssuanceIds { get; set; } = new(); }
public sealed class InventoryResult { public string OperationId { get; set; } public bool AwaitingWitness { get; set; } public List<string> TransactionIds { get; set; } = new(); public List<long> OutboxIds { get; set; } = new(); public string TransferId { get; set; } public string IssuanceId { get; set; } public string AssetId { get; set; } public List<string> IssuanceIds { get; set; } = new(); public string PurchaseOrderId { get; set; } }
public sealed class InventoryIssueInput { public string RequestId { get; set; } public string ItemId { get; set; } public string AssetId { get; set; } public string LotId { get; set; } public string FromLocationId { get; set; } public decimal Quantity { get; set; } public string UserId { get; set; } public int? UnitId { get; set; } public DateTime? ExpectedReturnOn { get; set; } public InventoryReferenceType ReferenceType { get; set; } public string ReferenceId { get; set; } public string Note { get; set; } }
public sealed class InventoryReturnInput { public string RequestId { get; set; } public string IssuanceId { get; set; } public int Revision { get; set; } public string ToLocationId { get; set; } public decimal Quantity { get; set; } public InventoryAssetStatus Condition { get; set; } public string Note { get; set; } }
public sealed class InventoryEquipment { public InventoryAsset Asset { get; set; } public InventoryStock Stock { get; set; } public string ItemName { get; set; } public int? UnitId { get; set; } public int? GroupId { get; set; } public string UserId { get; set; } public List<InventoryIssuance> Issuances { get; set; } = new(); }
public sealed class InventoryPage<T> { public List<T> Items { get; set; } = new(); public bool HasMore { get; set; } }
public sealed class InventoryOperationContent { public string Fingerprint { get; set; } public InventoryResult Result { get; set; } public InventoryCommand PendingCommand { get; set; } public string PendingKind { get; set; } public List<InventoryIssueInput> PendingIssues { get; set; } public InventoryReturnInput PendingReturn { get; set; } public string PerformerId { get; set; } public string WitnessId { get; set; } public DateTime? WitnessedOn { get; set; } public string Attestation { get; set; } }
public sealed class InventoryOperationContent { public string Fingerprint { get; set; } public InventoryResult Result { get; set; } public InventoryCommand PendingCommand { get; set; } public string PendingKind { get; set; } public List<InventoryIssueInput> PendingIssues { get; set; } public InventoryReturnInput PendingReturn { get; set; } public string PerformerId { get; set; } public string WitnessId { get; set; } public DateTime? WitnessedOn { get; set; } public string Attestation { get; set; } public InventoryPurchaseReceiptInput PendingPurchaseReceipt { get; set; } public InventoryCountComplete PendingCount { get; set; } }
public sealed class InventoryKitInput { public string Id { get; set; } public int Revision { get; set; } public string Name { get; set; } public List<InventoryKitLine> Lines { get; set; } = new(); }
public sealed class InventoryKitLine { public string ItemId { get; set; } public decimal Quantity { get; set; } }
public sealed class InventoryKitIssueInput { public string KitId { get; set; } public string RequestId { get; set; } public List<InventoryIssueInput> Lines { get; set; } = new(); }
Expand Down
14 changes: 13 additions & 1 deletion Core/Resgrid.Model/Inventories/InventoryModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public sealed class InventoryTransaction : InventoryRow
public string ReferenceId { get; set; }
public string ReversesTransactionId { get; set; }
public string IssuanceId { get; set; }
public string PurchaseOrderItemId { get; set; }
public string CountItemId { get; set; }
public int? LegacyInventoryId { get; set; }
public DateTime OccurredOn { get; set; }
}
Expand Down Expand Up @@ -132,19 +134,29 @@ public sealed class InventoryItemContent
public decimal? ReorderPoint { get; set; }
public decimal? ReorderQuantity { get; set; }
public decimal? DefaultUnitCost { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public decimal? AverageUnitCost { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string CurrencyCode { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string PreferredVendorId { get; set; }
}
public sealed class InventoryLabel { public string Name { get; set; } public string Note { get; set; } }
public sealed class InventoryLotContent { public string LotNumber { get; set; } public decimal? UnitCost { get; set; } public string VendorId { get; set; } }
public sealed class InventoryAssetContent { public string SerialNumber { get; set; } public string AssetTag { get; set; } public string Barcode { get; set; } public decimal? AcquisitionCost { get; set; } public DateTime? WarrantyExpiresOn { get; set; } }
public static class InventoryTables
{
public const int CatalogVersion = 19;
public const int UsageCatalogVersion = 20;
public const int PurchasingCatalogVersion = 21;
public const int OperationsCatalogVersion = 22;
public static readonly IReadOnlyDictionary<Type, string> All = new Dictionary<Type, string>
{
[typeof(InventoryCategory)] = "InventoryCategories", [typeof(InventoryItem)] = "InventoryItems", [typeof(InventoryLocation)] = "InventoryLocations",
[typeof(InventoryLot)] = "InventoryLots", [typeof(InventoryStock)] = "InventoryStocks", [typeof(InventoryAsset)] = "InventoryAssets", [typeof(InventoryTransaction)] = "InventoryTransactions",
[typeof(InventoryOperation)] = "InventoryOperations", [typeof(InventoryTransfer)] = "InventoryTransfers", [typeof(InventoryTransferItem)] = "InventoryTransferItems",
[typeof(InventoryIssuance)] = "InventoryIssuances", [typeof(InventoryKit)] = "InventoryKits", [typeof(InventoryKitItem)] = "InventoryKitItems"
[typeof(InventoryIssuance)] = "InventoryIssuances", [typeof(InventoryKit)] = "InventoryKits", [typeof(InventoryKitItem)] = "InventoryKitItems",
[typeof(RecordInventoryUsage)] = "RecordInventoryUsages",
[typeof(InventoryVendor)] = "InventoryVendors", [typeof(InventoryPurchaseOrder)] = "InventoryPurchaseOrders", [typeof(InventoryPurchaseOrderItem)] = "InventoryPurchaseOrderItems",
[typeof(InventoryCount)] = "InventoryCounts", [typeof(InventoryCountItem)] = "InventoryCountItems",
[typeof(InventoryAlert)] = "InventoryAlerts", [typeof(InventoryAlertDelivery)] = "InventoryAlertDeliveries"
};
public static IReadOnlyDictionary<string, (Func<T, string> Get, Action<T, string> Set)> Fields<T>() where T : InventoryRow =>
new Dictionary<string, (Func<T, string>, Action<T, string>)> { [All[typeof(T)].ToLowerInvariant() + ".content"] = (x => x.Content, (x, v) => x.Content = v) };
Expand Down
97 changes: 97 additions & 0 deletions Core/Resgrid.Model/Inventories/InventoryOperations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;

namespace Resgrid.Model.Inventories
{
public enum InventoryCountStatus { Draft = 0, AwaitingWitness = 1, Completed = 2, Cancelled = 3 }
public enum InventoryAlertType { LowStock = 0, ExpiringSoon = 1, Expired = 2, OverdueReturn = 3 }
public sealed class InventoryCount : InventoryMutableRow
{
public string LocationId { get; set; }
public int Status { get; set; }
public string SnapshotFingerprint { get; set; }
public DateTime SnapshotOn { get; set; }
public DateTime? CompletedOn { get; set; }
public string OperationId { get; set; }
}
public sealed class InventoryCountItem : InventoryRow
{
public string CountId { get; set; }
public string ItemId { get; set; }
public string LocationId { get; set; }
public string LotId { get; set; }
public string AssetId { get; set; }
public decimal ExpectedQuantity { get; set; }
public decimal? CountedQuantity { get; set; }
public string TransactionId { get; set; }
}
public sealed class InventoryCountContent
{
public string Name { get; set; }
public string Note { get; set; }
public int VarianceLineCount { get; set; }
public List<InventoryValuationTotal> Totals { get; set; } = new();
}
public sealed class InventoryCountItemContent
{
public string ItemName { get; set; }
public string UnitOfMeasure { get; set; }
public string SerialNumber { get; set; }
public string LotNumber { get; set; }
public decimal? UnitCost { get; set; }
public string CurrencyCode { get; set; }
}
public sealed class InventoryCountInput { public string Id { get; set; } public string LocationId { get; set; } public string Name { get; set; } public string Note { get; set; } }
public sealed class InventoryCountObservation { public string Id { get; set; } public decimal Quantity { get; set; } }
public sealed class InventoryCountUpdate { public string CountId { get; set; } public int Revision { get; set; } public List<InventoryCountObservation> Lines { get; set; } = new(); }
public sealed class InventoryCountComplete { public string CountId { get; set; } public int Revision { get; set; } public string RequestId { get; set; } }
public sealed class InventoryCountDetail { public InventoryCount Count { get; set; } public List<InventoryCountItem> Lines { get; set; } = new(); }
/// <summary>Content is empty: unattended evaluation uses dates/statuses and attended low-stock projections only.</summary>
public sealed class InventoryAlert : InventoryRow
{
public int AlertType { get; set; }
public string DedupKey { get; set; }
public string ItemId { get; set; }
public string LocationId { get; set; }
public string LotId { get; set; }
public string AssetId { get; set; }
public string IssuanceId { get; set; }
public int Status { get; set; }
public DateTime OpenedOn { get; set; }
public DateTime? ResolvedOn { get; set; }
public DateTime? DueOn { get; set; }
public decimal? Quantity { get; set; }
}
public sealed class InventoryAlertDelivery : InventoryRow
{
public string AlertId { get; set; }
public string UserId { get; set; }
public int State { get; set; }
public DateTime NextAttemptOn { get; set; }
public DateTime? LeaseUntil { get; set; }
public string ClaimToken { get; set; }
public int AttemptCount { get; set; }
public DateTime? HandedOffOn { get; set; }
}
public enum InventoryReportKind { OnHand = 0, Usage = 1, Expiration = 2, LowStock = 3, TransferHistory = 4, Issuance = 5, Valuation = 6, ControlledSubstanceLog = 7 }
public sealed class InventoryReportInput
{
public InventoryReportKind Kind { get; set; }
public DateTime? FromUtc { get; set; }
public DateTime? UntilUtc { get; set; }
public string LocationId { get; set; }
public string ItemId { get; set; }
public string UserId { get; set; }
public int? UnitId { get; set; }
}
public sealed class InventoryReport
{
public InventoryReportKind Kind { get; set; }
public DateTime GeneratedOn { get; set; }
public DateTime? FromUtc { get; set; }
public DateTime? UntilUtc { get; set; }
public List<string> Columns { get; set; } = new();
public List<Dictionary<string, object>> Rows { get; set; } = new();
public List<InventoryValuationTotal> Totals { get; set; } = new();
}
}
60 changes: 60 additions & 0 deletions Core/Resgrid.Model/Inventories/InventoryPurchasing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;

namespace Resgrid.Model.Inventories
{
public enum InventoryPurchaseOrderStatus { Draft = 0, Ordered = 1, PartiallyReceived = 2, Received = 3, Cancelled = 4 }
public sealed class InventoryVendor : InventoryMutableRow { public string ContactId { get; set; } }
public sealed class InventoryVendorContent { public string AccountNumber { get; set; } public string Note { get; set; } }
public sealed class InventoryPurchaseOrder : InventoryMutableRow
{
public string VendorId { get; set; }
public int Status { get; set; }
public string CurrencyCode { get; set; }
public DateTime? OrderedOn { get; set; }
public DateTime? ReceivedOn { get; set; }
}
public sealed class InventoryPurchaseOrderContent { public string Number { get; set; } public string Note { get; set; } public string SupplierName { get; set; } }
public sealed class InventoryPurchaseOrderItem : InventoryMutableRow
{
public string PurchaseOrderId { get; set; }
public string ItemId { get; set; }
public int LineNumber { get; set; }
public decimal QuantityOrdered { get; set; }
public decimal QuantityReceived { get; set; }
}
public sealed class InventoryPurchaseOrderItemContent { public string ItemName { get; set; } public string UnitOfMeasure { get; set; } public decimal UnitCost { get; set; } public string Note { get; set; } }
public sealed class InventoryVendorInput { public string Id { get; set; } public int Revision { get; set; } public string ContactId { get; set; } public InventoryVendorContent Details { get; set; } = new(); }
public sealed class InventoryPurchaseOrderInput
{
public string Id { get; set; }
public int Revision { get; set; }
public string VendorId { get; set; }
public string CurrencyCode { get; set; }
public string Number { get; set; }
public string Note { get; set; }
public List<InventoryPurchaseOrderLineInput> Lines { get; set; } = new();
}
public sealed class InventoryPurchaseOrderLineInput { public string Id { get; set; } public string ItemId { get; set; } public decimal QuantityOrdered { get; set; } public decimal UnitCost { get; set; } public string Note { get; set; } }
public sealed class InventoryPurchaseOrderChange { public string Id { get; set; } public int Revision { get; set; } public string RequestId { get; set; } }
public sealed class InventoryPurchaseReceiptInput { public string PurchaseOrderId { get; set; } public int Revision { get; set; } public string RequestId { get; set; } public List<InventoryPurchaseReceiptLine> Lines { get; set; } = new(); }
public sealed class InventoryPurchaseReceiptLine
{
public string PurchaseOrderItemId { get; set; }
public string LocationId { get; set; }
public string LotId { get; set; }
public decimal Quantity { get; set; }
public InventoryPurchaseAssetInput Asset { get; set; }
}
public sealed class InventoryPurchaseAssetInput { public string SerialNumber { get; set; } public string AssetTag { get; set; } public string Barcode { get; set; } public DateTime? ExpiresOn { get; set; } }
public sealed class InventoryPurchaseOrderDetail { public InventoryPurchaseOrder Order { get; set; } public List<InventoryPurchaseOrderItem> Lines { get; set; } = new(); public List<InventoryTransaction> Receipts { get; set; } = new(); }
public sealed class InventoryVendorChoice { public string Id { get; set; } public string Name { get; set; } }
public sealed class InventoryValuationLine
{
public string ItemId { get; set; } public string AssetId { get; set; } public string LotId { get; set; } public string LocationId { get; set; }
public string ItemName { get; set; } public string CurrencyCode { get; set; } public decimal Quantity { get; set; }
public decimal? UnitCost { get; set; } public decimal? Value { get; set; }
}
public sealed class InventoryValuationTotal { public string CurrencyCode { get; set; } public decimal KnownValue { get; set; } public int UncostedRows { get; set; } }
public sealed class InventoryValuation { public List<InventoryValuationLine> Lines { get; set; } = new(); public List<InventoryValuationTotal> Totals { get; set; } = new(); public bool HasNegativeStock { get; set; } public DateTime AsOfUtc { get; set; } }
}
10 changes: 10 additions & 0 deletions Core/Resgrid.Model/Inventories/InventoryQuery.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
namespace Resgrid.Model.Inventories
{
public sealed class InventoryStockQuantity
{
public string ItemId { get; set; }
public string LocationId { get; set; }
public decimal Quantity { get; set; }
}

/// <summary>Structural filters applied before paging; authored content is never queried outside its protected read boundary.</summary>
public sealed class InventoryQuery
{
Expand All @@ -8,5 +15,8 @@ public sealed class InventoryQuery
public string AssetId { get; set; }
public string IssuedToUserId { get; set; }
public string KitId { get; set; }
public string SourceId { get; set; }
public int? SourceType { get; set; }
public int? RecordKind { get; set; }
}
}
Loading
Loading