Here we go through how you can create products and materials and how you can attach them to you orders with the Skyplanner-API. We will also show you how to create default process steps for your products and how to create order items using those defaults.
Creating a product/material #
Creating and updating both products and materials is done through the same API-endpoint: /products. The type of the product is set by the type-attribute: ‘product’ or ‘material’
When creating products and materials make sure you set the is_active value as true if you want the product/material shown as being active in the product listing. Also note that you can set the available stock quantity with the free_amount attribute.
Creating default process steps for a product #
Before adding default process steps for a product you need to have the appropriate workstages. Workstages can be created either through the Skyplanner UI or the /workstages-endpoint.
Adding default process steps is done from the /products/jobs/{productId}-endpoint.
So for example if you want to add a default step to the product with the id 22220 you would do a POST-request like this:
Some notable fields:
- order_number
- This is an index number telling Skyplanner in which order the process steps are meant to be completed
- For example: first step gets value 1, second step gets value 3, third step gets value 3 and so on…
- workstations
- This is a list of workstations this process step can be scheduled to
- Give here workstation ids as an comma separated list, like this: “61,62,63”
- time_variation
- Possible values: time_per_pcs, pcs_per_time, fixed_time
- duration, settingtime, settletime
- Give these values in seconds
Updating a default process step #
When updating a default process step you have to use the order_number attribute to specify which step to update.
For example, the first process step (order_number 1) in this product is done with a PUT-request like this:
Deleting default process steps #
Deleting default process steps is also done by using the order_number values.
Order_numbers are given in an array like this:
Adding a material/sub product to a product #
To attach a material or sub product we need to use the /sub-products endpoint.
The process is pretty straightforward: we put the id of the material or sub product to the production_planning_product_id attribute and the id of the product we want the material/sub product to be attached to into the production_planning_product_parent_id attribute.
Adding a material to order item #
You can also attach materials directly to an order item by using the /row-materials endpoint. This way you can attach extra materials or use a completely different list of materials in an order item from the default materials set to the products. Note that you can have only one row-material entity for an order item for each material. So in effect you can not create two entities with the same production_planning_product_id to the same phaser_order_row_id.
Updating the stock level #
You can update the product or material stock level by sending a PUT-request with the free_amount attribute.