S++Business systems language
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, "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}