Warning – There are no more bins left to pick from
Using the Pick API to reserve parts for part requests is usually one of the easier API calls made from the Logistics Toolkit. Just specify the part request and preference of picking from good or bad stock, and let the API go to work. The Pick API will continue to attempt to pick parts until it has reserved all of the inventory necessary, or run out of locations to pick from.
There are three basic result paths for the Pick API: success, error, and partial success. The return codes for the API fall into these 3 areas as well. When successful, the return code is 0. When there is an error, the return code is < 0 (negative), and when there is partial success, the return code is > 0 (positive). All of the Dovetail API return codes are structured in this format, but the warning code (code > 0) is not as common. [Note that the SDK log files show the raw value, and the error codes will be the opposite values in the log.]
When there are enough parts found to satisfy the part request, everything completes as expected, and the inventory parts are reserved correctly and tagged with the part request id.
When something goes wrong in the Pick API process, the part request condition does not change, and no inventory parts are reserved. Most of the error messages built in to the Pick API are caused by errors in the parameters or in the database. For example, if an invalid user is specified, then a –1 return code is the result. Errors can also occur during the transfer of parts during the Pick process, and will have a large value of –120 or –121. Consult the Dovetail SDK documentation for complete details of the error codes.
Finally, when the quantity of parts requested exceeds what the API finds, then it will reserve and tag the parts found, change the condition to Picked, but leave the picked quantity short of what was requested. This is often the most troublesome of the result paths, since the end result is only partially complete. This result will never happen when the quantity requested is 1, since there is no way to Pick less than one part. It will either succeed or fail.
Partial Pick Example
Here is a simple part request for 5 “CR” parts. After selecting the “central stores” location, 2 parts were found. Clicking the Pick button at this time will initiate the Pick API, and reserve 2 of the 5 requested parts. The warning message shown above will appear, but the parts will be reserved and the part request condition will be set to Picked.
The troublesome part is that the part request condition is now “Picked”, but the picked quantity is less than the requested quantity. Notice in the example below that the order quantity is 5, but only 2 parts are reserved.
This part request is now ready to be Fulfilled, for the parts that have been Picked (reserved). After clicking the Find button, the Fulfill All button was clicked. The next step is to click the Save button to get the selected parts Fulfilled to the part request.
Now the request get Fulfilled, and at this point another (new) part request is created in order to get the remaining parts Picked and Fulfilled as part of future processing.
Once more parts are available, the new part request can be picked and fulfilled to complete the order.
Again, the Pick API is simple to use, either from Dovetail Agent as shown in the example, or by calling the API through code. Hopefully knowing the possible outcomes will lead to less confusion down the road.