Piece flows

Update piece

 

image-20240902-115618.png

 

@startuml actor "user" as user participant "mod-orders" as mo participant "mod-orders-storage" as mos participant "mod-inventory" as mi user -> mo: updatePiece() mo -> mos: Get piece by id mo -> mos: Get order id mo -> mos: Get order line by id mo -> mos: Get title by id mo -> mo: Validate piece, check acq units on title mo -> mi: Update item with piece fields note right Update fields like enumeration, chronology, displaySummary etc... end note mo -> mos: Get or create instance and update POL note right 1. Skip if POL already has instanceId populated 2. When Instance was not created(because Create Inventory was None) and now Create Inventory value was changed then new istance can be created(if was not exist before) in necessary tenant end note mo -> mi: Handle holding note right 1. Skip if the piece already has a holdingId populated. 2. When Create Inventory is INSTANCE_HOLDING or INSTANCE_HOLDING_ITEM then new holding with populated instanceId, locationId and sourceId will be created in a necessary tenant. end note mo -> mos: Handle item note right 1. Skip if piece was bound or Create Inventory is not equal to INSTANCE_HOLDING_ITEM 2. Update item with holdingId 3. Update an existing item Piece::itemId if exists 4. If createItem is true then create an new item with Piece::itemId end note mo -> mi: Delete holding note right 1. Skip if deleteHolding flag is false 2. Try to find holding in the necessary tenant by Piece::holdingId from storage piece 3. Delete holding only if it has not connected items end note mo -> mos: Update POL note right 1. Skip update for an ongoing non-opened orders 2. Calculate POL receipt status and update po line 3. Skip package and independent orders and update POL locations, quantities, estimated price end note mo -> mos: Update piece details mo -> mos: Update order/ order line receipt statuses if needed @enduml