Archive

Archive for the ‘Technology’ Category

Raspberry Pi CTA Tracker Kiosk

February 9, 2017 Leave a comment

 

img_6610-1

I purchased a Raspberry Pi 3 about a year ago and finally got around to creating a fully functional CTA bus/train tracker out of it.

Parts Needed

Raspberry Pi
http://amzn.to/2lp5YOf 

Micro SDHC Cards
http://amzn.to/2kYn04N

Screen
http://amzn.to/2kTArTK

Cable (Cable that came with screen was defective)
http://amzn.to/2ltoJvX

Keyboard and Mouse (any will do, but I like this)
http://amzn.to/2kNfUO5

CTA Tracker URL:

Create your specific CTA Tracker URL and save it for later
http://www.transitchicago.com/developers/diybtform.aspx

Read more…

Generating XML in PL/SQL

January 17, 2017 Leave a comment

At work we have historically been using concatenation for generating XML Data. I stumbled upon these XML functions the other day, and thought it was worth sharing. They seem to be the proper, and I’m sure more efficient, way to generate XML using Oracle PL/SQL. I’m dumbfounded that our developers didn’t use this method, but who am I to judge!

Oracle Documentation:

http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb13gen.htm#ADXDB1600

Easier to Understand Guide:

http://allthingsoracle.com/generating-xml-from-sql-and-pl-sql-part-1/
http://allthingsoracle.com/generating-xml-from-sql-and-plsql-part-2/

Example Query for Delivery Lines

Should produce XML for a Delivery with its lines, where lines contain the Item Number, Description, Shipped Quantity, and Requested Quantity.

SELECT XMLSERIALIZE (
 DOCUMENT (SELECT XMLELEMENT (
 "EXTRACT",
 (SELECT XMLAGG (
 XMLELEMENT (
 "DELIVERY",
 XMLELEMENT ("DELIVERY_ID",
 DELIVERY_ID),
 XMLELEMENT (
 "LIST_LINE",
 (SELECT XMLAGG (
 XMLELEMENT (
 "LINE",
 XMLFOREST (
 msib.segment1 AS "ITEM_NUMBER",
 XMLCDATA ( MSIBTL.DESCRIPTION) AS DESCRIPTION,
 NVL ( WDD.SHIPPED_QUANTITY, 0) AS "SHIPPED_QUANTITY",
 WDD.REQUESTED_QUANTITY AS "REQUESTED_QUANTITY",
 wdd.delivery_detail_id)))
 FROM wsh_delivery_assignments wda,
 wsh_delivery_details wdd,
 mtl_system_items_b msib,
 mtl_system_items_TL msibTL
 WHERE wda.delivery_id = wnd.delivery_id
 AND wda.delivery_detail_id = wdd.delivery_detail_id
 AND wdd.inventory_item_id = msib.inventory_item_id
 AND msib.organization_id = WND.ORGANIZATION_ID
 AND wdd.inventory_item_id = msibTL.inventory_item_id
 AND msibTL.organization_id = WND.ORGANIZATION_ID
 AND MSIBTL.LANGUAGE = 'US'))))
 AS XML
 FROM wsh_new_deliveries wnd
 WHERE delivery_id = :delivery_id))
 FROM DUAL) AS CLOB
 VERSION 1.1 INDENT)
 AS xmlserialize_doc
 FROM DUAL;

 

Sending ZPL to a Label Printer Using PL/SQL

January 9, 2017 Leave a comment

Oracle’s WMS package has some label printing capabilities, but the functionality is quite poor, and requires knowledge of XML Label printing.

XML Label printing, generally, is the ability to send an XML file to a label printer, where the XML file contains the label format to use, and the data/variables to print on the label.  This allows you to have one label “template” which can be reused for printing similar data.  Printing a shipping label for example.  The label format never changes, but the data does.  The standard solution requires a ZPL Template to be stored on a Zebra printer’s flash memory.  That ZPL template can be coded by hand, or by using Zebra Designer software.  One drawback to this solution is that templates must be downloaded to every printer which will be used. Centralized label template storage would be ideal.

There are several third party solutions that bolt onto the Oracle functionality and allow for a centralized label template, but they also have their own drawbacks, and can cost several hundred thousand dollars to implement, in addition to the ongoing maintenance and server costs.  Even with the third party solutions, the user is still left with quite a few deficiencies with the Oracle WMS feature set.

There is an alternative to the template centralization problem which I think is ideal.  Store the templates on the server which will be generating the print requests.  Instead of having the Zebra printer or third party add on tool merge the XML with the ZPL template, have the same server that is generating the requests do it.

I’ve come up with a simple PL/SQL script which allows a programmer to send a string of text to a label printer through the network using TCP/IP protocol.  It uses the same function that Oracle uses to send the XML to the printer when printing without a third part tool, but instead of sending XML, one can send ZPL.  This script can easily be added to a procedure that splices data with a ZPL template.

The strange thing about this function is that it has multiple outputs and cannot be used in a SELECT statement like most functions.  I’m not sure why Oracle decided to use a function rather than a procedure, but here’s how you can run it:

DECLARE

 l_return_msg           VARCHAR2(3000);
 l_printer_status       VARCHAR2(3000);
 l_return               VARCHAR2(3000);
 l_zpl                  CLOB;
 l_printer_ip           VARCHAR2(20);
 l_printer_port         VARCHAR2(10);
 BEGIN
 l_zpl :=’^XA^FO50,300^A0N,125,125^FDTEST^XZ’;  –String to send to printer
 l_printer_ip      :=’192.168.1.10′; –IP Address of printer
 l_printer_port    :=’9100′;
 l_return := INV_PRINT_REQUEST.SEND_XML_TCPIP(
        p_ip_address => l_printer_ip
    ,   p_port => to_char(l_printer_port)
    ,   p_xml_content => l_zpl
    ,   x_return_msg => l_return_msg
    ,   x_printer_status => l_printer_status
    );
END;

Oracle WMS Cycle Count Bug

December 5, 2016 Leave a comment

We recently completed a Physical Inventory using Oracle WMS Cycle Count functionality and some custom programming. It was a arguably a success. I’ll post something about that in the future, hopefully, but here is something that is really aggravating me at the moment.

Two of the biggest problems we had appeared to be bugs with seeded forms/functionality. We had two different symptoms, that seemed like seeded (built in/out of the box) functionality was broken, and it took us quite some time to identify the root cause.

  • The Approve Cycle Counts form would not show us a portion of the cycle count entries
    • The counts were in the database
    • The counts were in our report
    • The counts would not show up on the form
  • Recounts would not be given to users
    • Initial counts would be made
    • Recounts would be manually queued to users using the Warehouse Control Board
    • As soon as the user would go to the telnet Directed Cycled Count Tasks screen, the task would go directly back to pending
    • The user would never see the task to work on

I logged two separate SRs with Oracle.  Both made little progress for several weeks.

Luckily, one of our developers identified the commonality between the records. There was an EXPORT_FLAG on the MTL_CYCLE_COUNT_ENTRIES table which was set to 1 for the offending records.  I updated the two SRs with these details.

Read more…

Oracle Value Set: Allow Only Alphanumeric Values

November 10, 2016 Leave a comment

We have a problem at work which required us to only allow alphanumeric values in a DFF.  No spaces, punctuation, or special characters.  Here is what I came up with:

valueset
valueset2

Function (WordPress will change quotes to smart quotes, you will need to change back)

FND PLSQL “declare

l_value varchar2( 150 ) := :!value ;
l_valid NUMBER := NULL ;
BEGIN
SELECT (LENGTH(TRIM(TRANSLATE(REPLACE(l_value,’ ‘,’.’), ‘abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’, ‘ ‘))))
INTO l_valid
FROM dual;
IF (l_valid IS NOT NULL) THEN
fnd_message.set_name( ‘FND’, ‘FND_GENERIC_MESSAGE’ ) ;
fnd_message.set_token( ‘MESSAGE’, ‘Value must be alpha-numeric’ );
fnd_message.raise_error ;
END IF ;
END;

Regular Expression Version:

FND PLSQL “declare
l_value varchar2( 150 ) := :!value ;
BEGIN
IF REGEXP_SUBSTR(l_value, ‘^[a-zA-Z0-9]+$’) IS NULL THEN
fnd_message.set_name( ‘FND’, ‘FND_GENERIC_MESSAGE’ ) ;
fnd_message.set_token( ‘MESSAGE’, ‘(‘||l_value||’) must be alphanumeric.’);
fnd_message.raise_error ;
END IF ;
END;

My Three Favorite Windows Add-ins

October 21, 2016 Leave a comment

ZBar
I love having multiple monitors!  However, one problem with multiple monitors is that Windows doesn’t extend the task bar very well onto the second or third monitor.  It by default doesn’t extent it at all, so to select applications/windows to make active, you have to go to the other monitor.  There is an option put the same task bar on both monitors, but with that, I don’t know which program/window is on which monitor.

ZBar to the rescue. ZBar adds a task bar to the other monitor(s), and displays only the applications/windows on that monitor. It also removes the applications/windows on the primary monitor’s task bar. I love it.

WizMouse
WizMouse imitates a really nice MacOS feature; it makes the window under the mouse scroll when the user scrolls.  Windows by default only scrolls the active window/frame.  With WizMouse, I can scroll the list of emails in Outlook, and then move my mouse over to the preview, and scroll that, without clicking in the frame!  I can also move my mouse over an Excel document which is open in the background, and scroll it, even though the Excel window is under a bunch of other windows.  What a fantastic program!

ArsClip
ArsClip keeps track of my copy-paste activity and allows me to past something that I copied before the most recent copy. I’ve set mine to give me the history menu when pressing ALT+V.  The program also allows me to “paste values” with a keyboard shortcut; I’ve set mine to CTRL+SHIFT+V.  It saves me so much time!

Print Labels Directly From Oracle to Zebra Printers

June 7, 2016 Leave a comment

Labeling is a very important business process that usually confuses even the best of us.  It involves many moving parts; including, but not limited to, ERP systems, printer hardware, bar-code symbologies, and label templates. It’s seemingly rare in corporate IT to find a single person who knows enough about all of these technologies to create a simple labeling solution. Third party companies like Bartender and Loftware have swooped in to provide “turnkey solutions” which have their own complexities. From my point of view, these third party solutions provide little, if any, value. I’d even go as far to say that they detract value from the overall solution.

Here are a few points which a third party software vendor may bring up which will seem enticing to you:

  • With a third party solution, you can have one centralized label template repository
  • We offer a visual label template editor
  • We can direct printing based on business data

Here is what the sales people won’t tell you about third party labeling solutions:

  • License costs are extraordinary high and repeat annually
  • Each server requires a license
    • Each server in a load balancing cluster will require a license (A license per IP address)
    • Each test/development server requires a license
  • The software requires hardware/virtual machines (VMs) to run on (which also has an additional cost)
    • Multiply it for each test/development instance
  • The software provides an additional point of failure which can be difficult to troubleshoot
  • Additional desktop software is also required, and may not be very robust
    • Precise formatting can be very difficult, or impossible
    • Even basic ZPL functions are difficult or impossible to implement
  • Some key features, like linking to data from external sources, is limited in capability
  • There’s a conflict of interest between the software quality and desire to sell consulting services
  • Zebra offers a WYSIWYG visual label template editor, for a lower price

Let me be the first to tell you; third party software is not going to make your labeling solution simple. In practice, it will likely make you want to pull your hair out.

Luckily, Oracle comes ready to print labels out of the box!  Don’t let the Loftware salesperson tell you otherwise!  Here are the steps you can take to print a label directly from Oracle; no third party systems involved.

Design a ZPL Template:

^XA
^MNW^POI^PMN^LH0,0^JMA^MD25^PQ1,0,0,N^CI0^PW812^MMT^LL406^LRY^FO20,25^GB773,0,70^FS
^FT340,80^A0N,60,60^FH^FN10^FDITEM^FS
^MCY^XZ

Save the template on your Zebra printer’s flash memory
ZebraTemplateZPL[1]

Configure your device IP address.
DeviceIP[1]

Set your profile option: ‘WMS: Label Print Mode’ = ‘Synchronous – TCP/IP’
Profile[1]

Set up your label Format and fields
(make sure the name matches the storage path on the printer)
LabelFormat

 

 

Back to the third party software benefits; are any of them true?  I don’t think so.

For one, Zebra offers software (ZebraNet Bridge Enterprise) that will push label templates to all your zebra printers in just a few clicks; making centralized label templates a moot point.  The Zebra software is only a few hundred dollars.  Once.

As mentioned before, Zebra offers label template design software (Zebra Designer) that is, in my experience, far better than a third parties software. Think of it this way, the easier Zebra makes printing labels, the more hardware/supplies your company will buy from them. On the flip side, with third party vendors like Loftware, the more complex the software, the more consulting services they can sell you.

Lastly, the ERP system, in my case, Oracle, should be robust enough to direct labels to desired printers.  If it’s not, you will likely be better off designing a custom solution in the ERP system rather than implementing a third party package, which itself will require much technical work.

With just a little work, you can be printing labels, directly from Oracle, without any need for virtual machines or complex middleware.

References

ERPschools – Oracle MSCA Label Printing
Zebra – Barcode Printing from Oracle WMS