That's my class diagram at the moment:

enter image description here

I believe I can control the level of stock at each venue by the difference between the quantity of purchased ingredient and the quantity of beverage sold (as each beverage is composed by ingredient).

However, I have a requirement that should allow users to transfer ingredients between venues, and I am wondering what is the best approach for that...

A new purchase order would add the product to one venue's inventory, but how can I remove it from the other one?

有帮助吗?

解决方案

Just in case someone get to this question, here goes my solution:

I decided to create a table transfer_stocks to register all the transfers between venues. This table is also used to solve any discrepancy when stock is counted (when recipient_id is nil, it means wastage or stock missing in the venue -sender_id).

The products in stock is calculated by de difference between purchases, sales and stock transferred.

My class diagram:

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top