diff --git a/AlgebraicDataflowArchitectureModel/models/InventoryManagement.model b/AlgebraicDataflowArchitectureModel/models/InventoryManagement.model index c41ed3c..31bcdad 100644 --- a/AlgebraicDataflowArchitectureModel/models/InventoryManagement.model +++ b/AlgebraicDataflowArchitectureModel/models/InventoryManagement.model @@ -1,7 +1,10 @@ channel ItemRegistration { - out inventory(items:Map, registerItem(itemId:Str, quantity:Int)) = insert(items, itemId, {"count": quantity}) + out inventory(itemDB:Map, registerItem(itemId:Str, itemName:Str, quantity:Int)) = insert(itemDB, itemId, {"count": quantity, + "name": itemName}) } channel ReceivingOrShipping(itemId:Str) { - out inventory.{itemId}.count(prev_quantity:Int, receiveOrship(quantity:Int)) = prev_quantity + quantity + out inventory.{itemId}.count(prev_quantity:Int, receiveOrShip(quantity:Int)) = if(prev_quantity + quantity >= 0, + prev_quantity + quantity, + prev_quantity) }