Download the source code and project files (Visual C# 2013 Desktop)
This program uses the code I wrote earlier to interface with a USB postal scale and, ultimately, make doing ink inventory a much easier task. The code is for a Dymo 25 lb postal scale, but should be compatible with other scales by changing the product/vendor IDs (0x0922, 0x8004) in scale.cs:
//in scale.cs public HidDevice[] GetDevices() { return HidDevices.Enumerate(0x0922, 0x8004).Cast<HidDevice>().ToArray(); }Here's the intended flow for the user after clicking the "connect to scale" button:
Doing ink inventory can be tedious, especially if you have a lot of colours! The goal of this program was to produce a text document that would accurately list the masses of all the inks in inventory based on some categories. Obviously, the buttons I've included in this program are specific to the shop in which I work - many shops have a greater variety of film inks, for example, or may not have any "DT" inks. But the program is easy to modify - add in some buttons, increase the arraySize variable, and edit the two arrays - colourArray (holds the total masses of each colour) and colourNameArray (holds the actual names of the colours that correspond with colourArray so that you can identify which mass belongs to which colour in the text file itself).
There are a few features I added for the sake of the "real world". The radio button group in the bottom-left corner allows you to add/subtract the mass on the scale to the colour whose button you clicked. So if you have a 7 lb jug of yellow on the scale and you accidently click cyan, you can subtract the cyan and add it to the yellow to correct your mistake. I also added the ability to save/load files, just in case! Always good to have a backup, and it's more convenient to have a usable text file with all the info you need rather than having to write all the values down by hand and deliver that to some one else who in turn may have to put those values back into a computer. Who's got time for that?! The text file prints with the name of the colour above the mass of the colour. For example:
Mixed Yellow 25.78 Mixed Red 89.24 Mixed Blue 23.45 ...Or, alternatively:
colourNameArray[0] colourArray[0] colourNameArray[1] colourArray[1] ...That formatting might not work for everyone, but it does at least mean you can simply print it out and have the values in front of you without having to write them out by hand. It also means that you can load these values back into the program! What happens if you stop for the day? You can save the file and continue working on it the next day without having to leave the program running. What happens if you miss a few jugs of ink? You can load it up and add them! What happens if you lose your printout? You have another copy on your hard drive! It just made sense to add a save/load feature.