How low can you go   Leave a comment

Who thought encoding information on dead trees was a good idea?

I get distracted for a few days and all of a sudden the menu bars change, just to confuse me. As if I wasn’t confused enough already.

Where was I? Tuesday. What happened? No idea, so just as well I made notes.

*Reads notes*

Oh yeah, that. Righto.

You know what makes planning food a nuisance? Having almost half your day’s calorie allowance used up by dinner. The other problem is that if dinner doesn’t actually contain all those calories, because they’re accounting calories, you can get hungry but have nothing left you’re allowed to eat. Accounting calories aren’t filling. Still, we survived. Useful fruit with its tiny calorific value!

The main plan for Tuesday was a game of Space Hulk in the evening, so after work I quickly knocked together dinner, got stuff ready, had a shower and then set the game up just in time for when my friend was due to arrive.

When he was about twenty minutes late, I thought I ought to soon SMS him.

Twenty minutes later, I did.

Twenty minutes after that, I received an apologetic request to re-schedule for Wednesday. Oops. A bit annoying because I’d been planning to go to the gym, but the plan was for him to come round straight after I had dinner, so maybe it’d all fit.

Unfortunately, it was now too late to go to the gym on Tuesday. Instead, I thought I might as well get on with some work, mucking around with the label printer and making it do actual useful things.

Doing this I discovered how awful Windows’ printer handling is. As far as I can tell, the printer API (and this is the Win32 API, nothing in .net can even manage this) can’t tell you anything useful about the status of the printer (and in quite a lot of cases, can’t even do that until after you’ve tried to print to it. How helpful is that? Not bloody helpful at all, if you want to code something vaguely reliable that can check whether it’ll fail before it actually does). All you can do easily is ask for a list of the available printers. And by “available” it means “has a driver installed”. It might be unplugged, smashed to bits and dumped in a skip, but you ask Windows and it is still available.

Thanks, guys. I know everything to do with printers and printing is fundamentally awful, but were the people who came up with that deliberately fed drugs?

Fortunately, the LP 2844 driver updates its status reliably when it’s plugged in or unplugged, and the Windows Management Information API can get the online/offline status. As stupid, out of the way and convoluted as that seems (never mind that it’s relying on happy chance with the printer driver not being crap that’ll inevitably bite me in the arse later, once I’ve forgotten it), at least the code’s not complicated. As long as non-Admins are allowed to use Windows Management Information services it might be sort of OK, sometimes.

Anyway, this mucking around made me realise that this system was absolutely doomed to failure. The reason: As soon as labels have printed, they’ve got live entries in the stock control database; printing the label is the thing that signs the stock in. So you really need to know that they’ve printed correctly; if the user prints a new batch of labels on failure (or just decides to print a couple of dozen because they’ve a stack of pallets to do and can’t be bothered mucking around, and so chucks away the excess labels, or just loses some and so reprints new ones…), you suddenly have twice as much crap in stock. And you can’t do anything about it because half of it doesn’t exist and isn’t labelled. Which is the problem with having anything rely on printers, which break about… Oh, two thirds of the time, if they’re a reliable model. Alas, I’d not thought of it before, because with everything else it doesn’t matter; it doesn’t print, keep pressing the button until it does. There’s another similar stock-control system, for produced stuff, which also generates unique items every time it’s printed, but these are OK because they’re not actually active until they’re scanned. Print out any number of extras, and they just sit being blank records. Doesn’t matter.

The obvious thing would be to ask the operator “So, did that work then?”. Unfortunately, you can’t rely on them having either a clue, or much grasp of English. It’s got to just work. You have to have faith in the printer.

Unfortunately, my faith in printers is even lower than my faith in humanity.

So I’ll see if I can get it working reliably using WMI and whatever error codes you get from the printing system when it’s not going, and leave it open such that when it fails dismally I can impose an extra “so this actually printed then” scan on them.

Which nobody will like much.

And they’ll forget to scan things, or just miss the occasional pallet, so you’ll have unaccounted stuff sitting in the warehouse. And so there will be cases where stuff is re-ordered unnecessarily, or people get shouted at for not having it delivered, and so on.

You can’t win.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s