2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-05-06 17:53:44 +00:00

[UI] BOM compare (#11853)

* Refactor existing components

* Select assembly for comparison

* Rough BOM comparison table

* Select  display mode

* Layout tweaks

* Reset secondary part when drawer is closed

* Responsive grids

* Documentation

* Update CHANGELOG.md

* Add playwright tests

* Update wording

* Allow specification of secondary part with URL search params

* Update URL params when value changes

* Clearer display using icons

* Improve diff  layout

* Adjust playwright tests
This commit is contained in:
Oliver
2026-05-03 12:18:44 +10:00
committed by GitHub
parent f0edb002d0
commit 24ce51c5ca
13 changed files with 764 additions and 219 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

+15 -78
View File
@@ -4,7 +4,7 @@ title: Bill of Materials
## Bill of Materials
A Bill of Materials (BOM) defines the list of component parts required to make an assembly, [create builds](./build.md) and allocate inventory.
A Bill of Materials (BOM) defines the list of component parts required to make an assembly, [create build orders](./build.md) and allocate inventory.
A part which can be built from other sub components is called an *Assembly*.
@@ -169,89 +169,26 @@ If the BOM requires revalidation, the status will be displayed as "Not Validated
{{ image("build/bom_invalid.png", "BOM Not Validated") }}
## Required Quantity Calculation
## BOM Comparison
When a new [Build Order](./build.md) is created, the required production quantity of each component part is calculated based on the BOM line items defined for the assembly being built. To calculate the required production quantity of a component part, the following considerations are made:
It is possible to compare the BOM of one assembly with another assembly. This comparison can highlight different component parts, quantities and other properties of the BOM line items.
### Base Quantity
To compare the BOM of one assembly with another, navigate to the "Bill of Materials" tab of the part detail page, then click on the {{ icon("git-compare", color="blue", title="Compare BOM") }} icon at the top of the BOM table:
The base quantity of a BOM line item is defined by the `Quantity` field of the BOM line item. This is the number of parts which are required to build one assembly. This value is multiplied by the number of assemblies which are being built to determine the total quantity of parts required.
{{ image("build/bom_compare_icon.png", "BOM Compare") }}
```
Required Quantity = Base Quantity * Number of Assemblies
```
This will open the BOM comparison view, which allows you to select a secondary assembly to compare with the primary assembly. The BOM line items of the two assemblies will be displayed side by side, with differences highlighted:
### Attrition
{{ image("build/bom_compare.png", "BOM Compare") }}
The `Attrition` field of a BOM line item is used to account for expected losses during the production process. This is expressed as a percentage of the `Base Quantity` (e.g. 2%).
### Display Mode
If a non-zero attrition percentage is specified, it is applied to the calculated `Required Quantity` value.
When comparing BOMs from two different assemblies, the user can select from the following view modes:
```
Required Quantity = Required Quantity * (1 + Attrition Percentage)
```
| View Mode | Description |
| --- | --- |
| *Show all parts* | Display all BOM line items from both assemblies. Differences are highlighted. |
| *Show different parts* | Display only the BOM line items which are different between the two assemblies. |
| *Show common parts* | Display only the BOM line items which are common between the two assemblies. |
!!! info "Optional"
The attrition percentage is optional. If not specified, it defaults to 0%.
### Setup Quantity
The `Setup Quantity` field of a BOM line item is used to account for fixed losses during the production process. This is an additional quantity of the part which is required to ensure that the production run can be completed successfully. This value is added to the calculated `Required Quantity`.
```
Required Quantity = Required Quantity + Setup Quantity
```
!!! info "Optional"
The setup quantity is optional. If not specified, it defaults to 0.
### Rounding Multiple
The `Rounding Multiple` field of a BOM line item is used to round the calculated `Required Quantity` value to the nearest multiple of the specified value. This is useful for ensuring that the required quantity is a whole number, or to meet specific packaging requirements.
```
Required Quantity = ceil(Required Quantity / Rounding Multiple) * Rounding Multiple
```
!!! info "Optional"
The rounding multiple is optional. If not specified, no rounding is applied to the calculated production quantity.
### Example Calculation
Consider a BOM line item with the following properties:
- Base Quantity: 3
- Attrition: 2% (0.02)
- Setup Quantity: 10
- Rounding Multiple: 25
If we are building 100 assemblies, the required quantity would be calculated as follows:
```
Required Quantity = Base Quantity * Number of Assemblies
= 3 * 100
= 300
Attrition Value = Required Quantity * Attrition Percentage
= 300 * 0.02
= 6
Required Quantity = Required Quantity + Attrition Value
= 300 + 6
= 306
Required Quantity = Required Quantity + Setup Quantity
= 306 + 10
= 316
Required Quantity = ceil(Required Quantity / Rounding Multiple) * Rounding Multiple
= ceil(316 / 25) * 25
= 13 * 25
= 325
```
So the final required production quantity of the component part would be `325`.
!!! info "Calculation"
The required quantity calculation is performed automatically when a new [Build Order](./build.md) is created.
In each case, any differences between the BOM line items are highlighted in red.
+90
View File
@@ -0,0 +1,90 @@
---
title: Required Build Quantity
---
## Required Build Quantity
When a new [Build Order](./build.md) is created, the required production quantity of each component part is calculated based on the BOM line items defined for the assembly being built. To calculate the required production quantity of a component part, the following considerations are made:
### Base Quantity
The base quantity of a BOM line item is defined by the `Quantity` field of the BOM line item. This is the number of parts which are required to build one assembly. This value is multiplied by the number of assemblies which are being built to determine the total quantity of parts required.
```
Required Quantity = Base Quantity * Number of Assemblies
```
### Attrition
The `Attrition` field of a BOM line item is used to account for expected losses during the production process. This is expressed as a percentage of the `Base Quantity` (e.g. 2%).
If a non-zero attrition percentage is specified, it is applied to the calculated `Required Quantity` value.
```
Required Quantity = Required Quantity * (1 + Attrition Percentage)
```
!!! info "Optional"
The attrition percentage is optional. If not specified, it defaults to 0%.
### Setup Quantity
The `Setup Quantity` field of a BOM line item is used to account for fixed losses during the production process. This is an additional quantity of the part which is required to ensure that the production run can be completed successfully. This value is added to the calculated `Required Quantity`.
```
Required Quantity = Required Quantity + Setup Quantity
```
!!! info "Optional"
The setup quantity is optional. If not specified, it defaults to 0.
### Rounding Multiple
The `Rounding Multiple` field of a BOM line item is used to round the calculated `Required Quantity` value to the nearest multiple of the specified value. This is useful for ensuring that the required quantity is a whole number, or to meet specific packaging requirements.
```
Required Quantity = ceil(Required Quantity / Rounding Multiple) * Rounding Multiple
```
!!! info "Optional"
The rounding multiple is optional. If not specified, no rounding is applied to the calculated production quantity.
### Example Calculation
Consider a BOM line item with the following properties:
- Base Quantity: 3
- Attrition: 2% (0.02)
- Setup Quantity: 10
- Rounding Multiple: 25
If we are building 100 assemblies, the required quantity would be calculated as follows:
```
Required Quantity = Base Quantity * Number of Assemblies
= 3 * 100
= 300
Attrition Value = Required Quantity * Attrition Percentage
= 300 * 0.02
= 6
Required Quantity = Required Quantity + Attrition Value
= 300 + 6
= 306
Required Quantity = Required Quantity + Setup Quantity
= 306 + 10
= 316
Required Quantity = ceil(Required Quantity / Rounding Multiple) * Rounding Multiple
= ceil(316 / 25) * 25
= 13 * 25
= 325
```
So the final required production quantity of the component part would be `325`.
!!! info "Calculation"
The required quantity calculation is performed automatically when a new [Build Order](./build.md) is created.
+1
View File
@@ -150,6 +150,7 @@ nav:
- Bill of Materials: manufacturing/bom.md
- Build Orders: manufacturing/build.md
- Build Outputs: manufacturing/output.md
- Required Quantity: manufacturing/required.md
- Allocating Stock: manufacturing/allocate.md
- External Manufacturing: manufacturing/external.md
- Example Build Order: manufacturing/example.md