Problem: Website sales are continually overselling inventory in our ERP.
For some time now website sales have caused issues with inventory. Due to the speed at which inventory is updated along with the multiple channels in which inventory is sold there is now a need to build a buffer into web sales inventory. This buffer will let us control when at what point our website is told we inventory is out on a given item.
This should eliminate the frequency at which our web site causes inventory over-sale because our website inventory will show 0 when the TrueInventory – Buffer == 0.
Solution: Write a program that gives the ability to make granular adjusts to a buffer for inventory sent to company website.
In other words. Trick the site into thinking we have x number less inventory in every style sold then actual available inventory in stock.
- Do not under any circumstance edit the original inventory file that is written twice daily by the ERP.
- Allow a user to adjust buffer size to their specifications.
- Do not allow inventory buffer to drop items below 0
- Run program remotely in a hands off manor on a schedule
With everything above in mind I set out to build an independent solution for managing an inventory buffer for our web sales. First I used python’s ftplib to make a connection to the remote server using ftp. Once I had that established I copy the Inventory file down from the server locally to the remote computer. Once I have the raw inventory file I parse through the data using pythons built in tools and use the formula y = y – x when y = current real inventory and x = desired buffer. Followed by an if statement to catch and remove all negative numbers if y < 0, y = 0. This is all the logic I need to keep the inventory numbers above -1.
The data once processed is write to a new file with a new file name and subsequently uploaded via ftp. By renaming the file this allows me to run the buffer script with as much frequency as I want without the worry of over writing a file that has already had its buffer subtracted. Having the same functionality built by the solutions provider would have cost $1700. I was able to do it in my spare time for $0.
You can find my source code here.
Leave a Reply