Skip to main content

StockLocationService

StockLocationService

Contains methods relating to StockLocation entities.

Signature
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

method
(requestContextService: RequestContextService, connection: TransactionalConnection, channelService: ChannelService, roleService: RoleService, listQueryBuilder: ListQueryBuilder, configService: ConfigService, requestContextCache: RequestContextCacheService, customFieldRelationService: CustomFieldRelationService, eventBus: EventBus) => StockLocationService

initStockLocations

method
() =>

findOne

method
(ctx: RequestContext, stockLocationId: ID) => Promise<StockLocation | undefined>

findAll

method
(ctx: RequestContext, options?: ListQueryOptions<StockLocation>, relations?: RelationPaths<StockLocation>) => Promise<PaginatedList<StockLocation>>

create

method
(ctx: RequestContext, input: CreateStockLocationInput) => Promise<StockLocation>

update

method
(ctx: RequestContext, input: UpdateStockLocationInput) => Promise<StockLocation>

delete

method
(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

method
(ctx: RequestContext, input: AssignStockLocationsToChannelInput) => Promise<StockLocation[]>

Assigns multiple StockLocations to the specified Channel. Requires the UpdateStockLocation permission on the target channel.

removeStockLocationsFromChannel

method
(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

method
(ctx: RequestContext) =>

getAllocationLocations

method
(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

method
(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

method
(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

method
(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.