Compile function Labeling_Services(@Service, @Params) #pragma precomp SRP_PreCompiler Declare Function Database_Services, Environment_Services, Set_Printer, Direct_Print, Printer_Select, Error_Services Declare Function Logging_Services, Datetime Declare subroutine Error_Services, Labeling_Services, Lot_Services $insert LOGICAL $Insert LOT_EQUATES $Insert TEST_WAFER_PROD_EQUATES $Insert RETURN_TO_FAB_LOTS_EQUATES LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\LabelPrinting' LogDate = Oconv(Date(), 'D4/') LogTime = Oconv(Time(), 'MTS') LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' TestWaferLabelPrinting.csv' Headers = 'Logging DTM' : @FM : 'Lot Id' : @FM : 'Username' : @FM : 'PrinterID' : @FM : 'Message' objTWLabelPrinting = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$) GoToService Return Response or "" //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Service Parameter Options //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Options LOAD_LOCK_SIDE = 'Left', 'Right', 'Both' //----------------------------------------------------------------------------- // SERVICES //----------------------------------------------------------------------------- Service PrintLabel(ZPLString, PrinterId) SuccessfulPrint = False$ ErrorMessage = '' If PrinterId EQ '' then PrinterId = Printer_Select(PrinterID) end If PrinterID NE '' then stat = Direct_Print('START', PrinterId, '', '') If Stat GE 0 then stat = Direct_Print('PRINT', ZPLString) If Stat GE 0 then stat = Direct_Print('STOP') end end If Stat LT 0 then Begin Case Case Stat EQ -1 ErrorMessage = "A subsequent START message was sent prior to a previous report's STOP message was invoked." Case Stat EQ -2 ErrorMessage = 'Unable to initialize printer. The printer name may be incorrect or the printer is not avaible' Case Stat EQ -3 OR Stat EQ -4 ErrorMessage = 'Problems starting the report.' Case Stat EQ -5 OR Stat EQ -6 ErrorMessage = 'Problems stopping the report.' Case Stat EQ -7 ErrorMessage = 'Error with printing data - fatal error sending data to the printer.' Case Stat EQ -8 ErrorMessage = 'Error with printing data - wrong number of bytes sent to the printer.' Case Stat EQ -9 OR Stat EQ -10 ErrorMessage = 'Error occurred sending the PAGE message' Case Stat EQ -11 ErrorMessage = 'Problems aborting the report.' Case Stat EQ -12 ErrorMessage = 'The Direct_Print function was called prior to the START message being invoked.' End Case end end If ErrorMessage NE '' then Error_Services('Add', ErrorMessage) end end service Service PrintTestWaferLotLabel(LotId, Username, PrinterId) ErrorMessage = '' If Username EQ '' then Username = @User4 If Username EQ '' then Username = @USERNAME end If RowExists('LOT', LotId) then ZPLStringLabel = '' LotRec = Database_Services('ReadDataRow', 'LOT', LotId) PartNoId = LotRec PartNo = Xlate('TEST_WAFER_PROD', PartNoId, TEST_WAFER_PROD_PART_NAME$, 'X') VendorPartNo = LotRec VendorLotNo = LotRec VendorCode = LotRec LotQty = LotRec For LabelCnt = 1 to 2 ZPLStringLabel := '^XA' ZPLStringLabel := '^LH0,0' ZPLStringLabel := '^PR1' ZPLStringLabel := '^LL406' ZPLStringLabel := '^PW900' ZPLStringLabel := '^MD22' ZPLStringLabel := '^MMT' ZPLStringLabel := '^FO25,25^A045,70,40^FD(1T)Lot Number: ^FS^FX(Lot Number Title)^FS' ZPLStringLabel := '^FO320,25^A045,70,40^FD':LotId:'^FS^FX(Lot Number Text)^FS' ZPLStringLabel := '^FO25,200^A070,40^FD':PartNo:'^FS^FX(Part Number Text)^FS' ZPLStringLabel := '^FO60,300^BY7^B3,,50,N^FD1T':LotId:'^FS^FX(Lot Number 1D Barcode)^FS' ZPLStringLabel := "^FO25,370^A045,28^FDWe do what we promise. That's quality made by Infineon.^FS^FX(Infineon Quality Statement)^FS" ZPLStringLabel := '^FO500,105^CI28' ZPLStringLabel := '^BXN,5,200^FDP':PartNo:'|S':VendorPartNo:'|1T':LotId:'|2T':VendorLotNo:'|(PSN)|Q':LotQty:'|1V':VendorCode:'|SEQ':LabelCnt:'^FS^FX(2DBarcode)^FS' ZPLStringLabel := '^XZ' Next LabelCnt If ZPLStringLabel NE '' then Labeling_Services('PrintLabel', ZPLStringLabel, PrinterId) If Error_Services('NoError') then //Log Event for lot. end else //Log Error for lot ErrorMessage = Error_Services('GetMessage') end end end else ErrorMessage = 'Error printing label for lot ' : LotId : '. LotId was null or did not exist in database.' end If ErrorMessage EQ '' then Lot_Services('CreateLotEvent', LotId, 'TW', Datetime(), 'COMMENT', 'Lot Labels Printed', '', 0, 0, '', Username) end else Error_Services('Add', ErrorMessage) end End Service Service GetTestWaferLotZPL(LotId, Username) ZPLStringLabel = '' LotRec = Database_Services('ReadDataRow', 'LOT', LotId) PartNoId = LotRec PartNo = Xlate('TEST_WAFER_PROD', PartNoId, TEST_WAFER_PROD_PART_NAME$, 'X') VendorPartNo = LotRec VendorLotNo = LotRec VendorCode = LotRec LotQty = LotRec For LabelCnt = 1 to 2 ZPLStringLabel := '^XA' ZPLStringLabel := '^LH0,0' ZPLStringLabel := '^PR1' ZPLStringLabel := '^LL406' ZPLStringLabel := '^PW900' ZPLStringLabel := '^MD22' ZPLStringLabel := '^MMT' ZPLStringLabel := '^FO25,25^A045,70,40^FD(1T)Lot Number: ^FS^FX(Lot Number Title)^FS' ZPLStringLabel := '^FO320,25^A045,70,40^FD':LotId:'^FS^FX(Lot Number Text)^FS' ZPLStringLabel := '^FO25,175^A070,75^FD':PartNo:'^FS^FX(Part Number Text)^FS' ZPLStringLabel := '^FO60,300^BY2^B3,,50,N^FD1T':LotId:'^FS^FX(Lot Number 1D Barcode)^FS' ZPLStringLabel := "^FO25,370^A045,28^FDWe do what we promise. That's quality made by Infineon.^FS^FX(Infineon Quality Statement)^FS" ZPLStringLabel := '^FO500,105^CI28' ZPLStringLabel := '^XZ' Next LabelCnt Response = ZPLStringLabel end service Service GetAllZebraPrinters() Server = Environment_Services('GetServer') ZebraPrinterList = '' ZebraPrinterList<1> = 'MESZBRPRT002' : @VM : '10.95.30.247' : @VM : 9100 ZebraPrinterList<2> = 'MESZBRPRT003' : @VM : '10.95.1.27' : @VM : 9100 ZebraPrinterList<3> = 'MESZBRPRT004' : @VM : '10.95.15.252' : @VM : 9100 ZebraPrinterList<4> = 'MESZBRPRT005' : @VM : '10.95.30.42' : @VM : 9100 ZebraPrinterList<5> = 'MESZBRPRT006' : @VM : '10.95.25.25' : @VM : 9100 ZebraPrinterList<6> = 'MESZBRPRT007' : @VM : '10.95.1.13' : @VM : 9100 ZebraPrinterList<7> = 'MESZBRPRT008' : @VM : '10.95.164.24' : @VM : 9100 ZebraPrinterList<8> = 'MESZBRPRT0011' : @VM : '10.95.15.33' : @VM : 6101 ZebraPrinterList<9> = 'FI_ZEBRA_PRINTER' : @VM : '10.95.164.55' : @VM : 9100 If Server EQ 'MESTSA01EC' OR Server EQ 'MESSA01EC' then ZebraPrinterList<10> = 'JONATHAN_HOME_TEST' : @VM : '192.168.0.123' : @VM : 9100 end Response = ZebraPrinterList end service Service PrintReactorLabel(ReactNo, LoadLockSide=LOAD_LOCK_SIDE) If ( (ReactNo NE '') and (LoadLockSide NE '') ) then BaseZpl = '^XA^LH10,10^FO35,5^BY2^B3N,,80,N^FD10SR{ReactNo}.{LoadLockSidePrefix}^FS^FO10,105^A045,90^FB400,1,,C^FDR{ReactNo} {LoadLockSide}^FS^XZ' Convert 'R' to '' in ReactNo If LoadLockSide _EQC 'Both' then LoadLockSidePrefix = 'L' ZplLeft = BaseZpl Swap '{ReactNo}' with ReactNo in ZplLeft Swap '{LoadLockSidePrefix}' with LoadLockSidePrefix in ZplLeft Swap '{LoadLockSide}' with 'Left' in ZplLeft ZplRight = BaseZpl LoadLockSidePrefix = 'R' Swap '{ReactNo}' with ReactNo in ZplRight Swap '{LoadLockSidePrefix}' with LoadLockSidePrefix in ZplRight Swap '{LoadLockSide}' with 'Right' in ZplRight Zpl = ZplLeft:ZplRight end else LoadLockSidePrefix = LoadLockSide[1, 1] Zpl = BaseZpl Swap '{ReactNo}' with ReactNo in Zpl Swap '{LoadLockSidePrefix}' with LoadLockSidePrefix in Zpl Swap '{LoadLockSide}' with LoadLockSide in Zpl end Labeling_Services('PrintLabel', Zpl, '\\messp1003.infineon.com\MESZBRPRT008') end else Error_Services('Add', 'Error in ':Service:' service. Null ReactNo or LoadLockSide passed in.') end end service Service GetReturnToFabLabelZPL(RTFId) ZPLStringLabel = '' LotRec = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFId) CassId = LotRec CassType = LotRec ReturnToFabReason = LotRec CassIdText = CassId BarcodeText = "" Begin Case Case CassType EQ 'RDS' BarcodeText = '1T' : CassId Case CassType EQ 'WM_OUT' swap '*' with '.' in CassId CassIdText = CassId BarcodeText = 'O' : CassId End Case ZPLStringLabel := '^XA' ZPLStringLabel := '^LH0,0' ZPLStringLabel := '^PR1' ZPLStringLabel := '^LL406' ZPLStringLabel := '^PW900' ZPLStringLabel := '^MD22' ZPLStringLabel := '^MMT' ZPLStringLabel := '^FO25,25^A070,75^FDReturn To Fab^FS^FX(Title)^FS' ZPLStringLabel := '^FO25,100^A045,70,40^FD(1T)Lot Number:':CassIdText:' ^FS^FX(Lot Number Title)^FS' ZPLStringLabel := '^FB780,5,0,L^FO25,180^A045,30,30^FD':ReturnToFabReason:'^FS' ZPLStringLabel := '^FO60,325^BY2^B3,,50,N^FD':BarcodeText:'^FS^FX(Lot Number 1D Barcode)^FS' ZPLStringLabel := '^FO500,105^CI28' ZPLStringLabel := '^XZ' Response = ZPLStringLabel end service