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:
parent
41cbdaadba
commit
36f16bf951
@ -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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user