Added in functionality for TW WIP Reporting

Refactored error logging and catching.
This commit is contained in:
Infineon\Ouellette 2024-10-31 08:13:46 -07:00 committed by Ouellette Jonathan (CSC FI SPS MESLEO)
parent 0ec0428f19
commit 508707f0f2
6 changed files with 478 additions and 104 deletions

View File

@ -2,15 +2,32 @@ Compile function Lot_Services(@Service, @Params)
#pragma precomp SRP_PreCompiler #pragma precomp SRP_PreCompiler
Declare function TEST_WAFER_PROD_SERVICES, SRP_Datetime, Datetime, Database_Services, Lot_Services, Error_Services, RTI_CREATEGUID Declare function TEST_WAFER_PROD_SERVICES, SRP_Datetime, Datetime, Database_Services, Lot_Services, Error_Services, RTI_CREATEGUID
Declare function SRP_Array, SRP_Json Declare function SRP_Array, SRP_Json, Environment_Services, Logging_Services
Declare subroutine Database_Services, Btree.Extract, Lot_Services, Error_Services, Labeling_Services, SRP_Json Declare subroutine Database_Services, Btree.Extract, Lot_Services, Error_Services, Labeling_Services, SRP_Json, Logging_Services
$insert LOGICAL $insert APP_INSERTS
$Insert LOT_EQUATES $Insert LOT_EQUATES
$Insert TEST_WAFER_PROD_EQUATES $Insert TEST_WAFER_PROD_EQUATES
$Insert Lot_Operation_Equates $Insert Lot_Operation_Equates
$Insert PRODUCT_OPERATION_EQUATES $Insert PRODUCT_OPERATION_EQUATES
$Insert LOT_EVENT_EQUATES $Insert LOT_EVENT_EQUATES
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\Lot'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' TestWaferLotCreation.csv'
Headers = 'Logging DTM' : @FM : 'Product Name' : @FM : 'Username' : @FM : 'Message'
objTWCreationLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' LotMove.csv'
Headers = 'Logging DTM' : @FM : 'Lot Id' : @FM : 'Username' : @FM : 'Message'
objLotMoveLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' LotEvent.csv'
Headers = 'Logging DTM' : @FM : 'Lot Id' : @FM : 'Event Type' : @FM : 'Operator' : @FM : 'Begin Wafer Qty' : @FM : 'End Wafer Qty' : @FM : 'Bonus Wafer Qty' : @FM : 'Reduce Wafer Qty' : @FM : 'Message'
objLotEventLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
Options EVENT_TYPES = 'MOVE_IN', 'MOVE_OUT', 'HOLD_ON', 'HOLD_OFF', 'REDUCE_WAFER_QTY', 'BONUS_WAFER_QTY', 'COMMENT', 'LOCATION' Options EVENT_TYPES = 'MOVE_IN', 'MOVE_OUT', 'HOLD_ON', 'HOLD_OFF', 'REDUCE_WAFER_QTY', 'BONUS_WAFER_QTY', 'COMMENT', 'LOCATION'
Options LOT_TYPES = 'TW', 'RDS', 'WM_OUT', 'WM_IN' Options LOT_TYPES = 'TW', 'RDS', 'WM_OUT', 'WM_IN'
@ -96,35 +113,56 @@ Service CreateNewTestWaferLot(LotType, ProdName, LotQty, VendorPartNo, VendorLot
ThisLotCurrOpId = Lot_Services('GetLotCurrOperation', CreatedLotNumber) ThisLotCurrOpId = Lot_Services('GetLotCurrOperation', CreatedLotNumber)
If ThisLotCurrOpId NE '' then If ThisLotCurrOpId NE '' then
Lot_Services('MoveInLot', NewLotId, LotQty, Username) Lot_Services('MoveInLot', NewLotId, LotQty, Username)
If PrinterID NE 'WEB' then if Error_Services('NoError') then
Labeling_Services('PrintTestWaferLotLabel', CreatedLotNumber, Username, PrinterID) //Set lot to open
Lot_Services('OpenLot', CreatedLotNumber)
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.
Labeling_Services('PrintTestWaferLotLabel', CreatedLotNumber, Username, PrinterID)
If Error_Services('HasError') then
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : CreatedLotNumber : ' , ' : Error_Services('GetMessage')
end
end
Lot_Services('MoveOutLot', NewLotId, LotQty, Username)
If Error_Services('NoError') then
Lot_Services('MoveInLot', NewLotId, LotQty, Username)
If Error_Services('HasError') then
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end end
Lot_Services('MoveOutLot', NewLotId, LotQty, Username)
Lot_Services('MoveInLot', NewLotId, LotQty, Username)
end else end else
//Error: Error getting current operation ErrorMessage = 'Error in Create New Test Wafer Lot Process, error getting current operation for lot: ' : NewLotId
end end
end else end else
//Error: Failed to initialize lot operations ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end end
end end
end else end else
//Lot attributes didn't write correctly. ErrorMessage = 'Error in Create New Test Wafer Lot Process, Lot attributes did not write correctly for lot: ' : NewLotId
end end
end else end else
//Error: Lot already had data ErrorMessage = 'Error in Create New Test Wafer Lot Process, Lot already had data, lot: ' : NewLotId
end end
end else end else
//Error creating new lot ID ErrorMessage = 'Error in Create New Test Wafer Lot Process, Created lot: ' : NewLotId : ' not found in LOT table.'
end end
end else end else
//Error getting new Lot ID ErrorMessage = 'Error in Create New Test Wafer Lot Process, no lot id returned.'
end end
end else end else
//Ambiguous Product name, multiple results. ErrorMessage = 'Error in Create New Test Wafer Lot Process, ambiguous product passed to routine OR no matching products found.'
end end
end else end else
//No Matching part no found ErrorMessage = 'Error in Create New Test Wafer Lot Process, product(':ProdName:') passed to routine not found.'
end end
end else end else
ErrorMessage = 'Null value passed in for ProdID' ErrorMessage = 'Null value passed in for ProdID'
@ -132,11 +170,27 @@ Service CreateNewTestWaferLot(LotType, ProdName, LotQty, VendorPartNo, VendorLot
end else end else
ErrorMessage = 'Lot type was not test wafer' ErrorMessage = 'Lot type was not test wafer'
end end
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ProdName
LogData<3> = Username
LogData<4> = 'Successfully created lot id ' : CreatedLotNumber : ' of product type ' : ProdName '.'
Logging_Services('AppendLog', objTWCreationLog, LogData, @RM, @FM, False$)
end else
Error_Services('Add', ErrorMessage)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ProdName
LogData<3> = Username
LogData<4> = ErrorMessage
Logging_Services('AppendLog', objTWCreationLog, LogData, @RM, @FM, False$)
end
Response = CreatedLotNumber Response = CreatedLotNumber
End Service End Service
Service GenerateInitialLotOperationRecords(LotId) Service GenerateInitialLotOperationRecords(LotId)
ErrorMessage = ''
If LotID NE '' then If LotID NE '' then
if RowExists('LOT', LotId) then if RowExists('LOT', LotId) then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId) LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
@ -151,19 +205,22 @@ Service GenerateInitialLotOperationRecords(LotId)
//NewOperationRecID = //NewOperationRecID =
Next operation Next operation
end else end else
//Error: No Operations returned ErrorMessage = 'No Operations found for ' : ProdId
end end
end else end else
//Error: Prod ID for lot is null ErrorMessage = 'Prod ID not specified'
end end
//ID will be LotNum + OperationID //ID will be LotNum + OperationID
//Get product operations //Get product operations
end else end else
//error: lot does not exist ErrorMessage = 'Lot ID does not exist.'
end end
end else end else
//error: null lot id ErrorMessage = 'Lot ID was null'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end end
end service end service
@ -184,35 +241,43 @@ Service GetPrescribedOperationsByProdId(ProdId, ProdType)
end service end service
Service CreateInitialLotOperationRecords(LotId) Service CreateInitialLotOperationRecords(LotId)
ErrorMessage = ''
If LotId NE '' then If LotId NE '' then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId) LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
LotType = LotRec<LOT_TYPE$> LotType = LotRec<LOT_TYPE$>
ProdId = LotRec<LOT_PROD_ID$> ProdId = LotRec<LOT_PROD_ID$>
ThisInitialProdOperations = Lot_Services('GetPrescribedOperationsByProdId', ProdId, LotType) ThisInitialProdOperations = Lot_Services('GetPrescribedOperationsByProdId', ProdId, LotType)
For each ProdOperation in ThisInitialProdOperations using @VM If Error_Services('NoError') AND ThisInitialProdOperations NE '' then
For each ProdOperation in ThisInitialProdOperations using @VM
ProdOperationRec = Database_Services('ReadDataRow', 'PRODUCT_OPERATION', ProdOperation) ProdOperationRec = Database_Services('ReadDataRow', 'PRODUCT_OPERATION', ProdOperation)
OperationID = ProdOperationRec<PRODUCT_OPERATION_OPERATION_ID$> OperationID = ProdOperationRec<PRODUCT_OPERATION_OPERATION_ID$>
OperationSequence = ProdOperationRec<PRODUCT_OPERATION_OPERATION_SEQUENCE$> OperationSequence = ProdOperationRec<PRODUCT_OPERATION_OPERATION_SEQUENCE$>
LotOperationRecID = LotId : '*' : OperationID LotOperationRecID = LotId : '*' : OperationID
If Not(RowExists('LOT_OPERATION', LotOperationRecID)) then If Not(RowExists('LOT_OPERATION', LotOperationRecID)) then
LotOperationRec = '' LotOperationRec = ''
LotOperationRec<LOT_OPERATION_LOT_ID$> = LotId LotOperationRec<LOT_OPERATION_LOT_ID$> = LotId
LotOperationRec<LOT_OPERATION_OPERATION_ID$> = OperationID LotOperationRec<LOT_OPERATION_OPERATION_ID$> = OperationID
LotOperationRec<LOT_OPERATION_OPERATION_SEQUENCE$> = OperationSequence LotOperationRec<LOT_OPERATION_OPERATION_SEQUENCE$> = OperationSequence
LotOperationRec<LOT_OPERATION_REWORK$> = False$ LotOperationRec<LOT_OPERATION_REWORK$> = False$
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationRecId, LotOperationRec) Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationRecId, LotOperationRec)
TestRec = Database_Services('ReadDataRow', 'LOT', LotId) TestRec = Database_Services('ReadDataRow', 'LOT', LotId)
end else end else
//Error: Lot Operation already existed, cannot overwrite ErrorMessage = 'Lot Operation already existed, cannot overwrite'
end end
Next Operation
end else
ErrorMessage = 'Error getting prescribed operations for lot# ' : LotId
end
Next Operation
end else end else
//Error: Lot ID was null ErrorMessage = 'Lot ID was null'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end end
TestRec = Database_Services('ReadDataRow', 'LOT', LotId)
end service end service
//Returns a @FM delimited list of operations in sequence //Returns a @FM delimited list of operations in sequence
@ -323,6 +388,8 @@ Service AddLotOperationIntoSequence(LotId, NewOperationId, NewSequence, Rework)
end service end service
Service MoveInLot(LotID, WaferQty, Operator) Service MoveInLot(LotID, WaferQty, Operator)
ErrorMessage = ''
ThisLotCurrOperationID = ''
If LotId NE '' then If LotId NE '' then
If WaferQty NE '' then If WaferQty NE '' then
If RowExists('LOT', LotId) then If RowExists('LOT', LotId) then
@ -340,26 +407,41 @@ Service MoveInLot(LotID, WaferQty, Operator)
LotType = XLATE('LOT', LotId, LOT_TYPE$, 'X') LotType = XLATE('LOT', LotId, LOT_TYPE$, 'X')
CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X') CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X')
Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'MOVE_IN', '', '', 0, 0, CurrOperation, Operator) Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'MOVE_IN', '', '', 0, 0, CurrOperation, Operator)
If Error_Services('HasError') then
ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. ' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. Error writing to lot operation record. ' : Error_Services('GetMessage')
end end
end else
ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. Error getting lots current operation.'
end end
//Log to Lot Event Table
end else end else
//Error: Error reading record ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. ' : Error_Services('GetMessage')
end end
end else end else
//Error Invalid Lot id entered ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. Lot ID not found in LOT table.'
end end
end else end else
//Error: Wafer Qty was null ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. Lot Qty was not passed to routine.'
end end
end else end else
//Error: Lot Id was null ErrorMessage = 'Error in Move In process. Lot id was not passed to routine.'
end
If ErrorMessage NE '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Successfully Moved Lot into operation ' : ThisLotCurrOperationID : '.'
Logging_Services('AppendLog', objLotMoveLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end end
end service end service
Service MoveOutLot(LotID, WaferQty, Operator) Service MoveOutLot(LotID, WaferQty, Operator)
ErrorMessage = ''
ThisLotCurrOperationID = ''
If LotId NE '' then If LotId NE '' then
If WaferQty NE '' then If WaferQty NE '' then
If RowExists('LOT', LotId) then If RowExists('LOT', LotId) then
@ -376,7 +458,6 @@ Service MoveOutLot(LotID, WaferQty, Operator)
ReduceQty = CurrLotQty - WaferQty ReduceQty = CurrLotQty - WaferQty
End Case End Case
end end
//Possibly Add locking here
If Error_Services('NoError') then If Error_Services('NoError') then
ThisLotCurrOperationID = Lot_Services('GetLotCurrOperation', LotId) ThisLotCurrOperationID = Lot_Services('GetLotCurrOperation', LotId)
If ThisLotCurrOperationID NE '' then If ThisLotCurrOperationID NE '' then
@ -387,28 +468,52 @@ Service MoveOutLot(LotID, WaferQty, Operator)
Database_Services('WriteDataRow', 'LOT_OPERATION', ThisLotCurrOperationID, ThisLotCurrOperationRec) Database_Services('WriteDataRow', 'LOT_OPERATION', ThisLotCurrOperationID, ThisLotCurrOperationRec)
If Error_Services('NoError') then If Error_Services('NoError') then
LotType = XLATE('LOT', LotId, LOT_TYPE$, 'X') LotType = XLATE('LOT', LotId, LOT_TYPE$, 'X')
CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X') CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X')
Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'MOVE_OUT', '', '', ReduceQty, BonusQty, CurrOperation, Operator) Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'MOVE_OUT', '', '', ReduceQty, BonusQty, CurrOperation, Operator)
If Error_Services('HasError') then
ErrorMessage = 'Error in Move In process for Lot id ' : LotId : '. ' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error in Move Out process for Lot id ' : LotId : '. Error writing to lot operation record. ' : Error_Services('GetMessage')
end end
end else
ErrorMessage = 'Error in Move Out process for Lot id ' : LotId : '. Error getting lots current operation.'
end end
//Log to lot event table.
end else end else
//Error: Error reading record ErrorMessage = 'Error in Move Out process for Lot id ' : LotId : '. ' : Error_Services('GetMessage')
end end
end else end else
//Error Invalid Lot id entered ErrorMessage = 'Error in Move Out process for Lot id ' : LotId : '. Lot ID not found in LOT table.'
end end
end else end else
//Error: Wafer Qty was null ErrorMessage = 'Error in Move Out process for Lot id ' : LotId : '. Lot Qty was not passed to routine.'
end end
end else end else
//Error: Lot Id was null ErrorMessage = 'Error in Move Out process. Lot id was not passed to routine.'
end
If ErrorMessage NE '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Successfully Moved Lot out of operation ' : ThisLotCurrOperationID : '.'
Logging_Services('AppendLog', objLotMoveLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Error in Move Out process for Lot id ' : LotId : '. ' : ErrorMessage
Logging_Services('AppendLog', objLotMoveLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end end
end service end service
Service CreateLotEvent(LotId, LotType=LOT_TYPES, EventDatetime, EventType=EVENT_TYPES, EventNote, EventEquipmentId, ReduceWaferQty, BonusWaferQty, OperationId, OperatorId) Service CreateLotEvent(LotId, LotType=LOT_TYPES, EventDatetime, EventType=EVENT_TYPES, EventNote, EventEquipmentId, ReduceWaferQty, BonusWaferQty, OperationId, OperatorId)
ErrorMessage = ''
BeginWaferQty = ''
EndWaferQty = ''
If LotId NE '' then If LotId NE '' then
Begin Case Begin Case
Case LotType EQ 'TW' Case LotType EQ 'TW'
@ -428,49 +533,83 @@ Service CreateLotEvent(LotId, LotType=LOT_TYPES, EventDatetime, EventType=EVENT_
OperationID = Lot_Services('GetLotCurrOperation', LotId) OperationID = Lot_Services('GetLotCurrOperation', LotId)
OperationID = XLATE('LOT_OPERATION', OperationID, LOT_OPERATION_OPERATION_ID$, 'X') OperationID = XLATE('LOT_OPERATION', OperationID, LOT_OPERATION_OPERATION_ID$, 'X')
end end
If ReduceWaferQty NE '' then //OperationId should be set by now, if not, it is an error. Raise the error and cancel any processing.
If Num(ReduceWaferQty) then If OperationID NE '' then
EndWaferQty = BeginWaferQty - ReduceWaferQty If ReduceWaferQty NE '' then
If Num(ReduceWaferQty) then
EndWaferQty = BeginWaferQty - ReduceWaferQty
end
end end
end If BonusWaferQty NE '' then
If BonusWaferQty NE '' then If Num(BonusWaferQty) then
If Num(BonusWaferQty) then EndWaferQty = BeginWaferQty + BonusWaferQty
EndWaferQty = BeginWaferQty + BonusWaferQty end
end end
end NewEventRec = ''
NewEventRec = '' NewEventRec<LOT_EVENT_LOT_ID$> = LotId
NewEventRec<LOT_EVENT_LOT_ID$> = LotId NewEventRec<LOT_EVENT_LOT_EVENT_TYPE$> = EventType
NewEventRec<LOT_EVENT_LOT_EVENT_TYPE$> = EventType NewEventRec<LOT_EVENT_EVENT_DATETIME$> = EventDatetime
NewEventRec<LOT_EVENT_EVENT_DATETIME$> = EventDatetime NewEventRec<LOT_EVENT_EVENT_NOTE$> = EventNote
NewEventRec<LOT_EVENT_EVENT_NOTE$> = EventNote NewEventRec<LOT_EVENT_EQUIPMENT_ID$> = EventEquipmentId
NewEventRec<LOT_EVENT_EQUIPMENT_ID$> = EventEquipmentId NewEventRec<LOT_EVENT_EVENT_REDUCE_WAFER_QTY$> = ReduceWaferQty
NewEventRec<LOT_EVENT_EVENT_REDUCE_WAFER_QTY$> = ReduceWaferQty NewEventRec<LOT_EVENT_EVENT_BONUS_WAFER_QTY$> = BonusWaferQty
NewEventRec<LOT_EVENT_EVENT_BONUS_WAFER_QTY$> = BonusWaferQty NewEventRec<LOT_EVENT_EVENT_BEGIN_WAFER_QTY$> = BeginWaferQty
NewEventRec<LOT_EVENT_EVENT_BEGIN_WAFER_QTY$> = BeginWaferQty NewEventRec<LOT_EVENT_EVENT_END_WAFER_QTY$> = EndWaferQty
NewEventRec<LOT_EVENT_EVENT_END_WAFER_QTY$> = EndWaferQty NewEventRec<LOT_EVENT_EVENT_OPERATION_ID$> = OperationId
NewEventRec<LOT_EVENT_EVENT_OPERATION_ID$> = OperationId NewEventRec<LOT_EVENT_EVENT_OPERATOR_ID$> = OperatorId
NewEventRec<LOT_EVENT_EVENT_OPERATOR_ID$> = OperatorId
NewEventSequence = Lot_Services('GetLotEventNextSequence', LotId) NewEventSequence = Lot_Services('GetLotEventNextSequence', LotId)
NewEventRec<LOT_EVENT_SEQUENCE$> = NewEventSequence NewEventRec<LOT_EVENT_SEQUENCE$> = NewEventSequence
Database_Services('WriteDataRow', 'LOT_EVENT', NewEventId, NewEventRec) Database_Services('WriteDataRow', 'LOT_EVENT', NewEventId, NewEventRec)
if Error_Services('HasError') then
ErrorMessage = 'Error in Create Lot Event routine, Error writing Lot Event record, ' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error in Create Lot Event routine, Current Operation for lot id ' : LotId : ' could not be determined.'
end
end else end else
//Error: Nonexistent Lot Id passed to routine ErrorMessage = 'Error in Create Lot Event routine, Lot Id passed to routine was not found in LOT table.'
end end
end else end else
//Error Missing Parameter ErrorMessage = 'Error in Create Lot Event routine, Missing event type or Operator ID.'
end end
Case LotType EQ 'RDS' Case LotType EQ 'RDS'
null ErrorMessage = 'Error in Create Lot Event routine, Lot type RDS was passed to routine and this is currently not supported.'
Case LotType EQ 'WM_OUT' Case LotType EQ 'WM_OUT'
null ErrorMessage = 'Error in Create Lot Event routine, Lot type WM_OUT was passed to routine and this is currently not supported.'
Case LotType EQ 'WM_IN' Case LotType EQ 'WM_IN'
null ErrorMessage = 'Error in Create Lot Event routine, Lot type WM_IN was passed to routine and this is currently not supported.'
Case Otherwise$ Case Otherwise$
//Error: Invalid LotType Passed to routine ErrorMessage = 'Error in Create Lot Event routine, An invalid lot type was passed to routine.'
End Case End Case
end else end else
//Error: Lot ID was null ErrorMessage = 'Error in Create Lot Event routine, A null value for Lot Id was passed to routine.'
end
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotId
LogData<3> = EventType
LogData<4> = OperatorId
LogData<5> = BeginWaferQty
LogData<6> = EndWaferQty
LogData<7> = BonusWaferQty
LogData<8> = ReduceWaferQty
LogData<9> = 'Successfully logged event.'
Logging_Services('AppendLog', objLotEventLog, LogData, @RM, @FM, False$)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotId
LogData<3> = EventType
LogData<4> = OperatorId
LogData<5> = BeginWaferQty
LogData<6> = EndWaferQty
LogData<7> = BonusWaferQty
LogData<8> = ReduceWaferQty
LogData<9> = ErrorMessage
Logging_Services('AppendLog', objLotEventLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end end
end service end service
@ -525,6 +664,10 @@ Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
SRP_JSON(objLot, 'SetValue', 'WaferQty', LotRec<LOT_WAFER_QTY$>) SRP_JSON(objLot, 'SetValue', 'WaferQty', LotRec<LOT_WAFER_QTY$>)
SRP_JSON(objLot, 'SetValue', 'VendorPartNo', LotRec<LOT_VENDOR_PART_NO$>) SRP_JSON(objLot, 'SetValue', 'VendorPartNo', LotRec<LOT_VENDOR_PART_NO$>)
SRP_JSON(objLot, 'SetValue', 'VendorLotNo', LotRec<LOT_VENDOR_LOT_NO$>) SRP_JSON(objLot, 'SetValue', 'VendorLotNo', LotRec<LOT_VENDOR_LOT_NO$>)
SRP_JSON(objLot, 'SetValue', 'Vendor', LotRec<LOT_VENDOR_CODE$>)
CurrOperation = Lot_Services('GetLotCurrOperation', LotId)
CurrOperation = Field(CurrOperation, '*', 2)
SRP_JSON(objLot, 'SetValue', 'CurrOperation', CurrOperation)
If FullObject then If FullObject then
//Events Array //Events Array
EventsArrayJson = '' EventsArrayJson = ''
@ -612,4 +755,47 @@ Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
Response = JsonString Response = JsonString
end service end service
Service OpenLot(LotId)
ErrorMessage = ''
If RowExists('LOT', LotId) then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId, True$, 0, False$)
LotRec<LOT_OPEN$> = True$
Database_Services('WriteDataRow', 'LOT', LotId, LotRec, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = 'Error setting lot ' : LotId : ' to open.' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Unable to Open Lot ' : LotId : '. Lot ID was not found in LOT table.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
end service
Service CloseLot(LotId)
ErrorMessage = ''
If RowExists('LOT', LotId) then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId, True$, 0, False$)
LotRec<LOT_OPEN$> = False$
Database_Services('WriteDataRow', 'LOT', LotId, LotRec, True$, False$, False$)
If Error_Services('HasError') then
ErrorMessage = 'Error setting lot ' : LotId : ' to closed.' : Error_Services('GetMessage')
end
end else
ErrorMessage = 'Unable to Close Lot ' : LotId : '. Lot ID was not found in LOT table.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
end service
Service HoldLot(LotId)
end service
Service UnholdLot(LotId)
end service

View File

@ -0,0 +1,107 @@
Compile function OPERATION_TW_CREATE(LotId, Action, Operator)
//Action: IN, OUT, PROCESS
Declare function Lot_Services, Error_Services, Datetime, Database_Services
Declare subroutine Database_Services, Lot_Services
#pragma precomp SRP_PreCompiler
$insert LOGICAL
$Insert APP_INSERTS
$Insert Lot_Operation_Equates
$Insert LOT_EQUATES
Success = False$
debug
If RowExists('LOT', LotId) then
If Operator NE '' and RowExists('LSL_USERS', Operator) then
Begin Case
Case Action = 'IN'
GoSub MoveIn
Case Action = 'OUT'
GoSub MoveOut
Case Action = 'PROCESS'
GoSub Process
Case Otherwise$
null
End Case
end else
Error_Services('Add', 'Operator ID was null')
end
end else
Error_Services('Add', 'Invalid lot passed to Operation routine.')
Success = False$
end
Return Success
MoveIn:
debug
//Get TW Create Operation ID
ThisOperationID = Lot_Services('GetLotCurrOperation', LotId)
If Field(ThisOperationId, '*', 1) EQ 'TW_CREATE' then
ThisLotCurrOperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', ThisOperationID)
ThisLotCurrOperationRec<LOT_OPERATION_DATETIME_IN$> = Datetime()
ThisLotCurrOperationRec<LOT_OPERATION_WAFER_IN_QTY$> = Xlate('LOT', LotId, LOT_WAFER_QTY$, 'X')
ThisLotCurrOperationRec<LOT_OPERATION_OPERATOR_IN_ID$> = Operator
Database_Services('WriteDataRow', 'LOT_OPERATION', ThisLotCurrOperationID, ThisOperationID)
If Error_Services('NoError') then
LotType = XLATE('LOT', LotId, LOT_TYPE$, 'X')
CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X')
Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'MOVE_IN', '', '', 0, 0, CurrOperation, Operator)
end
end else
Error_Services('Add', 'Failed to move in lot. Lot is not currently at TW_CREATE. Detected Operation is ' : Field(ThisOperationId, '*', 1))
end
return
MoveOut:
ThisOperationID = Lot_Services('GetLotCurrOperation', LotId)
If Field(ThisOperationId, '*', 1) EQ 'TW_CREATE' then
ThisLotCurrOperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', ThisLotCurrOperationID)
LotMovedIn = ThisLotCurrOperationRec<LOT_OPERATION_DATETIME_IN$>
If LotMovedIn then
ThisOperationSteps = ThisLotCurrOperationRec<LOT_OPERATION_STEPS$>
AllStepsCompleted = False$
for each OperationStepId in ThisOperationSteps using @VM
ThisStepComplete = Xlate('LOT_OPERATION_STEP', OperationStepId, LOT_OPERATION_STEP_STEP_COMPLETED$, 'X')
If ThisStepComplete then
AllStepsComplete = True$
end else
AllStepsComplete = False$
end
until AllStepsCompleted = False$
Next OperationStep
If AllStepsCompleted then
ThisLotCurrOperationRec<LOT_OPERATION_DATETIME_OUT$> = Datetime()
ThisLotCurrOperationRec<LOT_OPERATION_WAFER_OUT_QTY$> = Xlate('LOT', LotId, LOT_WAFER_QTY$, 'X')
ThisLotCurrOperationRec<LOT_OPERATION_OPERATOR_OUT_ID$> = Operator
Database_Services('WriteDataRow', 'LOT_OPERATION', ThisLotCurrOperationID, ThisLotCurrOperationRec)
If Error_Services('NoError') then
LotType = XLATE('LOT', LotId, LOT_TYPE$, 'X')
CurrOperation = XLATE('LOT_OPERATION', ThisLotCurrOperationID, LOT_OPERATION_OPERATION_ID$, 'X')
Lot_Services('CreateLotEvent', LotId, LotType, Datetime(), 'MOVE_OUT', '', '', ReduceQty, BonusQty, CurrOperation, Operator)
end
end else
Error_Services('Add', 'Failed to move out lot. Not all steps completed.')
end
end else
Error_Services('Add', 'Failed to move out lot. Lot was not moved in.')
end
end
return
Process:
//Get Current Step and proceed from that step onward
return
OpenLot:
return
PrintLabel:
return

View File

@ -42,7 +42,7 @@ $insert APP_INSERTS
$insert API_SETUP $insert API_SETUP
$insert HTTP_INSERTS $insert HTTP_INSERTS
Declare Function Report_Services, Oi_Wizard_Services, Logging_Services, Environment_Services Declare Function Report_Services, Oi_Wizard_Services, Logging_Services, Environment_Services, Test_Run_Services
Declare subroutine Report_Services, Logging_Services Declare subroutine Report_Services, Logging_Services
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\API\Reports' LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\API\Reports'
@ -133,6 +133,8 @@ CreateHALItem:
ReportStartDtm = Http_Services('GetQueryField', 'StartDate') ReportStartDtm = Http_Services('GetQueryField', 'StartDate')
ReportEndDtm = Http_Services('GetQueryField', 'EndDate') ReportEndDtm = Http_Services('GetQueryField', 'EndDate')
RepJSON = Report_Services('GetDailyReactorUptimeDataJSON', ReportStartDtm, ReportEndDtm) RepJSON = Report_Services('GetDailyReactorUptimeDataJSON', ReportStartDtm, ReportEndDtm)
Case ReportID = 'TestWaferWIPReport'
RepJSON = Report_Services('GetOpenTestWaferLotWIPReportJson')
Case Otherwise$ Case Otherwise$
Error_Services('Add', 'Unsupported report') Error_Services('Add', 'Unsupported report')
End Case End Case
@ -223,5 +225,3 @@ API reports.GET
HTTP_Resource_Services('LoremIpsum') HTTP_Resource_Services('LoremIpsum')
end api end api

View File

@ -81,6 +81,7 @@ Declare function Set_Printer, Get_Printer, Msg, Get_Status, Printer_Select, ob
Declare function Schedule_Services, Error_Services, Location_Services, SRP_Array, Signature_Services, obj_RDS_Test Declare function Schedule_Services, Error_Services, Location_Services, SRP_Array, Signature_Services, obj_RDS_Test
Declare function Epi_Part_Services, SRP_Math, Database_Services, SRP_JSON, Reactor_Services, SRP_Datetime Declare function Epi_Part_Services, SRP_Math, Database_Services, SRP_JSON, Reactor_Services, SRP_Datetime
Declare function SRP_Array, Environment_Services, Logging_Services, Datetime, Select_Into, Wafer_Counter_Services Declare function SRP_Array, Environment_Services, Logging_Services, Datetime, Select_Into, Wafer_Counter_Services
Declare function Lot_Services, Test_Run_Services
Equ TAB TO \09\ Equ TAB TO \09\
@ -1545,6 +1546,46 @@ Service CalcInProcessDailyPerformanceData()
end service end service
Service GetOpenTestWaferLotWIPReportJson()
ErrorMessage = ''
JSONCollection = ''
TestWaferLots = Test_Run_Services('GetTestWaferLots', True$)
hJSONCollection = ''
If SRP_JSON(hJSONCollection, 'New', 'Object') then
hTWLotArray = ''
If SRP_JSON(hTWLotArray, 'New', 'Array') then
Abort = False$
for each TestWaferLotId in TestWaferLots using @VM
ThisLotJson = Lot_Services('ConvertLotRecordToJson', TestWaferLotId, '', '', False$)
If Error_Services('NoError') then
hTWLot = ''
If (SRP_JSON(hTWLot, 'Parse', ThisLotJson) EQ '') then
SRP_JSON(hTWLotArray, 'Add', hTWLot)
SRP_JSON(hTWLot, 'Release')
end
end else
Abort = True$
end
Until Abort
Next TestWaferLotId
If Abort EQ False$ then
SRP_JSON(hJSONCollection, 'Set', 'Lots', hTWLotArray)
end
SRP_JSON(hTWLotArray, 'Release')
end else
ErrorMessage = 'Error creating test wafer Json array.'
end
JSONCollection = SRP_JSON(hJSONCollection, 'Stringify', 'Styled')
SRP_JSON(hJSONCollection, 'Release')
end else
ErrorMessage = 'Error creating test wafer Json Collection'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
Response = JSONCollection
end service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs // Internal GoSubs
@ -1845,3 +1886,4 @@ ClearCursors:
return return

View File

@ -8,9 +8,9 @@ $Insert TEST_RUN_EQUATES
$Insert TEST_RUN_WAFER_EQUATES $Insert TEST_RUN_WAFER_EQUATES
$Insert TEST_RUN_OBJ_EQUATES $Insert TEST_RUN_OBJ_EQUATES
Declare function Nextkey, Error_Services, Environment_Services, OConv, Logging_Services, SRP_Hashtable 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 Declare function SRP_Datetime, Database_Services, Test_Run_Services, File_Services, Status, delete, Insert, Datetime, SRP_Json
Declare subroutine Database_Services, Btree.Extract, Error_Services, Logging_Services, Rlist, Test_Run_Services, 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' LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\TEST_RUN_SERVICES\TestWaferProduct'
LogDate = Oconv(Date(), 'D4/') LogDate = Oconv(Date(), 'D4/')
@ -297,6 +297,24 @@ Service GetAllTestRunTypes()
Response = rtList Response = rtList
end service end service
Service GetTestWaferLots(ShowOnlyOpenLots)
ErrorMessage = ''
TestWaferLotKeys = ''
SearchString = 'TYPE':@VM:'TW':@FM
If ShowOnlyOpenLots then
SearchString := 'OPEN':@VM:True$:@FM
end
Open 'DICT.LOT' to @DICT then
Btree.Extract(SearchString, 'LOT', @DICT, TestWaferLotKeys, '', '')
end else
ErrorMessage = 'Error opening LOT dictionary.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
Response = TestWaferLotKeys
end service
Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID) Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID)
Response = '' Response = ''
ErrorMessage = '' ErrorMessage = ''
@ -326,7 +344,7 @@ Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID)
If RunTypeID EQ '' then If RunTypeID EQ '' then
ErrorMessage := 'Run Type ID Missing. ' ErrorMessage := 'Run Type ID Missing. '
end end
If EqpTypeID EQ '' then If EqpType EQ '' then
ErrorMessage := 'Equipment Type ID Missing. ' ErrorMessage := 'Equipment Type ID Missing. '
end end
If EqpID EQ '' then If EqpID EQ '' then
@ -346,7 +364,7 @@ Service CreateTestRunRecord(RunTypeID, EqpType, EqpID, PSNo, RDSNo, UserID)
end end
end service end service
Service CreateTestRunWaferRecord(TestRunID, TWPartID, TWUsageTypeID, SourceLotID) Service CreateTestRunWaferRecord(TestRunID, TWPartID, TWUsageTypeID, SourceLotID, Username)
ErrorMessage = '' ErrorMessage = ''
If TestRunID NE '' AND TWPartID NE '' then If TestRunID NE '' AND TWPartID NE '' then
If RowExists('TEST_RUN', TestRunID) then If RowExists('TEST_RUN', TestRunID) then
@ -366,6 +384,9 @@ Service CreateTestRunWaferRecord(TestRunID, TWPartID, TWUsageTypeID, SourceLotID
Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM) Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM)
//Increment Usage in TEST_WAFER_PROD Record //Increment Usage in TEST_WAFER_PROD Record
Test_Run_Services('IncrementTWProdUsage', TWPartID) Test_Run_Services('IncrementTWProdUsage', TWPartID)
If SourceLotID NE '' then
Test_Run_Services('UseTWFromLot', SourceLotId, 1, Username)
end
Response = TRWaferKey Response = TRWaferKey
end else end else
ErrorMessage := 'Error writing TEST_RUN_WAFER record with key of ' : TRWaferKey '. ' ErrorMessage := 'Error writing TEST_RUN_WAFER record with key of ' : TRWaferKey '. '
@ -389,6 +410,19 @@ Service CreateTestRunWaferRecord(TestRunID, TWPartID, TWUsageTypeID, SourceLotID
Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM) Logging_Services('AppendLog', objLogTR, LogData, @FM, @VM)
end end
end service end service
Service UseTWFromLot(LotId, UsageQty, Username)
ErrorMessage = ''
If RowExists('LOT', LotId) then
Lot_Services('CreateLotEvent', LotId, 'TW', Datetime(), 'REDUCE_WAFER_QTY', 'Consumed test wafer.', '', UsageQty, 0, '', Username)
end else
ErrorMessage = 'Error logging wafer consumption from Lot # ' : LotId : '. Lot does not exist in LOT table.'
end
If ErrorMessage EQ '' then
end else
//Log Error
end
end service
Service GetTestRunById(TestRunID) Service GetTestRunById(TestRunID)
If TestRunID NE '' then If TestRunID NE '' then
@ -603,3 +637,4 @@ end service

View File

@ -1,20 +1,24 @@
compile insert LOT_EQUATES compile insert LOT_EQUATES
/*---------------------------------------- /*----------------------------------------
Author : Table Create Insert Routine Author : Table Create Insert Routine
Written : 11/10/2024 Written : 28/10/2024
Description : Insert for Table LOT Description : Insert for Table LOT
----------------------------------------*/ ----------------------------------------*/
#ifndef __LOT_EQUATES__ #ifndef __LOT_EQUATES__
#define __LOT_EQUATES__ #define __LOT_EQUATES__
equ LOT_TYPE$ to 1 equ LOT_TYPE$ to 1
equ LOT_PROD_ID$ to 2 equ LOT_PROD_ID$ to 2
equ LOT_ORIG_WAFER_QTY$ to 3 equ LOT_ORIG_WAFER_QTY$ to 3
equ LOT_WAFER_QTY$ to 4 equ LOT_WAFER_QTY$ to 4
equ LOT_VENDOR_PART_NO$ to 5 equ LOT_VENDOR_PART_NO$ to 5
equ LOT_VENDOR_LOT_NO$ to 6 equ LOT_VENDOR_LOT_NO$ to 6
equ LOT_VENDOR_CODE$ to 7 equ LOT_VENDOR_CODE$ to 7
equ LOT_LOT_EVENTS$ to 8 equ LOT_LOT_EVENTS$ to 8
equ LOT_LOT_OPERATIONS$ to 9 equ LOT_LOT_OPERATIONS$ to 9
equ LOT_TEST_RUN_WAFER_IDS$ to 10
equ LOT_OPEN$ to 11
equ LOT_HOLD$ to 12
equ LOT_HOT$ to 13
#endif #endif