From my generated inventory (using handheld barcode scanner) I have a file with my current status of what is in my freezer. This file sits on the tablet where the barcode reader sens the data.
That is all well and fine, but I do not have it running all the time, so when I (1) generate the Inventory Report, based on the updated Inventory file, at a specific time, using Task Scheduler, then it may not run and create the report.
The next part of the process, after generating the new report, is to (2) email me, at a specific time, the new report.
If the Computer is not on, then task 1 does not happen, nor does task 2. Not a reliable flow.
If I’m going to automate the tasks (1 & 2 above) and update the information I want a machine that is running all the time, or at least is running at a specific time each day, so that the scripts for 1 & 2 can be run, using Task Scheduler from, Windows 10.
A solution is, after updating the inventory, is to send the file somewhere where the scripts can be run at a set time. I have a VPS (Virtual Private Server) that is running continuously, and in that environment I can be confident that the tasks will run at a predetermined time (unless I reboot the server and forget to reload the scripts).
I need to copy the file across to the Server using FTP (File Transfer Protocol).
An aside about freezer inventory scanning & QR codes
I have a 5 digit code for the inventory items, and I have to create a unique QR code and stick this QR code somewhere so I can scan it. As I have a variety of things in the Freezer, a lot of the time I have to create lots of QR codes for this. I’ve been testing on 22 items, but that would be about 1/4-1/3 of the different items I have in the freezer.
I don’t think the current process is very good.
I’m wondering about going to a numbering system that would then do a lookup on a file to identify the item to go with that number. So just need a current list of numbers and then just scan numbers, you may even be able to scan each digit at a time. Although having numbers from 1 to 50 may be a lot easier.
I’d need to add another iteration in the process for it to go and check the item out of a list. Another step to explore.
Thinking about this, I need to put in number in one GUI, then that needs to loop through the checking file. In fact, the edit file asks you for the string you want to search for, so this simplified the re-coding process.
In the loop it checks the whole string for a match of a code item, and since this is different than the other numbers it does it without any problems, but as we are putting another number in, I had to use the substring so that it only searched the first 2 digits and that worked fine.
If InStr(SubStr(A_LoopReadLine,1,2), SearchString)
The file now works on the number at the front for lookup, so this allows you to change the order of items in the list (as long as you update the checklist you are doing the lookup from) so that the more common ones can have a lower number. I’ve left the 5 digit code in for the time being.
01,00,00,01,26-02-2021,J liver & veg cooked, jlv&v 02,08,00,00,26-02-2021,J chicken Drumsticks raw, jcdrm 03,00,05,00,26-02-2021,m shrimp 1kg bag raw 200g/portion , mshmp 04,00,05,00,26-02-2021,m prawn 1kg bag 200g /portion , mprwn 05,02,00,00,26-02-2021,m pies mince ,mpies 06,00,02,00,26-02-2021,m dumplings portions (8 to 10) ,mdump
So the editing of the freezer inventory is fine, I’ve yet to run it on the reporting script, as they need to change as their variable is based on their position in the string, which has now been re-ordered.
Back to FTP
So I need to copy my file to the server then the Server can run the script over the file. There are a few bits of code out there on the forum but nothing on YouTube. A lot of the articles date around 2006. I downloaded a few scripts but finally came across class_FTP which can be found on Github here.
I tested the script they had out and it worked well for me. I found that it uploaded to my server site with no issue.
I used settings I had in my FileZilla FTP transfer programme & I did multiple tests with it and they all worked successfully.
I can now update my inventory, when that is done, I need to run a script to copy the file onto my server.
From there I can run the Report file script, which is triggered at a specific time daily to run over the FreezerInventory file.
That report script will have a timestamp for the time it is run, and for the date of the FreezerInventory file. This means that if the FreezerInventory file is of the day before or earlier, the email can be disregarded as the Report File has not been updated.
One method is to not run the report file, or run a dummy one saying that the FreezerInventory file has not been updated. By sending a dud report file this indicates the process is still running, but that the information will only replicate the information from the day before if it attaches the full report file.
This is how the current report stands:
When setting up the FTP transfer I need to have a little Toast Notification to say that the file has been sent. I do not want to use a message box as this will require me to push another OK button with the scanner.
End comment 1
This process is still evolving. I’m pleased to get the FTP transferring the file, I now need to setup the Server site scripts with Task Scheduler so that they trigger on time.
Also to re-write the reporting script based on the new configuration using numbers as codes instead of a 5 digit letter code.
I think the new method of updating and adding to the freezer inventory will be easier and more convenient to use. I may need to go back to the plantscan script and update that too.
End comment 2
I reflected on the processof setting up the NULL report above while developing it. I now have it working. Then I thought, you could have 2 processes for inventory management reporting, based on the complexity and number of people involved in the process.
Process 1 above, which would work well if others are doing inventory management. This works for larger processes.
Process 2, a more simpler process, where you just have another script on your tablet, so after doing the scanning of the inventory you just run the script on the Tablet to email you the report. This would work better for smaller inventory management processes like a freezer inventory that you are managing.
I think I need to initiate both processes to see that they both work. I’ll do a video on them later.
Another issue that pops up is records. If you were doing a proper inventory then you would need backup records showing changes over time. If there was an error, or audit, or reconciliation then you could refer to earlier records by date.
In a bigger process you’d push this to a database and let that manage it, but a simple method would be to just create a 2nd file with the Current date appended to it, so it wouldn’ be over written. This would soon fill your computer up, but you could do a backup storage & zip & store them elsewhere.
The best way to make a backup, is to copy the file FileCopy, %ReportFile%, %ReportFileBackup% where the backup is the same name as the report but with current date appended. If you didn’t want this then you could comment out.
As the information is comingh out as a string, it doesn’t look too pretty, I wonder if you can make into an HTML file ( so you can have headers, paragraphs and bold text etc. Or maybe markup language? Worth a bit of investingation to make the report easier to read.