A fine cost calculation method and system for catering dishes
By establishing a BOM-based recipe tree structure and decoupling architecture, the problems of extensive management, inaccurate unit conversion, high system coupling, and non-closed-loop financial accounting in traditional catering cost calculation methods have been solved, realizing refined calculation of dish costs and full automation of the financial process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Filing Date
- 2026-04-17
- Publication Date
- 2026-07-10
AI Technical Summary
Traditional restaurant cost calculation methods suffer from problems such as extensive recipe management, inaccurate unit conversion, high system architecture coupling, lack of multi-cycle cost synthesis capabilities, and non-closed-loop financial accounting, resulting in low cost accounting accuracy, large calculation errors, and impact on decision-making efficiency.
It adopts a BOM-based recipe tree structure, supports independent recipe management for semi-finished and finished products, realizes intelligent unit conversion with density parameters, adopts a decoupled architecture design, supports multi-cycle cost synthesis, builds a closed loop of the entire financial chain, and realizes refined calculation of dish costs.
It enables accurate cost accounting of dishes down to the gram level, eliminates calculation errors caused by density differences, ensures real-time cashiering, meets the cost synthesis needs of different management scenarios, and automates the entire financial accounting process, thereby improving decision-making efficiency.
Smart Images

Figure CN122367540A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cost management technology in the catering industry, specifically to a method and system for refined cost calculation of catering dishes. Background Technology
[0002] Cost accounting is a crucial aspect of business management in the catering industry. Traditional catering cost calculation methods suffer from the following problems:
[0003] First, recipe management is rudimentary. Traditional methods typically use a simple one-dimensional ingredient list to record recipes, which cannot support multi-level nested semi-finished product recipe structures. It also cannot achieve independent recipe management for semi-finished and finished products, leading to difficulties in maintaining recipe data, making it difficult to accurately reflect the raw material consumption relationship in the actual production process, and resulting in low cost accounting accuracy, which cannot be accurate to the gram level.
[0004] Second, unit conversion relies on manual labor and is inaccurate. The units used for raw material procurement and consumption are often different; for example, procurement may be in "jin" (a unit of weight in kilograms), while the formula may be in "grams." Traditional methods rely on manual unit conversion, which is prone to calculation errors. More importantly, traditional methods use fixed coefficient conversions, which cannot handle the density differences between liquid and solid raw materials, leading to errors in the conversion between volume and mass units.
[0005] Third, the system architecture is highly coupled. Traditional restaurant software tightly couples the POS cashier system with the cost accounting system, causing business data and financial data to interfere with each other, affecting the real-time performance of cashier transactions and limiting the ability to perform detailed financial accounting.
[0006] Fourth, it lacks the ability to synthesize costs over multiple periods. Traditional methods cannot flexibly support cost synthesis for different periods such as days, months, and quarters, making it difficult to meet the needs of different management scenarios.
[0007] Fifth, the financial accounting process is not closed-loop. Traditional methods cannot achieve a closed-loop process from restaurant ordering and back-end management to financial accounting. Financial personnel need to manually process cost data and cannot quickly generate cost reports, which affects decision-making efficiency.
[0008] Therefore, there is a need for a method and system for calculating the cost of catering dishes that can be based on BOM to break down the recipe in detail, support independent recipe management for semi-finished and finished products, realize intelligent unit conversion with density parameters, adopt a decoupled architecture design, support multi-cycle cost synthesis, and build a closed loop of financial chain. Summary of the Invention
[0009] The purpose of this invention is to provide a method and system for refined cost calculation of catering dishes. By establishing a recipe tree structure based on BOM, supporting independent recipe management for semi-finished and finished products, realizing intelligent unit conversion with density parameters, adopting a decoupled architecture design, supporting multi-cycle cost synthesis, and constructing a closed-loop financial chain, refined calculation of catering dish costs can be achieved.
[0010] To achieve the above objectives, the present invention adopts the following technical solution:
[0011] A method and system for refined cost calculation of catering dishes, the method comprising the following steps:
[0012] S1: Establish a recipe tree structure based on BOM. The recipe tree structure supports independent recipe management for semi-finished products and finished products. It adopts multi-level nested storage. Each node records the amount of raw materials, unit, yield rate and actual amount used, so as to realize the cost accounting of dishes accurate to the gram level.
[0013] S2: Perform formula tree flattening processing, and use a recursive traversal algorithm to expand the nested semi-finished product nodes into a raw material detail list, while retaining the hierarchical relationship and parent-child relationship information.
[0014] S3: Establish an intelligent unit conversion mechanism with density parameters to automatically convert the purchase unit into grams of consumption based on the product attributes, eliminating calculation errors caused by density differences.
[0015] S4: Configure cost calculation parameters and use the weighted average method to calculate the real-time cost of raw materials.
[0016] S5: Execute dish synthesis, calculate the required amount of raw materials based on the recipe tree, obtain the real-time cost of raw materials, and generate a synthesis record.
[0017] S6: Build a closed-loop system that covers the entire chain from restaurant ordering and back-end management to financial accounting, supporting direct financial accounting and rapid generation of cost reports.
[0018] Furthermore, in step S1, each node of the formula tree structure records the following information: node name, node type, node ID, dosage, unit, yield, actual dosage, whether it is a main ingredient, sorting number, level depth, and parent node ID. The node type includes raw material nodes and semi-finished product nodes.
[0019] Furthermore, the independent formula management of semi-finished products and finished products in step S1 includes: establishing a master table for semi-finished product formulas, recording formula codes, output units, output quantities, yield rates, and formula tree structures; establishing a raw material association table for semi-finished product formulas, recording raw material IDs, dosages, units, yield rates, and actual dosages; and recording formula version numbers and tracking formula change history.
[0020] Furthermore, the specific method for flattening the formula tree in step S2 is as follows: recursively traverse from the root node, expand the child nodes layer by layer, convert the tree structure into a linear list, and at the same time retain the hierarchical relationship and parent-child association information, which facilitates the subsequent calculation of raw material requirements and cost accounting.
[0021] Furthermore, the intelligent unit conversion mechanism with density parameters in step S3 includes: establishing a commodity density parameter table to record the density values of different commodities; converting volume units to mass units based on commodity density; and supporting automatic conversion between procurement units and consumption units, with the conversion formula being: mass = volume × density.
[0022] Furthermore, the unit conversion in step S3 also includes built-in conversion rules: the conversion rate from jin to gram is 500, the conversion rate from kilogram to gram is 1000, the conversion rate from kilogram to gram is 1000, the conversion rate from two ounces to gram is 50, and the conversion rate from liter to milliliter is 1000.
[0023] Furthermore, in step S3, the unit conversion first obtains the tenant-defined conversion rate from the database. If it does not exist in the database, the built-in conversion rule is used. If the conversion units are the same, the conversion rate is returned as 1.
[0024] Furthermore, the formula for calculating the weighted average cost in step S4 is: New unit cost = (Total cost of current inventory + Total cost of new inventory) / (Quantity of current inventory + Quantity of new inventory).
[0025] Furthermore, the formula for calculating the raw material requirement in step S5 is: Actual usage = Standard usage ÷ Yield rate × Production quantity.
[0026] Furthermore, the generation of synthesis records in step S5 includes: establishing a master synthesis order table to record the synthesis order number, synthesis date, status, and total cost; establishing a raw material consumption detail table to record the raw material ID, required quantity, actual quantity, unit cost, and total cost; and establishing a finished product output detail table to record the dish ID, output quantity, unit cost, and total cost.
[0027] Furthermore, the closed-loop process in step S6 includes: an architecture design that decouples the POS cashier from the back-end cost system, enabling dual-channel synchronization of menu data; support for multi-cycle cost synthesis based on daily, monthly, and quarterly periods; and support for direct financial accounting and rapid generation of cost reports.
[0028] This invention also provides a refined cost calculation system for catering dishes, comprising: a recipe management module for establishing a BOM-based recipe tree structure, supporting independent recipe management for semi-finished and finished products, and performing recipe tree flattening processing; a unit conversion module for establishing an intelligent unit conversion mechanism with density parameters, automatically converting procurement units into grams of consumption based on product attributes; a cost calculation module for configuring cost calculation parameters and calculating real-time raw material costs using a weighted average method; a synthesis execution module for executing dish synthesis, calculating raw material requirements based on the recipe tree, obtaining real-time raw material costs, and generating synthesis records; and a financial accounting module for constructing a closed-loop system covering the entire chain from catering ordering and back-end management to financial accounting, supporting direct financial accounting and rapid generation of cost reports.
[0029] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method.
[0030] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method.
[0031] The beneficial effects of this invention are:
[0032] First, by establishing a BOM-based recipe tree structure, it supports independent recipe management for semi-finished and finished products, enables multi-level nested storage, and allows for accurate cost accounting of dishes down to the gram level, thus solving the problems of extensive recipe management and low accounting accuracy in traditional methods.
[0033] Second, by flattening the formula tree, the complex nested structure is expanded into a linear list, while retaining the hierarchical relationship and parent-child association information, which facilitates the subsequent calculation of raw material requirements and cost accounting.
[0034] Third, by establishing an intelligent unit conversion mechanism with density parameters, the purchasing unit is automatically converted into the number of grams consumed based on the product attributes, eliminating calculation errors caused by density differences and solving the problem that traditional methods cannot handle the density differences between liquid and solid raw materials.
[0035] Fourth, by decoupling the POS cashier system from the back-end cost system, the system achieves dual-channel synchronization of menu data, which not only ensures the real-time nature of cashiering but also supports refined financial accounting, thus solving the problem of high coupling in the traditional system architecture.
[0036] Fifth, by supporting multi-cycle cost synthesis at the daily, monthly, and quarterly levels, it meets the needs of different management scenarios and solves the problem of traditional methods lacking multi-cycle cost synthesis capabilities.
[0037] Sixth, by constructing a closed-loop system covering the entire process from restaurant ordering and back-end management to financial accounting, it supports direct financial accounting and rapid generation of cost reports, thus solving the problem of non-closed-loop financial accounting processes in traditional methods. Attached Figure Description
[0038] Figure 1 This is a flowchart of the refined cost calculation method for catering dishes of the present invention, which shows the complete process from recipe tree establishment to financial closed loop.
[0039] Figure 2 This is an architectural block diagram of the refined cost calculation system for catering dishes of the present invention, which shows the composition and interrelationship of the recipe management module, unit conversion module, cost calculation module, synthesis execution module, and financial accounting module. Detailed Implementation
[0040] The following is combined Figure 1 The flowcharts and specific embodiments shown below provide a more detailed description of the present invention.
[0041] Example 1: Establishment of a recipe tree structure based on BOM
[0042] This embodiment uses "braised pork" as an example to illustrate the process of establishing a recipe tree structure based on BOM.
[0043] First, a master table for dishes is created, including basic information such as dish name, dish code, and price. Then, a recipe tree structure based on a Bill of Materials (BOM) is established, using multi-level nested storage. The root node of the recipe tree is the dish itself, and its child nodes include ingredient nodes and semi-finished product nodes.
[0044] The information recorded in the raw material node includes: node name (e.g., "pork belly"), node type (ingredient), node ID (raw material ID), usage (500), unit (gram), yield (100), actual usage (500), whether it is a main ingredient (true), sorting number (1), level depth (1), and parent node ID (dish ID).
[0045] The information recorded in the semi-finished product node includes: node name (e.g., "braised sauce"), node type (semi_finished), node ID (semi-finished product ID), usage (50), unit (grams), yield (100), actual usage (50), whether it is a main ingredient (false), sorting number (2), level depth (1), and parent node ID (dish ID).
[0046] Semi-finished product nodes can also contain child nodes, forming a multi-level nested structure. For example, the child nodes of the "braised sauce" semi-finished product include raw material nodes such as "light soy sauce", "dark soy sauce", and "rock sugar".
[0047] Independent formula management for semi-finished and finished products includes: establishing a master table for semi-finished product formulas, recording formula codes, output units, output quantities, yield rates, and formula tree structures; establishing a raw material association table for semi-finished product formulas, recording raw material IDs, usage amounts, units, yield rates, and actual usage amounts; and recording formula version numbers and tracking formula change history.
[0048] The above structure enables accurate cost accounting for dishes down to the gram level.
[0049] Example 2: Flattening of the formulation tree
[0050] This embodiment illustrates the specific implementation process of formula tree flattening.
[0051] The flattening process employs a recursive traversal algorithm, starting from the root node and traversing child nodes level by level. For each node, its information is added to a linear list, recording its level depth and parent node ID. If a node contains child nodes, the child nodes are processed recursively.
[0052] The result of flattening is a linear list, where each element represents a raw material node and includes information such as node name, node type, usage, unit, yield, actual usage, hierarchy depth, and parent node ID.
[0053] The advantage of flattening is that it transforms a complex tree structure into a linear structure that is easier to process, while preserving hierarchical relationships and parent-child associations, which facilitates subsequent calculations of raw material requirements and cost accounting.
[0054] Example 3: Intelligent unit conversion with density parameter
[0055] This embodiment illustrates the specific implementation process of intelligent unit conversion with density parameters.
[0056] Establish a density parameter table for commodities and record the density values of different commodities. For example, the density of cooking oil is 0.92 g / ml, the density of soy sauce is 1.15 g / ml, and the density of vinegar is 1.01 g / ml.
[0057] To convert volume units to mass units based on the product's density, use the formula: Mass = Volume × Density. For example, if a recipe requires 100 ml of soy sauce, and the density of soy sauce is 1.15 g / ml, then the mass = 100 × 1.15 = 115 g.
[0058] The unit conversion also includes built-in conversion rules: the conversion rate from jin to gram is 500, the conversion rate from kilogram to gram is 1000, the conversion rate from kilogram to gram is 1000, the conversion rate from liang to gram is 50, and the conversion rate from liter to milliliter is 1000.
[0059] Unit conversion prioritizes retrieving the tenant-defined conversion rate from the database. If the conversion rate is not found in the database, the built-in conversion rules are used. If the conversion units are the same, the conversion rate of 1 is returned.
[0060] By using intelligent unit conversion with density parameters, calculation errors caused by density differences are eliminated, enabling accurate conversion between procurement units and consumption units.
[0061] Example 4: Weighted Average Cost Calculation
[0062] This embodiment illustrates the specific implementation process of weighted average cost calculation.
[0063] The formula for calculating weighted average cost is: New unit cost = (Total cost of current inventory + Total cost of new arrivals) / (Quantity of current inventory + Quantity of new arrivals).
[0064] For example, if the current inventory of a certain raw material is 1000 grams and the current total inventory cost is 20 yuan, and the newly added quantity is 500 grams with a new total cost of 12.5 yuan, then the new unit cost = (20 + 12.5) / (1000 + 500) = 0.0217 yuan / gram.
[0065] Weighted average cost calculation is performed each time raw materials are received into the warehouse, ensuring the real-time nature and accuracy of inventory cost data.
[0066] Example 5: Dish Synthesis Execution
[0067] This example illustrates the specific implementation process of dish synthesis.
[0068] When synthesizing a dish, the required amount of raw materials is first calculated based on the recipe tree. The formula for calculating the required amount of raw materials is: Actual usage = Standard usage ÷ Yield rate × Production quantity.
[0069] For example, if the standard amount of "pork belly" in a dish recipe is 500 grams, the yield is 100%, and the production quantity is 2 servings, then the actual amount used = 500 ÷ 100% × 2 = 1000 grams.
[0070] Next, obtain the real-time cost of raw materials. Obtain the weighted average cost from the inventory records and multiply it by the actual usage to get the raw material cost.
[0071] Finally, a synthesis record is generated. The synthesis record includes: a synthesis order master table, which records the synthesis order number, synthesis date, status, and total cost; a raw material consumption details table, which records the raw material ID, required quantity, actual quantity, unit cost, and total cost; and a finished product output details table, which records the dish ID, output quantity, unit cost, and total cost.
[0072] Example 6: Closed-Loop Financial Management
[0073] This embodiment illustrates the specific implementation process of a closed-loop financial system across the entire value chain.
[0074] The system employs an architecture that decouples the POS cashier system from the backend cost system, enabling dual-channel synchronization of menu data. The POS cashier system focuses on real-time operations such as ordering and payment, while the backend cost system focuses on refined management such as recipe management and cost accounting. The two systems achieve dual-channel synchronization of menu data through a data synchronization interface.
[0075] Supports cost aggregation across multiple periods, including daily, monthly, and quarterly. Based on the user-selected period, the system automatically aggregates the dish aggregation records for that period, calculating the total cost and average cost for that period.
[0076] It supports direct financial accounting and rapid generation of cost reports. Financial personnel can directly obtain cost data from the system without manual processing. The system automatically generates cost reports, including cost summary tables, raw material consumption details tables, and finished product output details tables.
[0077] By establishing a closed-loop financial system, the entire process from restaurant ordering and back-end management to financial accounting has been automated, improving work efficiency and reducing human error.
[0078] Example 7: Semi-finished product independent formulation model
[0079] This example illustrates the process of establishing an independent formulation model for semi-finished products.
[0080] The semi-finished product independent formula model includes: a semi-finished product formula master table, which records the formula code, output unit, output quantity, yield, and formula tree structure; and a semi-finished product formula raw material association table, which records the raw material ID, usage, unit, yield, and actual usage.
[0081] The semi-finished product formula supports version management. The version number is incremented by 1 each time the formula is changed, and historical version records are retained for easy formula backtracking and auditing.
[0082] The advantages of a semi-finished product independent recipe model are: the semi-finished product recipe exists independently of the dish recipe, can be shared by multiple dishes, reduces data redundancy, and facilitates unified management and maintenance.
[0083] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method and system for refined cost calculation of catering dishes, characterized in that, The method Includes the following steps: S1: Establish a recipe tree structure based on BOM. The recipe tree structure supports independent recipe management for semi-finished products and finished products. It adopts multi-level nested storage. Each node records the amount of raw materials, unit, yield rate and actual amount used, so as to realize the cost accounting of dishes accurate to the gram level. S2: Perform recipe tree flattening, using a recursive traversal algorithm to expand nested semi-finished product nodes into a detailed list of raw materials, preserving hierarchical relationships and parent-child association information; S3: Establish an intelligent unit conversion mechanism with density parameters, automatically converting procurement units into grams of consumption based on product attributes, eliminating calculation errors caused by density differences; S4: Configure cost calculation parameters, using a weighted average method to calculate real-time raw material costs; S5: Perform dish synthesis, calculating raw material requirements based on the recipe tree, obtaining real-time raw material costs, and generating synthesis records; S6: Construct a closed-loop system covering the entire chain from restaurant ordering and backend management to financial accounting, supporting direct financial accounting and rapid generation of cost reports.
2. The method and system for refined cost calculation of catering dishes according to claim 1, characterized in that, In step S1, each node of the formula tree structure records the following information: node name, node type, node ID, dosage, unit, yield, actual dosage, whether it is a main ingredient, sorting number, level depth and parent node ID. The node type includes raw material nodes and semi-finished product nodes. The independent formula management of semi-finished and finished products includes: establishing a master table for semi-finished product formulas, recording formula codes, output units, output quantities, yield rates, and formula tree structures; establishing a raw material association table for semi-finished product formulas, recording raw material IDs, dosages, units, yield rates, and actual dosages; recording formula version numbers; and tracking formula change history.
3. The method and system for refined cost calculation of catering dishes according to claim 1, characterized in that, The specific method for flattening the formula tree in step S2 is as follows: recursively traverse from the root node, expand the child nodes layer by layer, convert the tree structure into a linear list, and at the same time retain the hierarchical relationship and parent-child association information, which facilitates the subsequent calculation of raw material requirements and cost accounting.
4. The method and system for refined cost calculation of catering dishes according to claim 1, characterized in that, The intelligent unit conversion mechanism with density parameters in step S3 includes: establishing a commodity density parameter table, recording the density values of different commodities, converting volume units to mass units based on commodity density, supporting automatic conversion between purchasing units and consumption units, and using the conversion formula: mass = volume × density; the unit conversion also includes built-in conversion rules: the conversion rate from jin to gram is 500, the conversion rate from kilogram to gram is 1000, the conversion rate from kilogram to gram is 1000, the conversion rate from liang to gram is 50, and the conversion rate from liter to milliliter is 1000; the unit conversion prioritizes obtaining the tenant-defined conversion rate from the database, if it does not exist in the database, the built-in conversion rules are used, and if the conversion units are the same, the conversion rate of 1 is returned.
5. The method and system for refined cost calculation of catering dishes according to claim 1, characterized in that, The formula for calculating the weighted average cost in step S4 is: New unit cost = (Total cost of current inventory + Total cost of new inventory) / (Quantity of current inventory + Quantity of new inventory); The formula for calculating the raw material demand in step S5 is: Actual usage = Standard usage ÷ Yield rate × Production quantity.
6. The method and system for refined cost calculation of catering dishes according to claim 1, characterized in that, The step S5 of generating the synthesis record includes: establishing a synthesis order master table to record the synthesis order number, synthesis date, status and total cost; establishing a raw material consumption detail table to record the raw material ID, required quantity, actual quantity, unit cost and total cost; and establishing a finished product output detail table to record the dish ID, output quantity, unit cost and total cost.
7. The method and system for refined cost calculation of catering dishes according to claim 1, characterized in that, The closed-loop process in step S6 includes: an architecture design that decouples the POS cashier from the back-end cost system to achieve dual-channel synchronization of menu data; support for multi-cycle cost synthesis for days, months, and quarters; and support for direct financial accounting and rapid generation of cost reports.
8. A refined cost calculation system for catering dishes, characterized in that, include: The recipe management module is used to establish a BOM-based recipe tree structure, support independent recipe management for semi-finished and finished products, and perform recipe tree flattening. The unit conversion module is used to establish an intelligent unit conversion mechanism with density parameters, which automatically converts the purchase unit into the number of grams consumed based on the product attributes. The cost calculation module is used to configure cost calculation parameters and calculate the real-time cost of raw materials using the weighted average method; the synthesis execution module is used to execute the synthesis of dishes, calculate the raw material requirements based on the recipe tree, obtain the real-time cost of raw materials, and generate synthesis records; the financial accounting module is used to build a closed loop of the entire chain from restaurant ordering and back-end management to financial accounting, supporting direct financial accounting and quickly generating cost reports. The formula management module further includes: a formula tree construction unit for constructing formula data into a multi-level tree structure; a formula tree flattening unit for converting the tree structure into a linear list using a recursive traversal algorithm; and a hierarchical relationship maintenance unit for preserving node hierarchy depth and parent-child relationship information. The unit conversion module further includes: a density parameter storage unit for storing density values for different products; a volume-to-mass conversion unit for converting volume units to mass units based on density; a built-in conversion unit for storing commonly used unit conversion rules; and a database conversion unit for obtaining tenant-defined conversion rates from the database. The financial accounting module further includes: a decoupling architecture unit for achieving data isolation between the POS cashier and the backend cost system; a multi-period synthesis unit for supporting daily, monthly, and quarterly multi-period cost synthesis; and a report generation unit for quickly generating cost reports.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7.