This description outlines how the system manages the relationships between base items, ingredients, recipe items, menu groups, and menu items, based on the implementation. The focus is on functional concepts, lifecycle, and relationships.
1. Base Item (The starting point for everything)
An item can be assigned one (or none) of three distinct roles:
Ingredient Source Item: An item that gives rise to one or more registrable ingredients.
Recipe Item: An item composed of ingredients.
Menu Item: An item consisting of selections from one or more menu groups.
The system activates the roles upon creation or later processing (flagging). Examples:
The Recipe role is set when it needs to be able to have "made of" ingredients.
The Menu role is set when it is linked to menu groups. Activating a role may cause the corresponding metadata object to be created if it is missing (e.g., menu information when menu groups are added).
2. Ingredient Linked to an Item (Ingredient Affiliation)
When an item functions as a source for ingredients (Ingredient Source Item), one or more ingredients are registered with:
A unique ingredient number per item.
Net and gross quantity / weight.
A flag indicating if it is the standard (default).
Option for alternative items (alternative products that can be used instead of the primary one).
There is also support for a "standard ingredient" (default) with a specified quantity per unit and number of units. An ingredient can later be copied to another item (reuse when modeling similar products).
3. Recipe Item (Made of ingredients)
A recipe item contains a list of "made of" ingredients:
Each relation specifies which ingredient number is included.
Quantity linked to the specific item–ingredient relationship.
A flag indicating if the ingredient is optional. The system filters out deleted ingredients when the recipe is displayed or retrieved.
Administration includes:
Adding an ingredient to the recipe (includes quantity and optionality).
Updating quantity/optionality.
Deleting or ignoring an ingredient if it is marked as deleted.
Copying the entire set of ingredient relations to a new item (for quick duplication of recipes).
A clear distinction is made between:
Ingredient Source Item (provides ingredients)
Recipe Item (consists of ingredients)
A given item is not both at the same time in the same configuration.
4. Alternative Items in an Ingredient Context
For a registered ingredient, alternative items can be specified. Functionally, this means:
There are substitutes that can be used during production or assembly.
The system stores the link and updates foreign keys upon changes. This allows for flexibility without changing the primary recipe.
5. Menu Groups (Structuring choices)
A menu group represents a set of choices that can be offered in a menu item:
Each group has a unique group number.
Localized names (multilingual support).
Status (active, etc.).
A collection of associated items that can be selected within the group, potentially with an add-on price per item. Example data shows that one menu group can contain multiple items with individual add-ons.
6. Menu Item (Item with menu groups)
When an item is assigned one or more menu groups:
The item is functionally classified as a menu item.
An internal menu relationship is established if it does not already exist.
For each link, the number of choices or quantity limit associated with the group (NumberOfItems) is registered.
Existing group links can be updated or removed during synchronization/import.
7. Import and Synchronization of Menu Groups
When reading external data:
If the incoming dataset contains menu groups, the item is set as a menu item.
Missing menu metadata is created automatically.
Existing links are loaded, compared, and either:
Updated (if the group exists but parameters change),
Created (if a new group is added),
Removed (if the group is no longer in the incoming dataset). This ensures consistency between external definitions and the internal structure.
8. Copy Logic
The system supports copying structures when a new item is created based on an existing one:
Ingredient relations (including quantity and optionality).
Menu group links (including the number of items). The copy operation creates new relations for the new item, without modifying the original.
9. Administration and Operations (Functional view)
Available functional operations include:
Creating an item with one or more roles activated.
Creating an ingredient (standard or regular) for an ingredient source item.
Copying an ingredient from one item to another.
Adding an ingredient to a recipe (for a recipe item).
Updating or deleting an ingredient in a recipe.
Adding a menu group to a menu item.
Updating a menu group (including the number of choices).
Removing a menu group from a menu item.
Creating and maintaining localized names for menu groups.
Adding alternative items for an ingredient.
Validating that the user has the necessary permissions to change the recipe or menu (access control is part of the flow).
10. Data Availability and Display
When data is retrieved for display:
A recipe item is presented with a filtered list of active ingredient relations (deleted ones are marked and removed from view).
A menu item is presented with its associated groups and the possible choices within each group.
An ingredient source item can be displayed with the ingredients it provides (including information on quantity per unit and number of units where relevant).
11. Roles and Delimitation
An item can only have one of the specialized roles active at a time in its functional definition:
It either provides ingredients,
Or it is built from ingredients,
Or it offers menu choices via menu groups. This creates clear decision paths in the user interface and during import.
12. Optional and Mandatory Components
In recipes, ingredients are marked as:
Mandatory (must be included).
Optional (can be omitted). In menus, each group member can have its own add-on cost.
13. Quantity and Structure Dimensions
Ingredients handle:
Quantity (net/gross).
Number of and quantity per unit (for standard setups). The recipe relation handles the quantity per ingredient in the context of a specific item. Menu groups handle the number of choices (limit) and associated items.
14. Error Handling and Maintenance
Functionally, there are mechanisms for:
Validation before saving (e.g., access rights, valid references).
Marking deleted ingredients instead of immediate physical removal (soft delete) so that history can be preserved.
Updating foreign key links when alternative items are changed.
15. Localization Support
Menu groups and certain names are retrieved and stored with language-specific values (multilingual structure), allowing the customer's interface to display the correct language.