Skip to content

Latest commit

 

History

History
231 lines (168 loc) · 7.25 KB

api.md

File metadata and controls

231 lines (168 loc) · 7.25 KB

Classes

BOM

Functions

QueryFunction(pn)Promise.<BOMItemDetails>

A user defined function that returns properties associated with a provided part number.

Typedefs

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.

BOM

Kind: global class

new BOM(queryFunction, metadata)

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

boM.length : Number

Number of unique items in the instance of bill of materials.

Kind: instance property of BOM
Read only: true

boM.add(pn, [qty])

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

boM.set(pn, qty)

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

boM.remove(pn, [qty])

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

boM.getDetails([pn]) ⇒ Promise.<(Array.<BOMItemDetails>|BOMItemDetails)>

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.

boM.costRoll() : Promise.<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

boM.export(filePath) ⇒ Promise

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.

boM.buildFromTemplate(templatePath, data) ⇒ Promise

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)

BOMItem : Object

BOM item.

Kind: global typedef
Properties

Name Type Description
pn String Part Number
qty Number Quantity

BOMItemDetails : Object

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.

BOMCustomProperty : Object

Custom metadata property.

Kind: global typedef
Properties

Name Type Description
name String Property name/title.
value String Property value.

BOMMetadata : Object

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.