You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
3.0 KiB
99 lines
3.0 KiB
using System.Collections.Immutable;
|
|
using Common.Documents;
|
|
using Connected.Entities;
|
|
using Connected.Notifications;
|
|
using Connected.ServiceModel;
|
|
using ItemOps = Logistics.Documents.Receive.ReceivePostingItemOps;
|
|
using Ops = Logistics.Documents.Receive.ReceivePostingDocumentOps;
|
|
using PlannedOps = Logistics.Documents.Receive.ReceivePlannedItemsOps;
|
|
|
|
namespace Logistics.Documents.Receive;
|
|
internal sealed class ReceivePostingDocumentService : DocumentService<int, long>, IReceivePostingDocumentService
|
|
{
|
|
public event ServiceEventHandler<PrimaryKeyEventArgs<long>> PlannedItemUpdated;
|
|
public ReceivePostingDocumentService(IContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
public async Task Delete(PrimaryKeyArgs<int> args)
|
|
{
|
|
await Invoke(GetOperation<Ops.Delete>(), args);
|
|
}
|
|
|
|
public async Task<int> Insert(InsertReceivePostingDocumentArgs args)
|
|
{
|
|
return await Invoke(GetOperation<Ops.Insert>(), args);
|
|
}
|
|
|
|
public async Task<long> InsertItem(InsertReceivePostingItemArgs args)
|
|
{
|
|
return await Invoke(GetOperation<ItemOps.Insert>(), args);
|
|
}
|
|
|
|
public async Task Patch(PatchArgs<int> args)
|
|
{
|
|
if (await Select(args.Id) is not ReceivePostingDocument entity)
|
|
return;
|
|
|
|
await Update(entity.Merge(args, State.Default).AsArguments<UpdateReceivePostingDocumentArgs>());
|
|
}
|
|
|
|
public async Task PatchPlanedItem(PatchArgs<long> args)
|
|
{
|
|
if (await SelectPlannedItem(args.Id) is not ReceivePlannedItem entity)
|
|
return;
|
|
|
|
await UpdatePlannedItem(entity.Merge(args, State.Default).AsArguments<UpdateReceivePlannedItemArgs>());
|
|
}
|
|
|
|
public async Task<ImmutableList<IReceivePostingDocument>> Query(PrimaryKeyArgs<int> args)
|
|
{
|
|
return await Invoke(GetOperation<Ops.Query>(), args);
|
|
}
|
|
|
|
public async Task<ImmutableList<IReceivePostingItem>> QueryItems(PrimaryKeyArgs<int> args)
|
|
{
|
|
return await Invoke(GetOperation<ItemOps.Query>(), args);
|
|
}
|
|
|
|
public async Task<ImmutableList<IReceivePlannedItem>> QueryPlannedItems(PrimaryKeyArgs<int> args)
|
|
{
|
|
return await Invoke(GetOperation<PlannedOps.Query>(), args);
|
|
}
|
|
|
|
public async Task<ImmutableList<IReceivePlannedItem>> QueryPlannedItems(PrimaryKeyArgs<long> args)
|
|
{
|
|
return await Invoke(GetOperation<PlannedOps.QueryByItem>(), args);
|
|
}
|
|
|
|
public async Task<IReceivePostingDocument?> Select(PrimaryKeyArgs<int> args)
|
|
{
|
|
return await Invoke(GetOperation<Ops.Select>(), args);
|
|
}
|
|
|
|
public async Task<IReceivePostingItem?> SelectItem(PrimaryKeyArgs<long> args)
|
|
{
|
|
return await Invoke(GetOperation<ItemOps.Select>(), args);
|
|
}
|
|
|
|
public async Task<IReceivePlannedItem?> SelectPlannedItem(PrimaryKeyArgs<long> args)
|
|
{
|
|
return await Invoke(GetOperation<PlannedOps.Select>(), args);
|
|
}
|
|
|
|
public async Task<IReceivePlannedItem?> SelectPlannedItem(SelectReceivePlannedItemArgs args)
|
|
{
|
|
return await Invoke(GetOperation<PlannedOps.SelectByEntity>(), args);
|
|
}
|
|
|
|
public async Task Update(UpdateReceivePostingDocumentArgs args)
|
|
{
|
|
await Invoke(GetOperation<Ops.Update>(), args);
|
|
}
|
|
|
|
public Task UpdatePlannedItem(UpdateReceivePlannedItemArgs args)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|