petshop-scene-receiveShopStock.spp
petshop/catalogue/petshop-scene-receiveShopStock.spp
Download original file · Petstore source contents
1domain petshop;23atomic check checkStockReceiptQuantity(StockReceiptAgreement) {4require(StockReceiptAgreement.quantity > 0, "INVALID_QUANTITY");5}67atomic calculate prepareStockReceipt(Goods, StockLine, StockSupply, StockReceiptAgreement) {8StockLine.goods = Goods;9StockSupply.goods = Goods;10StockReceiptAgreement.goods = Goods;11StockReceiptAgreement.stock = StockLine;12StockReceiptAgreement.source = StockSupply;13}1415atomic update receiveInventory(StockLine, StockSupply, StockReceiptAgreement);1617Scenario serial receiveShopStock(Goods, StockLine, StockSupply, StockReceiptAgreement) {18checkGoodsCredential;19checkStockReceiptQuantity;20findGoods;21identify(Goods);22prepareStockReceipt;23parallel {24findStockLine;25findStockSupply;26}27identify(StockLine);28identify(StockSupply);29transaction {30receiveInventory bounds {31StockSupply.balance: [null, null];32StockLine.available: [0, null];33};34}35}