|
|
|
|
using System.Collections.Immutable;
|
|
|
|
|
using Connected.Entities;
|
|
|
|
|
using Connected.ServiceModel;
|
|
|
|
|
using Connected.Services;
|
|
|
|
|
using Ops = Connected.Logistics.Types.WarehouseLocations.WarehouseLocationOps;
|
|
|
|
|
|
|
|
|
|
namespace Connected.Logistics.Types.WarehouseLocations;
|
|
|
|
|
internal sealed class WarehouseLocationService : EntityService<int>, IWarehouseLocationService
|
|
|
|
|
{
|
|
|
|
|
public WarehouseLocationService(IContext context) : base(context)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Delete(PrimaryKeyArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
await Invoke(GetOperation<Ops.Delete>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> Insert(InsertWarehouseLocationArgs args)
|
|
|
|
|
{
|
|
|
|
|
return Invoke(GetOperation<Ops.Insert>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Patch(PatchArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
if (await Select(args.Id) is not WarehouseLocation entity)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
await Update(args.Patch<UpdateWarehouseLocationArgs, WarehouseLocation>(entity));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<ImmutableList<IWarehouseLocation>> Query(QueryArgs? args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<Ops.Query>(), args ?? QueryArgs.Default);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<ImmutableList<IWarehouseLocation>> Query(QueryWarehouseLocationArgs args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<Ops.QueryByWarehouse>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<ImmutableList<IWarehouseLocation>> Query(PrimaryKeyListArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<Ops.Lookup>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<ImmutableList<IWarehouseLocation>> QueryChildren(QueryWarehouseLocationChildrenArgs args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<Ops.QueryChildren>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IWarehouseLocation?> Select(PrimaryKeyArgs<int> args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<Ops.Select>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IWarehouseLocation?> Select(SelectWarehouseLocationArgs args)
|
|
|
|
|
{
|
|
|
|
|
return await Invoke(GetOperation<Ops.SelectByCode>(), args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Update(UpdateWarehouseLocationArgs args)
|
|
|
|
|
{
|
|
|
|
|
await Invoke(GetOperation<Ops.Update>(), args);
|
|
|
|
|
}
|
|
|
|
|
}
|