Merged PR 12079: Backend functionality for retrieving Open NCR Report from OI

Backend functionality for retrieving Open NCR Report from OI

Related work items: #237978
This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO) 2025-03-04 23:15:06 +01:00
parent 41cbdaadba
commit 36f16bf951
3 changed files with 114 additions and 2 deletions

View File

@ -48,11 +48,14 @@ Compile function NCR_Services(@Service, @Params)
***********************************************************************************************************************/
$insert APP_INSERTS
$Insert SERVICE_SETUP
$Insert NCR_EQUATES
$Insert REACTOR_EQUATES
Declare subroutine Set_Status, Logging_Services, Error_Services, Obj_Notes, Set_Property, Obj_Wo_Mat, Hold_Services
Declare subroutine Btree.Extract, SRP_JSon
Declare function Environment_Services, Logging_Services, SRP_Datetime, Utility, Scan_Services, Error_Services
Declare function Database_Services, Signature_Services, Epipro_Services, Rds_Services, Memberof, Datetime
Declare function Get_Property
Declare function Get_Property, SRP_Json, obj_ncr
EQU COL$RDS_NO TO 1
EQU COL$REACTOR TO 2
@ -588,3 +591,74 @@ Service SendToSPC(NCRNo, RDSList, ReactorType, PSNo, DeptResp, LossCode, LossDes
end service
Service GetOpenNCRKeys()
table = "NCR"
ErrorMessage = ''
RDSRecords = ''
Open "DICT ":table To @DICT Else
ErrorMessage = 'Error opening NCR dictionary'
End
If ErrorMessage EQ '' then
srch_strng = "STATUS":@VM:'O':@FM
option = ""
flag = ""
Btree.Extract(srch_strng, table, @DICT, RDSRecords, option, flag)
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
Response = RDSRecords
end service
Service ConvertRecordToJson(NCRId)
NCRJson = ''
ErrorMessage = ''
If RowExists('NCR', NCRId) then
NCRRecord = Database_Services('ReadDataRow', 'NCR', NCRId, True$, 0, False$)
If Error_Services('NoError') then
objNCR = ''
If SRP_JSON(objNCR, 'New', 'Object') then
SRP_JSON(objNCR, 'SetValue', 'NCRId', NCRId)
ThisNCREntryDate = NCRRecord<NCR_ENTRY_DATE$>
ThisNCREntryTime = NCRRecord<NCR_ENTRY_TIME$>
If ThisNCREntryTime EQ '' then ThisNCREntryTime = 0
ThisNCREntryDateTime = OConv(SRP_DateTime('Combine', ThisNCREntryDate, ThisNCREntryTime), 'DT')
SRP_JSON(objNCR, 'SetValue', 'EntryDateTime', ThisNCREntryDateTime, 'String')
SRP_JSON(objNCR, 'SetValue', 'Shift', NCRRecord<NCR_SHIFT$>)
ThisNCRReactorNo = NCRRecord<NCR_REACTOR$>
SRP_JSON(objNCR, 'SetValue', 'Reactor', ThisNCRReactorNo);//This needs to be a list to support EpiPro
ThisNCRCassId = ''
ThisNCRReactorType = Xlate('REACTOR', ThisNCRReactorNo, REACTOR_REACT_TYPE$, 'X')
If ThisNCRReactorType NE 'EPP' then
ThisNCRCassId = NCRRecord<NCR_RDS_ID$>
end else
ThisNCRWONo = NCRRecord<NCR_WO_NO$>
ThisNCRStepNo = NCRRecord<NCR_WO_STEP$>
ThisNCRCassNo = NCRRecord<NCR_WO_MAT_CASS_NO$>
ThisNCRCassId = ThisNCRWONo : '*' : ThisNCRStepNo : '*' : ThisNCRCassNo
end
SRP_JSON(objNCR, 'SetValue', 'CasetteId', ThisNCRCassId)
SRP_JSON(objNCR, 'SetValue', 'LossStage', NCRRecord<NCR_LOSS_STAGE$>)
ThisNCRRejectCount = 0
ThisNCRRejectCount = Obj_Ncr('RejQty', NCRId:@RM:NCRRecord)
SRP_JSON(objNCR, 'SetValue', 'TotalRejected', ThisNCRRejectCount)
SRP_JSON(objNCR, 'SetValue', 'LossComments', NCRRecord<NCR_LOSS_COMMENTS$>)
NCRJson = SRP_JSON(objNCR, 'Stringify', 'Styled')
SRP_JSON(objNCR, 'Release')
end else
ErrorMessage = 'Error creating NCR Json Object'
end
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Non-existent NCR Id passed to routine'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
Response = NCRJson
end service

View File

@ -135,6 +135,8 @@ CreateHALItem:
RepJSON = Report_Services('GetDailyReactorUptimeDataJSON', ReportStartDtm, ReportEndDtm)
Case ReportID = 'TestWaferWIPReport'
RepJSON = Report_Services('GetOpenTestWaferLotWIPReportJson')
Case ReportID = 'OpenNCRReport'
RepJson = Report_Services('GetOpenNCRReportJson')
Case Otherwise$
Error_Services('Add', 'Unsupported report')
End Case
@ -232,3 +234,4 @@ API reports.GET
end api

View File

@ -82,7 +82,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 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 Lot_Services, Test_Run_Services
Declare function Lot_Services, Test_Run_Services, NCR_Services
Equ TAB TO \09\
@ -2330,6 +2330,40 @@ Service PrintMaterialTrackReport(RptColumns, LocationFilter, NoMatFlag, OldRepor
end service
Service GetOpenNCRReportJson()
ErrorMessage = ''
OpenNCRReportJson = ''
OpenNCRKeyList = NCR_Services('GetOpenNCRKeys')
objJson = ''
If SRP_Json(objJson, 'New') then
objOpenNCRJsonArray = ''
If SRP_Json(objOpenNCRJsonArray, 'New', 'Array') then
for each NCRKey in OpenNCRKeyList using @VM
ThisNCRJsonString = NCR_Services('ConvertRecordToJson', NCRKey)
ThisNCRJsonObj = ''
ParseResult = SRP_Json(ThisNCRJsonObj, 'Parse', ThisNCRJsonString)
If ParseResult EQ '' then
SRP_Json(objOpenNCRJsonArray, 'Add', ThisNCRJsonObj)
SRP_Json(ThisNCRJsonObj, 'Release')
end else
SRP_Json(ThisNCRJsonObj, 'Release')
end
Next NCRKey
SRP_Json(objJson, 'Set', 'OpenNCRReport', objOpenNCRJsonArray)
SRP_Json(objOpenNCRJsonArray, 'Release')
end else
ErrorMessage = 'Error creating Open NCR JSON Array.'
end
OpenNCRReportJson = SRP_JSON(objJSON, 'Stringify', 'Styled')
SRP_JSON(objJSON, 'Release')
end else
ErrorMessage = 'Error creating root JSON object.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
Response = OpenNCRReportJson
end service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
@ -2352,3 +2386,4 @@ OipiPrintError:
return