ScHpEnXeL Suspended 32613 Posts user info edit post |
We (i advised them to go with someone bigger and not some local nobody one man show) recently hired a local guy to create a basic inventory system for us. Long story short, barcode labels come from our customer with a "P" Prefix on part number barcodes and a Q prefix on quantity barcodes. So, if a barcode containing P70P3001 is scanned, the actual part number the system needs to use the part number 70P3001. Q20 means quantity is 20.. pretty simple.
My question is this: All I want him to make the scanner software do is drop/ignore the first letter of the part number if the first letter is a P. I can not comprehend how this can be that hard to do. I know I could have done it after the first java class I had years ago. He has repeatedly sent us updates to accomplish this, none of which have worked.
Is there anything hard about this? Would anyone care to write out the basics of the code that is needed to do this? He's given us probably 6 updates at this point, none of which have fixed the problem.. on the last one he claims "We had to do some crazy stuff with the scanner SDK to get the prefix removed." Also, we have no part numbers that begin with a P, so that is not a possible problem to be considered.
Personally I think he got in over his head and just won't admit he doesn't have a clue what he's doing but I wanted to be sure before I called him out on it.
Thanks! 8/27/2008 8:30:38 AM |
smoothcrim Universal Magnetic! 18966 Posts user info edit post |
it would be somewhat silly to do it during the scan process. I dont know how the code is structured but all you need to do is scan the barcode and dump the string (p564654654q567) and then parse the string into its proper tokens. you could make an array of inventory objects, each having a name/number string var and a quantity int var or just dump it all in a simple database. however you do it, I would definitely do it in 2 parts. one for scanning and just dumping raw strings to a text file and another component (script, java, a million ways to do it effectively here) to put it into a format you actually want. if you just want an excel sheet, a 3 line perl script or python script could do it. 8/27/2008 8:41:56 AM |
spöokyjon ℵ 18617 Posts user info edit post |
This should be ridiculously simple. The fact that this required updates at all, or messing with the SDK (wtf?) should tell you something. 8/27/2008 8:47:13 AM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
i think pics might help..
is the layout of the app right now. when i scan a barcode whatever is in that barcode should go wherever the cursor is..no parsing or anything during the scanning process.
now when i hit submit, if the first letter of the barcode is a P, i want the P ignored and the rest of the barcode used
[Edited on August 27, 2008 at 8:47 AM. Reason : ^i agree 100%, but need more than "I think he's an idiot" when I call him out on it]
[Edited on August 27, 2008 at 8:48 AM. Reason : ignore the red box around simple view] 8/27/2008 8:47:13 AM |
BigMan157 no u 103354 Posts user info edit post |
$code=preg_replace("/^P/i", "", $code);
done
p.s. ugh i need to start coding in something that's not php again8/27/2008 8:48:11 AM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
how bout one I understand a little bit.. like VB 8/27/2008 8:52:48 AM |
BigMan157 no u 103354 Posts user info edit post |
i would if i knew vb
http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.replace(VS.71).aspx maybe?
[Edited on August 27, 2008 at 8:59 AM. Reason : damn you autolinker]
[Edited on August 27, 2008 at 9:00 AM. Reason : /^P/i is the regular expression bit, it says to find a P at the start of a string, case-insensitive] 8/27/2008 8:58:49 AM |
Shaggy All American 17820 Posts user info edit post |
String barcodeType = scannedCode.substring(0,1); String parsedCode = scannedCode.substring(1);
b/c im lazy 8/27/2008 9:07:19 AM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
How does that check if there's a P as the first character? Some barcodes don't have a P prefix..can't just chop the first letter off of everything 8/27/2008 10:29:24 AM |
OmarBadu zidik 25071 Posts user info edit post |
this is extremely easy - if he can't accomplish this then he's worthless - most barcode scanners just read the barcode and output the text to the field selected and nothing more 8/27/2008 10:42:26 AM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
that is correct. it's basically just the same as typing in with the keyboard.. no processing of what's scanned happens at that stage
and i wonder if i can decompile this app and find someone to fix it for a little cash just so i can say here's all it took to fix it.. 8/27/2008 10:45:10 AM |
OmarBadu zidik 25071 Posts user info edit post |
there have been some code fixed posted already
what language was it written in 8/27/2008 10:49:52 AM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
either VB or C#
the few things i've seen his code from were in VB so that's my guess
[Edited on August 27, 2008 at 10:52 AM. Reason : asdf] 8/27/2008 10:52:40 AM |
Shaggy All American 17820 Posts user info edit post |
if(barcodeType.equalsignorecase("p") || barcodeType.equalisignorecase("q")) do stuff else tack it back on to the original code
There are better ways to do it for sure, but thats 2 minutes worth of writing code that does what you want.
This took me about 5 minute to figure out the regex
String pMatch="^[pP].*"; String qMatch="^[qQ].*";
if(scannedCode.matches(pMatch) handle pmatch if(scannedCode.matches(qMatch) handle qmatch else handle no match 8/27/2008 10:56:06 AM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
yeah, the "do stuff" and "handle pmatch" parts are what I actually need
but yea, good to see everyone agrees this should be an easy as hell thing to do to any real programmer 8/27/2008 11:02:10 AM |
evan All American 27701 Posts user info edit post |
PM me b, i'll help you out 8/27/2008 12:47:19 PM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
PM sent, b 8/27/2008 1:06:18 PM |