StockLocationService
StockLocationService
Contains methods relating to StockLocation entities.
class StockLocationService {
constructor(requestContextService: RequestContextService, connection: TransactionalConnection, channelService: ChannelService, roleService: RoleService, listQueryBuilder: ListQueryBuilder, configService: ConfigService, requestContextCache: RequestContextCacheService, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus)
initStockLocations() => ;
findOne(ctx: RequestContext, stockLocationId: ID) => Promise<StockLocation | undefined>;
findAll(ctx: RequestContext, options?: ListQueryOptions<StockLocation>, relations?: RelationPaths<StockLocation>) => Promise<PaginatedList<StockLocation>>;
create(ctx: RequestContext, input: CreateStockLocationInput) => Promise<StockLocation>;
update(ctx: RequestContext, input: UpdateStockLocationInput) => Promise<StockLocation>;
delete(ctx: RequestContext, input: DeleteStockLocationInput) => Promise<DeletionResponse>;
assignStockLocationsToChannel(ctx: RequestContext, input: AssignStockLocationsToChannelInput) => Promise<StockLocation[]>;
removeStockLocationsFromChannel(ctx: RequestContext, input: RemoveStockLocationsFromChannelInput) => Promise<StockLocation[]>;
defaultStockLocation(ctx: RequestContext) => ;
getAllocationLocations(ctx: RequestContext, orderLine: OrderLine, quantity: number) => ;
getReleaseLocations(ctx: RequestContext, orderLine: OrderLine, quantity: number) => ;
getSaleLocations(ctx: RequestContext, orderLine: OrderLine, quantity: number) => ;
getCancellationLocations(ctx: RequestContext, orderLine: OrderLine, quantity: number) => ;
}
constructor
(requestContextService: RequestContextService, connection: TransactionalConnection, channelService: ChannelService, roleService: RoleService, listQueryBuilder: ListQueryBuilder, configService: ConfigService, requestContextCache: RequestContextCacheService, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus) => StockLocationServiceinitStockLocations
() => findOne
(ctx: RequestContext, stockLocationId: ID) => Promise<StockLocation | undefined>findAll
(ctx: RequestContext, options?: ListQueryOptions<StockLocation>, relations?: RelationPaths<StockLocation>) => Promise<PaginatedList<StockLocation>>create
(ctx: RequestContext, input: CreateStockLocationInput) => Promise<StockLocation>update
(ctx: RequestContext, input: UpdateStockLocationInput) => Promise<StockLocation>delete
(ctx: RequestContext, input: DeleteStockLocationInput) => Promise<DeletionResponse>Deletes a StockLocation. If transferToLocationId is specified in the input, all stock levels
from the deleted location will be transferred to the target location. The last StockLocation
cannot be deleted.
assignStockLocationsToChannel
(ctx: RequestContext, input: AssignStockLocationsToChannelInput) => Promise<StockLocation[]>Assigns multiple StockLocations to the specified Channel. Requires the UpdateStockLocation
permission on the target channel.
removeStockLocationsFromChannel
(ctx: RequestContext, input: RemoveStockLocationsFromChannelInput) => Promise<StockLocation[]>Removes multiple StockLocations from the specified Channel. Requires the DeleteStockLocation
permission on the target channel. StockLocations cannot be removed from the default channel.
defaultStockLocation
(ctx: RequestContext) => getAllocationLocations
(ctx: RequestContext, orderLine: OrderLine, quantity: number) => Returns the locations and quantities to use for allocating stock when an OrderLine is created. This uses the configured StockLocationStrategy.
getReleaseLocations
(ctx: RequestContext, orderLine: OrderLine, quantity: number) => Returns the locations and quantities to use for releasing allocated stock when an OrderLine is cancelled or modified. This uses the configured StockLocationStrategy.
getSaleLocations
(ctx: RequestContext, orderLine: OrderLine, quantity: number) => Returns the locations and quantities to use for creating sales when an Order is fulfilled. This uses the configured StockLocationStrategy.
getCancellationLocations
(ctx: RequestContext, orderLine: OrderLine, quantity: number) => Returns the locations and quantities to use for cancelling sales when an OrderLine is cancelled after fulfillment. This uses the configured StockLocationStrategy.