mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-01 17:41:33 +00:00
BOM Enhancements (#10042)
* Add "round_up_multiple" field * Adjust field def * Add serializer field * Update frontend * Nullify empty numerical values * Calculate round_up_multiple value * Adjust table rendering * Update API version * Add unit test * Additional unit test * Change name of value * Update BOM docs * Add new fields * Add data migration for new fields * Bug fix for data migration * Adjust API fields * Bump API docs * Update frontend * Remove old 'overage' field * Updated BOM docs * Docs tweak * Fix required quantity calculation * additional unit tests * Tweak BOM table * Enhanced "can_build" serializer * Refactor "can_build" calculations * Code cleanup * Serializer fix * Enhanced rendering * Updated playwright tests * Fix method name * Update API unit test * Refactor 'can_build' calculation - Make it much more efficient - Reduce code duplication * Fix unit test * Adjust serializer type * Update src/backend/InvenTree/part/models.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/backend/InvenTree/part/test_bom_item.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/docs/manufacturing/bom.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update docs/docs/manufacturing/bom.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Adjust unit test * Adjust tests * Tweak requirements * Tweak playwright tests * More playwright fixes --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -17,9 +17,11 @@ A BOM for a particular assembly is comprised of a number (zero or more) of BOM "
|
||||
| Property | Description |
|
||||
| --- | --- |
|
||||
| Part | A reference to another *Part* object which is required to build this assembly |
|
||||
| Quantity | The quantity of *Part* required for the assembly |
|
||||
| Reference | Optional reference field to describe the BOM Line Item, e.g. part designator |
|
||||
| Overage | Estimated losses for a build. Can be expressed as absolute values (e.g. 1, 7, etc) or as a percentage (e.g. 2%) |
|
||||
| Quantity | The quantity of *Part* required for the assembly |
|
||||
| Attrition | Estimated attrition losses for a production run. Expressed as a percentage of the base quantity (e.g. 2%) |
|
||||
| Setup Quantity | An additional quantity of the part which is required to account for fixed setup losses during the production process. This is added to the base quantity of the BOM line item |
|
||||
| Rounding Multiple | A value which indicates that the required quantity should be rounded up to the nearest multiple of this value. |
|
||||
| Consumable | A boolean field which indicates whether this BOM Line Item is *consumable* |
|
||||
| Inherited | A boolean field which indicates whether this BOM Line Item will be "inherited" by BOMs for parts which are a variant (or sub-variant) of the part for which this BOM is defined. |
|
||||
| Optional | A boolean field which indicates if this BOM Line Item is "optional" |
|
||||
@@ -96,7 +98,7 @@ The `Create BOM Item` form will be displayed:
|
||||
|
||||
{{ image("build/bom_add_item.png", "Create BOM Item Form") }}
|
||||
|
||||
Fill-out the `Quantity` (required), `Reference`, `Overage` and `Note` (optional) fields then click on <span class="badge inventree confirm">Submit</span> to add the BOM item to this part's BOM.
|
||||
Fill-out the required fields then click on <span class="badge inventree confirm">Submit</span> to add the BOM item to this part's BOM.
|
||||
|
||||
### Add Substitute for BOM Item
|
||||
|
||||
@@ -111,3 +113,90 @@ Select a part in the list and click on "Add Substitute" button to confirm.
|
||||
## Multi Level BOMs
|
||||
|
||||
Multi-level (hierarchical) BOMs are natively supported by InvenTree. A Bill of Materials (BOM) can contain sub-assemblies which themselves have a defined BOM. This can continue for an unlimited number of levels.
|
||||
|
||||
## Required Quantity Calculation
|
||||
|
||||
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.
|
||||
|
Reference in New Issue
Block a user