Please help because there seems to be something I’m missing when modifying state transitions.
I’ve added a new state “Partially Completed” this should reflect the fact that some items in an order have been “Delivered”. The complication is that we do not know how many deliveries we have ahead of time.
Here is the scenario:
- Order is placed for 2 items, and the order gets a default delivery record for all OrderRows
- ItemA is delivered, add a new Delivery to the Order and set OrderRow.DeliveryId to the new Delivery.ID
- ItemB is delivered, add a new Delivery to the Order and set OrderRow.DeliveryId to the new Delivery.ID
- Both items have been delivered (and hence does not have related OrderRows anymore), so the original delivery gets set to Delivered
I’ve modified both the OrderStateBuilder to allow transition to PartiallyCompleted when not all Deliveries are in State Delivered; Completed when ALL Deliveries are in state Delivered
I’ve also added a related state to the DeliveryStateMachine to include a DeliveryState.Delivered to an OrderState.PartiallyDelivered (in addition to the previously existing related state DeliveryState to OrderState.Completed).
When running the OrderStateBuilder is invoked when the first Delivery is made (ItemA) but no longer after that (delivering ItemB cause no changes in the state machine).
I should additionally point out that after adding the related state for PartiallyCompleted, the second Delivery state does not actually change when I call SetDeliveryStatus
Any tips? Anything else I should be thinking about?
Regards, Stephen
Litium version: 5.6.8