Re-adding from old branch

This commit is contained in:
Infineon\Ouellette
2024-11-19 15:51:39 -07:00
committed by Ouellette Jonathan (CSC FI SPS MESLEO)
parent ef1744c8b1
commit 3a2ff00722
14 changed files with 2821 additions and 1783 deletions

View File

@ -7,6 +7,8 @@ $Insert TEST_WAFER_TYPES_DISPO_OPTIONS_EQUATES
$Insert TEST_RUN_EQUATES
$Insert TEST_RUN_WAFER_EQUATES
$Insert TEST_RUN_OBJ_EQUATES
$Insert LOT_EQUATES
$Insert LOT_OPERATION_EQUATES
Declare function Nextkey, Error_Services, Environment_Services, OConv, Logging_Services, SRP_Hashtable, Lot_Services
Declare function SRP_Datetime, Database_Services, Test_Run_Services, File_Services, Status, delete, Insert, Datetime, SRP_Json
@ -315,7 +317,9 @@ Service GetTestWaferLots(ShowOnlyOpenLots)
Response = TestWaferLotKeys
end service
Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID)
Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID, TWLotIds, TWLotQtys)
TWRunKey = ''
Response = ''
ErrorMessage = ''
If RunTypeID NE '' AND EqpType NE '' AND EqpID NE '' AND UserID NE '' then
@ -331,11 +335,112 @@ Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID)
TWRunKey = nextkey('TEST_RUN')
Database_Services('WriteDataRow', 'TEST_RUN', TWRunKey, TWRunRec)
If Error_Services('NoError') then
LogData = ''
LogData<1, 1> = LoggingDTM
LogData<1, 2> = @User4
LogData<1, 3> = 'Successfully created new TEST_RUN record with ID of ' : TWRunKey
Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM)
If RowExists('TEST_RUN', TWRunKey) then
LogData = ''
LogData<1, 1> = LoggingDTM
LogData<1, 2> = UserID
LogData<1, 3> = 'Successfully created new TEST_RUN record with ID of ' : TWRunKey
Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM)
//Now create the test wafer usages
Success = False$
If TWLotIds NE '' then
//Supports new logging methods.
for each TWLotId in TWLotIds using @VM setting twlPos
LotRec = Database_Services('ReadDataRow', 'LOT', TWLotId, True$, 0, False$)
IsThisLotOnHold = LotRec<LOT_HOLD$>
IsThisLotOpen = LotRec<LOT_OPEN$>
IsThisLotATWLot = LotRec<LOT_TYPE$> EQ 'TW'
ThisLotCurrQty = LotRec<LOT_WAFER_QTY$>
ThisLotPartId = LotRec<LOT_PROD_ID$>
//
ThisUsageQty = TWLotQtys<1, twlPos>
If IsThisLotOpen then
If Not(IsThisLotOnHold) then
If IsThisLotATWLot then
InAtTWInUse = False$
Loop
LotMovedIn = Lot_Services('IsLotMovedIn', TWLotId)
ThisLotCurrOperationId = Lot_Services('GetLotCurrOperationId', TWLotId)
ThisLotCurrOperation = Database_Services('ReadDataColumn', 'LOT_OPERATION', ThisLotCurrOperationId, LOT_OPERATION_OPERATION_ID$, True$, 0, False$)
Begin Case
Case ThisLotCurrOperation EQ 'TW_IN_USE'
If Not(LotMovedIn) then
Lot_Services('CreateLotEvent', TWLotId, 'TW', Datetime(), 'MOVE_IN', 'Move into TW_IN_USE', '', 0, 0, '', UserID)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
end else
InAtTWInUse = True$
end
Case ThisLotCurrOperation EQ 'TW_READY_TO_USE'
If Not(LotMovedIn) then
Lot_Services('CreateLotEvent', TWLotId, 'TW', Datetime(), 'MOVE_IN', 'Move into TW_READY_TO_USE', '', 0, 0, '', UserID)
end else
Lot_Services('CreateLotEvent', TWLotId, 'TW', Datetime(), 'MOVE_OUT', 'Move out of TW_READY_TO_USE', '', 0, 0, '', UserID)
end
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
Case Otherwise$
ErrorMessage = 'Error: Lot ':TWLotId:' is currently at ' : ThisLotCurrOperation : '. It cannot be used at this time.'
End Case
Until ErrorMessage NE '' Or InAtTWInUse
Repeat
If InAtTWInUse then
if Num(ThisUsageQty) then
If ThisUsageQty GT 0 then
//Now check that the usage QTY can be consumed from the TW Lot
ThisLotCurrQty = Database_Services('ReadDataColumn', 'LOT', TWLotId, LOT_WAFER_QTY$, True$, 0, False$)
If ThisUsageQty LE ThisLotCurrQty then
Abort = false$
for i = 1 to ThisUsageQty
Test_Run_Services('CreateTestRunWaferRecord',TWRunKey, ThisLotPartId, RunTypeID, TWLotId, UserID)
If Error_Services('HasError') then
ErrorMessage = Error_Services('GetMessage')
end
until ErrorMessage NE ''
Next i
If ErrorMessage EQ '' then
Lot_Services('CreateLotEvent', TWLotId, 'TW', Datetime(), 'REDUCE_WAFER_QTY', ThisUsageQty : ' wafers consumed from lot.', EqpID, ThisUsageQty, 0, '', UserID)
end
end else
ErrorMessage = 'Error in Create Test Run Record routine, ' : TWLotId : ' does not have enough wafers.'
end
end
end else
ErrorMessage = 'Error in Create Test Run Record routine, Invalid qty for lot ' : TWLotId : ' passed to routine.'
end
end
end else
//Lot is not classified as a test wafer lot.
end
end else
//Lot is on hold
end
end else
//Lot is not open
end
until ErrorMessage NE ''
Next TWLotId
If ErrorMessage EQ '' then
//commit everything
end else
//commit nothing, there was an error.
end
end else
//Supports legacy TW logging
Response = TWRunKey
end
end else
ErrorMessage = 'Error in Create Test Run Record routine, Generated Test Run Key did not exist in TEST Run table.'
end
Response = TWRunKey
end else
ErrorMessage = Error_Services('GetMessage')
@ -364,30 +469,32 @@ Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID)
end
end service
Service CreateTestRunWaferRecord(TestRunID, TWPartID, TWUsageTypeID, SourceLotID)
Service CreateTestRunWaferRecord(TestRunID, TWPartID, TWUsageTypeID, SourceLotId, Username)
ErrorMessage = ''
If TestRunID NE '' AND TWPartID NE '' then
If RowExists('TEST_RUN', TestRunID) then
TRWaferRec = ''
TRWaferRec<TEST_RUN_WAFER_TEST_RUN_ID$> = TestRunID
TRWaferRec<TEST_RUN_WAFER_TEST_WAFER_PROD_ID$> = TWPartID
TRWaferRec<TEST_RUN_WAFER_TEST_USAGE_TYPE_ID$> = TWUsageTypeID
TRWaferRec<TEST_RUN_WAFER_SOURCE_LOT_ID$> = SourceLotID
TRWaferKey = Nextkey('TEST_RUN_WAFER')
Database_Services('WriteDataRow', 'TEST_RUN_WAFER', TRWaferKey, TRWaferRec)
If Error_Services('NoError') AND RowExists('TEST_RUN_WAFER', TRWaferKey) then
LogData = ''
LogData<1, 1> = LoggingDTM
LogData<1, 2> = @User4
LogData<1, 3> = 'Successfully wrote ' : TRWaferKey : ' to the TEST_RUN_WAFER table.'
Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM)
//Increment Usage in TEST_WAFER_PROD Record
Test_Run_Services('IncrementTWProdUsage', TWPartID)
Response = TRWaferKey
end else
ErrorMessage := 'Error writing TEST_RUN_WAFER record with key of ' : TRWaferKey '. '
end
//Legacy Code: Pre LOT usage
TRWaferRec = ''
TRWaferRec<TEST_RUN_WAFER_TEST_RUN_ID$> = TestRunID
TRWaferRec<TEST_RUN_WAFER_TEST_WAFER_PROD_ID$> = TWPartID
TRWaferRec<TEST_RUN_WAFER_TEST_USAGE_TYPE_ID$> = TWUsageTypeID
TRWaferRec<TEST_RUN_WAFER_SOURCE_LOT_ID$> = SourceLotID
TRWaferKey = Nextkey('TEST_RUN_WAFER')
Database_Services('WriteDataRow', 'TEST_RUN_WAFER', TRWaferKey, TRWaferRec)
If Error_Services('NoError') AND RowExists('TEST_RUN_WAFER', TRWaferKey) then
LogData = ''
LogData<1, 1> = LoggingDTM
LogData<1, 2> = @User4
LogData<1, 3> = 'Successfully wrote ' : TRWaferKey : ' to the TEST_RUN_WAFER table.'
Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM)
//Increment Usage in TEST_WAFER_PROD Record
If ErrorMessage = '' then
Test_Run_Services('IncrementTWProdUsage', TWPartID)
Response = TRWaferKey
end
end else
ErrorMessage := 'Error writing TEST_RUN_WAFER record with key of ' : TRWaferKey '. '
end
end else
ErrorMessage := 'Unable to find parent TEST_RUN record. '
end
@ -403,10 +510,12 @@ Service CreateTestRunWaferRecord(TestRunID, TWPartID, TWUsageTypeID, SourceLotID
LogData = ''
LogData<1, 1> = LoggingDTM
LogData<1, 2> = @User4
LogData<1, 3> = 'Error Writing ' : TWRunKey : ' to the TEST_RUN_WAFER table. ' : ErrorMessage
LogData<1, 3> = 'Error Writing to the TEST_RUN_WAFER table. ' : ErrorMessage
Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM)
Error_Services('Add', 'Error creating new test run record: ' : ErrorMessage)
end
end service
Service UseTWFromLot(LotId, UsageQty, Username)
ErrorMessage = ''
If RowExists('LOT', LotId) then
@ -635,3 +744,4 @@ end service