S++Core systems, human-reviewable
DEMO SOURCE · SPP / APP / PHYRead the book

petshop-scene-receiveShopStock.spp

petshop/catalogue/petshop-scene-receiveShopStock.spp

Download original file · Petstore source contents

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