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

634 lines
16 KiB
Plaintext

COMPILE SUBROUTINE Print_Packing_Slip( CocIds, PrintPath, PDFileName ,PrinterInitialized, HideUI)
DECLARE FUNCTION set_printer, get_printer, msg, fieldcount, Printer_Select, obj_Install
DECLARE FUNCTION obj_WM_Out
DECLARE SUBROUTINE security_err_msg
$Insert LOGICAL
$INSERT SECURITY_RIGHTS_EQU
$INSERT OIPRINT_EQUATES
$INSERT MSG_EQUATES
$INSERT QUOTE_EQU
$INSERT COMPANY_EQUATES
$INSERT QUOTE_SPEC_EQU
$INSERT PROD_SPEC_EQUATES
$Insert CUST_EPI_PART_EQUATES
$INSERT WO_STEP_EQU
$INSERT WO_LOG_EQUATES
$INSERT WO_MAT_EQUATES
$INSERT SEMI_VEND_CODE_EQUATES
$INSERT ORDER_EQU
$INSERT COC_EQUATES
$INSERT APPCOLORS
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
EQU FONT_NAME$ TO 1
EQU FONT_SIZE$ TO 2
EQU FONT_JUST$ TO 3
EQU FONT_BOLD$ TO 4
EQU FONT_ITALIC$ TO 5
EQU FONT_UNDERLINE$ TO 6
IF NOT(ASSIGNED(PrintPath)) THEN PrintPath = ''
IF NOT(ASSIGNED(PDFFileName)) THEN PDFFileName = ''
IF NOT(ASSIGNED(PrinterInitialized)) THEN PrinterInitialized = 0
IF NOT(PrinterInitialized) THEN
* * * PRINT SETUP * * *
PageInfo = ''
PageInfo<PI$LEFT> = '0.5'
PageInfo<PI$TOP> = '1.35'
PageInfo<PI$RIGHT> = '0.5'
PageInfo<PI$BOTTOM> = '0.25'
PageSetup = 0 ;* 0 = Portrait, 1 = Landscape mode
PrintSetup = ''
PrintSetup<1,1> = '2' ;* Specific Location
PrintSetup<1,2> = '5' ;* Show Print and PDF, hide Print Setup
PrintSetup<1,3> = '0' ;* Show the printing window
PDFParms = 'Printing PDF Document':@FM: '' :@FM:'':@FM: ''
stat = Set_Printer( 'INIT', PDFParms, 'Packing Slip',PageInfo,PageSetup , PrintSetup)
END
If Assigned(HideUI) else HideUI = False$
If HideUI NE True$ then HideUI = False$
ShipNo = CocIds<1>
IF NOT(PrinterInitialized) THEN
ShipRec = XLATE('COC',ShipNo,'','X')
font = 'Arial' ;* Font basics
font<2> = 10
font<4> = 0
stat = Set_Printer('FONTHEADFOOT', font)
stat = Set_Printer('LINESTYLE', PS_SOLID:@FM:2)
stat = Set_Printer('LINE', -0.1:@FM:-1.2:@FM:7.5:@FM:-1.2, 1)
stat = Set_Printer('LINE', -0.1:@FM:-0.1:@FM:7.5:@FM:-0.1, 1)
location = -.15:@fm:-1.150:@fm:1.57:@fm:1
stat = Set_Printer('BMP',obj_Install('Get_Prop','ColorBMP'),location, 0,1)
* * * * Added 10/8/2015 JCH - Updated 'CONFIG','COMPANY' record with Infinieon Company and Division
InstDat = obj_Install('Get_Prop','Company':@FM:'Division')
Company = InstDat<1>
Division = InstDat<2>
font = 'Arial'
font<2> = '12' ;* Big type
font<4> = 1 ;* Bold on
font<5> = 0 ;* Italics
stat = Set_Printer('TEXTXY',Company,5.7:@FM:-1.15,font,1)
stat = Set_Printer('TEXTXY',Division,5.7:@FM:-0.970,font,1)
font<2> = 10 ;* 10 point font
font<4> = 0 ;* Bold off
font<5> = 0 ;* Italics Off
stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','Address'), 5.7:@fm:-0.775, font,1)
stat = Set_Printer('TEXTXY',obj_Install('Get_Prop','CSZC'), 5.7:@fm:-0.625, font,1)
stat = Set_Printer('TEXTXY','Tel: ':obj_Install('Get_Prop','Phone'), 5.7:@fm:-0.475, font, 1)
stat = Set_Printer('TEXTXY','FAX: ':obj_Install('Get_Prop','FAX'), 5.7:@fm:-0.325, font, 1)
stat = Set_Printer('TEXTXY','Shipment No: ':ShipNo,3.0:@FM:-0.325,font,1)
IF ShipRec<COC_SAP_DEL_NO$> NE '' THEN
SAPDelNo = '12345678'
stat = Set_Printer('TEXTXY','SAP Delivery No: ':SAPDelNo,2.8:@FM:-0.525,font,1)
END
END
CCnt = fieldcount( CocIds, @fm )
FOR I = 1 TO CCnt
ThisCOC = CocIds<i>
ThisCOCRec = XLATE( 'COC', ThisCOC, '', 'X' )
WONo = ThisCOCRec<COC_WO_NO$>
WORec = XLATE('WO_LOG',WONo,'','X')
SAPDelNo = ThisCOCRec<COC_SAP_DEL_NO$>
ProdOrdNo = WORec<WO_LOG_PROD_ORD_NO$>
PO = WORec<WO_LOG_CUST_PO_NO$>
CustNo = Xlate('COC', ShipNo, 'WO_CUST_NO_EX', 'X')
CustRec = XLATE('COMPANY',CustNo,'','X')
ShipToAttn = CustRec<COMPANY_SHIP_TO_ATTN$>
ShipToCo = CustRec<COMPANY_SHIP_TO_CO$>
ShipToAddr = CustRec<COMPANY_SHIP_TO_ADDRESS$>
Swap @TM With ', ' In ShipToAddr
ShipToCity = CustRec<COMPANY_SHIP_TO_CITY$>
ShiptoState = CustRec<COMPANY_SHIP_TO_STATE$>
ShipToZip = CustRec<COMPANY_SHIP_TO_ZIP$>
CustData = ''
IF ShipToAttn NE '' THEN CustData := ShipToAttn:CRLF$
IF ShiptoCo NE '' THEN CustData := ShiptoCo:CRLF$
IF ShipToAddr NE '' THEN CustData := ShipToAddr:CRLF$
IF ShipToCity NE '' THEN CustData := ShipToCity:', '
IF ShipToState NE ''THEN CustData := ShipToState:' ':OCONV(ShipToZip,'[ZIP_FORMAT]')
QuoteNo = ''
OrderNo = ''
VendCd = CustRec<COMPANY_VEND_CD$>
ShipDt = OCONV(ThisCOCRec<COC_SHIP_DT$>,'D4/')
WaferCnts = XLATE('COC',ThisCOC,'CASS_WAFER_CNT','X')
TotalShipQty = SUM( WaferCnts )
WOStepNos = ThisCOCRec<COC_WO_STEP$>
WOCassNos = ThisCOCRec<COC_CASS_NO$>
RDSNos = ThisCOCRec<COC_RDS_NO$>
ShipWOStepKey = WORec<WO_LOG_WO_STEP_KEY$>[-1,'B':@VM]
ShipPSN = XLATE('WO_STEP',ShipWOStepKey,1,'X') ;* Get Last Step PS_NO
EpiPartNo = Xlate('COC', ShipNo, 'EPI_PART_NO_EX', 'X')
CustEpiPartRec = Xlate('CUST_EPI_PART',CustNO:'*':EpiPartNo,'','X')
CustSpecIDs = CustEpiPartRec<CUST_EPI_PART_SPEC_NO$>
CustSpecRevs = CustEpiPartRec<CUST_EPI_PART_SPEC_REV$>
CustSpecRevDts = CustEpiPartRec<CUST_EPI_PART_SPEC_REV_DT$>
CustSpecRevDts = Oconv(CustSpecRevDts,'D4/')
SWAP @VM WITH CRLF$ IN CustSpecIDs
SWAP @VM WITH CRLF$ IN CustSpecRevs
SWAP @VM WITH CRLF$ IN CustSpecRevDts
RDSSlotNos = ''
LotNos = ''
PartNos = ''
SuppCds = ''
LotSlotNos = ''
BatchNos = ''
FOR I = 1 TO COUNT(WOCassNos,@VM) + (WOCassNos NE '')
WOCassNo = WOCassNos<1,I>
WOStepNo = WOStepNos<1,I>
RDSNo = RDSNos<1,I>
PSNo = XLATE('WO_STEP',WONo:'*':WOStepNo,WO_STEP_PROD_SPEC_ID$,'X')
If Assigned(PSNo) else
PSNo = Xlate('RDS', RDSNo, 'PROD_SPEC_ID', 'X')
end
Substrate = XLATE( 'PROD_SPEC', PSNo, PROD_SPEC_SPEC_SUBSTRATE$, 'X' )
WSize = Substrate<1,QSSubWafersize$>
WOMatRec = XLATE('WO_MAT',WONo:'*':WOCassNo,'','X')
BatchNos<1,I> = WOMatRec<WO_MAT_SAP_BATCH_NO$>
IF RDSNo NE '' THEN
LotNos<1,I> = WOMatRec<WO_MAT_LOT_NO$>
If WOMatRec<WO_MAT_RESHIP_CUST_PART_NO$> NE '' then
PartNos<1, I> = WOMatRec<WO_MAT_RESHIP_CUST_PART_NO$>
end else
PartNos<1, I> = WOMatRec<WO_MAT_CUST_PART_NO$>
end
SubPartNo = WOMatRec<WO_MAT_SUB_PART_NO$>
IF VendCd NE '' THEN
SuppCd = VendCd
END ELSE
IF SubPartNo MATCHES "6N'-'1A'-'2A" THEN
SuppCd = FIELD(SubPartNo,'-',3)
END ELSE
SuppCd = WOMatRec<WO_MAT_SUB_VEND_CD$>
SuppCd = XLATE('SEMI_VEND_CODE',SuppCd,SEMI_VEND_CODE_EPI_VEND_CD$,'X')
END
END
SuppCds<1,I> = SuppCd
END ELSE
WMOutKey = WONo:'*':WOStepNo:'*':WOCassNo
RDSSlots = obj_WM_Out('RDSSlots',WMOutKey)
SWAP @VM WITH CRLF$ IN RDSSlots
RDSNo = RDSSlots<1>
InCassData = obj_WM_Out('InCassData',WMOutKey)
InLotNos = InCassData<2>
InPartNos = InCassData<3>
InSubPartNos = InCassData<4>
InSuppCds = ''
LotCnt = COUNT(InLotNos,@VM) + (InLotNos NE '')
PartCnt = COUNT(InPartNos,@VM) + (InPartNos NE '')
SubPartCnt = COUNT(InSubPartNos,@VM) + (InSubPartNos NE '')
ULotNos = ''
FOR M = 1 TO LotCnt
LotNo = InLotNos<1,M>
LOCATE LotNo IN ULotNos BY 'AL' USING @VM SETTING Pos ELSE
ULotNos = INSERT(ULotNos,1,Pos,0,LotNo)
END
NEXT M
UPartNos = ''
FOR M = 1 TO LotCnt
PartNo = InPartNos<1,M>
LOCATE PartNo IN UPartNos BY 'AL' USING @VM SETTING Pos ELSE
UPartNos = INSERT(UPartNos,1,Pos,0,PartNo)
END
NEXT M
USubPartNos = ''
FOR M = 1 TO SubPartCnt
SubPartNo = InSubPartNos<1,M>
LOCATE SubPartNo IN USubPartNos BY 'AL' USING @VM SETTING Pos ELSE
USubPartNos = INSERT(USubPartNos,1,Pos,0,SubPartNo)
END
NEXT M
FOR N = 1 TO COUNT(USubPartNos,@VM) + (USubPartNos NE '')
USubPartNo = USubPartNos<1,N>
IF VendCd NE '' THEN
SuppCd = VendCd
END ELSE
IF USubPartNo MATCHES "6N'-'1A'-'2A" THEN
SuppCd = FIELD(USubPartNo,'-',3)
END ELSE
SuppCd = WOMatRec<WO_MAT_SUB_VEND_CD$>
SuppCd = XLATE('SEMI_VEND_CODE',SuppCd,SEMI_VEND_CODE_EPI_VEND_CD$,'X')
END
END
InSuppCds<1,N> = SuppCd
NEXT N
SWAP @VM WITH CRLF$ IN ULotNos
SWAP @VM WITH CRLF$ IN UPartNos
SWAP @VM WITH CRLF$ IN InSuppCds
RDSNos<1,I> = RDSNo
LotNos<1,I> = ULotNos
PartNos<1,I> = UPartNos
SuppCds<1,I> = InSuppCds
END
NEXT I
* Print the title line
font = 'Arial'
font<2> = '18' ;* Big type
font<4> = 1 ;* Bold on
font<5> = 1 ;* Italics
IF SAPDelNo = '' THEN
stat = Set_Printer('TEXTXY','Packing Slip',2.9:@FM:-0.80,font,0)
END ELSE
stat = Set_Printer('TEXTXY','Packing Slip',2.9:@FM:-1.00,font,0)
END
font<2> = 12
font<4> = 0 ;* Bold off
font<5> = 0 ;* Italics off
stat = set_printer( 'FONT', font )
stat = Set_Printer('TEXTXY','Ship Date: ':ShipDt,0.0:@FM:0.4,0,0)
bcFont = ''
bcFont<1> = '3 of 9 Barcode'
bcFont<2> = '24'
bcFont<3> = 'R'
bcFont<4> = '0'
stat = Set_Printer('TEXTXY','*':'2S':'V':ThisCOC:'*',4.00:@FM:.10,bcFont,0) ;* Added JCH
font<2> = 12 ;* 12 points
font<4> = 1 ;* Bold On
stat = Set_Printer('TEXTXY', 'Packing List - V':ThisCOC, 4.0:@fm:-.1, font, 0 )
stat = Set_Printer('TEXTXY','SID (2S) V':ThisCOC,4:@FM:.35,font,0)
stat = Set_Printer("POS", 0:@FM:.60)
*IF SAPDelNo = '' THEN
/*
* Bill to and Ship to information
colFormat = '>1080'
colFormat<1,2> = '<4700'
colFormat<1,3> = '>1080'
colFormat<1,4> = '<3620'
colData = 'Bill To:'
colData<1,2> = BillToData
colData<1,3> = 'Ship To:'
colData<1,4> = ShipToData
font<2> = 10
font<4> = 0
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,3)
stat = Set_Printer('TEXT')
*/
*END ELSE
colFormat = '>1080'
colFormat<1,2> = '<4700'
colData = 'Ship To:'
colData<1,2> = CustData
stat = Set_Printer('TEXT') ;* Blank line between Date and Customer added
font<2> = 10
font<4> = 0
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,3)
stat = Set_Printer('TEXT')
*END
* Shipment Information
colHeader = 'Customer No' ; colFormat = '^2160'
colHeader<1,2> = 'Ship Date' ; colFormat<1,2> = '^2160'
colHeader<1,3> = 'PO Number' ; colFormat<1,3> = '^2160'
colHeader<1,4> = 'Quote No' ; colFormat<1,4> = '^2160'
colHeader<1,5> = 'WO No' ; colFormat<1,5> = '^2160'
colData = CustNo
colData<1,2> = ShipDt
colData<1,3> = PO
colData<1,4> = QuoteNo
colData<1,5> = WONo
*IF SAPDelNo NE '' THEN
colHeader<1,4> = 'Prod Ord No'
colData<1,4> = ProdOrdNo
*END
font<2> = 10 ;* 10 point
font<4> = 1 ;* Bold
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE', colFormat,colHeader,'',LTGREY$,'',0,6)
font<4> = 0 ;* Bold off
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,6)
stat = Set_Printer('TEXT')
/*
IF SAPDelNo = '' THEN
colHeader = 'Ship Via' ; colFormat = '^5400'
colHeader<1,2> = 'Terms' ; colFormat<1,2> = '^5400'
colData = ShipVia
colData<1,2> = Terms
font<2> = 10 ;* 10 point
font<4> = 1 ;* Bold
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE', colFormat,colHeader,'',LTGREY$,'',0,6)
font<4> = 0 ;* Bold off
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,6)
stat = Set_Printer('TEXT')
END
*/
* Specification information *
colHeader = 'Spec No' ; colFormat = '^2700' ; colData = PSNo
colHeader<1,2> = 'Cust Spec' ; colFormat<1,2> = '^2700' ; colData<1,2> = CustSpecIDs
colHeader<1,3> = 'Cust Spec Rev' ; colFormat<1,3> = '^2700' ; colData<1,3> = CustSpecRevs
colHeader<1,4> = 'Cust Spec Rev Dt' ; colFormat<1,4> = '^2700' ; colData<1,4> = CustSpecRevDts
font<FONT_SIZE$> = 10 ;* 10 point
font<FONT_BOLD$> = 1 ;* Bold
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE', colFormat,colHeader,'',LTGREY$,'',0,6)
font<FONT_BOLD$> = 0 ;* Bold off
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE',colFormat,'',colData,LTGREY$,'',1,6)
stat = Set_Printer('TEXT')
* Order detail
colHeader = 'Cass':CRLF$:'No' ; colFormat = '^720'
colHeader<1,2> = 'Cass ID' ; colFormat<1,2> = '^1440'
colHeader<1,3> = 'BatchNo' ; colFormat<1,3> = '^1440'
colHeader<1,4> = 'Qty' ; colFormat<1,4> = '^720'
colHeader<1,5> = 'RDS No' ; colFormat<1,5> = '^1080'
colHeader<1,6> = 'Lot No':CRLF$:WSize ; colFormat<1,6> = '^2160'
colHeader<1,7> = 'Cust Part No' ; colFormat<1,7> = '^2160'
colHeader<1,8> = 'Supp Cd' ; colFormat<1,8> = '^1080'
ShipDetail = ''
FOR D = 1 TO COUNT(WOCassNos,@VM) + (WOCassNos NE '')
ShipDetail<D,1> = WOCassNos<1,D>
ShipDetail<D,2> = WONo:'.':WOStepNos<1,D>:'.':WOCassNos<1,D>
ShipDetail<D,3> = BatchNos<1,D>
ShipDetail<D,4> = WaferCnts<1,D>
ShipDetail<D,5> = RDSNos<1,D>
ShipDetail<D,6> = LotNos<1,D>
ShipDetail<D,7> = PartNos<1,D>
ShipDetail<D,8> = SuppCds<1,D>
NEXT D
font<2> = 10
font<4> = 1 ;* Bold on
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE', colFormat,colHeader,'',LTGREY$,'',0,6)
font<2> = 10
font<4> = 0 ;* Bold off
stat = Set_Printer('FONT',font)
boxFormat = '<+2160'
boxFormat<1,2> = '<+2160'
boxFormat<1,3> = '<+2160'
boxFormat<1,4> = '<+2160'
boxFormat<1,5> = '<+2160'
FOR J = 1 TO COUNT(WaferCnts,@VM) + (WaferCnts NE '')
stat = Set_Printer('CALCTABLE',colFormat:@FM:ShipDetail<J>)
TableSize = Get_Printer('CALCTABLE')
TableHeight = TableSize<2>
IF Get_Printer('POS')<2> + TableHeight > 6.75 THEN
boxData = ''
PageNo = Get_Printer('PAGE')
FOR B = 1 TO 5
boxData<1,B> = 'Box ':(B + (10*(PageNo-1)))
NEXT B
FOR B = 6 TO 10
boxData<2,B-5> = 'Box ':(B + (10*(PageNo-1)))
NEXT B
boxData<1> = boxData<1>:CRLF$
boxData<2> = boxData<2>:CRLF$
SWAP @VM WITH CRLF$:@VM IN boxData
stat = Set_Printer('POS',0:@FM:'8.1')
font<2> = 8
stat = Set_Printer('FONT',font)
stat = Set_Printer("ADDTABLE", boxFormat, '', boxData, '', '', 1, TB_ALL)
font<2> = 10
stat = Set_Printer('FONT',font)
stat = Set_Printer('PAGEBREAK')
font<2> = '18' ;* Big type
font<4> = 1 ;* Bold on
font<5> = 1 ;* Italics
stat = Set_Printer('TEXTXY','Packing Slip',2.9:@FM:-0.80,font,0)
font<2> = 10
font<4> = 1 ;* Bold on
font<5> = 0
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE', colFormat,colHeader,'',LTGREY$,'',0,6)
font<2> = 10
font<4> = 0 ;* Bold off
stat = Set_Printer('FONT',font)
stat = Set_Printer('ADDTABLE',colFormat,'',ShipDetail<J>,LTGREY$,'',0,7)
END ELSE
stat = Set_Printer('ADDTABLE',colFormat,'',ShipDetail<J>,LTGREY$,'',1,7)
END
NEXT J
stat = Set_Printer('TEXT')
stat = Set_Printer('TEXT')
* Check boxes at bottom of the sheet
boxData = ''
boxData<1,1> = 'Date Shipped:':CRLF$:OCONV(Date(),'D4/')
boxData<1,2> = 'Checked By:':CRLF$
boxData<1,3> = 'Packed By:':CRLF$
boxData<1,4> = 'Total Pieces:':CRLF$
boxData<1,5> = 'Total Weight':CRLF$
PageNo = Get_Printer('PAGE')
FOR B = 1 TO 5
boxData<2,B> = 'Box ':(B + (10*(PageNo-1)))
NEXT B
FOR B = 6 TO 10
boxData<3,B-5> = 'Box ':(B + (10*(PageNo-1)))
NEXT B
boxData<1> = boxData<1>:CRLF$
boxData<2> = boxData<2>:CRLF$
SWAP @VM WITH CRLF$:@VM IN boxData
stat = Set_Printer('POS',0:@FM:'8.1')
font<2> = 8
stat = Set_Printer('FONT',font)
stat = Set_Printer("ADDTABLE", boxFormat, '', boxData, '', '', 1, TB_ALL)
font<2> = 10
stat = Set_Printer('FONT',font)
* Order totals at bottom of the page
font<2> = 10
stat = Set_Printer('FONT',font)
stat = set_printer('TEXTXY', 'Total Qty Shipped:':fmt( TotalShipQty, 'R#7' ), 0:@fm:9.63, font, 0 )
stat = set_Printer('TEXTXY','Manufacturing DUNs Number: ':obj_Install('Get_Prop','Duns'),2.5:@FM:9.63,font,0)
IF NOT(PrinterInitialized) THEN
stat = set_printer( 'TERM' )
END
NEXT I
RETURN