Hi Guys
Just tackled something that I thought would be tricky but actually was reasonably simple and works great.
Environment; WebApp 19 server with users in intranet. Store label needs to be printed:
- On creation of a new part record,
- On button press on ZoomPart.wo,
- On Barcode scanner scan (for replace label),
- On mobile phone for 'missing label'.
I decided to get the Dymo Label Maker Wireless for the following reasons
- Fast enough for my customers need (about 1 sec process time + 1 sec printing per label)
- Wireless, so network linked to the server (instead of USB headaches) while can be next to the user or be taken to the store room (Please note it does not have a battery, so does still need the power pack plugged in)
- Good labels including Solvent/Oil resistant 'durable series', with extra stickyness
To do the software side, no SDK download required. Just:
- Install the Dymo Label App (DLS8Setup.8.7.3.exe at this stage) on the webApp server
- Add Dymo to the network (instructions are in the box and quite simple via Access point and your phone).
- Run Dymo Add printer utility on the server
- Run Dymo Label v8, to design a label layout and name each text/barcode/image object, save in your .\Reports directory or so (It is an XML file so good for version control).
- In DataFlex Create Class / Import COM automation / Browse 'C:\Program Files (x86)\DYMO\DYMO Label Software\DLSSDKCOMLibrary.dll"
- Create your own class like mine below
Code:
Use cIniFile.pkg
Use DLSSDKCOMLibrary.pkg
Struct tStoreLabel
String PartNo
String Group
String Bin
Integer BinCol
Integer BinShelf
String Barcode
String Desc
End_Struct
Class cDymoAddIn is a cComDymoAddIn
Procedure Construct_Object
Forward Send Construct_Object
Set peAutoCreate to acAutoCreate
End_Procedure
End_Class
Class cDymoLabels is a cComDymoLabels
Procedure Construct_Object
Forward Send Construct_Object
Set peAutoCreate to acAutoCreate
End_Procedure
End_Class
Class cStoreLabel is a cIniFile
Function LabelTemplate Returns String
String sProgPath
String sDymoPartsLabel
Get psProgramPath of (phoWorkspace(ghoApplication)) to sProgPath
Set psFileName to (sProgPath + '\Settings.ini')
Get ReadString 'DYMO' 'PartsLabel' '' to sDymoPartsLabel
Function_Return sDymoPartsLabel
End_Function
Function ComposeBinCS Integer iCol Integer iShelf Returns String
String sCS
Move '' to sCS
If (iCol > 0 or iShelf > 0) Begin
Move (SFormat("%1 - %2", iCol, iShelf)) to sCS
End
Function_Return sCS
End_Function
Procedure Construct_Object
Forward Send Construct_Object
Object oDymoPrinter is a cDymoAddIn
End_Object
Object oDymoLabel is a cDymoLabels
End_Object
End_Procedure
Function PrintLabel tStoreLabel theLabel Returns Boolean
String sLabel
Boolean bOk
String sBinCS
If (not(IsComObjectCreated(oDymoPrinter))) Begin
Send CreateComObject of oDymoPrinter
End
If (not(IsComObjectCreated(oDymoLabel))) Begin
Send CreateComObject of oDymoLabel
End
Get LabelTemplate to sLabel
Get ComOpen of oDymoPrinter sLabel to bOk
If (bOk) Begin
Get ComSetField of oDymoLabel 'Barcode' (Trim(theLabel.Barcode)) to bOk
Get ComSetField of oDymoLabel 'PartNo' (Trim(theLabel.PartNo)) to bOk
Get ComSetField of oDymoLabel 'Group' (Trim(theLabel.Group)) to bOk
Get ComSetField of oDymoLabel 'Bin' (Trim(theLabel.Bin)) to bOk
Get ComSetField of oDymoLabel 'BinCS' (ComposeBinCS(Self, theLabel.BinCol, theLabel.BinShelf)) to bOk
Get ComSetField of oDymoLabel 'Description' (Trim(theLabel.Desc)) to bOk
Get ComPrint of oDymoPrinter 1 True to bOk
End
Else Begin
Error 300 (SFormat("Unable to open Parts Label file '%1'",sLabel))
End
Function_Return bOk
End_Function
End_Class
- Add at each required event the object and the call like
Code:
Use cStoreLabel.pkg
...
Object oStoreLabel is a cStoreLabel
End_Object
...
Procedure OnClick
tStoreLabel theLabel
Boolean bOk
Get Field_Current_Value of (Main_DD(Self)) (RefTable(PART.NO)) to theLabel.PartNo
Get Field_Current_Value of (Main_DD(Self)) (RefTable(PART.BARCODE_ID)) to theLabel.Barcode
Get Field_Current_Value of (Main_DD(Self)) (RefTable(PART.BIN)) to theLabel.Bin
Get Field_Current_Value of (Main_DD(Self)) (RefTable(PART.BIN_COL)) to theLabel.BinCol
Get Field_Current_Value of (Main_DD(Self)) (RefTable(PART.BIN_SHELF)) to theLabel.BinShelf
Get Field_Current_Value of (Main_DD(Self)) (RefTable(PART.DESC)) to theLabel.Desc
Get Field_Current_Value of (Main_DD(Self)) (RefTable(PART.GROUP)) to theLabel.Group
If (theLabel.PartNo > '') Begin
Get PrintLabel of oStoreLabel theLabel to bOk
If (not(bOk)) Begin
Send UserError "Label could not be printed"
End
End
End_Procedure
And off you go...
Hope this is useful for others. The dymo printers are getting so cheap now, so lots of usages I'd say...
Merry Xmas!
Marco - 28 IT Pty Ltd - Adelaide - South Australia