StockMovementService
StockMovementService
Contains methods relating to StockMovement entities.
class StockMovementService {
shippingEligibilityCheckers: ShippingEligibilityChecker[];
shippingCalculators: ShippingCalculator[];
constructor(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder, globalSettingsService: GlobalSettingsService, stockLevelService: StockLevelService, eventBus: EventBus, stockLocationService: StockLocationService, configService: ConfigService)
getStockMovementsByProductVariantId(ctx: RequestContext, productVariantId: ID, options: StockMovementListOptions) => Promise<PaginatedList<StockMovement>>;
adjustProductVariantStock(ctx: RequestContext, productVariantId: ID, stockOnHandNumberOrInput: number | StockLevelInput[]) => Promise<StockAdjustment[]>;
createAllocationsForOrder(ctx: RequestContext, order: Order) => Promise<Allocation[]>;
createAllocationsForOrderLines(ctx: RequestContext, lines: OrderLineInput[]) => Promise<Allocation[]>;
createSalesForOrder(ctx: RequestContext, lines: OrderLineInput[]) => Promise<Sale[]>;
createCancellationsForOrderLines(ctx: RequestContext, lineInputs: OrderLineInput[]) => Promise<Cancellation[]>;
createReleasesForOrderLines(ctx: RequestContext, lineInputs: OrderLineInput[]) => Promise<Release[]>;
}
shippingEligibilityCheckers
shippingCalculators
constructor
(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder, globalSettingsService: GlobalSettingsService, stockLevelService: StockLevelService, eventBus: EventBus, stockLocationService: StockLocationService, configService: ConfigService) => StockMovementService
getStockMovementsByProductVariantId
(ctx: RequestContext, productVariantId: ID, options: StockMovementListOptions) => Promise<PaginatedList<StockMovement>>
Returns a PaginatedList of all StockMovements associated with the specified ProductVariant.
adjustProductVariantStock
(ctx: RequestContext, productVariantId: ID, stockOnHandNumberOrInput: number | StockLevelInput[]) => Promise<StockAdjustment[]>
Adjusts the stock level of the ProductVariant, creating a new StockAdjustment entity in the process.
createAllocationsForOrder
(ctx: RequestContext, order: Order) => Promise<Allocation[]>
Creates a new Allocation for each OrderLine in the Order. For ProductVariants
which are configured to track stock levels, the ProductVariant.stockAllocated
value is
increased, indicating that this quantity of stock is allocated and cannot be sold.
createAllocationsForOrderLines
(ctx: RequestContext, lines: OrderLineInput[]) => Promise<Allocation[]>
Creates a new Allocation for each of the given OrderLines. For ProductVariants
which are configured to track stock levels, the ProductVariant.stockAllocated
value is
increased, indicating that this quantity of stock is allocated and cannot be sold.
createSalesForOrder
(ctx: RequestContext, lines: OrderLineInput[]) => Promise<Sale[]>
Creates Sales for each OrderLine in the Order. For ProductVariants
which are configured to track stock levels, the ProductVariant.stockAllocated
value is
reduced and the stockOnHand
value is also reduced by the OrderLine quantity, indicating
that the stock is no longer allocated, but is actually sold and no longer available.
createCancellationsForOrderLines
(ctx: RequestContext, lineInputs: OrderLineInput[]) => Promise<Cancellation[]>
Creates a Cancellation for each of the specified OrderItems. For ProductVariants
which are configured to track stock levels, the ProductVariant.stockOnHand
value is
increased for each Cancellation, allowing that stock to be sold again.
createReleasesForOrderLines
(ctx: RequestContext, lineInputs: OrderLineInput[]) => Promise<Release[]>
Creates a Release for each of the specified OrderItems. For ProductVariants
which are configured to track stock levels, the ProductVariant.stockAllocated
value is
reduced, indicating that this stock is once again available to buy.