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.