Waybill.cs · WaybillBehavior.cs
[KandraDocumentEntity]
public partial class Waybill : DocumentBase, IEntityWithRows<WaybillRow>
{
public override string Code { get; set; } = "";
public override DateTime DateTime { get; set; }
public Guid CounterpartyId { get; set; }
public Guid WarehouseId { get; set; }
public List<WaybillRow> Rows { get; set; } = [];
}
// Registers are written only inside a posting scope.
public class WaybillBehavior : DocumentBehavior<Waybill, WaybillDto>
{
public override async ValueTask OnSubmitAsync(Waybill doc, ISubmitScope scope)
{
var inventory = scope.GetWriter<IInventoryRegisterWriter>();
foreach (var row in doc.Rows)
await inventory.ExpenseAsync(doc, row.ItemId, doc.WarehouseId, row.Quantity);
}
}
// Controllers, API client, EF config, DI, Blazor pages: generated.