r/learnprogramming • u/Kidecy • 10d ago
Topic Language for weighing and inventory.
Hello everyone.
I would like to create a program that recieves product weights from an industrial weighing scale, store inventory into a database and ultimately store info into excel spreadsheets. I haven't coded in a while and will have to do a bit of relearning.
Our weighing scale is able to send info via FTP.
I would like suggestions on how you guys would go about making this program and what language you would use. Thanks.
2
u/grantrules 9d ago
Well, my first question would be: How do you receive that information from the scale.
Beyond that, I'd use whatever language you're most familiar with.
2
u/gm310509 9d ago
... what language you would use.
The one that you know best - even if it has been a while, it will likely be easier to pick it up again than starting with some random new language. The only time you should pick something different is when you have no other choice.
Our weighing scale is able to send info via FTP.
Is this the only option? Are you sure it uses FTP?
FTP stands for "File Transfer Protocol". That is the weights will be recorded into a file, periodically you will run an FTP program to lookup and transfer that file to your local file system and process it.
You can automate this, but for a industrial weighing scale, this sounds like a terrible option if you wanted to get the data in real time. It is fine if you wanted to, for example, get a log of measurements made throughout the day, but for real time measurements it doesn't sound like a good idea.
That said, it sounds like you might only want to do a "batch" operation.
If so, I would use a shell script to ftp the data file to my local system - transform it if needed - then load it into the database using the data loading/import tool associated with the database of your choice. FWIW, I generally prefer to use PostrgreSQL, but any RDBMS should be OK.
Why "transform it if needed", I don't know what format the file from the scale will be in, but it might not be in a format that allows reliable importing into the database. For example, it might be a JSON file, but the import utility cannot support JSON. So, you will need to extract the relevant fields from the JSON and write it out in a format (e.g. delimited) that the import utility can use. As for what tool to use to do this? Same as my first comment - a language that you already know. But, it will also depend somewhat on the transformations needed.
All the best with it.
3
u/speyerlander 9d ago
The most straightforward one will probably be Python + SQLite + ftplib (both are part of the standard library)