I'm currently working on a project which should help us with our inventory control as well as our purchases to assembly our final product.
We're in the stage of modeling our database and one of the requirements is to generate a BOM (Bill of materials).
I've read this thread and found an example data model for BOM:
conceptual data model and physical data model
but i'm not sure I fully understand.
Our final product consists of a couple of sub-assemblies, so each sub-assembly is a row in the product_hierarchy
table, and the final product also a row in that table. Each sub-assembly is made out of seperate (atomic) parts and each part is identified in a table tpart
(each part has manufacturer field, minimum reorder quantity and other specific fields).
When generating a BOM all separate parts should also be included, so it's not fully clear to me how to model our database:
product_hierarchy
which will never be one's 'parent' (the table tpart is no longer needed)product_hierarchy
and tpart
: each unit has several parts; each part can belong to several unitsI'm leaning towards the second alternative, since a part is basically a total different entity (has a price, several possible suppliers, ...) whereas an assemblied entity has no external (as in: outside our company) properties.
Any input is appreciated! Thanks!
What Is a Bill of Materials, or BOM? A bill of materials has its roots in manufacturing. It is a list of the raw materials, sub-assemblies, intermediate assemblies, sub-components, parts, and the quantities of each needed to manufacture an end product.
A bill of materials (BOM) is a comprehensive inventory of the raw materials, assemblies, subassemblies, parts and components, as well as the quantities of each needed to manufacture a product. In a nutshell, it is the complete list of all the items that are required to build a product.
An example of a Bill of materials is a bakery that needs to sell about 1,000 cakes. A BOM for this bakery will include all the ingredients needed to bake cakes, the baking pans, ovens, and packaging. The quantity, overall cost, and needed time should be also included in the list.
The models you linked fail to address some major properties BOMs normally have:
Here is a simple model that addresses these concerns:
The PART table is either a top-assembly or a sub-assembly or a leaf part. It uses a publicly known "part number" to identify its rows, which is not actually a number at all and can contain non-numeric characters.
The BOM table models many-to-many relationship of PART by itself. It's really no different from any other junction table, except both "endpoint" tables are actually the same table. This way, one sub-assembly or part can be reused in multiple parent assemblies.
On top of this model, you can fairly naturally add things like "drawing position" or "unit of measure" (e.g. a paint can be part of BOM but is measured in "kilograms" instead of "pieces").
There are more things you might want to do in reality, but are beyond the scope of a simple StackOverflow post like this.
For example:
These are some of the reasons why real PDM systems tend to be complex. If you actually need all that functionality, you should probably consider using a commercial product instead of trying to re-implement it yourself...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With