open-insight/LSL2/STPROC/OBJ_ZEBRA105SL.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

281 lines
8.4 KiB
Plaintext

COMPILE FUNCTION obj_Zebra105SL(Method,Parms)
/*
Methods for Printing on Zebra 105SL
09/11/2003 JCH - Initial Coding
Properties:
Methods:
SubPackLabel(ParmList) - Prints Sub-Pack Label (4"W x 3"H)
*/
DECLARE FUNCTION Set_Printer, Get_Printer, Get_Status, Msg, Printer_Select,Get_Property
DECLARE FUNCTION Utility, PrintSetup, obj_Install, Direct_Print, Environment_Services
DECLARE SUBROUTINE Set_Status, Msg
$INSERT OIPRINT_EQUATES
$INSERT MSG_EQUATES
$INSERT LABELS
$INSERT PRINTSETUP_EQUATES
EQU PI$LEFT TO 1
EQU PI$TOP TO 2
EQU PI$RIGHT TO 3
EQU PI$BOTTOM TO 4
EQU PI$WIDTH TO 5
EQU PI$HEIGHT TO 6
EQU PI$SIZE TO 7
ErrTitle = 'Error in Stored Procedure "obj_Zebra105SL"'
ErrorMsg = ''
IF NOT(ASSIGNED(Method)) THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
IF NOT(ASSIGNED(Parms)) THEN Parms = ''
IF ErrorMsg NE '' THEN
Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
RETURN ''
END
Methods = 'SubPackLabel'
Result = ''
LOCATE Method IN Methods USING @FM SETTING Pos THEN
ON Pos GOSUB SubPackLabel
END
IF ErrorMsg NE '' THEN
Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
RETURN ''
END
RETURN Result
* * * * * * *
SubPackLabel:
* * * * * * *
PrinterID = Parms[1,@RM]
CustPartNo = Parms[COL2()+1,@RM]
RevLvl = Parms[COL2()+1,@RM]
PartQty = Parms[COL2()+1,@RM]
PartDesc = Parms[COL2()+1,@RM]
LotNo = Parms[COL2()+1,@RM] ;* RDS
CustName = Parms[COL2()+1,@RM]
PONo = Parms[COL2()+1,@RM]
CustLot = Parms[COL2()+1,@RM]
Thickness = Parms[COL2()+1,@RM]
Resistivity = Parms[COL2()+1,@RM]
Conductivity = Parms[COL2()+1,@RM]
ReqShipDt = Parms[COL2()+1,@RM]
WONo = Parms[COL2()+1,@RM]
IF PrinterID = '' THEN ErrorMsg = 'Null parameter Printer Path passed to routine (':Method:').'
* Check bar coded data for validity for length
IF CustPartNo = '' THEN ErrorMsg = 'Null parm "CustPartNo" passed to routine (':Method:').'
IF PartQty = '' THEN ErrorMsg = 'Null parm "PartQty" passed to routine (':Method:').'
IF LotNo = '' THEN ErrorMsg = 'Null parm "LotNo" passed to routine (':Method:').'
IF LEN(CustPartNo) > 18 THEN ErrorMsg = 'CustPartNo parameter exceeds 18 characters (':Method:').'
IF LEN(RevLvl) > 3 THEN ErrorMsg = 'RevLvl parameter exceeds 3 characters (':Method:').'
IF LEN(PartQty) > 6 THEN ErrorMsg = 'PartQty parameter exceeds 6 characters (':Method:').'
IF NOT(NUM(PartQty)) THEN ErrorMsg = 'PartQty parameter is not a number (':Method:').'
IF ErrorMsg THEN RETURN
GOSUB OIPIInit ;* Selects printer and initializes OIPrinter Interface
GOSUB Label4x3 ;* Zebra printer setup and background lines for labels
* Block 1 Left (Cust Part)
LabelString := '^FO0,0^A0,25^FDCust Part(1P):^FS':CRLF$ ;* Label Line 1
LabelString := '^FO15,40^A0,50,40^FD':CustPartNo:'^FS':CRLF$ ;* Readable
LabelString := '^FO15,95^BY2^BC,60,N^FDP':CustPartNo:'^FS':CRLF$ ;* Code 128
LabelString := '^BY3,3.0':CRLF$
* Block 1 Right (Rev Lvl)
LabelString := '^FO508,0^BY2^B3,,60,N^FD2P':RevLvl:'^FS':CRLF$ ;* Code 39
LabelString := '^BY3,3.0':CRLF$
LabelString := '^FO508,70^A0,25^FDRev.Level (2P):^FS':CRLF$ ;* Label Line 1
LabelString := '^FO680,70^A0,50,48^FD':RevLvl:'^FS':CRLF$ ;* Readable
* Block 2 Left (Quantity)
LabelString := '^FO0,165^A0,25^FDQuantity (Q):^FS':CRLF$ ;* Label Line 1
LabelString := '^FO15,195^A0,50,40^FD':PartQty:'^FS':CRLF$ ;* Readable
LabelString := '^FO15,245^BY2^B3,,60,N^FDQ':PartQty:'^FS':CRLF$ ;* Code 39
LabelString := '^BY3,3.0':CRLF$
* Block 2 Right (Description)
LabelString := '^FO345,165^A0,25^FDDescription:^FS':CRLF$ ;* Label Line 1
LabelString := '^FO345,195^A0,30,40^FD':PartDesc:'^FS':CRLF$ ;* Readable
LabelString := '^FO350,235^A0,25^FDThickness:^FS':CRLF$ ;* Label Line 3
LabelString := '^FO550,235^A0,25^FD':Thickness:'^FS':CRLF$ ;* Readable
LabelString := '^FO350,260^A0,25^FDResistivity:^FS':CRLF$ ;* Label Line 4
LabelString := '^FO550,260^A0,25^FD':Resistivity:'^FS':CRLF$ ;* Readable
IF Conductivity NE '' THEN
LabelString := '^FO350,285^A0,25^FDConductivity:^FS':CRLF$ ;* Label Line 4
LabelString := '^FO550,285^A0,25^FD':Conductivity:'^FS':CRLF$ ;* Readable
END
* Block 3 Left (Customer Lot)
LabelString := '^FO0,315^A0,25^FDCustomer Lot:^FS':CRLF$ ;* Label Line 1
LabelString := '^FO15,350^A0,50,40^FD':CustLot:'^FS':CRLF$ ;* Readable
LabelString := '^FO15,400^BY2^B3,,60,N^FD':CustLot:'^FS':CRLF$ ;* Code 39
LabelString := '^BY3,3.0':CRLF$
* Block 3 Right (Supplier)
LabelString := '^FO360,320^XGR:':GRFName:',1,1^FS' ;* Horizontal Company Logo
* Block 4
LabelString := '^FO0,470^A0,25^FDCustomer:^FS':CRLF$ ;* Label Line
LabelString := '^FO120,470^A0,45,25^FD':CustName:'^FS':CRLF$ ;* Readable
LabelString := '^FO0,515^A0,25^FDRDS No:^FS':CRLF$ ;* Label Line
LabelString := '^FO100,515^A0,36,40^FD':LotNo:'^FS':CRLF$ ;* Readable
LabelString := '^FO0,555^A0,25^FDPO No:^FS':CRLF$ ;* Label Line
LabelString := '^FO100,555^A0,36,20^FD':PONo:'^FS':CRLF$ ;* Readable
LabelString := '^FO450,515^A0,25^FDWO No:^FS':CRLF$ ;* Label Line
LabelString := '^FO590,515^A0,36^FD':WONo:'^FS':CRLF$ ;* Readable
LabelString := '^FO450,555^A0,25^FDReq Ship Dt:^FS':CRLF$ ;* Label Line
LabelString := '^FO590,555^A0,36^FD':ReqShipDt:'^FS':CRLF$ ;* Readable
LabelString := '^XZ'
If Environment_Services('GetLabelPrintMethod') _EQC 'OIPI' then
stat = Set_Printer('TEXT',LabelString)
end else
stat = Direct_Print('PRINT', LabelString)
end
GOSUB OIPrint_Err
RETURN
* * * * * * * * * * * * * * * * * * * * * * * *
* L O C A L M E T H O D S
* * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *
OIPIInit:
* * * * * *
* Internal method that selects printer, initializes OIPI and then prints block grid
FileName = "Printing Label"
Title = "Printing Label" ;* Initialize Printing
PageInfo = ''
PageInfo<PI$LEFT> = 0.1
PageInfo<PI$TOP> = 0.1
PageInfo<PI$RIGHT> = 0.1
PageInfo<PI$BOTTOM> = 0.1
PageSetup = '1' ;* Landscape
PrintSetup = '' ;* Preview
PrintPath = Printer_Select(PrinterID) ;* Select printer - Displays popup if PrinterPort not found
IF PrintPath = '' THEN
Def = ""
Def<MTYPE$> = "TA3"
Def<MTEXT$> = 'Destination Printer not Selected..'
Def<MCAPTION$> = ''
Def<MICON$> = '*'
Msg(@WINDOW, Def, '')
RETURN
END
If Environment_Services('GetLabelPrintMethod') _EQC 'OIPI' then
stat = Set_Printer("INIT",FileName,Title,PageInfo,PageSetup,PrintSetup,PrintPath)
end else
stat = Direct_Print('START', PrintPath<1>, '', '')
end
IF stat < 0 THEN GOSUB OIPrint_Err
RETURN
* * * * * * *
Label4x3:
* * * * * * *
BitMap = obj_Install('Get_Prop','ZebraGRF') ;* Substitute company logo converted to .GRF (Zebra graphics format)
OSREAD ImageData FROM BitMap THEN
If Environment_Services('GetLabelPrintMethod') _EQC 'OIPI' then
stat = Set_Printer('TEXT',ImageData) ;* Download bitmap image to the printer
end else
stat = Direct_Print('PRINT', ImageData)
end
END
GRFName = FIELD(BitMap,'.',1)
* Label is 812 x 608 dots at 8dots/mm (203 dots/inch)
* Leave periodic spaces in Label String - OIPrint interface wraps text on spaces and will cut off
* the LabelString if there aren't any spaces. Printer Width needs to be set to 132 or greater
LabelString = '^XA' ;* Start of label format
LabelString := '^LH30,70' ;* Label home offset (needed to get onto the label medium)
LabelString := '^BY3' ;* Set narrow Bar Code line width to 3 dots
LabelString := '^PR2' ;* Print speed = 2 IPS
LabelString := '^FO0,156^GB809,0,3,B^FS':@FM ;* 'Top' of 4x3 Label
LabelString := '^FO0,308^GB809,0,3,B^FS':@FM ;* 1st 'horizontal' line (bottom of 1st cell)
LabelString := '^FO0,460^GB809,0,3,B^FS':@FM ;* 2nd 'horizontal' line (bottom of 2nd cell)
RETURN
* * * * * * *
OIPrint_Err:
* * * * * * *
* Local method to kill the OIPI engine
If Environment_Services('GetLabelPrintMethod') _EQC 'OIPI' then
stat = Set_Printer("TERM")
end else
stat = Direct_Print('STOP')
end
* Added after upgrade to OI4.13a to reset default printer in OIPI32 engine.
PrintCount = PrintSetup(PRN_GET$,'',Printers,DefaultPrinter)
CONVERT ',' TO @FM IN DefaultPrinter
DefPrintPath = DefaultPrinter<1>:@FM:DefaultPrinter<3>
Void = set_printer( 'INIT', '', '', .63:@fm:.63:@fm:.25:@fm:'', 0,'',DefPrintPath )
Void = Set_Printer('TERM')
RETURN