469 lines
18 KiB
Plaintext
469 lines
18 KiB
Plaintext
Compile function Report_Services_Dev3(@Service, @Params)
|
|
/***********************************************************************************************************************
|
|
|
|
Name : Report_Services
|
|
|
|
Description : Handler program for all Report services.
|
|
|
|
Notes : Application errors should be logged using the Error Services module. There are a few methodological
|
|
assumptions built into way errors are managed which are important to understand in order to properly
|
|
work with Error Services:
|
|
|
|
- The term 'top' refers to the originating procedure of a call stack and the term 'bottom' refers to
|
|
the last routine (or the current routine) within a call stack. Within the OpenInsight Debugger
|
|
this will appear backwards since the originating procedure always appears at the bottom of the
|
|
list and the current routine appears at the top of the list. We are using this orientation because
|
|
it is common to refer to the process of calling other procedures as 'drilling down'.
|
|
|
|
- The reason for defining the orientation of the call stack is because Error_Services allows for
|
|
multiple error conditions to be appended to an original error. In most cases this will happen when
|
|
a procedure at the bottom of the stack generates an error condition and then returns to its
|
|
calling procedure. This higher level procedure can optionally add more information relevant to
|
|
itself. This continues as the call stack 'bubbles' its way back to the top to where the
|
|
originating procedure is waiting.
|
|
|
|
- Native OpenInsight commands that handle errors (e.g., Set_Status, Set_FSError, Set_EventStatus)
|
|
preserve their error state until explicitly cleared. This can hinder the normal execution of code
|
|
since subsequent procedures (usually SSPs) will fail if a pre-existing error condition exists.
|
|
Our philosophy is that error conditions should automatically be cleared before a new procedure
|
|
is executed to avoid this problem. However, the nature of Basic+ does not make this easy to
|
|
automate for any given stored procedure. Therefore, if a stored procedure wants to conform to our
|
|
philosophy then it should include a call into the 'Clear' service request at the top of the
|
|
program. Alternatively this can be done through a common insert (see SERVICE_SETUP for example.)
|
|
|
|
- Service modules will use the SERVICE_SETUP insert and therefore automatically clear out any
|
|
error conditions that were set before.
|
|
|
|
Parameters :
|
|
Service [in] -- Name of the service being requested
|
|
Param1-10 [in/out] -- Additional request parameter holders
|
|
Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
|
|
|
|
Metadata :
|
|
|
|
History : (Date, Initials, Notes)
|
|
07/28/21 djs Copied original source code from Report_Services. Modified GetMaterialTrackReport
|
|
to use the SCHED_DET_NG table (i.e. Scheduler 2.0) instead of the SCHED_DET table.
|
|
|
|
|
|
***********************************************************************************************************************/
|
|
#pragma precomp SRP_PreCompiler
|
|
|
|
$Insert SERVICE_SETUP
|
|
$Insert LOGICAL
|
|
$Insert OIPRINT_EQUATES
|
|
$Insert SCHED_DET_NG_EQUATES
|
|
$Insert WO_LOG_EQUATES
|
|
$Insert APPCOLORS
|
|
$Insert MSG_EQUATES
|
|
$Insert SCHEDULE_EQU
|
|
$Insert LOCATION_EQUATES
|
|
$Insert RLIST_EQUATES
|
|
|
|
Declare subroutine Utility, ErrMsg, Set_Status, Set_Printer, RList, SRP_Stopwatch, Btree.Extract, Error_Services, V119
|
|
Declare subroutine Push.Select, Pop.Select, SRP_Stopwatch, Database_Services
|
|
Declare function Set_Printer, Get_Printer, Msg, Get_Status, Printer_Select, obj_Install, Dialog_Box, obj_Location
|
|
Declare function Error_Services, Location_Services, SRP_Array, Signature_Services
|
|
Declare function Epi_Part_Services, SRP_Math, Datetime, Database_Services
|
|
|
|
Equ TAB$ TO \09\
|
|
|
|
GoToService
|
|
|
|
Return Response or ""
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// SERVICES
|
|
//-----------------------------------------------------------------------------
|
|
|
|
Service CalculateMaterialTrackData(RptColumns, LocationFilter, NoMatFlag)
|
|
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
|
Lock hSysLists, ServiceKeyID then
|
|
|
|
NoMatFlag = True$
|
|
|
|
LocationFilter = ''
|
|
LocationFilter<1, 1> = 'SR*KTR]'
|
|
LocationFilter<1, 2> = '1K*PTI'
|
|
LocationFilter<1, 3> = 'CR*BE'
|
|
LocationFilter<1, 4> = 'CR*BO'
|
|
LocationFilter<1, 5> = 'CR*TUN'
|
|
LocationFilter<1, 6> = 'CR*EPR'
|
|
LocationFilter<1, 7> = 'CR*FE'
|
|
LocationFilter<1, 8> = 'CR*FEH'
|
|
LocationFilter<1, 9> = 'CR*FO'
|
|
LocationFilter<1, 10> = 'CR*FOH'
|
|
|
|
|
|
// All Possible Report Columns
|
|
AllRptColumns = ''
|
|
AllRptColumns<1, 1> = 'React No'
|
|
AllRptColumns<1, 2> = 'React Type'
|
|
AllRptColumns<1, 3> = 'WO No'
|
|
AllRptColumns<1, 4> = 'SAP Prod No'
|
|
AllRptColumns<1, 5> = 'Sub Part No'
|
|
AllRptColumns<1, 6> = 'Epi Part No'
|
|
AllRptColumns<1, 7> = 'WO Qty'
|
|
AllRptColumns<1, 8> = 'RX Qty'
|
|
AllRptColumns<1, 9> = 'UnRel Qty'
|
|
AllRptColumns<1, 10> = 'Kit Location'
|
|
AllRptColumns<1, 11> = 'Kit Qty'
|
|
AllRptColumns<1, 12> = '+/-'
|
|
AllRptColumns<1, 13> = 'Kit RO'
|
|
AllRptColumns<1, 14> = 'PTI RO'
|
|
AllRptColumns<1, 15> = 'Load'
|
|
AllRptColumns<1, 16> = 'Comments'
|
|
|
|
RptColumns = AllRptColumns
|
|
|
|
ErrorTitle = 'Error in service ':Service
|
|
ErrCode = ''
|
|
ErrorMsg = ''
|
|
|
|
OPEN 'SCHED_DET_NG' TO SchedDetTable then
|
|
OPEN 'DICT.SCHED_DET_NG' TO @DICT then
|
|
Today = Datetime()
|
|
|
|
ReactList = ''
|
|
WOList = ''
|
|
SchedDetKeys = ''
|
|
PrevReactNo = ''
|
|
PrevWO = ''
|
|
|
|
SelectSent = 'SELECT SCHED_DET_NG WITH STOP_DTM GE "':OCONV(Today, 'DT'):'" BY REACT_NO'
|
|
|
|
RList(SelectSent,TARGET_ACTIVELIST$,'','','')
|
|
IF Get_Status(errCode) THEN
|
|
ErrMsg(errCode)
|
|
Unlock hSysLists, ServiceKeyID else Null
|
|
RETURN
|
|
END
|
|
|
|
Done = 0
|
|
@ID = ''
|
|
LOOP
|
|
PrevSchedDetKey = @ID
|
|
READNEXT @ID ELSE Done = 1
|
|
UNTIL Done
|
|
READ SchedDetRec FROM SchedDetTable,@ID THEN
|
|
ReactNo = SchedDetRec<SCHED_DET_NG.REACT_NO$>
|
|
WONo = SchedDetRec<SCHED_DET_NG.WO_NO$>
|
|
If ReactNo NE '' then
|
|
LOCATE ReactNo IN ReactList BY 'AR' USING @FM SETTING Pos ELSE
|
|
ReactList = INSERT(ReactList,Pos,0,0,ReactNo)
|
|
END
|
|
END
|
|
If WONo NE '' then
|
|
LOCATE WONo IN WOList<Pos> USING @VM SETTING WPos ELSE
|
|
WOList = INSERT(WOList,Pos,-1,0,WONo)
|
|
SchedDetKeys = INSERT(SchedDetKeys,-1,0,0,@ID)
|
|
END
|
|
END
|
|
END
|
|
|
|
REPEAT
|
|
|
|
CALL Make.List(0,SchedDetKeys,SchedDetTable,@DICT)
|
|
|
|
DateRange = 'Effective ':OCONV(Date(),'D4')
|
|
|
|
RowIndex = 0
|
|
AllReportData = ''
|
|
@RECCOUNT = 0
|
|
FirstPass = 1
|
|
LastRecord = 0
|
|
FirstLine = 1
|
|
fontSpacing = 100
|
|
|
|
* Zero Accumulators For Each Break
|
|
|
|
Prev.ReactNo = ''
|
|
Last.ReactNo.Break = 1
|
|
|
|
GoTo ReadRecord
|
|
|
|
end else
|
|
ErrorMsg = 'Unable to open "SCHED_DET_NG" table.'
|
|
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
|
end
|
|
end else
|
|
ErrorMsg = 'Unable to open "SCHED_DET_NG" table.'
|
|
ErrMsg(ErrorTitle:@SVM:ErrorMsg)
|
|
end
|
|
Unlock hSysLists, ServiceKeyID else Null
|
|
end
|
|
|
|
End Service
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Internal GoSubs
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
ReadRecord:
|
|
|
|
* Zero Break Flags To False
|
|
|
|
ReactNo.Break=0
|
|
|
|
READNEXT @ID, Which.Value ELSE
|
|
LastRecord = 1
|
|
ReactNo.Break = 1
|
|
ReactNo = Prev.ReactNo
|
|
END
|
|
|
|
S.ATID = @ID
|
|
|
|
IF FirstPass AND LastRecord THEN
|
|
GOTO Bail
|
|
END
|
|
|
|
IF LastRecord THEN GOTO BREAKS
|
|
|
|
READO @RECORD FROM SchedDetTable,@ID ELSE
|
|
GOTO ReadRecord
|
|
END
|
|
|
|
@RECCOUNT += 1
|
|
|
|
* Calculate Value(s) For Column(s)
|
|
|
|
S.ATID = {@ID}
|
|
I.ATID = S.ATID
|
|
S.ReactNo = {REACT_NO}
|
|
I.ReactNo = S.ReactNo
|
|
S.WoNo = {WO_NO}
|
|
I.WoNo = S.WoNo
|
|
S.SubPartNo = XLATE('WO_LOG', S.WoNo, 'ORD_SUB_PART_NO', 'X')
|
|
I.SubPartNo = S.SubPartNo
|
|
S.EpiPartNo = XLATE('WO_LOG', S.WoNo, WO_LOG_EPI_PART_NO$, 'X')
|
|
I.EpiPartNo = S.EpiPartNo
|
|
S.WO_Qty = Xlate('WO_LOG', {WO_NO}, WO_LOG_WO_QTY$, 'X')
|
|
I.WO_Qty = S.WO_Qty
|
|
S.WO_RX_Qty = Xlate('WO_LOG', {WO_NO}, 'RX_QTY', 'X')
|
|
I.WO_RX_Qty = S.WO_RX_Qty
|
|
S.WO_UnRel_QTY = Xlate('WO_LOG', {WO_NO}, 'UNREL_QTY', 'X')
|
|
I.WO_UnRel_QTY = S.WO_UnRel_QTY
|
|
S.REACT_TYPE = Xlate('WO_LOG', {WO_NO}, 'REACT_TYPE', 'X')
|
|
S.ProdOrdNo = Xlate('WO_LOG', {WO_NO}, 'PROD_ORD_NO', 'X')
|
|
|
|
Locate 'SR*KTR]' in LocationFilter using @VM setting vPos then
|
|
KitData = Location_Services('GetLocationCassInfo', S.WONo, 'SR*KTR]')
|
|
SWAP CRLF$ WITH @VM IN KitData
|
|
end else
|
|
KitData = ''
|
|
end
|
|
|
|
KitCassList = KitData<3>
|
|
NewKitData = ''
|
|
|
|
Swap ',' with @VM in KitData
|
|
|
|
// Filter out cassettes on hold
|
|
NewKitData<1> = KitData<1>
|
|
Swap @VM with ',' in KitCassList
|
|
For each Cass in KitCassList using ',' setting cPos
|
|
Key = S.WONo:'*':Cass
|
|
OnHold = Xlate('WO_MAT', Key, 'HOLD', 'X')
|
|
If OnHold NE True$ then
|
|
NewKitData<3, -1> = KitData<3, cPos>
|
|
end
|
|
Next Cass
|
|
|
|
LocInfo = ''
|
|
LocInfo<1> = NewKitData<1>
|
|
LocInfo<2> = DCount(NewKitData<3>, @VM)
|
|
LocInfo<3> = NewKitData<3>
|
|
Database_Services('WriteDataRow', 'WO_LOC', S.WONo:'*':'SR*KTR]', LocInfo)
|
|
|
|
NewKitData<2> = DCount(NewKitData<3>, @VM) ; // Update cassette count
|
|
KitData = NewKitData
|
|
|
|
Swap @VM with ',' in KitData
|
|
|
|
S.KitLocation = KitData<1>
|
|
I.KitLocation = S.KitLocation
|
|
|
|
* S.KitQty = OCONV(SUM(KitData<2>) * 25,'MD0,Z')
|
|
|
|
|
|
S.KitCassCnt = COUNT(KitData<3>,',') + (KitData<3> NE '')
|
|
I.KitCassCnt = S.KitCassCnt
|
|
|
|
KitCassList = KitData<3>
|
|
S.KitQty = 0
|
|
For each CassNo in KitCassList using ','
|
|
S.KitQty += Xlate('WO_MAT', S.WONo:'*':CassNo, 'WAFER_QTY', 'X')
|
|
Next CassNo
|
|
I.KitQty = S.KitQty
|
|
|
|
Locate '1K*PTI' in LocationFilter using @VM setting vPos then
|
|
PTIData = Location_Services('GetLocationCassInfo', S.WONo, '1K*PTI')
|
|
SWAP CRLF$ WITH @VM IN PTIData
|
|
end else
|
|
PTIData = ''
|
|
end
|
|
PTICassList = PTIData<3>
|
|
NewPTIData = ''
|
|
|
|
Swap ',' with @VM in PTIData
|
|
// Filter out cassettes on hold
|
|
NewPTIData<1> = PTIData<1>
|
|
Swap @VM with ',' in PTICassList
|
|
For each Cass in PTICassList using ',' setting cPos
|
|
Key = S.WONo:'*':Cass
|
|
OnHold = Xlate('WO_MAT', Key, 'HOLD', 'X')
|
|
If OnHold NE True$ then
|
|
NewPTIData<3, -1> = PTIData<3, cPos>
|
|
end
|
|
Next Cass
|
|
|
|
LocInfo = ''
|
|
LocInfo<1> = '1K*PTI'
|
|
LocInfo<2> = DCount(NewPTIData<3>, @VM)
|
|
LocInfo<3> = NewPTIData<3>
|
|
Database_Services('WriteDataRow', 'WO_LOC', S.WONo:'*':'1K*PTI', LocInfo)
|
|
|
|
NewPTIData<2> = DCount(NewPTIData<3>, @VM) ; // Update cassette count
|
|
PTIData = NewPTIData
|
|
|
|
Swap @VM with ',' in PTIData
|
|
PTICassList = PTIData<3>
|
|
|
|
CRLocs = ''
|
|
CRLocs<0, -1> = 'CR*BE'
|
|
CRLocs<0, -1> = 'CR*BO'
|
|
CRLocs<0, -1> = 'CR*TUN'
|
|
CRLocs<0, -1> = 'CR*EPR'
|
|
CRLocs<0, -1> = 'CR*FE'
|
|
CRLocs<0, -1> = 'CR*FEH'
|
|
CRLocs<0, -1> = 'CR*FO'
|
|
CRLocs<0, -1> = 'CR*FOH'
|
|
|
|
LoadedData = ''
|
|
LocQueryList = ''
|
|
For each Loc in CRLocs using @VM setting crPos
|
|
Locate Loc in LocationFilter using @VM setting vPos then
|
|
LocQueryList<0, -1> = Loc
|
|
end
|
|
Next Loc
|
|
LoadedCassList = ''
|
|
ReactType = Xlate('WO_LOG', S.WONo, 'REACT_TYPE', 'X')
|
|
|
|
If ReactType NE 'EPP' then
|
|
If LocQueryList NE '' then
|
|
For each CRLoc in LocQueryList using @VM
|
|
CRLocCassList = ''
|
|
LoadedData = Location_Services('GetLocationCassInfo', S.WONo, CRLoc)
|
|
Swap CRLF$ with @VM in LoadedData
|
|
CassList = LoadedData<3>
|
|
Swap @VM with ',' in CassList
|
|
For each CassNo in CassList using ','
|
|
If ( (S.WONo NE '') and (CassNo NE '') ) then
|
|
WOMatKey = S.WONo:'*':CassNo
|
|
UnloadSigComp = Signature_Services('CheckSignature', WOMatKey, 'UNLOAD')
|
|
OnHold = Xlate('WO_MAT', WOMatKey, 'HOLD', 'X')
|
|
CurrStatus = Xlate('WO_MAT', WOMatKey, 'CURR_STATUS', 'X')
|
|
If Not(UnloadSigComp or OnHold or (CurrStatus EQ 'REJ') ) then
|
|
CRLocCassList<0, -1> = CassNo
|
|
Locate CassNo in LoadedCassList using @VM setting vPos else
|
|
LoadedCassList<0, -1> = CassNo
|
|
end
|
|
end
|
|
end
|
|
Next CassNo
|
|
LocInfo = ''
|
|
LocInfo<3> = CRLocCassList
|
|
Database_Services('WriteDataRow', 'WO_LOC', S.WONo:'*':CRLoc, LocInfo)
|
|
Next CRLoc
|
|
end
|
|
end
|
|
|
|
* TEST FOR CONTROL BREAK(S)
|
|
|
|
IF (S.ReactNo NE Prev.ReactNo) OR ReactNo.Break THEN
|
|
ReactNo = Prev.ReactNo
|
|
Prev.ReactNo = S.ReactNo
|
|
ReactNo.Break += 1
|
|
END
|
|
|
|
IF FirstPass THEN
|
|
FirstPass=0
|
|
GOTO DETAIL
|
|
END
|
|
|
|
|
|
BREAKS:
|
|
|
|
* Perform Last Record Output If Done
|
|
IF LastRecord THEN
|
|
colData = ''
|
|
GOTO Bail
|
|
END
|
|
|
|
|
|
DETAIL:
|
|
|
|
* Do Conversion If Any
|
|
|
|
IF S.REACTNO NE "" THEN S.REACTNO = OCONV(S.REACTNO,"MD0,")
|
|
IF S.WONO NE "" THEN S.WONO = OCONV(S.WONO,"MD0")
|
|
IF S.WO_QTY NE "" THEN S.WO_QTY = OCONV(S.WO_QTY,"MD0,")
|
|
IF S.WO_RX_QTY NE "" THEN S.WO_RX_QTY = OCONV(S.WO_RX_QTY,"MD0,")
|
|
IF S.WO_UNREL_QTY NE "" THEN S.WO_UNREL_QTY = OCONV(S.WO_UNREL_QTY,"MD0,")
|
|
|
|
* PRINT DETAIL LINE
|
|
|
|
COLDATA = ''
|
|
RowNumber = 0
|
|
|
|
/* ascending sort */
|
|
Convert @VM to ',' in KitCassList
|
|
Convert @VM to ',' in PTICassList
|
|
Convert @VM to ',' in LoadedCassList
|
|
KitCassList = SRP_Array('SortSimpleList', KitCassList, 'AscendingNumbers', ',')
|
|
PTICassList = SRP_Array('SortSimpleList', PTICassList, 'AscendingNumbers', ',')
|
|
LoadedCassList = SRP_Array('SortSimpleList', LoadedCassList, 'AscendingNumbers', ',')
|
|
|
|
CassNeeded = ''
|
|
EpiPartNo = Xlate('WO_LOG', S.WONo, 'EPI_PART_NO', 'X')
|
|
If EpiPartNo NE '' then
|
|
WPDAdjusted = Epi_Part_Services('GetAdjustedWafersPerDayScheduler', EpiPartNo, S.React_Type)
|
|
If WPDAdjusted NE '' then
|
|
CPDAdjusted = SRP_Math('CEILING', (WPDAdjusted/25) )
|
|
CassInCR = DCount(KitCassList, ',') + DCount(PTICassList, ',') + DCount(LoadedCassList, ',')
|
|
CassNeeded = CassInCR - CPDAdjusted
|
|
end
|
|
end
|
|
|
|
RowIndex += 1
|
|
Swap '.1' with '' in S.ProdOrdNo
|
|
|
|
AllReportData<RowIndex, 1> = S.ReactNo
|
|
AllReportData<RowIndex, 2> = S.React_Type
|
|
AllReportData<RowIndex, 3> = S.WONo
|
|
AllReportData<RowIndex, 4> = S.ProdOrdNo
|
|
AllReportData<RowIndex, 5> = S.SubPartNo
|
|
AllReportData<RowIndex, 6> = S.EpiPartNo
|
|
AllReportData<RowIndex, 7> = S.WO_Qty
|
|
AllReportData<RowIndex, 8> = S.WO_RX_Qty
|
|
AllReportData<RowIndex, 9> = S.WO_UnRel_Qty
|
|
AllReportData<RowIndex, 10> = S.KitLocation
|
|
AllReportData<RowIndex, 11> = S.KitQty
|
|
AllReportData<RowIndex, 12> = CassNeeded
|
|
AllReportData<RowIndex, 13> = KitCassList
|
|
AllReportData<RowIndex, 14> = PTICassList
|
|
AllReportData<RowIndex, 15> = LoadedCassList
|
|
AllReportData<RowIndex, 16> = ''
|
|
|
|
GOTO ReadRecord
|
|
|
|
Bail:
|
|
|
|
Unlock hSysLists, ServiceKeyID else Null
|
|
Database_Services('WriteDataRow', 'SYSLISTS', 'MAT_REPORT', AllReportData)
|
|
|
|
RETURN
|
|
|
|
|