Function WM_OUT_Actions_Dev(Action, CalcColName, FSList, Handle, Name, FMC, Record, Status, OrigRecord, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10) /*********************************************************************************************************************** This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written permission from Infineon. Name : WM_OUT_Actions Description : Handles calculated columns and MFS calls for the current table. Notes : This function uses @ID, @RECORD, and @DICT to make sure {ColumnName} references work correctly. If called from outside of a calculated column these will need to be set and restored. Parameters : Action [in] -- Name of the action to be taken CalcColName [in] -- Name of the calculated column that needs to be processed. Normally this should only be populated when the CalcField action is being used. FSList [in] -- The list of MFSs and the BFS name for the current file or volume. This is an @SVM delimited array, with the current MFS name as the first value in the array, and the BFS name as the last value. Normally set by a calling MFS. Handle [in] -- The file handle of the file or media map being accessed. Note, this does contain the entire handle structure that the Basic+ Open statement would provide. Normally set by a calling MFS. Name [in] -- The name (key) of the record or file being accessed. Normally set by a calling MFS. FMC [in] -- Various functions. Normally set by a calling MFS. Record [in] -- The entire record (for record-oriented functions) or a newly-created handle (for "get handle" functions). Normally set by a calling MFS. Status [in/out] -- Indicator of the success or failure of an action. Normally set by the calling MFS but for some actions can be set by the action handler to indicate failure. OrigRecord [in] -- Original content of the record being processed by the current action. This is automatically being assigned by the WRITE_RECORD and DELETE_RECORD actions within BASE_MFS. Param1-10 [in/out] -- Additional request parameter holders ActionFlow [out] -- Used to control the action chain (see the ACTION_SETUP insert for more information.) Can also be used to return a special value, such as the results of the CalcField method. History : (Date, Initials, Notes) 06/05/18 djs Original programmer. 03/07/19 djs Updated WRITE_RECORD and DELETE_RECORD actions such that calls to obj_NCR('RejQty') are now wrapped in a Sum() function call because EpiPro wafers return @VM delimited reject quantity values for each distinct RDS in the NCR record. This Sum() function call will not affect Non-EpiPro NCR records or EpiPro NCRs with only a single reject quanitity (i.e. the NCR only contains one distinct RDS). 05/10/21 djs Added WFR_STATUS calculated column to return an array of statuses per wafer per zone. This is an improvement over the RDS_CURR_STATUS calculated column that does not differentiate between zones. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler $insert LOGICAL $insert FILE.SYSTEM.EQUATES $insert ACTION_SETUP $insert RDS_TEST_EQUATES $insert RDS_EQUATES $insert WO_LOG_EQUATES $insert WM_OUT_EQUATES $insert WM_IN_EQUATES $insert WO_MAT_EQUATES $insert REACT_RUN_EQUATES $insert REACTOR_EQUATES $insert MAKEUP_WAFERS_EQUATES Declare function Database_Services, obj_NCR, obj_SAP, EpiPro_Services, obj_WO_Log, Error_Services Declare subroutine Error_Services, Database_Services, obj_NCR, obj_SAP, SAP_Services, Work_Order_Services Declare subroutine Material_Services If KeyID then GoSub Initialize_System_Variables Begin Case Case Action _EQC 'CalculateColumn' ; GoSub CalculateColumn Case Action _EQC 'READ_RECORD_PRE' ; GoSub READ_RECORD_PRE Case Action _EQC 'READ_RECORD' ; GoSub READ_RECORD Case Action _EQC 'READONLY_RECORD_PRE' ; GoSub READONLY_RECORD_PRE Case Action _EQC 'READONLY_RECORD' ; GoSub READONLY_RECORD Case Action _EQC 'WRITE_RECORD_PRE' ; GoSub WRITE_RECORD_PRE Case Action _EQC 'WRITE_RECORD' ; GoSub WRITE_RECORD Case Action _EQC 'DELETE_RECORD_PRE' ; GoSub DELETE_RECORD_PRE Case Action _EQC 'DELETE_RECORD' ; GoSub DELETE_RECORD Case Otherwise$ ; Status = 'Invalid Action' End Case If KeyID then GoSub Restore_System_Variables If Assigned(ActionFlow) else ActionFlow = ACTION_CONTINUE$ Return ActionFlow // ----- Calculated Columns -------------------------------------------------------------------------------------------- // // The typical structure of a calculated column will look like this: // // Declare function TableName_Actions // // A = {COL1} ; * Reference as many data columns in this way to ensure the dictionary dependency is generated. // // @ANS = TableName_Actions('CalcField', 'CalcColName') // // --------------------------------------------------------------------------------------------------------------------- CalculateColumn: // Make sure the ActionFlow return variable is cleared in case nothing is calculated. ActionFlow = '' Begin Case Case CalcColName EQ 'WFR_STATUS' ; GoSub WFR_STATUS End Case return WFR_STATUS: WfrStatus = '' Zones = {ZONE} RDSNos = {RDS} For each RDSNo in RDSNos using @VM setting vPos ReactRunRec = Database_Services('ReadDataRow', 'REACT_RUN', RDSNo) Zone = Zones<0, vPos> Result = '' LSKeys = ReactRunRec ZoneRDSTestKeys = '' For each RDSLayerKey in LSKeys using @VM setting lPos RDSTestKeys = Xlate('RDS_LAYER', RDSLayerKey, 'RDS_TEST_KEYS', 'X') ZoneRDSTestKeys<0, lPos> = RDSTestKeys<0, Zone> Next RDSLayerKey MetOutOfSpec = Sum(Xlate('RDS_TEST', ZoneRDSTestKeys, 'OUT_OF_SPEC', 'X')) IF MetOutOfSpec > 0 THEN Result = 'SPEC' END else ReactType = XLATE('REACTOR',ReactRunRec,REACTOR_REACT_TYPE$,'X') IF ReactType = 'EPP' THEN PocketChars = ReactRunRec InCassNos = ReactRunRec OutCassNos = ReactRunRec WaferChars = ReactRunRec UnloadSig = ReactRunRec TestFlag = 0 ProdTestFlag = 0 ProductionWafersLoaded = 0 ProductionWafersUnloaded = 0 FOR I = 1 TO COUNT(InCassNos,@VM) + (InCassNos NE '') PocketChar = PocketChars<1,I> WaferChar = WaferChars<1,I> IF PocketChar = 'TEST' THEN IF WaferChar = 'PROD' THEN ProdTestFlag = 1 IF WaferChar = 'TEST' THEN TestFlag = 1 END ELSE IF PocketChar = '' THEN IF InCassNos<1,I> NE '' THEN ProductionWafersLoaded += 1 IF OutCassNos<1,I> NE '' THEN ProductionWafersUnloaded += 1 END END NEXT I MetEntered = XLATE('RDS_LAYER',LSKeys,'TEST_MET_ENTERED','X') IF INDEX(MetEntered,'0',1) THEN MetComplete = 0 END ELSE MetComplete = 1 END BEGIN CASE CASE ProductionWafersLoaded = 0 AND (TestFlag = 1 OR ProdTestFlag = 1) AND UnloadSig = '' ; Result = 'TLOAD' CASE ProductionWafersLoaded = 0 AND (TestFlag = 1 OR ProdTestFlag = 1) AND UnloadSig NE '' ; Result = 'TULOAD' CASE ProductionWafersLoaded = 0 AND TestFlag = 0 ; Result = 'RLOAD' CASE ProductionWafersLoaded > 0 AND ProductionWafersUnloaded = 0 ; Result = 'LOAD' CASE ProductionWafersLoaded = ProductionWafersUnloaded AND MetComplete = 1 ; Result = 'ULOAD' CASE ProductionWafersLoaded = ProductionWafersUnloaded AND MetComplete = 0 ; Result = 'ULMET' CASE 1 ; *Result = 'UNK' END CASE END ELSE WONo = ReactRunRec CassNo = ReactRunRec WOStep = ReactRunRec WOMatRec = XLATE('WO_MAT',WONo:'*':CassNo,'','X') RDSKeys = '' RSCnt = 0 RunSigProfs = '' RunSignatures = '' RunSigDTMs = '' AllSigs = WOMatRec asCnt = COUNT(AllSigs,@VM) + (AllSigs NE '') FOR I = 1 TO asCnt IF AllSigs<1,I>[1,1] = WOStep THEN RSCnt += 1 RunSigProfs<1,RSCnt> = AllSigs<1,I> RunSignatures<1,RSCnt> = WOMatRec RunSigDTMs<1,RSCnt> = WOMatRec END NEXT I ProcessStart = 0 ProcessComp = 0 LOOP RunSignature = RunSignatures<1,1> RunSigProf = RunSigProfs<1,1> UNTIL RunSignature = '' ProcessStart = 1 RunSignatures = DELETE(RunSignatures,1,1,0) RunSigProfs = DELETE(RunSigProfs,1,1,0) REPEAT IF RunSignature = '' AND RunSigProf = '' AND ProcessStart = 1 THEN Result = 'COMP' END ELSE Result = RunSigProf[2,20] END END // ROTR inspection failure check -> Set status to PSTC (PostCleans) If Result EQ 'ULOAD' then RotrAction = XLATE('REACT_RUN',RDSNo,'ROTR_ACTION','X') IF RotrAction = 'F' Then ;* Drive the CURR_STATUS to PostEpi Clean if the ROTR fails Result = 'PSTC' END end end WfrStatus<0, vPos> = Result Next RDSNo ActionFlow = WfrStatus return // ----- MFS calls ----------------------------------------------------------------------------------------------------- READ_RECORD_PRE: // In order to stop a record from being read in this action these lines of code must be used: // // OrigFileError = 100 : @FM : KeyID // Status = 0 // Record = '' // ActionFlow = ACTION_STOP$ return READ_RECORD: // In order to stop a record from being read in this action these lines of code must be used: // // OrigFileError = 100 : @FM : KeyID // Status = 0 // Record = '' return READONLY_RECORD_PRE: // In order to stop a record from being read in this action these lines of code must be used: // // OrigFileError = 100 : @FM : KeyID // Status = 0 // Record = '' // ActionFlow = ACTION_STOP$ return READONLY_RECORD: // In order to stop a record from being read in this action these lines of code must be used: // // OrigFileError = 100 : @FM : KeyID // Status = 0 // Record = '' return WRITE_RECORD_PRE: WMOSlotNCRs = {SLOT_NCR} // WO_MAT column pads @VMs while WM_OUT column does not, so trim trailing @VMs from WO_MAT column. WOMatSlotNCRs = Xlate('WO_MAT', {WO_MAT_KEY}, 'EPOS_NCR', 'X') Done = False$ For Slot = 25 to 1 Step -1 If WOMatSlotNCRs<0, Slot> EQ '' then WOMatSlotNCRs = Delete(WOMatSlotNCRs, 0, Slot, 0) end else Done = True$ end Until Done Next Slot NCRMismatch = (WMOSlotNCRs NE WOMatSlotNCRs) If NCRMismatch then Record = WOMatSlotNCRs SaveRecord = Record end return WRITE_RECORD: WONo = {WO_NO} WMOKey = Name If OrigRecord NE Record then Work_Order_Services('PostWOStepUpdateRequest', WONo) Material_Services('PostWMOutUpdateRequest', WMOKey) Material_Services('PostWOMatUpdateRequest', {WO_MAT_KEY}) end // Check for RDS No changes and update WO_LOG ship qty if needed. OrigRDSNos = OrigRecord NewRDSNos = Record ShipNo = Record If ( (ShipNo NE '') and (OrigRDSNos NE NewRDSNos) ) then WOLogRec = Database_Services('ReadDataRow', 'WO_LOG', WONo) OrigShipQty = WOLogRec NewShipQty = obj_WO_Log('ShipQty',WONo:@RM:WOLogRec) If OrigShipQty NE NewShipQty then WOLogRec = NewShipQty Database_Services('WriteDataRow', 'WO_LOG', WONo, WOLogRec, True$, False$, True$) end end // Check MAKEUP_BOX flag. If False$ -> True$, then send CASS_COMP SAP transaction MakeupBox = Record MakeupBoxOrig = OrigRecord If ( (MakeupBox EQ True$) and (MakeupBoxOrig EQ False$) ) then // Send CASS_COMP SAP transaction SAP_Services('AddCassCompTransaction', {WO_MAT_KEY}) end If MakeupBox then // Populate MAKEUP_WAFERS table SlotNos = {SLOT_NO} InCassNos = {IN_CASS_NO} InSlotNos = {IN_SLOT_NO} For each SlotNo in SlotNos using @VM setting sPos InCassNo = InCassNos<0, sPos> InSlotNo = InSlotNos<0, sPos> MUWfrID = WONo:'*':InCassNo:'*':InSlotNo If InCassNo NE '' then // Add wafer to the MAKEUP_WAFERS table if it is not present If (RowExists('MAKEUP_WAFERS', MUWfrID) EQ False$) then WOMatKey = {WO_MAT_KEY} MUWfrRec = '' MUWfrRec = {SAP_BATCH_NO} MUWfrRec = {PS_NO} MUWfrRec = Xlate('WO_LOG', WONo, 'CUST_NO', 'X') MUWfrRec = Xlate('WO_LOG', WONo, 'PROD_ORD_NO', 'X') MUWfrRec = Xlate('WO_MAT', WOMatKey, 'WAFER_SIZE', 'X') MUWfrRec = {PART_NO} MUWfrRec = {RDS} MUWfrRec = WMOKey MUWfrRec = {PROD_VER_NO} MUWfrRec = {CUST_PART_NO} Database_Services('WriteDataRow', 'MAKEUP_WAFERS', SlotID, MUWfrRec, True$, False$, True$) end end else // Remove wafer from MAKEUP_WAFERS table if it is present end Next SlotNo end // Copy FQA date and datetime to the WO_MAT record. ReactType = Xlate('WO_LOG', WONo, 'REACT_TYPE', 'X') EpiPro = (ReactType EQ 'EPP') If EpiPro then OrigFQASig = OrigRecord OrigFQASigDTM = OrigRecord FQASig = Record FQASigDTM = Record If ( (OrigFQASig NE FQASig) or (OrigFQASigDTM NE FQASigDTM) ) then WOMatStage = '1MO_QA' WOMatKey = {WO_MAT_KEY} WOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey) SigProf = WOMatRec Sigs = WOMatRec SigDTMs = WOMatRec Locate WOMatStage in SigProf using @VM setting vPos then Sigs<0, vPos> = FQASig SigDTMs<0, vPos> = FQASigDTM WOMatRec = Sigs WOMatRec = SigDTMs Database_Services('WriteDataRow', 'WO_MAT', WOMatKey, WOMatRec, True$, False$, True$) end end end **** SAP BATCHMOVE_IN **** WorkOrderNo = {WO_NO} // If makeup wafers added/removed after FQA and if not shipped -> send to SAP SAPOrderNo = XLATE('WO_LOG', WorkOrderNo, WO_LOG_PROD_ORD_NO$, 'X') IF ( (SAPOrderNo NE '') and {SAP_BATCH_NO} ) THEN MakeupBox = {MAKEUP_BOX} OrigMUWONos = OrigRecord NewMUWONos = Record OrigMUCassNos = OrigRecord NewMUCassNos = Record SAPSLocFrom = '' SAPSLocTo = '' If ( (OrigMUWONos NE NewMUWONos) or (OrigMUCassNos NE NewMUCassNos) ) then Material = Xlate('WO_LOG', WorkOrderNo, 'EPI_PART_NO', 'X') For WfrIndex = 1 to 25 OrigMUCassID = '' OrigMUWONo = OrigMUWONos<0, WfrIndex> OrigMUCassNo = OrigMUCassNos<0, WfrIndex> If OrigMUWONo NE '' and OrigMUCassNo NE '' then OrigMUCassID = OrigMUWONo:'*':OrigMUCassNo NewMUCassID = '' NewMUWONo = NewMUWONos<0, WfrIndex> NewMUCassNo = NewMUCassNos<0, WfrIndex> If NewMUWONo NE '' and NewMUCassNo NE '' then NewMUCassID = NewMUWONo:'*':NewMUCassNo Begin Case Case ( (OrigMUCassID EQ '') and (NewMUCassID NE '') ) // MU wafer added If MakeupBox EQ True$ then // Current box is a makeup box and new box is a makeup box. We want to update // the batch number in SAP. SAPSLocFrom = '0400' SAPSLocTo = '0400' end else SAPSLocFrom = '0400' SAPSLocTo = '0500' end BatchFrom = Xlate('WO_MAT', NewMUCassID, 'SAP_BATCH_NO', 'X') BatchTo = {SAP_BATCH_NO} If ( (BatchTo NE '') and (BatchFrom NE '') ) then TransQty = 1 obj_SAP('AddTransaction','BATCHMOVE_IN':@RM:Material:@RM:BatchFrom:@RM:BatchTo:@RM:SAPSLocFrom:@RM:SAPSLocTo:@RM:TransQty) end Case ( (OrigMUCassID NE '') and (NewMUCassID EQ '') ) // MU wafer removed If MakeupBox EQ True$ then // Current box is a makeup box and new box is a makeup box. We want to update // the batch number in SAP. SAPSLocFrom = '0400' SAPSLocTo = '0400' end else SAPSLocFrom = '0500' SAPSLocTo = '0400' end BatchFrom = {SAP_BATCH_NO} BatchTo = Xlate('WO_MAT', OrigMUCassID, 'SAP_BATCH_NO', 'X') If ( (BatchTo NE '') and (BatchFrom NE '') ) then TransQty = 1 obj_SAP('AddTransaction','BATCHMOVE_IN':@RM:Material:@RM:BatchFrom:@RM:BatchTo:@RM:SAPSLocFrom:@RM:SAPSLocTo:@RM:TransQty) end Case Otherwise$ // No change Null End Case Next WfrIndex end end return DELETE_RECORD_PRE: return DELETE_RECORD: WorkOrderNo = {WO_NO} CassNo = {WO_MAT_CASS_NO} WoMatKey = WorkOrderNo : '*' : CassNo WoMatRec = Database_Services('ReadDataRow', 'WO_MAT', WoMatKey) WMIKey = WoMatRec WMOKey = WoMatRec If WMIKey NE '' then WMIRec = Database_Services('ReadDataRow', 'WM_IN', WMIKey) Database_Services('WriteDataRow', 'WM_IN', WMIKey, WMIRec, True$, True$, False$) end If WMOKey NE '' then WMORec = Database_Services('ReadDataRow', 'WM_OUT', WMOKey) Database_Services('WriteDataRow', 'WM_OUT', WMOKey, WMORec, True$, True$, False$) end * // If scrap after FQA and if not shipped -> send to SAP * SAPOrderNO = XLATE('WO_LOG', WorkOrderNo, WO_LOG_PROD_ORD_NO$, 'X') * IF SAPOrderNo NE '' THEN * FQASig = '' * FQADate = '' * ReactorType = XLATE('WO_LOG', WorkOrderNo, 'REACT_TYPE', 'X') * * IF (ReactorType = 'EPP') OR (ReactorType = 'EpiPro') THEN * StatusStage = '1MO_QA' * FQASig = WoMatRec * FQADate = WoMatRec * WMOutKey = Xlate('WO_MAT', WoMatKey, 'WMO_KEY', 'X') * CassStatus = Xlate('WM_OUT', WMOutKey, 'CURR_STATUS', 'X') * * END ELSE * // Non-EpiPro * StatusStage = '1QA' * SigProfile = WoMatRec * Signatures = WoMatRec * SigDTMS = WoMatRec * LOCATE StatusStage IN SigProfile USING @VM SETTING Pos THEN * FQASig = Signatures<1, Pos> * FQADate = SigDTMS<1, Pos> * end * RDSNo = Xlate('WO_MAT', WoMatKey, 'RDS_NO', 'X') * CassStatus = Xlate('RDS', RDSNo, 'CURR_STATUS', 'X') * END * * If (FQASig NE '') and (FQADate NE '') and (CassStatus NE 'SHIP') and (CassStatus NE 'COMP') then * // Add transaction * NCRNo = @ID * TransQty = Sum(obj_NCR('RejQty',NCRNo:@RM:Record)) * TransQty = TransQty * '-1' * * IF TransQty NE 0 THEN * obj_SAP('AddTransaction','SCRAP_IN':@RM:WorkOrderNo:@RM:CassNo:@RM:TransQty) * end * end * end return // ----- Internal Methods ---------------------------------------------------------------------------------------------- Initialize_System_Variables: // Save these for restoration later SaveDict = @DICT SaveID = @ID SaveRecord = @RECORD OrigFileError = @FILE.ERROR // Now make sure @DICT, ID, and @RECORD are populated CurrentDictName = '' If @DICT then DictHandle = @DICT<1, 2> Locate DictHandle in @TABLES(5) Using @FM Setting fPos then CurrentDictName = Field(@TABLES(0), @FM, fPos, 1) end end If CurrentDictName NE DictName then Open DictName to @DICT else Status = 'Unable to initialize @DICT' end @ID = KeyID If Record else // Record might not have been passed in. Read the record from the database table just to make sure. @FILE.ERROR = '' Open TableName to hTable then FullFSList = hTable[1, 'F' : @VM] BFS = FullFSList[-1, 'B' : @SVM] LastHandle = hTable[-1, 'B' : \0D\] FileHandle = \0D\ : LastHandle[1, @VM] Call @BFS(READO.RECORD, BFS, FileHandle, KeyID, FMC, Record, ReadOStatus) end end @RECORD = Record return Restore_System_Variables: Transfer SaveDict to @DICT Transfer SaveID to @ID Transfer SaveRecord to @RECORD @FILE.ERROR = OrigFileError return