mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-20 15:05:12 +00:00
[bug] Can build fix (#13090)
* Fix 'can_build' calculation - Take 'piece_count' into consideration - Update queryset annotations - Update quantity calculation call sites * Updated docs
This commit is contained in:
1 parent
66e3278ea7
commit
43956b9324
19 files changed
+368
-25
No files matched your search
@@ -77,6 +77,9 @@ An assembly requires 4 pieces of tubing, each 500mm long, with 5% attrition:
|
||||
!!! note "Default Behavior"
|
||||
When `piece_count` is left at its default value of 1, the BOM line item behaves exactly as it did before this feature was introduced. Existing BOMs are unaffected.
|
||||
|
||||
!!! info "Where Piece Count Applies"
|
||||
The total material per assembly (`quantity x piece_count`) is used wherever InvenTree calculates component requirements for an assembly, including the [required build quantity](./required.md), the *Can Build* quantity, [BOM pricing](../part/pricing.md#bom-pricing), and the *Total Quantity* column of the [BOM Exporter](../plugins/builtin/bom_exporter.md).
|
||||
|
||||
!!! tip "When to Use Piece Count"
|
||||
Use `piece_count` when you are cutting or dividing a material into multiple identical pieces. If each piece has a different length, create separate BOM line items instead.
|
||||
|
||||
@@ -216,7 +219,7 @@ In the example above, the *Doohickey* sub-assembly is required three times for e
|
||||
Other columns (such as *Available Stock*) display the same values as they would in the BOM for the sub-assembly itself.
|
||||
|
||||
!!! info "Setup Quantity and Attrition"
|
||||
The calculated quantity values are based on the line item quantities only. The [setup quantity](#bom-line-items) and [attrition](#bom-line-items) of any upstream sub-assemblies are not included in the calculation.
|
||||
The calculated quantity values are based on the line item quantities only. The quantity of each upstream sub-assembly includes its [piece count](#piece-count-cut-to-length-parts) (`quantity x piece_count`). The [setup quantity](#bom-line-items) and [attrition](#bom-line-items) of any upstream sub-assemblies are not included in the calculation.
|
||||
|
||||
#### Behavior
|
||||
|
||||
|
||||
@@ -14,6 +14,17 @@ The base quantity of a BOM line item is defined by the `Quantity` field of the B
|
||||
Required Quantity = Base Quantity * Number of Assemblies
|
||||
```
|
||||
|
||||
### Piece Count
|
||||
|
||||
The `Piece Count` field of a BOM line item is used for [cut-to-length parts](./bom.md#piece-count-cut-to-length-parts), where the `Quantity` field represents the size (e.g. length) of each individual piece. The base quantity is multiplied by the piece count to determine the total material required for each assembly.
|
||||
|
||||
```
|
||||
Required Quantity = Base Quantity * Piece Count * Number of Assemblies
|
||||
```
|
||||
|
||||
!!! info "Optional"
|
||||
The piece count is optional. If not specified, it defaults to 1.
|
||||
|
||||
### 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%).
|
||||
@@ -54,6 +65,7 @@ Required Quantity = ceil(Required Quantity / Rounding Multiple) * Rounding Multi
|
||||
Consider a BOM line item with the following properties:
|
||||
|
||||
- Base Quantity: 3
|
||||
- Piece Count: 1
|
||||
- Attrition: 2% (0.02)
|
||||
- Setup Quantity: 10
|
||||
- Rounding Multiple: 25
|
||||
@@ -61,8 +73,8 @@ Consider a BOM line item with the following properties:
|
||||
If we are building 100 assemblies, the required quantity would be calculated as follows:
|
||||
|
||||
```
|
||||
Required Quantity = Base Quantity * Number of Assemblies
|
||||
= 3 * 100
|
||||
Required Quantity = Base Quantity * Piece Count * Number of Assemblies
|
||||
= 3 * 1 * 100
|
||||
= 300
|
||||
|
||||
Attrition Value = Required Quantity * Attrition Percentage
|
||||
|
||||
Reference in new issue
Block a user