Merged PR 21151: Return To Fab Operations and Processing

This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO)
2025-07-16 21:17:07 +02:00
parent b607432be4
commit aabd4c3a91
56 changed files with 8856 additions and 2508 deletions

View File

@ -46,21 +46,25 @@ Compile function Lot_Services(@Service, @Params)
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$Insert SERVICE_SETUP
$Insert APP_INSERTS
Declare function TEST_WAFER_PROD_SERVICES, SRP_Datetime, Datetime, Database_Services, Lot_Services, Error_Services, RTI_CREATEGUID
Declare function SRP_Array, SRP_Json, Environment_Services, Logging_Services, MemberOf, Lot_Event_Services, GetTickCount, Lot_Operation_Services
Declare function PSN_Services, Return_To_Fab_Services
Declare subroutine Database_Services, Btree.Extract, Lot_Services, Error_Services, Labeling_Services, SRP_Json, Logging_Services
Declare subroutine SRP_Run_Command, Service_Services, obj_notes, Lot_Event_Services, Mona_Services
$insert APP_INSERTS
$Insert LOT_EQUATES
$Insert TEST_WAFER_PROD_EQUATES
$Insert LOT_OPERATION_EQUATES
$Insert Lot_Operation_Equates
$Insert PRODUCT_OPERATION_EQUATES
$Insert LOT_EVENT_EQUATES
$Insert NOTIFICATION_EQUATES
$Insert VOIDED_LOT_EQUATES
$Insert IFX_EQUATES
Declare function TEST_WAFER_PROD_SERVICES, SRP_Datetime, Datetime, Database_Services, Lot_Services, Error_Services, RTI_CREATEGUID
Declare function SRP_Array, SRP_Json, Environment_Services, Logging_Services, MemberOf, Lot_Event_Services, GetTickCount
Declare subroutine Database_Services, Btree.Extract, Lot_Services, Error_Services, Labeling_Services, SRP_Json, Logging_Services
Declare subroutine SRP_Run_Command, Service_Services, obj_notes, Lot_Event_Services, Mona_Services
$Insert RDS_EQUATES
$Insert WO_LOG_EQUATES
$Insert PROD_VER_EQUATES
$Insert OPERATION_EQUATES
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\Lot'
LogDate = Oconv(Date(), 'D4/')
@ -77,7 +81,7 @@ objLotStartLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', He
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' LotRun.csv'
Headers = 'Logging DTM' : @FM : 'Lot Id' : @FM : 'Username' : @FM : 'Tool Id' : @FM : 'Message'
objLotRunLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
objRunLog = 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'
@ -91,8 +95,9 @@ LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' T
Headers = 'Logging DTM' : @FM : 'Lot Id' : @FM : 'Operator' : @FM : 'Message'
objLotClosureLog = 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', 'LOAD', 'UNSIGN_LOAD', 'TW_USE', 'CLOSE', 'SIGN_FQA', 'UNSIGN_FQA'
Options EVENT_TYPES = 'MOVE_IN', 'MOVE_OUT', 'HOLD_ON', 'HOLD_OFF', 'REDUCE_WAFER_QTY', 'BONUS_WAFER_QTY', 'COMMENT', 'LOCATION', 'LOAD', 'UNSIGN_LOAD', 'TW_USE', 'CLOSE', 'SIGN_FQA', 'UNSIGN_FQA', 'SYSTEM_COMMENT'
Options LOT_TYPES = 'TW', 'RDS', 'WM_OUT', 'WM_IN', 'WO_MAT', 'LOT'
Options LEGACY_LOT_TYPES = 'RDS', 'WM_OUT', 'WM_IN', 'WO_MAT'
IsProd = Environment_Services('IsProd')
If IsProd EQ True$ then
@ -177,71 +182,112 @@ Service GenerateNewLotId(LotType)
end service
Service GetLotIdByLegacyLotIdAndType(LegacyLotId, LegacyLotType)
StartTick = GetTickCount()
Service GetLotIdByLegacyLotIdAndType(LegacyLotId, LegacyLotType=LEGACY_LOT_TYPES)
StartTick = GetTickCount()
MetricName = 'GetLotIdByLegacyLotIdAndType'
ErrorMsg = ''
Open 'DICT.LOT' to DictLot then
SearchString = ''
SearchString := 'LEGACY_LOT_ID':@VM:LegacyLotId:@FM
SearchString := 'TYPE':@VM:LegacyLotType:@FM
LotIdKeys = ''
Btree.Extract(SearchString, 'LOT', DictLot, LotIdKeys, '', '')
ErrCode = ''
IF Get_Status(ErrCode) then
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract. Error code ':ErrCode:'.'
end else
Response = LotIdKeys<1,1>
end
end else
ErrorMsg = 'Error in ':Service:' service. Error opening LOT dictionary.'
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
SearchString = ''
SearchString := 'LEGACY_LOT_ID':@VM:LegacyLotId:@FM
SearchString := 'LEGACY_LOT_TYPE':@VM:LegacyLotType:@FM
LotIdKeys = ''
Btree.Extract(SearchString, 'LOT', DictLot, LotIdKeys, '', '')
ErrCode = ''
IF Get_Status(ErrCode) then
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract. Error code ':ErrCode:'.'
end else
Response = LotIdKeys<1,1>
end
end else
ErrorMsg = 'Error in ':Service:' service. Error opening LOT dictionary.'
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMsg NE '' then
Error_Services('Add', ErrorMsg)
end
end service
Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, VendorCode, Username, PrinterID, LotId)
Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, VendorCode, Username, PrinterID, LegacyLotId)
StartTick = GetTickCount()
MetricName = 'CreateNewLot'
CreatedLotNumber = ''
ErrorMessage = ''
Begin Case
Case LotType EQ 'RDS' OR LotType EQ 'WM_IN' OR LotType EQ 'WM_OUT' OR LotType EQ 'WO_MAT'
// Case statement for legacy lot entity types
NewLotId = Lot_Services('GenerateNewLotId', LotType)
If NewLotId NE '' then
If RowExists('LOT', NewLotId) NE False$ then
LotRec = ''
LotRec<LOT_TYPE$> = LotType
LotRec<LOT_PROD_ID$> = ''
LotRec<LOT_ORIG_WAFER_QTY$> = LotQty
LotRec<LOT_WAFER_QTY$> = LotQty
LotRec<LOT_VENDOR_PART_NO$> = VendorPartNo
LotRec<LOT_VENDOR_LOT_NO$> = VendorLotNo
LotRec<LOT_VENDOR_CODE$> = VendorCode
LotRec<LOT_LEGACY_LOT_ID$> = LotId
Database_Services('WriteDataRow', 'LOT', NewLotId, LotRec)
If Error_Services('HasError') then
ErrorMessage = 'Error in ':Service:' service. ':Error_Services('GetMessage')
end else
CreatedLotNumber = NewLotId
end
end else
ErrorMessage = 'Error in ':Service:' service. LOT record "':NewLotId:'" already exists.'
end
end else
ErrorMessage = 'Error in ':Service:' service. No lot ID passed in.'
end
Case LotType EQ 'TW'
CreatedLotNumber = ''
ErrorMessage = ''
Begin Case
Case LotType EQ 'RDS' OR LotType EQ 'WM_IN' OR LotType EQ 'WM_OUT' OR LotType EQ 'WO_MAT'
If LegacyLotId NE '' then
LegacyLotType = LotType
LotId = Lot_Services('GetLotIdByLegacyLotIdAndType', LegacyLotId, LegacyLotType)
If LotId EQ '' then
LotType = 'PROD'
// Case statement for legacy lot entity types
NewLotId = Lot_Services('GenerateNewLotId', LegacyLotType)
If NewLotId NE '' then
If RowExists('LOT', NewLotId) NE False$ then
WoNo = ''
EpiPartNo = ''
ProdVerNo = ''
Begin Case
Case LegacyLotType EQ 'RDS'
WoNo = XLATE('RDS', LegacyLotId, RDS_WO$, 'X')
Case LegacyLotType EQ 'WM_IN' OR LegacyLotType EQ 'WM_OUT' OR LegacyLotType EQ 'WO_MAT'
WoNo = Field(LegacyLotId, '*', 1)
End Case
ProdVerNo = XLATE('WO_LOG', WoNo, WO_LOG_PROD_VER_NO$, 'X')
EpiPartNo = XLATE('WO_LOG', WoNo, WO_LOG_EPI_PART_NO$, 'X')
ProdId = EpiPartNo : '*' : ProdVerNo
ProdSpecId = XLATE('WO_LOG', WoNo, WO_LOG_PROD_SPEC_ID$, 'X')
If ProdSpecId EQ '' then
Begin Case
Case LegacyLotType EQ 'RDS'
ProdSpecId = XLATE('RDS', LegacyLotId, RDS_PROD_SPEC_ID$, 'X')
Case Otherwise$
ProdSpecId = XLATE('PROD_VER', ProdVerNo, PROD_VER_PROC_STEP_PSN$, 'X')
End Case
end
If Not(RowExists('PRODUCT', ProdId)) then ProdId = ''
LotRec = ''
LotRec<LOT_TYPE$> = 'PROD'
LotRec<LOT_PROD_ID$> = ProdId
LotRec<LOT_ORIG_WAFER_QTY$> = LotQty
LotRec<LOT_WAFER_QTY$> = LotQty
LotRec<LOT_VENDOR_PART_NO$> = VendorPartNo
LotRec<LOT_VENDOR_LOT_NO$> = VendorLotNo
LotRec<LOT_VENDOR_CODE$> = VendorCode
LotRec<LOT_LEGACY_LOT_ID$> = LegacyLotId
LotRec<LOT_LEGACY_LOT_TYPE$> = LegacyLotType
LotRec<LOT_WO_LOG_ID$> = WONo
LotRec<LOT_PROD_SPEC_ID$> = ProdSpecId
LotRec<LOT_EPI_PART_NO$> = EpiPartNo
LotRec<LOT_PROD_VER_NO$> = ProdVerNo
Database_Services('WriteDataRow', 'LOT', NewLotId, LotRec)
If Error_Services('NoError') then
CreatedLotNumber = NewLotId
end else
ErrorMessage = 'Error in ':Service:' service. ':Error_Services('GetMessage')
end
end else
ErrorMessage = 'Error in ':Service:' service. Failed to generate new LOT id. LOT record "':NewLotId:'" already exists.'
end
end else
ErrorMessage = 'Error in ':Service:' service. Failed to generate new LOT id.'
end
end else
ErrorMessage = 'Error in ':Service:' service. Lot Id ':LotId:' already exists for LegacyLotId ':LegacyLotId:'.'
end
end else
ErrorMessage = 'Error in ':Service:' service. Null LegacyLotId passed in.'
end
Case LotType EQ 'TW'
If ProdName NE '' then
TWProdID = Test_Wafer_Prod_Services('GetTestWaferProdIDsByPartName', ProdName)
If TWProdID NE '' then
@ -536,41 +582,45 @@ end service
Service CreateInitialLotOperationRecords(LotId)
ErrorMessage = ''
If LotId NE '' then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
LotType = LotRec<LOT_TYPE$>
ProdId = LotRec<LOT_PROD_ID$>
ThisInitialProdOperations = Lot_Services('GetPrescribedOperationsByProdId', ProdId, LotType)
If Error_Services('NoError') AND ThisInitialProdOperations NE '' then
For each ProdOperation in ThisInitialProdOperations using @VM
ProdOperationRec = Database_Services('ReadDataRow', 'PRODUCT_OPERATION', ProdOperation)
OperationID = ProdOperationRec<PRODUCT_OPERATION_OPERATION_ID$>
OperationSequence = ProdOperationRec<PRODUCT_OPERATION_OPERATION_SEQUENCE$>
LotOperationRecID = Rti_Createguid()
If Not(RowExists('LOT_OPERATION', LotOperationRecID)) then
LotOperationRec = ''
LotOperationRec<LOT_OPERATION_LOT_ID$> = LotId
LotOperationRec<LOT_OPERATION_OPERATION_ID$> = OperationID
LotOperationRec<LOT_OPERATION_OPERATION_SEQUENCE$> = OperationSequence
LotOperationRec<LOT_OPERATION_REWORK$> = False$
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationRecId, LotOperationRec)
TestRec = Database_Services('ReadDataRow', 'LOT', LotId)
end else
ErrorMessage = 'Error in ':Service:' service. Lot Operation already existed, cannot overwrite.'
end
Next Operation
end else
ErrorMessage = 'Error in ':Service:' service. Error getting prescribed operations for lot# ' : LotId
end
end else
ErrorMessage = 'Error in ':Service:' service. Null LotID passed into service.'
end
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
ErrorMessage = ''
If LotId NE '' then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
LotType = LotRec<LOT_TYPE$>
ProdId = LotRec<LOT_PROD_ID$>
ThisInitialProdOperations = Lot_Services('GetPrescribedOperationsByProdId', ProdId, LotType)
If Error_Services('NoError') AND ThisInitialProdOperations NE '' then
For each ProdOperation in ThisInitialProdOperations using @VM
ProdOperationRec = Database_Services('ReadDataRow', 'PRODUCT_OPERATION', ProdOperation)
OperationID = ProdOperationRec<PRODUCT_OPERATION_OPERATION_ID$>
OperationSequence = ProdOperationRec<PRODUCT_OPERATION_OPERATION_SEQUENCE$>
LotOperationRecID = Rti_Createguid()
If Not(RowExists('LOT_OPERATION', LotOperationRecID)) then
LotOperationRec = ''
LotOperationRec<LOT_OPERATION_LOT_ID$> = LotId
LotOperationRec<LOT_OPERATION_OPERATION_ID$> = OperationID
LotOperationRec<LOT_OPERATION_OPERATION_SEQUENCE$> = OperationSequence
LotOperationRec<LOT_OPERATION_REWORK$> = False$
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationRecId, LotOperationRec)
If Error_Services('HasError') then
ErrorMessage = 'Error Writing Lot Operation Record.'
end
end else
ErrorMessage = 'Lot Operation already existed, cannot overwrite'
end
Next Operation
end else
ErrorMessage = 'Error getting prescribed operations for lot# ' : LotId
end
end else
ErrorMessage = 'Lot ID was null'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
end service
// Returns a @FM delimited list of operations in sequence
Service GetLotOperationSequence(LotId)
@ -604,9 +654,10 @@ end service
Service GetLotCurrOperationId(LotId)
StartTick = GetTickCount()
MetricName = 'GetLotCurrOperationId'
ErrorMsg = ''
ErrorMsg = ''
StartTick = GetTickCount()
MetricName = 'GetLotCurrOperationId'
CurrOperation = ''
If LotID NE '' then
// Get them in sequence first
@ -1022,126 +1073,145 @@ end service
Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
ErrorMessage = ''
JsonString = ''
If FullObject EQ '' then FullObject = True$
If RowExists('LOT', LotId) then
objJSON = ''
If SRP_JSON(objJSON, 'New', 'Object') then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
If Error_Services('NoError') then
If SRP_JSON(objLot, 'New', 'Object') then
SRP_JSON(objLot, 'SetValue', 'LotId', LotId)
SRP_JSON(objLot, 'SetValue', 'Type', LotRec<LOT_TYPE$>)
SRP_JSON(objLot, 'SetValue', 'ProdId', LotRec<LOT_PROD_ID$>)
Begin Case
Case LotRec<LOT_TYPE$> = 'TW'
ProdName = XLATE('TEST_WAFER_PROD', LotRec<LOT_PROD_ID$>, TEST_WAFER_PROD_PART_NAME$, 'X')
Case Otherwise$
ProdName = ''
End Case
SRP_JSON(objLot, 'SetValue', 'ProdName', ProdName)
SRP_JSON(objLot, 'SetValue', 'OrigWaferQty', LotRec<LOT_ORIG_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', 'VendorLotNo', LotRec<LOT_VENDOR_LOT_NO$>)
SRP_JSON(objLot, 'SetValue', 'Vendor', LotRec<LOT_VENDOR_CODE$>)
CurrOperation = Lot_Services('GetLotCurrOperationId', LotId)
CurrOperation = XLATE('LOT_OPERATION', CurrOperation, LOT_OPERATION_OPERATION_ID$, 'X')
SRP_JSON(objLot, 'SetValue', 'CurrOperation', CurrOperation)
MostRecentEventId = LotRec<LOT_MOST_RECENT_LOT_EVENT_ID$>
MostRecentEventDtmIConv = Xlate('LOT_EVENT', MostRecentEventId, LOT_EVENT_EVENT_DATETIME$, 'X')
MostRecentEventDtmOConv = OConv(MostRecentEventDtmIConv, 'DT')
SRP_JSON(objLot, 'SetValue', 'MostRecentEventDateTime', MostRecentEventDtmOConv)
If FullObject then
// Events Array
EventsArrayJson = ''
If SRP_Json(EventsArrayJson, 'New', 'Array') then
LotEventKeys = Lot_Event_Services('GetLotEventsInSequence', LotId)
for each LotEventKey in LotEventKeys using @FM
objEvent = ''
EventRec = Database_Services('ReadDataRow', 'LOT_EVENT', LotEventKey)
If SRP_Json(objEvent, 'New', 'Object') then
SRP_JSON(objEvent, 'SetValue', 'LotEventId', LotEventKey)
SRP_JSON(objEvent, 'SetValue', 'LotId', EventRec<LOT_EVENT_LOT_ID$>)
SRP_JSON(objEvent, 'SetValue', 'LotEventType', EventRec<LOT_EVENT_LOT_EVENT_TYPE$>)
SRP_JSON(objEvent, 'SetValue', 'EventDatetime', OConv(EventRec<LOT_EVENT_EVENT_DATETIME$>, 'DT'))
SRP_JSON(objEvent, 'SetValue', 'EventNote', EventRec<LOT_EVENT_EVENT_NOTE$>)
SRP_JSON(objEvent, 'SetValue', 'EquipmentId', EventRec<LOT_EVENT_EQUIPMENT_ID$>)
SRP_JSON(objEvent, 'SetValue', 'EventReduceWaferQty', EventRec<LOT_EVENT_EVENT_REDUCE_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventBonusWaferQty', EventRec<LOT_EVENT_EVENT_BONUS_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventBeginWaferQty', EventRec<LOT_EVENT_EVENT_BEGIN_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventEndWaferQty', EventRec<LOT_EVENT_EVENT_END_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventOperationId', EventRec<LOT_EVENT_EVENT_OPERATION_ID$>)
SRP_JSON(objEvent, 'SetValue', 'EventOperatorId', EventRec<LOT_EVENT_EVENT_OPERATOR_ID$>)
SRP_JSON(objEvent, 'SetValue', 'Sequence', EventRec<LOT_EVENT_SEQUENCE$>)
SRP_JSON(EventsArrayJson, 'Add', objEvent)
SRP_JSON(objEvent, 'Release')
end
Next LotEventKey
SRP_JSON(objLot, 'Set', 'LotEvents', EventsArrayJson)
SRP_JSON(EventsArrayJson, 'Release')
end else
ErrorMessage = 'Error Creating Events JSON Array'
end
// Operations Array
OperationsArrayJson = ''
If SRP_Json(OperationsArrayJson, 'New', 'Array') then
LotOperationKeys = Lot_Services('GetLotOperationSequence', LotId)
for each LotOperationKey in LotOperationKeys using @FM
objOperation = ''
OperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', LotOperationKey)
If SRP_Json(objOperation, 'New', 'Object') then
SRP_JSON(objOperation, 'SetValue', 'LotOperationId', LotOperationKey)
SRP_JSON(objOperation, 'SetValue', 'LotId', OperationRec<LOT_OPERATION_LOT_ID$>)
SRP_JSON(objOperation, 'SetValue', 'OperationId', OperationRec<LOT_OPERATION_OPERATION_ID$>)
SRP_JSON(objOperation, 'SetValue', 'DatetimeIn', OConv(OperationRec<LOT_OPERATION_DATETIME_IN$>, 'DT'))
SRP_JSON(objOperation, 'SetValue', 'DatetimeOut', Oconv(OperationRec<LOT_OPERATION_DATETIME_OUT$>, 'DT'))
SRP_JSON(objOperation, 'SetValue', 'EquipmentId', OperationRec<LOT_OPERATION_EQUIPMENT_ID$>)
SRP_JSON(objOperation, 'SetValue', 'WaferInQty', OperationRec<LOT_OPERATION_WAFER_IN_QTY$>)
SRP_JSON(objOperation, 'SetValue', 'WaferOutQty', OperationRec<LOT_OPERATION_WAFER_OUT_QTY$>)
SRP_JSON(objOperation, 'SetValue', 'OperatorInId', OperationRec<LOT_OPERATION_OPERATOR_IN_ID$>)
SRP_JSON(objOperation, 'SetValue', 'OperatorOutId', OperationRec<LOT_OPERATION_OPERATOR_OUT_ID$>)
SRP_JSON(objOperation, 'SetValue', 'OperationSequence', OperationRec<LOT_OPERATION_OPERATION_SEQUENCE$>)
SRP_JSON(objOperation, 'SetValue', 'Rework', OperationRec<LOT_OPERATION_REWORK$>)
SRP_JSON(objOperation, 'SetValue', 'DatetimeStart', OConv(OperationRec<LOT_OPERATION_DATETIME_START$>, 'DT'))
SRP_JSON(objOperation, 'SetValue', 'DatetimeStop', OConv(OperationRec<LOT_OPERATION_DATETIME_STOP$>, 'DT'))
SRP_JSON(OperationsArrayJson, 'Add', objOperation)
SRP_JSON(objOperation, 'Release')
end
Next LotOperationKey
SRP_JSON(objLot, 'Set', 'LotOperations', OperationsArrayJson)
SRP_JSON(OperationsArrayJson, 'Release')
end else
ErrorMessage = 'Error Creating Operations JSON Array'
end
end
SRP_JSON(objJSON, 'Set', 'Lot', objLot)
SRP_JSON(objLot, 'Release')
end else
ErrorMessage = 'Error creating new Lot Json Object'
end
end else
ErrorMessage = 'Error reading ':LotId:' from lot table.'
end
JsonString = SRP_JSON(objJSON, 'Stringify', 'Styled')
SRP_JSON(objJSON, 'Release')
end else
ErrorMessage = 'Error creating new Json Object'
end
end else
ErrorMessage = 'Invalid or null lot number passed to routine.'
end
If ErrorMessage EQ '' then
Response = JsonString
end else
Error_Services('Add', ErrorMessage)
end
ErrorMessage = ''
JsonString = ''
If FullObject EQ '' then
FullObject = True$
end
If RowExists('LOT', LotId) then
objJSON = ''
If SRP_JSON(objJSON, 'New', 'Object') then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
If Error_Services('NoError') then
If SRP_JSON(objLot, 'New', 'Object') then
SRP_JSON(objLot, 'SetValue', 'LotId', LotId)
SRP_JSON(objLot, 'SetValue', 'LegacyLotId', LotRec<LOT_LEGACY_LOT_ID$>, 'String')
SRP_JSON(objLot, 'SetValue', 'LegacyLotType', LotRec<LOT_LEGACY_LOT_TYPE$>, 'String')
CanUserModifyLot = Lot_Services('CanUserModifyLot', CurrUser)
SRP_JSON(objLot, 'SetValue', 'CanUserModifyLot', CanUserModifyLot, 'Boolean')
SRP_JSON(objLot, 'SetValue', 'WorkOrderNo', LotRec<LOT_WO_LOG_ID$>, 'String')
SRP_JSON(objLot, 'SetValue', 'EpiPartNo', LotRec<LOT_EPI_PART_NO$>, 'String')
SRP_JSON(objLot, 'SetValue', 'Type', LotRec<LOT_TYPE$>)
SRP_JSON(objLot, 'SetValue', 'ProdId', LotRec<LOT_PROD_ID$>)
ProdSpecNo = LotRec<LOT_PROD_SPEC_ID$>
SRP_JSON(objLot, 'SetValue', 'ProdSpecNo', ProdSpecNo, 'String')
Begin Case
Case LotRec<LOT_TYPE$> = 'TW'
ProdName = XLATE('TEST_WAFER_PROD', LotRec<LOT_PROD_ID$>, TEST_WAFER_PROD_PART_NAME$, 'X')
Case Otherwise$
ProdName = ''
End Case
SRP_JSON(objLot, 'SetValue', 'ProdName', ProdName)
SRP_JSON(objLot, 'SetValue', 'OrigWaferQty', LotRec<LOT_ORIG_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', 'VendorLotNo', LotRec<LOT_VENDOR_LOT_NO$>)
SRP_JSON(objLot, 'SetValue', 'Vendor', LotRec<LOT_VENDOR_CODE$>)
CurrLotOperationId = Lot_Services('GetLotCurrOperationId', LotId)
CurrOperation = XLATE('LOT_OPERATION', CurrLotOperationId, LOT_OPERATION_OPERATION_ID$, 'X')
CurrOperationDesc = XLATE('OPERATION', CurrOperation, OPERATION_OPERATION_DESCRIPTION$, 'X')
SRP_JSON(objLot, 'SetValue', 'CurrLotOperationId', CurrLotOperationId)
SRP_JSON(objLot, 'SetValue', 'CurrOperation', CurrOperation)
SRP_JSON(objLot, 'SetValue', 'CurrOperationDesc', CurrOperationDesc, 'String')
MostRecentEventId = LotRec<LOT_MOST_RECENT_LOT_EVENT_ID$>
MostRecentEventDtmIConv = Xlate('LOT_EVENT', MostRecentEventId, LOT_EVENT_EVENT_DATETIME$, 'X')
MostRecentEventDtmOConv = OConv(MostRecentEventDtmIConv, 'DT')
SRP_JSON(objLot, 'SetValue', 'MostRecentEventDateTime', MostRecentEventDtmOConv)
if LotRec<LOT_LEGACY_LOT_ID$> NE '' then
ActiveRTFId = Return_To_Fab_Services('GetOpenReturnToFabRecordIdByCassId', LotRec<LOT_LEGACY_LOT_ID$>)
end else
ActiveRTFId = Return_To_Fab_Services('GetOpenReturnToFabRecordIdByCassId', LotId)
end
SRP_JSON(objLot, 'SetValue', 'ActiveRTFId', ActiveRTFId, 'String')
If FullObject then
//Events Array
EventsArrayJson = ''
If SRP_Json(EventsArrayJson, 'New', 'Array') then
LotEventKeys = Lot_Event_Services('GetLotEventsInSequence', LotId)
for each LotEventKey in LotEventKeys using @FM
objEvent = ''
EventRec = Database_Services('ReadDataRow', 'LOT_EVENT', LotEventKey)
If SRP_Json(objEvent, 'New', 'Object') then
SRP_JSON(objEvent, 'SetValue', 'LotEventId', LotEventKey)
SRP_JSON(objEvent, 'SetValue', 'LotId', EventRec<LOT_EVENT_LOT_ID$>)
SRP_JSON(objEvent, 'SetValue', 'LotEventType', EventRec<LOT_EVENT_LOT_EVENT_TYPE$>)
SRP_JSON(objEvent, 'SetValue', 'EventDatetime', OConv(EventRec<LOT_EVENT_EVENT_DATETIME$>, 'DT'))
SRP_JSON(objEvent, 'SetValue', 'EventNote', EventRec<LOT_EVENT_EVENT_NOTE$>)
SRP_JSON(objEvent, 'SetValue', 'EquipmentId', EventRec<LOT_EVENT_EQUIPMENT_ID$>)
SRP_JSON(objEvent, 'SetValue', 'EventReduceWaferQty', EventRec<LOT_EVENT_EVENT_REDUCE_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventBonusWaferQty', EventRec<LOT_EVENT_EVENT_BONUS_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventBeginWaferQty', EventRec<LOT_EVENT_EVENT_BEGIN_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventEndWaferQty', EventRec<LOT_EVENT_EVENT_END_WAFER_QTY$>)
SRP_JSON(objEvent, 'SetValue', 'EventOperationId', EventRec<LOT_EVENT_EVENT_OPERATION_ID$>)
SRP_JSON(objEvent, 'SetValue', 'EventOperatorId', EventRec<LOT_EVENT_EVENT_OPERATOR_ID$>)
SRP_JSON(objEvent, 'SetValue', 'Sequence', EventRec<LOT_EVENT_SEQUENCE$>)
SRP_JSON(EventsArrayJson, 'Add', objEvent)
SRP_JSON(objEvent, 'Release')
end
Next LotEventKey
SRP_JSON(objLot, 'Set', 'LotEvents', EventsArrayJson)
SRP_JSON(EventsArrayJson, 'Release')
end else
ErrorMessage = 'Error Creating Events JSON Array'
end
OperationsArrayJson = ''
If SRP_Json(OperationsArrayJson, 'New', 'Array') then
LotOperationKeys = Lot_Services('GetLotOperationSequence', LotId)
for each LotOperationKey in LotOperationKeys using @FM
ThisLotOperationJsonString = Lot_Operation_Services('ConvertRecordToJson', LotOperationKey)
If SRP_Json(objLotOperation, 'PARSE', ThisLotOperationJsonString) EQ '' then
SRP_Json(OperationsArrayJson, 'Add', objLotOperation)
SRP_Json(objLotOperation, 'Release')
end
Next LotOperationKey
SRP_JSON(objLot, 'Set', 'LotOperations', OperationsArrayJson)
SRP_JSON(OperationsArrayJson, 'Release')
Recipes = PSN_Services('GetAllMetrologyRecipes', ProdSpecNo, True$, True$, True$, True$)
//Add in all lot recipe parameters
If SRP_JSON(objRecipes, 'New', 'Array') then
for each Recipe in Recipes using @FM
//ToolClass : @VM : Recipe : @VM : Stage
ToolClass = Recipe<1,1>
RecipeName = Recipe<1,2>
Stage = Recipe<1,3>
If SRP_JSON(objRecipe, 'New', 'Object') then
SRP_JSON(objRecipe, 'SetValue', 'ToolClass', ToolClass, 'String')
SRP_JSON(objRecipe, 'SetValue', 'RecipeName', RecipeName, 'String')
SRP_JSON(objRecipe, 'SetValue', 'StageName', Stage, 'String')
SRP_JSON(objRecipes, 'Add', objRecipe)
SRP_JSON(objRecipe, 'Release')
end
Next Recipe
SRP_JSON(objLot, 'Set', 'AllRecipes', objRecipes)
SRP_JSON(objRecipes, 'Release')
end
end else
ErrorMessage = 'Error Creating Operations JSON Array'
end
end
SRP_JSON(objJSON, 'Set', 'Lot', objLot)
SRP_JSON(objLot, 'Release')
end else
ErrorMessage = 'Error creating new Lot Json Object'
end
end else
ErrorMessage = 'Error reading ':LotId:' from lot table.'
end
JsonString = SRP_JSON(objJSON, 'Stringify', 'Styled')
SRP_JSON(objJSON, 'Release')
end else
ErrorMessage = 'Error creating new Json Object'
end
end else
ErrorMessage = 'Invalid or null lot number passed to routine.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
Response = JsonString
end service
@ -1339,7 +1409,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 = 'AutoCloseTestWaferLot' : @VM : LotId : @VM : 'SYSTEM'
Service_Services('PostProcedure', 'LOT_SERVICES', ServiceParms)
If Error_Services('HasError') then
Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', NOTIFICATION_USER_ID$, 'X')
@ -1509,12 +1579,38 @@ Service CreateNewVoidedLotRecord(LotId, LegacyLotId, LotType=LOT_TYPES, Username
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
Service CanUserModifyLot(UserId)
Begin Case
Case MemberOf(UserId, 'OI_ADMIN')
Response = true$
Case MemberOf(UserId, 'ENGINEERING')
Response = true$
Case MemberOf(UserId, 'ENG_TECH')
Response = true$
Case MemberOf(UserId, 'SUPERVISOR')
Response = true$
Case MemberOf(UserId, 'LEAD')
Response = true$
Case UserId EQ 'SYSTEM'
Response = true$
Case Otherwise$
Response = false$
End Case
end service
//----------------------------------------------------------------------------------------------------------------------
// Internal GoSubs
//----------------------------------------------------------------------------------------------------------------------