diff --git a/LSL2/OIWIN/NDW_ADJUST_LOT_QTY.json b/LSL2/OIWIN/NDW_ADJUST_LOT_QTY.json index 24cfe06..f7ad30c 100644 --- a/LSL2/OIWIN/NDW_ADJUST_LOT_QTY.json +++ b/LSL2/OIWIN/NDW_ADJUST_LOT_QTY.json @@ -1372,9 +1372,39 @@ "<8,18,1,14>": "", "<8,18,1,15>": "COMMEVT", "<8,18,1,16>": "0" + }, + "<8,18,2>": { + "<8,18,2,1>": "X", + "<8,18,2,2>": "EXECUTE", + "<8,18,2,3>": "@WINDOW_EVENTS", + "<8,18,2,4>": { + "<8,18,2,4,1>": "@SELF", + "<8,18,2,4,2>": "@EVENT", + "<8,18,2,4,3>": "@PARAM1", + "<8,18,2,4,4>": "@PARAM2", + "<8,18,2,4,5>": "@PARAM3", + "<8,18,2,4,6>": "@PARAM4", + "<8,18,2,4,7>": "@PARAM5", + "<8,18,2,4,8>": "@PARAM6" + }, + "<8,18,2,5>": "", + "<8,18,2,6>": "", + "<8,18,2,7>": "", + "<8,18,2,8>": "", + "<8,18,2,9>": "", + "<8,18,2,10>": "", + "<8,18,2,11>": "", + "<8,18,2,12>": "", + "<8,18,2,13>": "", + "<8,18,2,14>": "", + "<8,18,2,15>": "COMMEVT", + "<8,18,2,16>": "0" } }, - "<8,19>": "CHANGED", + "<8,19>": { + "<8,19,1>": "CHANGED", + "<8,19,2>": "LOSTFOCUS" + }, "<8,20>": "", "<8,21>": "", "<8,22>": "", diff --git a/LSL2/OIWIN/NDW_MAIN.json b/LSL2/OIWIN/NDW_MAIN.json index c8bf37b..d41b404 100644 --- a/LSL2/OIWIN/NDW_MAIN.json +++ b/LSL2/OIWIN/NDW_MAIN.json @@ -3859,7 +3859,8 @@ "<1,52,16>": "", "<1,52,17>": "", "<1,52,18>": "", - "<1,52,19>": "" + "<1,52,19>": "", + "<1,52,20>": "" }, "<1,53>": { "<1,53,1>": "ITEM", @@ -9173,7 +9174,7 @@ "<2,2,39,2>": "EXECUTE", "<2,2,39,3>": "LSL2*OIWINEXE**NDW_ADJUST_LOT_QTY", "<2,2,39,4>": { - "<2,2,39,4,1>": "CreateParam", + "<2,2,39,4,1>": "", "<2,2,39,4,2>": "@WINDOW" }, "<2,2,39,5>": "", diff --git a/LSL2/OIWIN/NDW_VIEW_LOT.json b/LSL2/OIWIN/NDW_VIEW_LOT.json index 22f070d..21cd033 100644 --- a/LSL2/OIWIN/NDW_VIEW_LOT.json +++ b/LSL2/OIWIN/NDW_VIEW_LOT.json @@ -522,7 +522,7 @@ }, "<3,11>": { "<3,11,1>": "0x60000", - "<3,11,2>": "0x80000000" + "<3,11,2>": "0x80000002" }, "<3,12>": "8", "<3,13>": { @@ -1221,7 +1221,7 @@ }, "<4,11>": { "<4,11,1>": "0x60000", - "<4,11,2>": "0x80000000" + "<4,11,2>": "0x80000002" }, "<4,12>": "7", "<4,13>": { diff --git a/LSL2/STPROC/NDW_ADJUST_LOT_QTY_EVENTS.txt b/LSL2/STPROC/NDW_ADJUST_LOT_QTY_EVENTS.txt index 31e7a6a..2556489 100644 --- a/LSL2/STPROC/NDW_ADJUST_LOT_QTY_EVENTS.txt +++ b/LSL2/STPROC/NDW_ADJUST_LOT_QTY_EVENTS.txt @@ -42,6 +42,7 @@ Event WINDOW.CREATE(CreateParam) Set_Property(@Window : '.PUB_SEARCH_LOT', 'VISIBLE', True$) end end else + msg(@Window, 'Only Lead, Supervisors, or engineering may adjust lot quantities') Result = '' Result<1> = False$ End_Dialog(@Window, Result) @@ -58,27 +59,44 @@ end event Event EDL_NEW_LOT_WFR_QTY.CHANGED(NewLotQty) NewLotQty = Get_Property(@Window : '.EDL_NEW_LOT_WFR_QTY', 'TEXT') - If Num(NewLotQty) then - If NewLotQty LE 25 AND NewLotQty GE 0 then - Set_Property(@Window : '.PUB_SUBMIT', 'ENABLED', True$) + If NewLotQty NE '' then + If Num(NewLotQty) then + If NewLotQty LE 25 AND NewLotQty GE 0 then + Set_Property(@Window : '.PUB_SUBMIT', 'ENABLED', True$) + end else + msg(@Window, 'New wafer quantity value must be a number between 0 and 25.') + Set_Property(@Window : '.EDL_NEW_LOT_WFR_QTY', 'TEXT', '') + end end else - msg(@Window, 'New wafer quantity value must be a number between 0 and 25.') - end - end else - If NewLotQty NE '' then - msg(@Window, 'New wafer quantity value must be a number between 0 and 25.') - end + If NewLotQty NE '' then + msg(@Window, 'New wafer quantity value must be a number between 0 and 25.') + end + end end + end event Event EDL_LOT_NO.CHANGED(LotNo) - LotIdString = Get_Property(@Window : '.EDL_LOT_NO', 'TEXT') - Begin Case - Case LotIdString[1, 4] EQ '1TTW' - Set_Property(@Window : '.EDL_LOT_NO', 'TEXT', LotIdString[3, 999]) - Case LotIdString[1, 2] EQ '1T' - Set_Property(@Window : '.EDL_LOT_NO', 'TEXT', LotIdString[3, 999]) - End Case + + LotNo = Get_Property(@Window : '.EDL_LOT_NO', 'TEXT') + If LotNo[1, 4] EQ '1T' then + LotNo = LotNo[3, 999] + Set_Property(@Window : '.EDL_LOT_NO', 'TEXT', LotNo) + end +end event + +Event EDL_LOT_NO.LOSTFOCUS(Flag, FocusID) + Set_Property(@Window : '.EDL_CURR_WFR_QTY', 'TEXT', '') + Set_Property(@Window : '.EDL_NEW_LOT_WFR_QTY', 'TEXT', '') + LotNo = Get_Property(@Window : '.EDL_LOT_NO', 'TEXT') + If LotNo[1, 4] EQ '1T' then + LotNo = LotNo[3, 999] + Set_Property(@Window : '.EDL_LOT_NO', 'TEXT', LotNo) + end + If RowExists('LOT', LotNo) then + GoSub GetLotCurrData + end + end event Event PUB_SEARCH_LOT.CLICK() @@ -95,26 +113,43 @@ Event PUB_SUBMIT.CLICK() CurrWfrQty = Database_Services('ReadDataColumn', 'LOT', LotId, LOT_WAFER_QTY$, True$, 0, False$) AmountToDecrease = 0 AmountToIncrease = 0 - If NewWfrQty NE CurrWfrQty then - Begin Case - Case NewWfrQty LT CurrWfrQty - AmountToDecrease = CurrWfrQty - NewWfrQty - Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'REDUCE_WAFER_QTY', 'Adjust wafer count by ' : AmountToDecrease, '', AmountToDecrease, 0, '', @User4) - Case NewWfrQty GT CurrWfrQty - AmountToIncrease = NewWfrQty - CurrWfrQty - Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'BONUS_WAFER_QTY', 'Adjust wafer count by ' : AmountToIncrease, '', 0, AmountToIncrease, '', @User4) - End Case - If Error_Services('NoError') then - msg(@Window, 'Wafer quantity adjusted successfully!') - Result = '' - Result<1> = True$ - End_Dialog(@Window, Result) + If RowExists('LOT', LotId) then + If NewWfrQty NE '' then + if Num(NewWfrQty) then + If NewWfrQty NE CurrWfrQty then + MsgHead = 'Adjust lot wafer quantity' + MsgText = 'Are you sure you wish to adjust lot ' : LotId : ' wafer quantity from ' : CurrWfrQty : ' to ' : NewWfrQty : '?' + + OK = Msg(@WINDOW,'','YESNO','',MsgHead:@FM:MsgText) + If OK then + Begin Case + Case NewWfrQty LT CurrWfrQty + AmountToDecrease = CurrWfrQty - NewWfrQty + Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'REDUCE_WAFER_QTY', 'Adjust wafer count by ' : AmountToDecrease, '', AmountToDecrease, 0, '', @User4) + Case NewWfrQty GT CurrWfrQty + AmountToIncrease = NewWfrQty - CurrWfrQty + Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'BONUS_WAFER_QTY', 'Adjust wafer count by ' : AmountToIncrease, '', 0, AmountToIncrease, '', @User4) + End Case + If Error_Services('NoError') then + msg(@Window, 'Wafer quantity adjusted successfully!') + Result = '' + Result<1> = True$ + End_Dialog(@Window, Result) + end else + ErrorMessage = Error_Services('GetMessage') + msg(@Window, 'Error Adjusting wafer quantity, ' : ErrorMessage) + end + end + end + end else + msg(@Window, 'New wafer count must be a number between 0-25') + end end else - ErrorMessage = Error_Services('GetMessage') - msg(@Window, 'Error Adjusting wafer quantity, ' : ErrorMessage) + msg(@Window, 'New wafer count cannot be blank and must be a number between 0-25') end + end else + msg(@Window, 'Lot # ' : LotId : ' not found!') end - end event Event PUB_CANCEL.CLICK() @@ -139,3 +174,4 @@ GetLotCurrData: return + diff --git a/LSL2/STPROC/NDW_LOG_TEST_WAFER_USAGE_EVENTS.txt b/LSL2/STPROC/NDW_LOG_TEST_WAFER_USAGE_EVENTS.txt index 96fd9b9..cf50db8 100644 --- a/LSL2/STPROC/NDW_LOG_TEST_WAFER_USAGE_EVENTS.txt +++ b/LSL2/STPROC/NDW_LOG_TEST_WAFER_USAGE_EVENTS.txt @@ -23,7 +23,6 @@ Return EventFlow or 1 //----------------------------------------------------------------------------- Event WINDOW.CREATE(CreateParam) - PlaceDialog(-2, -2) Set_Property(@Window, 'VISIBLE', 1) NewTWSystemActive = XLATE('APP_INFO', 'NEW_TW_SYSTEM_ACTIVE_SWITCH', 1, 'X') @@ -237,13 +236,15 @@ Event PUB_SUBMIT.CLICK() If Quantity NE '' AND TWLot NE '' then if Num(Quantity) then Begin Case - Case Quantity GT 0 AND Quantity LT 25 + Case Quantity GT 0 AND Quantity LE 25 TWLots<1, -1> = TWRow<1,1> TWLotQtys<1, -1> = TWRow<1,3> Case Quantity GT 25 NotReadyReason := 'Quantity value for test wafer lot ' : TWLot : ' must be less than 25.' : CRLF$ Case Quantity LE 0 NotReadyReason := 'Quantity value for test wafer lot ' : TWLot : ' must be greater than 0.' : CRLF$ + Case Otherwise$ + NotReadyReason := 'Quantity value for test wafer lot ' : TWLot : ' is invalid.' : CRLF$ End Case end else NotReadyReason := 'Quantity value for test wafer lot ' : TWLot : ' must be a number' : CRLF$ @@ -251,7 +252,6 @@ Event PUB_SUBMIT.CLICK() end else NotReadyReason := 'A quantity of test wafers used is required for test wafer lot ' : TWLot : CRLF$ end - Next TWRow If NotReadyReason EQ '' then TRWaferKey = Test_Run_Services('CreateTestRunRecord', SelRunTypeID, SelEquipType, EquipmentID, RelatedPSN, RelatedRDS, @User4, TWLots, TWLotQtys) diff --git a/LSL2/STPROC/SCAN_SERVICES.txt b/LSL2/STPROC/SCAN_SERVICES.txt index 2c7b335..ef2f29e 100644 --- a/LSL2/STPROC/SCAN_SERVICES.txt +++ b/LSL2/STPROC/SCAN_SERVICES.txt @@ -526,12 +526,15 @@ Service ProcessScanData(ScanID, ScanJSON) ScansRow = 'TENCOR_LOAD' ScansRow= ScanData[3,99] Case ScanData[1, 16] EQ 'TWQUANTITYUPDATE' + TWLot = Field(ScanData, '|', 2) TWLotQuantity = Field(ScanData, '|', 3) ThisScanTWLots = ScansRow + Locate TWLot in ThisScanTWLots using @VM setting twPOS then ScansRow = TWLotQuantity end + Case ScanData[1, 17] EQ 'TESTRUNTYPEUPDATE' TestRunTypeId = Field(ScanData, '|', 2) ScansRow = TestRunTypeId @@ -648,17 +651,27 @@ Service ProcessScanData(ScanID, ScanJSON) If ThisTestRunType NE '' then for each TWLot in TestWaferLotData using @VM setting twPOS If ScansRow NE '' OR ScansRow GT 0 then - TWLotCurrOperation = Lot_Services('GetLotCurrOperationName', TWLot) - If TWLotCurrOperation NE 'TW_CREATE' AND TWLotCurrOperation NE 'TW_CLOSE' then - TWLotCurrOpen = Database_Services('ReadDataColumn', 'LOT', TWLot, LOT_OPEN$, True$, 0, False$) - If Not(TWLotCurrOpen) then - Abort = True$ - Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is closed and cannot be used at this time.') + TWLotCurrQty = Database_Services('ReadDataColumn', 'LOT', TWLot, LOT_WAFER_QTY$, True$, 0, False$) + ThisCurrUsageQty = ScansRow + If TWLotCurrQty GT 0 then + If TWLotCurrQty GE ThisCurrUsageQty then + TWLotCurrOperation = Lot_Services('GetLotCurrOperationName', TWLot) + If TWLotCurrOperation NE 'TW_CREATE' AND TWLotCurrOperation NE 'TW_CLOSE' then + TWLotCurrOpen = Database_Services('ReadDataColumn', 'LOT', TWLot, LOT_OPEN$, True$, 0, False$) + If Not(TWLotCurrOpen) then + Abort = True$ + Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is closed and cannot be used at this time.') + end + end else + Abort = True$ + Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is currently at ':TWLotCurrOperation:' and cannot be used at this time.') + end + end else + Scan_Services('AddNotAcceptableReason', 'Test wafer Lot ':TWLot:' does not have enough wafers. Please select ' : TWLotCurrQty : ' wafers or less.') end end else - Abort = True$ - Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is currently at ':TWLotCurrOperation:' and cannot be used at this time.') - end + Scan_Services('AddNotAcceptableReason', 'Test wafer Lot ':TWLot:' has no wafers and cannot be logged for usage.') + end end else Abort = True$ Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' must have a quantity associated with it.') @@ -1114,19 +1127,28 @@ Service ProcessScanData(ScanID, ScanJSON) Abort = False$ for each TWLot in TestWaferLotData using @VM setting twPOS If ScansRow NE '' OR ScansRow GT 0 then - - TWLotCurrOperation = Lot_Services('GetLotCurrOperationName', TWLot) - If TWLotCurrOperation NE 'TW_CREATE' AND TWLotCurrOperation NE 'TW_CLOSE' then - TWLotCurrOpen = Database_Services('ReadDataColumn', 'LOT', TWLot, LOT_OPEN$, True$, 0, False$) - If Not(TWLotCurrOpen) then - - Abort = True$ - Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is closed and cannot be used at this time.') + TWLotCurrQty = Database_Services('ReadDataColumn', 'LOT', TWLot, LOT_WAFER_QTY$, True$, 0, False$) + ThisCurrUsageQty = ScansRow + If TWLotCurrQty GT 0 then + If TWLotCurrQty GE ThisCurrUsageQty then + TWLotCurrOperation = Lot_Services('GetLotCurrOperationName', TWLot) + If TWLotCurrOperation NE 'TW_CREATE' AND TWLotCurrOperation NE 'TW_CLOSE' then + TWLotCurrOpen = Database_Services('ReadDataColumn', 'LOT', TWLot, LOT_OPEN$, True$, 0, False$) + If Not(TWLotCurrOpen) then + + Abort = True$ + Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is closed and cannot be used at this time.') + end + end else + Abort = True$ + Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is currently at ':TWLotCurrOperation:' and cannot be used at this time.') + end + end else + Scan_Services('AddNotAcceptableReason', 'Test wafer Lot ':TWLot:' does not have enough wafers. Please select ' : TWLotCurrQty : ' wafers or less.') end end else - Abort = True$ - Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' is currently at ':TWLotCurrOperation:' and cannot be used at this time.') - end + Scan_Services('AddNotAcceptableReason', 'Test wafer Lot ':TWLot:' has no wafers and cannot be logged for usage.') + end end else Abort = True$ Scan_Services('AddNotAcceptableReason', 'Lot ':TWLot:' must have a quantity associated with it.') @@ -2319,3 +2341,4 @@ return + diff --git a/LSL2/STPROC/TEST_RUN_SERVICES.txt b/LSL2/STPROC/TEST_RUN_SERVICES.txt index 61a942e..466781c 100644 --- a/LSL2/STPROC/TEST_RUN_SERVICES.txt +++ b/LSL2/STPROC/TEST_RUN_SERVICES.txt @@ -11,7 +11,7 @@ $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 +Declare function SRP_Datetime, Database_Services, Test_Run_Services, File_Services, Status, delete, Insert, Datetime, SRP_Json, MemberOf Declare subroutine Database_Services, Btree.Extract, Error_Services, Logging_Services, Rlist, Test_Run_Services, Lot_Services, SRP_Json LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\TEST_RUN_SERVICES\TestWaferProduct' @@ -318,147 +318,166 @@ Service GetTestWaferLots(ShowOnlyOpenLots) end service 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 - RunDTM = SRP_Datetime('Now') - TWRunRec = '' - TWRunRec = RunDTM - TWRunRec = RunTypeID - TWRunRec = EqpID - TWRunRec = EqpType - TWRunRec = PSNo - TWRunRec = UserID - TWRunRec = RDSNo - TWRunKey = nextkey('TEST_RUN') - Database_Services('WriteDataRow', 'TEST_RUN', TWRunKey, TWRunRec) - If Error_Services('NoError') then - 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 - IsThisLotOpen = LotRec - IsThisLotATWLot = LotRec EQ 'TW' - ThisLotCurrQty = LotRec - ThisLotPartId = LotRec - - // - 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 + //Pre-Checks. + If TWLotIds NE '' then + for each TWLotId in TWLotIds using @VM setting twLotPos + ThisTWLotCurrQty = Database_Services('ReadDataColumn', 'LOT', TWLotId, LOT_WAFER_QTY$, True$, 0, False$) + If ThisTWLotCurrQty then + ThisTWLotUsageQty = TWLotQtys<1, twLotPos> + If ThisTWLotCurrQty LT ThisTWLotUsageQty then + ErrorMessage = 'Error in Create Test Run Record routine. Lot # ' : TWLotId : ' does not have enough wafers. Please choose ' : ThisTWLotCurrQty : ' wafers or less.' end end else - ErrorMessage = 'Error in Create Test Run Record routine, Generated Test Run Key did not exist in TEST Run table.' + ErrorMessage = 'Error in Create Test Run Record routine. Lot # ' : TWLotId : ' has a zero wafer quantity.' end - - Response = TWRunKey - end else - ErrorMessage = Error_Services('GetMessage') - end + Until ErrorMessage NE '' + Next TWLotId end else - If RunTypeID EQ '' then - ErrorMessage := 'Run Type ID Missing. ' - end - If EqpType EQ '' then - ErrorMessage := 'Equipment Type ID Missing. ' - end - If EqpID EQ '' then - ErrorMessage := 'Equipment ID Missing. ' - end - If UserID EQ '' then - ErrorMessage := 'User ID Missing. ' - end + ErrorMessage = 'Error in Create Test Run Record routine. No test wafer lots entered.' end + If ErrorMessage EQ '' then + If RunTypeID NE '' AND EqpType NE '' AND EqpID NE '' AND UserID NE '' then + RunDTM = SRP_Datetime('Now') + TWRunRec = '' + TWRunRec = RunDTM + TWRunRec = RunTypeID + TWRunRec = EqpID + TWRunRec = EqpType + TWRunRec = PSNo + TWRunRec = UserID + TWRunRec = RDSNo + TWRunKey = nextkey('TEST_RUN') + Database_Services('WriteDataRow', 'TEST_RUN', TWRunKey, TWRunRec) + If Error_Services('NoError') then + 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 + IsThisLotOpen = LotRec + IsThisLotATWLot = LotRec EQ 'TW' + ThisLotCurrQty = LotRec + ThisLotPartId = LotRec + + // + 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') + end + end else + If RunTypeID EQ '' then + ErrorMessage := 'Run Type ID Missing. ' + end + If EqpType EQ '' then + ErrorMessage := 'Equipment Type ID Missing. ' + end + If EqpID EQ '' then + ErrorMessage := 'Equipment ID Missing. ' + end + If UserID EQ '' then + ErrorMessage := 'User ID Missing. ' + end + end + end If ErrorMessage NE '' then LogData = '' LogData<1, 1> = LoggingDTM @@ -751,6 +770,22 @@ Service GenerateTWCSVReport(StartDTM, StopDTM, SavePath) end service +Service IsNewTWSystemActive(UserId) + IsTWSystemActive = False$ + If UserId EQ '' then + UserId = @USER4 + end + TWTrackingSystemActive = Database_Services('ReadDataColumn', 'APP_INFO', 'NEW_TW_SYSTEM_ACTIVE_SWITCH', 1, True$, 0, False$) + If TWTrackingSystemActive EQ True$ then + IsTWSystemActive = True$ + end else + If MemberOf(UserId, 'TW_TRACKING_TEST') then + IsTWSystemActive = True$ + end + end + +end service +