mall operator make the product on shelf so that the product cound be sold during the specifeid time segment. mall operator also need to set the price of the product/sku. the price including all the price for different level of promoters, shipping fees(freight),
OnShelf(product,List[OnShelfItem],start_time,end_time)
OnShelfItem: sku,count,Price Price: price for all levels, origin price to show,freight
count must less than total stock of all warehouse,needn't check, display stock=min(shelf stock,real stock)- if time is null, onshelf immediately
- update OnShelf strategy (take effect at queries for onshelf products)
- update OnShelfHistory [optional]
- Stock
- OnShelf (Status,strategy) : product(pk),state,start_time,end_time,location(normal|host list|activity...),List[OnShelfItem]
- OnShelfItem: sku,on_shelf_count,stock
- OnShelfHistory (ActionTaken) [optional]
user purchase product by placing an order,
CreateOrder(List[PurchaseItem],...)
PurchaseItem: product,sku,count,shelf
product is on shelf onshelf stock is greater than 0 sku stock is greater than 0
- found an warehouse which have enough stock,
- place an order, link the order and the warehouse
- decease the onshelf stock (OnShelfItem.stock)
- decrease the stock of the warehouse
- note: should do reverse operations when order has been canceled
- Stock: product,sku,count,warehouse
- OnShelf:
- Order: ... List[PurchaseItem]
- PurchaseItem: product,sku,count,warehouse,shelf,
- create order,which state is created
- publish event Order.OrderCreated(Order)
event handler:
- Shelf.onStockConfirmed(orderId) & Stock.onStockConfirmed(orderId,List[PurchaseItem]): update order,set state to Confirmed,update purchase items with warehouse
- Shelf.onStockNegative(orderId): cancel order due to lack of shelf stock
- Stock.onStockNegative(orderId): cancel order due to lack of stock
Order.cancel(reason): set state to canceled, publish Order.OrderCanceledEvent
may cause many canceled order when out of stock, frontend should disable purchase button when displayed in client ui.