Part 3 of 3: Pick and Pack Station with ERP Integration
A few weeks ago we wrote about our Pick and Pack implementation, detailing how we’ve created the system, the custom labels and automated custom printing.
Today we will expand on this to show you how we can integrate with one of the ERP solutions that are available on salesforce. We will use Rootstock as an example.
One function of ERP systems are to manage the process for inventory for Picking, Packing and Shipping. In this post we will discuss the Packing and Shipping part of the process and the API calls needed to the Rootstock system to achieve this.
The process that we use is as follows:
- Put all packed items into Custom Objects called Shipping Containers.
- Depending on whether all the items are being shipped at once (Full shipment) or in batches (Partial shipment) we make different calls to the Rootstock api and create the Rootstock Shipper object.
- Create the Container Objects and attach the newly created Zenkraft Shipping label information to them.
Here are the steps in more detail:
- If we look back at our pick and pack screenshot here:
We store the items you can see in the “In Progress Containers” section within our own Custom objects called Shipping Containers. There is no interaction with Rootstock at this stage as we are just preparing the information ready to create a Rootstock Shipper.
- Once the user clicks the “Finish Button”, we make a call to the Rootstock API to signal the items that have been packed, and request a new shipper to be created.The two key points to keep in mind here are whether the shipment is a FULL or PARTIAL shipment.FULL:A FULL pack order is when ALL the items on the Sales Order have been packed and are ready to be shipped. On the Rootstock side, this gets processed straight away.
In the code example below, we set the transaction type (line 2) to ‘Sales Order Pack’, we set the background processing (line 5) to false, and the all lines variable (line 6) to true. Line 6 specifies that this is a full shipment type.
A partial shipment is when you might have a very large order, but there are some items that haven’t been picked as available yet in the packing warehouse meaning that the order cannot be completed in 1 shipping session.
As there could be hundreds of lines have been packed we need to be careful to not hit any Salesforce SOQL limits, which is why we use the code below to ensure these limits do not get hit and end up with an error.
Line 8 is where we specify this is a partial shipment by setting alllines__c = false, and line 9 is setting backgroundprocessing__c = true. For each of these individual line items that are being packed we need to create a transaction, which we then send to be processed by the Rootstock ERP on line 19.
- Once the items have been marked as packed and the shipper has been created, we set our queued bulk shipping process to start creating the shipping label.The next set is to create the Rootstock Container Objects which we do using this code:We set all the container fields from line 2-19, with line 19 adding the new shipments tracking number.
And that is how we are able to integrate our Pick and PACK station with an ERP system.