diff --git a/LSL2/STPROC/LOT_SERVICES.txt b/LSL2/STPROC/LOT_SERVICES.txt index 0a7f64b..a5db4b5 100644 --- a/LSL2/STPROC/LOT_SERVICES.txt +++ b/LSL2/STPROC/LOT_SERVICES.txt @@ -326,7 +326,7 @@ Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, Vendo Lot_Services('OpenLot', CreatedLotNumber) if Error_Services('NoError') then // Move lot in - Lot_Services('MoveInLot', CreatedLotNumber, Username) + Lot_Services('StartLot', CreatedLotNumber, 'SYSTEM') if Error_Services('NoError') then If PrinterID NE 'WEB' then // If PrinterID is set to WEB this means the request comes from OI_Wizard and the client is going to handle printing. @@ -792,6 +792,33 @@ Service IsLotMovedIn(LotId) end service +Service IsLastOperation(LotId, LotOperationId) + + ErrorMsg = '' + Response = False$ + + If LotId NE '' then + If LotOperationId NE '' then + AllOpsInSeq = Lot_Services('GetLotOperationSequence', LotId) + if Error_Services('NoError') then + LastLotOperation = AllOpsInSeq[-1, "B":@FM] + If LotOperationId EQ LastLotOperation then Response = True$ + end else + ErrorMsg = Error_Services('GetMessage') + end + end else + ErrorMsg = 'LotOperationId was null.' + end + end else + ErrorMsg = 'LotId was null.' + end + + If ErrorMsg NE '' then + Error_Services('Add', ErrorMsg) + end + +end service + Service IsOperationCompleted(LotOperationId) @@ -819,8 +846,14 @@ Service StartLot(LotId, Operator) If RowExists('LOT', LotId) then Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'LOT_START', 'Lot started.', '', Operator) If Error_Services('NoError') then - Lot_Services('MoveInLot', LotId, Operator) - If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage') + CurrOperation = Lot_Services('GetLotCurrOperationName', LotId) + Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'ARRIVAL', 'Lot arrived at operation ' : CurrOperation : '.', '', Operator) + if Error_Services('NoError') then + Lot_Services('MoveInLot', LotId, Operator) + If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage') + end else + ErrorMessage = Error_Services('GetMessage') + end end else ErrorMessage = Error_Services('GetMessage') end @@ -958,12 +991,7 @@ Service MoveInLot(LotID, Operator) CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X') If Error_Services('NoError') then Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'MOVE_IN', 'Lot moved into operation ' : CurrOperation : '.', '', Operator) - If Error_Services('NoError') then - Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'ARRIVAL', 'Lot arrived at operation ' : CurrOperation : '.', '', Operator) - If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage') - end else - ErrorMessage = Error_Services('GetMessage') - end + If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage') end else ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. ' : Error_Services('GetMessage') end @@ -1018,6 +1046,7 @@ Service MoveOutLot(LotID, Operator) WaferQty = ThisLotRec If Error_Services('NoError') then ThisLotCurrOperationID = Lot_Services('GetLotCurrOperationId', LotId) + ThisLotCurrOperationName = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X') If ThisLotCurrOperationID NE '' then If Lot_Services('IsLotMovedIn', LotId) then ThisLotCurrOperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', ThisLotCurrOperationID) @@ -1029,7 +1058,23 @@ Service MoveOutLot(LotID, Operator) LotType = XLATE('LOT', LotId, LOT_TYPE$, 'X') CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X') If Error_Services('NoError') then - Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'MOVE_OUT', 'Lot moved out of operation ' : CurrOperation : '.', '', Operator) + IsLastLotOp = Lot_Services('IsLastOperation', LotId, ThisLotCurrOperationID) + if Error_Services('NoError') then + Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'MOVE_OUT', 'Lot moved out of operation ' : ThisLotCurrOperationName : '.', '', Operator) + If Error_Services('NoError') then + If Not(IsLastLotOp) then + NewCurrOperation = Lot_Services('GetLotCurrOperationName', LotId) + Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'ARRIVAL', 'Lot arrived at operation ' : NewCurrOperation : '.', '', Operator) + end else + Lot_Services('CloseLot', LotId) + if Error_Services('HasError') then + ErrorMessage = Error_Services('GetMessage') + end + end + end + end else + ErrorMessage = Error_Services('GetMessage') + end end else ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. ' : Error_Services('GetMessage') end @@ -1229,9 +1274,7 @@ Service OpenLot(LotId) LotRec = Database_Services('ReadDataRow', 'LOT', LotId, True$, 0, False$) LotRec = True$ Database_Services('WriteDataRow', 'LOT', LotId, LotRec, True$, False$, False$) - If Error_Services('NoError') then - Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'LOT_START', 'Lot created.', '', 'SYSTEM') - end else + If Error_Services('HasError') then ErrorMessage = 'Error setting lot ' : LotId : ' to open.' : Error_Services('GetMessage') end end else @@ -1272,51 +1315,39 @@ Service CloseLot(LotId) end service -Service AutoCloseTestWaferLot(LotId, CloseUserId) - +Service AutoCloseLot(LotId, CloseUserId) + AutoCloseTime = Datetime() ErrorMessage = '' If MemberOf(CloseUserId, 'LEAD') OR MemberOf(CloseUserId, 'SUPERVISOR') OR CloseUserId EQ 'SYSTEM' then LotOperations = Lot_Services('GetLotOperationSequence', LotId) for LotOperationIndex = 1 to DCount(LotOperations, @FM) + Until ErrorMessage NE '' ThisLotOperationId = LotOperations ThisOperationCompleted = Lot_Services('IsOperationCompleted', ThisLotOperationId) If Error_Services('NoError') then if Not(ThisOperationCompleted) then - ThisLotOperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', ThisLotOperationId) - if Error_Services('NoError') then - CurrLotQty = Database_Services('ReadDataColumn', 'LOT', LotId, LOT_WAFER_QTY$, True$, 0, False$) - If ThisLotOperationRec EQ '' then - ThisLotOperationRec = AutoCloseTime - end - If ThisLotOperationRec EQ '' then - ThisLotOperationRec = AutoCloseTime - end - if ThisLotOperationRec EQ '' then - ThisLotOperationRec = CloseUserId - end - if ThisLotOperationRec EQ '' then - ThisLotOperationRec = CloseUserId - end - if ThisLotOperationRec EQ '' then - ThisLotOperationRec = AutoCloseTime - end - if ThisLotOperationRec EQ '' then - ThisLotOperationRec = AutoCloseTime - end - If ThisLotOperationRec EQ '' then - ThisLotOperationRec = CurrLotQty - end - If ThisLotOperationRec EQ '' then - ThisLotOperationRec = CurrLotQty - end - Database_Services('WriteDataRow', 'LOT_OPERATION', ThisLotOperationId, ThisLotOperationRec, True$, False$, False$) - If Error_Services('HasError') then - ErrorMessage = Error_Services('GetMessage') - end - end else - ErrorMessage = Error_Services('GetMessage') - end + MovedIn = Lot_Services('IsLotMovedIn', LotId) + If MovedIn then + Lot_Services('MoveOutLot', LotId, CloseUserId) + If Error_Services('HasError') then + ErrorMessage = Error_Services('GetMessage') + end else + ErrorMessage = Error_Services('GetMessage') + end + end else + Lot_Services('MoveInLot', LotId, CloseUserId) + If Error_Services('NoError') then + If Lot_Services('IsLastOperation', LotId, ThisLotOperationId) then + Lot_Services('MoveOutLot', LotId, CloseUserId) + If Error_Services('HasError') then + ErrorMessage = Error_Services('GetMessage') + end + end + end else + ErrorMessage = Error_Services('GetMessage') + end + end end end else ErrorMessage = Error_Services('GetMessage') @@ -1326,31 +1357,12 @@ Service AutoCloseTestWaferLot(LotId, CloseUserId) ErrorMessage = CloseUserId : ' does not have permission to close this lot.' end If ErrorMessage EQ '' then - // Close Lot as there were no validation failures. - Lot_Services('CloseLot', LotId) - If Error_Services('NoError') then - LogData = '' - LogData<1> = LoggingDTM - LogData<2> = LotId - LogData<3> = CloseUserId - LogData<4> = 'Successfully marked lot as closed.' - Logging_Services('AppendLog', objLotClosureLog, LogData, @RM, @FM, False$) - end else - ErrorMessage = Error_Services('GetMessage') - LogData = '' - LogData<1> = LoggingDTM - LogData<2> = LotId - LogData<3> = CloseUserId - LogData<4> = 'Error marking lot as closed.' : ErrorMessage - Logging_Services('AppendLog', objLotClosureLog, LogData, @RM, @FM, False$) - // Send a message to FI - Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', NOTIFICATION_USER_ID$, 'X') - SentFrom = 'SYSTEM' - Subject = 'TEST WAFER LOT AUTO-CLOSURE FAILURE' - Message = 'Error in ' : service : ' with lot id ' : LotId : ' attempting to set CLOSE flag on lot. ' : ErrorMessage - Obj_Notes('Create',Recipients:@RM:SentFrom:@RM:Subject:@RM:Message) - Error_Services('Add', 'Error in ' : service : ' with lot ' : LotId : ':' : ErrorMessage) - end + LogData = '' + LogData<1> = LoggingDTM + LogData<2> = LotId + LogData<3> = CloseUserId + LogData<4> = 'Successfully marked lot as closed.' + Logging_Services('AppendLog', objLotClosureLog, LogData, @RM, @FM, False$) end else ErrorMessage = 'Error in ' : service : ' with lot ' : LotId : ':' : ErrorMessage LogData = '' @@ -1413,7 +1425,7 @@ Service ReduceLotWaferCount(LotId, ReductionQty, OperatorId) // Write Lot Event Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'REDUCE_WAFER_QTY', 'Reduced wafer count by ' : ReductionQty, '', OperatorId, False$, '') if LotNewWfrQty EQ 0 AND LotType EQ 'TW' then - ServiceParms = 'AutoCloseTestWaferLot' : SD$ : LotId : SD$ : 'SYSTEM' + ServiceParms = 'AutoCloseLot' : SD$ : LotId : SD$ : 'SYSTEM' Service_Services('PostProcedure', 'LOT_SERVICES', ServiceParms) If Error_Services('HasError') then Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', NOTIFICATION_USER_ID$, 'X') @@ -1619,3 +1631,4 @@ end service //---------------------------------------------------------------------------------------------------------------------- + diff --git a/LSL2/STPROC/OBJ_RDS2.txt b/LSL2/STPROC/OBJ_RDS2.txt index 875e5af..8b5bc10 100644 --- a/LSL2/STPROC/OBJ_RDS2.txt +++ b/LSL2/STPROC/OBJ_RDS2.txt @@ -772,9 +772,7 @@ IF NOT(UnloadFailed) THEN end else LotId = Lot_Services('GetLotIdByLegacyLotIdAndType', RDSNo, 'RDS') If Error_Services('NoError') then - Lot_Services('MoveOutLot', LotId, @User4) ; // Move out of POST_EPI operation - Lot_Services('MoveInLot', LotId, @User4) ; // Move into RDS_CLOSE operation - Lot_Services('CloseLot', LotId) + Lot_Services('AutoCloseLot', LotId, 'SYSTEM') end end @@ -1683,3 +1681,4 @@ RETURN + diff --git a/LSL2/STPROC/QA_SERVICES.txt b/LSL2/STPROC/QA_SERVICES.txt index 0af1625..ffe0962 100644 --- a/LSL2/STPROC/QA_SERVICES.txt +++ b/LSL2/STPROC/QA_SERVICES.txt @@ -3122,9 +3122,7 @@ Service SignUnloadStage(RDSNo, Username, ScanEntry) Lot_Services('MoveInLot', LotId, Username) ; // Move into POST_EPI operation // If no production wafers in this run, then move out of POST_EPI and close the lot. If Rds_Services('IsEpiProTestRun', RDSNo) then - Lot_Services('MoveOutLot', LotId, Username) ; // Move out of POST_EPI operation - Lot_Services('MoveInLot', LotId, Username) ; // Move into RDS_CLOSE operation - Lot_Services('CloseLot', LotId) + Lot_Services('AutoCloseLot', LotId, 'SYSTEM') end end end @@ -3844,3 +3842,4 @@ return +