- QueryFunction(pn) ⇒
Promise.<BOMItemDetails> A user defined function that returns properties associated with a provided part number.
- BOMItem :
Object BOM item.
- BOMItemDetails :
Object BOM item details (minimum).
- BOMCustomProperty :
Object Custom metadata property.
- BOMMetadata :
Object Optional metadata that can be associated with a bill of materials (BOM) instance.
Kind: global class
- BOM
- new BOM(queryFunction, metadata)
- .items :
Array.<BOMItem> - .length :
Number - .add(pn, [qty])
- .set(pn, qty)
- .remove(pn, [qty])
- .getDetails([pn]) ⇒
Promise.<(Array.<BOMItemDetails>|BOMItemDetails)> - .costRoll() :
Promise.<Number> - .export(filePath) ⇒
Promise - .buildFromTemplate(templatePath, data) ⇒
Promise
A new bill of materials (BOM) instance.
| Param | Type | Description |
|---|---|---|
| queryFunction | function |
A user defined function that returns properties associated with a provided part number (i.e., unique ID). See QueryFunction for my details. |
| metadata | BOMMetadata |
Optional metadata. |
boM.items : Array.<BOMItem>
List of items in the bill of materials and their quantities. Does not indicate order (i.e., order is 'random'). List is an object array of part number and qty.
Kind: instance property of BOM
Read only: true
Number of unique items in the instance of bill of materials.
Kind: instance property of BOM
Read only: true
Adds the desired quantity of parts to the bill of materials (BOM).
Kind: instance method of BOM
| Param | Type | Default | Description |
|---|---|---|---|
| pn | String |
Part Number (Unique ID) | |
| [qty] | Number |
1 |
Quantity |
Sets the quantity of a part to a specific quantity.
Kind: instance method of BOM
| Param | Type | Description |
|---|---|---|
| pn | String |
Part Number (Unique) |
| qty | Number |
Quantity |
Removes an item or certain quantity of an item from the bill of materials. Items with negative quantities are completely removed from the BOM.
Kind: instance method of BOM
| Param | Type | Description |
|---|---|---|
| pn | String |
Part Number (Unique ID) |
| [qty] | Number |
Quantity |
A promise resolving to an object containing all of the details for each item inside the bill of materials. If a part number is passed then only the details for that item will be returned.
Kind: instance method of BOM
| Param | Type | Description |
|---|---|---|
| [pn] | String |
Part number. |
Performs a cost roll on the items inside the BOM instance.
Operation depends on the property unit_cost being returned from
a provided query function.
Kind: instance method of BOM
Read only: true
Exports the current list of items to an Microsoft Excel spreadsheet.
Kind: instance method of BOM
| Param | Type | Description |
|---|---|---|
| filePath | String |
Desired filepath with .xlsx extension. |
Builds a bill of materials from a "JSON BOM template".
Kind: instance method of BOM
Returns: Promise - A promise that resolves to an Array of items added to the BOM.
| Param | Type | Description |
|---|---|---|
| templatePath | String |
Filepath to a JSON BOM template. |
| data | Object |
JavaScript data scoped to the JSON BOM template. |
QueryFunction(pn) ⇒ Promise.<BOMItemDetails>
A user defined function that returns properties associated with a provided part number.
Kind: global function
| Param | Type | Description |
|---|---|---|
| pn | String |
Part Number (Unique ID) |
BOM item.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| pn | String |
Part Number |
| qty | Number |
Quantity |
BOM item details (minimum).
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| pn | String |
Part Number (Unique ID) |
| qty | String |
Quantity |
| title | String |
Part title. |
| desc | String |
Part description. |
| unit | String |
Unit (ex: each, in, feet, lbs, etc.). |
| unit_cost | Number |
Unit cost. |
| unit_weight | Number |
Unit weight. |
Custom metadata property.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| name | String |
Property name/title. |
| value | String |
Property value. |
Optional metadata that can be associated with a bill of materials (BOM) instance.
Kind: global typedef
Properties
| Name | Type | Description |
|---|---|---|
| [title] | String |
(Optional) Default: "Bill of Materials" |
| [subtitle] | String |
(Optional) Subtitle. |
| [footer] | String |
(Optional) Footer. |
| [company] | String |
(Optional) Company name. |
| [created_by] | String |
(Optional) Author name / created by. |
| [custom] | Array.<BOMCustomProperty> |
(Optional) Custom user defined properties. |