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

472 lines
20 KiB
Plaintext

compile function ENGINEER_RPT1()
begin condition
pre:
post:
end condition
declare function msg, set_property, send_event, dialog_box, utility, get_property
declare function set_printer, fieldcount, key_sort, mast_sched_today_date, Printer_Select
declare subroutine rlist, or_view, activate_save_select, yield, extract_si_keys
declare subroutine update_index, btree.extract
$insert logical
$insert rlist_equates
$insert msg_equates
$insert rds_equ
$insert wo_log_equ
$insert quote_spec_equ
$insert company_equ
$insert reactor_log_equ
$insert oiprint_equates
$insert prod_spec_equ
Params = dialog_box( 'ENGINEER_RPT1', @window, '*CENTER' )
if Params = 'CANCEL' or Params = '' then
return 0
end
Stat = utility( 'CURSOR', 'H' )
open 'DICT.REACTOR_LOG' to DictReactorLogTable else
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Could not open DICT.REACTOR_LOG...'
Void = msg( '', MsgInfo )
return 0
end
****wo mast sched equates***
equ Days$ to 1
equ Month$ to 2
equ ReactorCnt$ to 3
****************************
****wo daily sched equates**
equ ReactControl$ to 1
****************************
****react mode equates******
equ Status$ to 1
equ User$ to 2
equ ChangeDate$ to 3
equ ChangeTime$ to 4
****************************
convert '*' to @fm in Params
Reactors = Params<1>
DayRange = Params<2>
DirToPrinter = Params<3>
DatesToUse = ''
Today = date()
begin case
case DayRange = '3 Day View'
DatesToUse = mast_sched_today_date(Today-1):@fm:mast_sched_today_date(''):@fm:mast_sched_today_date(Today+1)
case DayRange = 'Today'
DatesToUse = mast_sched_today_date('')
case DayRange = 'Yesterday'
DatesToUse = mast_sched_today_date(Today-1)
case DayRange = 'Tomorrow'
DatesToUse = mast_sched_today_date(Today+1)
end case
ODatesToUse = DatesToUse
Dcnt = fieldcount( DatesToUse, @fm )
WoMastRec = xlate( 'CONFIG', 'WO_MAST_SCHED', '', 'X' )
if Reactors then
* will be @vm delimited
end else
* no reactors were specified so get the number of reactors from
* the master scheduler and make array of reactors 1-whatever
Reactors = ''
for i = 20 to WoMastRec<ReactorCnt$>
Reactors := i:@vm
next i
Reactors[-1,1] = ''
end
Rcnt = fieldcount( Reactors, @vm )
****The printing subroutines will handle oconverting the report****
****Report Variables****
rpCurrentStatus = ''
rpCurrentWO = ''
rpCurrentBoxOf = ''
rpStartDate = ''
rpBoxStart = ''
rpLastBoxElapsed = ''
************************
MastSchedRec = xlate( 'CONFIG', 'WO_MAST_SCHED', '', 'X' )
gosub PrinterInit
* THIS CODE NEEDS TO CHANGE TO REFLECT THE CHANGE AS NOTED BELOW REGARDING WO_DAILY_SCHED
for i = 1 to Rcnt
ThisReactor = Reactors<1,i>
* take each reactor and try to find it in one of the wo_daily_sched1-999
* quit looking if we get a null record from wo_dail_sched:i
* meaning we are at the end
Done = false$
ReactorFound = false$
for j = 20 to 999
DailySchedRec = xlate( 'CONFIG', 'WO_DAILY_SCHED':j, '', 'X' )
if len(DailySchedRec) then
* we have a daily sched rec, now try to find in
*THE LOCATE IS NO LONGER NEEDED CAUSE EACH REACTOR HAS A WO_DAILY_SCHED20-999
locate ThisReactor in DailySchedRec<ReactControl$> using @vm setting Fpos then
ReactorFound = true$
RModeRec = xlate( 'CONFIG', 'REACT_MODE':ThisReactor, '', 'X' )
rpCurrentStatus = RModeRec<status$>
if ( rpCurrentStatus = 'N/A Not currently in use' ) or ( rpCurrentStatus = '' ) then
goto NextReactor
end
rpCurrentWO = DailySchedRec<Fpos+1> ;* cause of first field
trpCurrentWO = rpCurrentWO
* strip off extra work order information such as layering etc.
* and assign as trpcurrentWO
SeperateLayer = ''
LayPos = index( trpCurrentWO, 'LAY', 1 )
if LayPos then
BegPos = LayPos +3 ;* for length of lay
SeperateLayer = trpCurrentWO[BegPos,'F>']
swap '<LAY':SeperateLayer:'>' with '' in trpCurrentWO
end
swap '52nd' with '' in trpCurrentWO
convert @upper_case to '' in trpCurrentWO
convert @lower_case to '' in trpCurrentWO
convert " `~!@#$%^&*()_+-=\][{}|';:/?.>,<" to '' in trpCurrentWO
convert '"' to '' in trpCurrentWO
* now use that trpCurrentWO val to get the box information
extract_si_keys( 'RDS', 'WO', trpCurrentWO, TRdsRecs )
tRcnt = fieldcount( TRdsRecs, @vm )
RdsToProc = ''
if SeperateLayer then
if SeperateLayer = 1 then
* eliminate all layers except one
Trds = TRdsRecs
RdsToProc = ''
for zz = 1 to tRcnt
if index( Trds<1,zz>, '.', 1 ) else
RdsToProc := Trds<1,zz>:@vm
end
next zz
RdsToProc[-1,1] = ''
end else
* have to extract only the .layers
Trds = TRdsRecs
RdsToProc = ''
for zz = 1 to TRcnt
if index( Trds<1,zz>, '.':SeperateLayer, 1 ) then
RdsToProc := Trds<1,zz>:@vm
end
next zz
RdsToProc[-1,1] = ''
end
end
if RdsToProc then
TRdsRecs = RdsToProc
end
if TRdsRecs then
tRcnt = fieldcount( TRdsRecs, @vm )
Rdone = false$
CurrentBox = ''
RdsForRightReact = '' ;* used to build array of boxes that ran on this reactor
;* this way can find the previous one
CurRds = ''
for k = 1 to tRcnt
ThisRdsRec = xlate( 'RDS', TRdsRecs<1,k>, '', 'X' )
if ThisRdsRec<rds_reactor$> = ThisReactor then ;* may have split the WO
RdsForRightReact := TrdsRecs<1,k>:@fm
begin case
case (ThisRdsRec<rds_date_in$> <> '') and (ThisRdsRec<rds_date_out$>)
* box is finished go to the next
CurrentBox = k
CurRds = TRdsRecs<1,k>
* set the current box even if it is done this way
* if the user has not started the next box then this will show
* as the current box
case (ThisRdsRec<rds_date_in$> = '') and (ThisRdsRec<rds_date_out$> = '')
* box has not started
Rdone = true$
case (ThisRdsRec<rds_date_in$> <> '') and (ThisRdsRec<rds_date_out$> = '')
* box has started but has not finished
CurrentBox = k
Rdone = true$
CurRds = TRdsRecs<1,k>
end case
end
until Rdone
next k
if CurrentBox <> '' then
* have to reread in the case of the user did not start the next box
* then we would not have the current box rds
ThisRdsRec = xlate( 'RDS', TrdsRecs<1,CurrentBox>, '', 'X' )
rpCurrentBoxOf = 'Box ':CurrentBox:' of ':tRcnt
rpStartDate = oconv( ThisRdsRec<rds_date_in$>, 'D2/' )
rpBoxStart = oconv( ThisRdsRec<rds_time_in$>, 'MTH' )
if CurrentBox > 1 then
locate CurRds in RdsForRightReact using @fm setting RdsFPos then
rpLastBoxElapsed = xlate( 'RDS', RdsForRightReact<RdsFPos-1>, 'ELAPSED_HOURS', 'X' )
end else
rpLastBoxElapsed = ''
end
end else
rpLastBoxElapsed = 'N/A'
end
end else
rpCurrentBoxOf = 'Has not started'
rpStartDate = 'N/A'
rpBoxStart = 'N/A'
rpLastBoxElapsed = 'N/A'
end
end ;* no TRdsRecs
gosub PrintReactStat
for l = 1 to Dcnt
Table = 'Layer info':@vm:'Sched WO#':@vm:'Cnt':@vm:'Customer':@vm:'Target Thick':@vm:'Thick Measure':@vm:'Target Res':@vm:'Res Measure':@vm:'S.I.':@vm:"Conc":@vm:'Recipe'
* this is set once for each day for the detail headings
locate DatesToUse<l> in MastSchedRec<Days$> using @vm setting Dpos then
* Looping through the possible 3 days
Font<2> = 10
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', ODatesToUse<l> )
Font<2> = 8
Void = set_printer( 'FONT', Font )
DayValues = MastSchedRec<Dpos+3> ;* plus three cause of first three fields
ReactValues = DayValues<1,ThisReactor>
* strip down ReactValues to get bare WO#'S
ReactValues = field( ReactValues, '|', 1 ) ;* remove comments
swap "52nd" with '' in ReactValues
Convert ';' to @vm in ReactValues
convert @upper_case to '' in ReactValues
convert @lower_case to '' in ReactValues
convert " `~!@#$%^&*()_+-=\][{}|';:/?.>,<" to '' in ReactValues
convert '"' to '' in ReactValues
rvCnt = fieldcount( ReactValues, @vm )
for m = 1 to rvCnt
* tell Tom and Rick they need to put a value in the prod_spce_id field in the
* work order record
RptRow = ''
RptRow<1,2> = ReactValues<1,m>
extract_si_keys( 'RDS', 'WO', RptRow<1,2>, TtRdsRecs )
TBoxCnt = fieldcount( TtRdsRecs, @vm )
RptRow<1,3> = TBoxCnt
PSNId = xlate( 'WO_LOG', ReactValues<1,m>, wo_log_prod_spec_id$, 'X' )
CustId = xlate( 'WO_LOG', ReactValues<1,m>, wo_log_cust_no$, 'X' )
RptRow<1,4> = xlate( 'COMPANY', CustId, company_abbrev$, 'X' )
SpecSubstrate = xlate( 'PROD_SPEC', PSNId, prod_spec_spec_substrate$, 'X' )
EpiLayers = xlate( 'PROD_SPEC', PSNId, prod_spec_spec_epi$, 'X' )
convert char(247) to @fm in EpiLayers ;* each seperate layer
SepLCnt = fieldcount( EpiLayers, @fm)
******SEPERATE REACTOR LAYERS*********************************
for n = 1 to SepLCnt
RptRow<1,1> = 'Sep Lay ':n
ThisSepLayer = EpiLayers<n>
RptRow<1,6> = ThisSepLayer<1,QSEpiThickMeasure$>
RptRow<1,8> = field( ThisSepLayer<1,QSEpiResMeasure$>, char(248), 1 )
* above line incase of same reactor layers
if SpecSubstrate<1,QSSubInstructions$> <> '' then
RptRow<1,9> = 'Yes'
end else
RptRow<1,9> = 'No'
end
ConMinThick = iconv( ThisSepLayer<1,QSEpiConcMinThick$,1>, 'MS' );* take only first val of concentration
ConMaxThick = iconv( ThisSepLayer<1,QSEpiConcMaxThick$,1>, 'MS' );* take only first val of concentration
if ConMinThick and ConMaxThick then
if ConMinThick = ConMaxThick then
RptRow<1,10> = ConMinThick
end else
MinLessMax = (ConMaxThick-ConMinThick)
Tans = MinLessMax/2
RptRow<1,10> = ConMinThick+Tans
end
end
ResMinThick = ThisSepLayer<1,QSEpiResMinThick$>
ResMaxThick = ThisSepLayer<1,QSEpiResMaxThick$>
ResUnits = ThisSepLayer<1,QSEpiResUnits$>
MinThick = ThisSepLayer<1,QSEpiMinThick$>
MaxThick = ThisSepLayer<1,QSEpiMaxThick$>
if ResMinThick and ResMaxThick then
if ResMinThick = ResMaxThick then
RptRow<1,7> = ResMinThick
end else
Mid = ResMinThick + ((ResMaxThick-ResMinThick)/2)
RptRow<1,7> = Mid
end
end
if MinThick and MaxThick then
if MinThick = MaxThick then
RptRow<1,5> = MinThick
end else
Mid = MinThick + ((MaxThick-MinThick)/2)
RptRow<1,5> = Mid
end
end
RptRow<1,11> = ThisSepLayer<1,QSEpiRecipe$>:' ':field(ThisSepLayer<1,QSEpiRecipeName$>, char(248), 1 )
gosub PrintLayer
******SAME REACTOR LAYERS*********************************
convert char(248) to @fm in ThisSepLayer
RestOfLayers = field( ThisSepLayer, @fm, 2, 9999 )
RolCnt = fieldcount( RestOfLayers, @fm )
for o = 1 to RolCnt
RptRow<1,1> = 'Same Lay ':o
ThisSameLayer = RestOfLayers<o>
RptRow<1,6> = ThisSameLayer<1,QSEpiThickMeasure$>
RptRow<1,8> = ThisSameLayer<1,QSEpiResMeasure$>
ConMinThick = iconv( ThisSameLayer<1,QSEpiConcMinThick$,1>, 'MS' );* take only first val of concentration
ConMaxThick = iconv( ThisSameLayer<1,QSEpiConcMaxThick$,1>, 'MS' );* take only first val of concentration
if ConMinThick and ConMaxThick then
if ConMinThick = ConMaxThick then
RptRow<1,10> = ConMinThick
end else
MinLessMax = (ConMaxThick-ConMinThick)
Tans = MinLessMax/2
RptRow<1,10> = ConMinThick+Tans
end
end
ResMinThick = ThisSameLayer<1,QSEpiResMinThick$>
ResMaxThick = ThisSameLayer<1,QSEpiResMaxThick$>
ResUnits = ThisSameLayer<1,QSEpiResUnits$>
MinThick = ThisSameLayer<1,QSEpiMinThick$>
MaxThick = ThisSameLayer<1,QSEpiMaxThick$>
if ResMinThick and ResMaxThick then
if ResMinThick = ResMaxThick then
RptRow<1,7> = ResMinThick
end else
Mid = ResMinThick + ((ResMaxThick-ResMinThick)/2)
RptRow<1,7> = Mid
end
end
if MinThick and MaxThick then
if MinThick = MaxThick then
RptRow<1,5> = MinThick
end else
Mid = MinThick + ((MaxThick-MinThick)/2)
RptRow<1,5> = Mid
end
end
gosub PrintLayer
next o ;* same reactor layer
********************************************************
next n ;* seperate reactor layer
next m ;* each work order value in each day
*now extract the reactor log records for engineering for that day
*for that reactor
*SearchStr = 'CATEGORY':@vm:'E':@fm ;* show all logs requested by Tim Scullard
SearchStr = ''
SearchStr:= 'START_DATE':@vm:ODatesToUse<l>:@fm
SearchStr:= 'REACTOR':@vm:ThisReactor
SearchStr:= @fm
* do a btree.extract
btree.extract( SearchStr, 'REACTOR_LOG', DictReactorLogTable, RlKeys, '', Flag )
if Flag <> 0 then
MsgInfo = ''
MsgInfo<mcol$> = -2
MsgInfo<mrow$> = -2
MsgInfo<mtext$> = 'Error while extracting REACTOR_LOG records...'
Void = msg( '', MsgInfo )
return 0
end
if Rlkeys then
convert @vm to @fm in Rlkeys
RlKeys = key_sort( RlKeys, 'REACTOR_LOG', 'START_TIME', 1 )
Font<2> = 10
Void = set_printer( 'FONT', Font )
Void = set_printer( 'TEXT', 'Reactor Logs' )
Font<2> = 8
Void = set_printer( 'FONT', Font )
RlCnt = fieldcount( RlKeys, @fm )
Table = ''
Table<-1> = 'User':@vm:'Date':@vm:'Time':@vm:'Service':@vm:'Notes'
for p = 1 to RlCnt
ThisRlRec = xlate( 'REACTOR_LOG', RlKeys<p>, '', 'X' )
Tvar = oconv( ThisRlRec<reactor_log_entry_id$>, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )
Tvar<1,-1> = oconv( ThisRlRec<reactor_log_start_date$>, 'D2/' )
Tvar<1,-1> = oconv( ThisRlRec<reactor_log_start_time$>, 'MTH' )
*Tvar<1,-1> = ThisRlRec<reactor_log_service$>
Tvar<1,-1> = oconv( ThisRlRec<reactor_log_react_serv_id$>, '[XLATE_CONV,REACT_SERVS*DESCRIPTION]' )
Tnotes = ThisRlRec<reactor_log_notes$>
convert @tm to ' ' in Tnotes
Tvar<1,-1> = Tnotes
Table<-1> = Tvar
TableColVar = '<+2160':@vm:'^+1080':@vm:'^+1080':@vm:'<+2160':@vm:'<+8107'
x = Set_Printer("ADDTABLE", TableColVar, '', Table, '', '', 1, TB_ALL)
Table = ''
next p
end
end else
* day not found
Void = set_printer( 'TEXT', ODatesToUse<l> ):' not found in Master Scheduler...'
end
next l
end else
* not found so continue on to the 'WO_DAILY_SCHED':NEXTJ
* failed on locate
end
end else
* Daily sched rec j not found so quit
Done = true$
end
until Done
next j
if ReactorFound then
Void = set_printer( 'TEXT', '' )
Void = set_printer( 'TEXT', '' )
end
************
NextReactor:
************
next i
Void = set_printer( 'TERM', 1 )
Stat = utility( 'CURSOR', 'A' )
return 0
*============================================================================*
PrintReactStat:
Font<2> = 10
Void = set_printer( 'FONT', Font )
* printing starts here
Void = set_printer( 'TEXT', 'Reactor ':ThisReactor )
Font<2> = 8
Void = set_printer( 'FONT', Font )
Table = ''
Tvar = 'Current Status/Current WO/Current Box/Start Date/Box Start/Last Box Elapsed'
convert '/' to @vm in Tvar
Table<-1> = Tvar
Table<-1> = rpCurrentStatus:@vm:rpCurrentWo:@vm:rpCurrentBoxof:@vm:rpStartDate:@vm:rpBoxStart:@vm:oconv( rpLastBoxElapsed, 'MD2' )
TableColInfo = '<+2160':@vm:'<+2160':@vm:'^+2160':@vm:'^+1440':@vm:'^+1440':@vm:'^+2160'
x = Set_Printer("ADDTABLE", TableColInfo, '', Table, '', '', 1, TB_ALL)
rpCurrentStatus = ''
rpCurrentWo = ''
rpCurrentBoxof = ''
rpStartDate = ''
rpBoxStart = ''
rpLastBoxElapsed = ''
return
*============================================================================*
PrintLayer:
RptRow<1,5> = oconv( RptRow<1,5>, 'MD2' ) ;* target thickness
RptRow<1,7> = oconv( RptRow<1,7>, 'MD3' ) ;* target resistivity
RptRow<1,10> = oconv( RptRow<1,10>, 'MS21') ;* resistivity
Table<-1> = RptRow
TableColInfo = '<+1080':@vm:'^+1080':@vm:'<+360':@vm:'^+1800':@vm:'<+1440':@vm:'^+1714':@vm:'<+1440':@vm:'<+1714':@vm:'<+720':@vm:'<+720':@vm:'<+720'
x = Set_Printer("ADDTABLE", TableColInfo, '', Table,'', '', 1, TB_ALL)
Table = '' ;* this will remove the initial colheadings for detail lines
HoldSix = RptRow<1,6>
HoldEight = RptRow<1,8>
HoldNine = RptRow<1,9>
HoldEleven = RptRow<1,11>
RptRow = ''
RptRow<1,6> = HoldSix
RptRow<1,8> = HoldEight
RptRow<1,9> = HoldNine
RptRow<1,11> = HoldEleven
return
*============================================================================*
PrinterInit:
* initialize the printer and set the headings
if DirToPrinter = 'Yes' then
OutputParam = 0
end else
OutputParam = 3 ;* maximized print preview
end
PrintPath = Printer_Select('',1) ;* Get default printer path
Void = set_printer( 'INIT', '', '', '', 1, OutputParam,PrintPath )
TheHeader = " Engineering Report 'D' 'T' Page # 'P'"
Font = 'Times New Roman,12,L,1' ;* 14 point, Left just, Bold
convert ',' to @fm in font ;* Use @FM delimiter
Void = set_printer( 'FONTHEADFOOT', font )
Void = set_printer( 'HEADER', TheHeader, '', '' )
return
*============================================================================*