Here you can find a comprehensive guide on how to create an Order into Skyplanner with all related data. Some of this has been covered in the integration tutorial, but here we go through the Skyplanner data structure and integration process in more detail.
Data structure #
First we will go through how a Skyplanner Order is structured. The API-endpoints for the data entities mentioned here are highlighted like this: /phaser-orders
On the top level we have the Order (/phaser-orders)
Each Order must have a Customer (/customers).
Each Order can have multiple Order-items (/phaser-Order-items)
Each Order-item can have a Product (/products) attached to it, but it is not mandatory. Each Product has one stock (/saldos). Note that the stock entity is created automatically when a Product is created with the API.
Each Order-item can have multiple jobs (aka Process Steps) (/phaser-jobs).
Each job must have a workstage (/workstages).
Integration workflow #
Here is a step by step example of how you could structure your integration from your ERP-system to Skyplanner.
- Fetch sales/workorder from ERP
- Create Customer (get Customer id in response)
- Create Order with Customer id (get Order id in response)
- Fetch sales/workorder Order item data from ERP
- Create Product (get Product id in response)
- Create Order item with Order id & other data (get Order item id in response)
- Fetch process step data from ERP
- Create workstage (get workstage id in response)
- Create job with workstage id and other data
Extra tips #
On deleting #
Deleting phaser-orders, phaser-Order-items or phaser-jobs through the API (and from the UI) is done in a soft delete manner. This means that the data is not actually deleted from the database, but it is marked as archived. In effect the is_archive attribute of the entity is set to true when it is deleted. The archived/deleted entities can still be accessed with the API using the include_archived parameter. When include_archived=true, a GET-request will retrieve the entity even if it is archived.
Note that soft deleting is not available in every API endpoint! So you need to be careful as deleting for example customers, people etc. is permanent!
Using default Process Steps for you Order item #
If you have created some default Process Steps for the Product your Order item is producing you can tell the system to bring the defaults to the Order item with the API using the get_default_steps attribute.
Adding materials to Order item #
If you have attached materials to the produced Product they are automatically attached to the Order row.
However, if you do not want to use the materials attached to the Product (for example, if the item is a special Order and you want to use different materials etc) you can use the use_custom_materials attribute.