Files
open-insight/LSL2/STPROC/OPERATION_SERVICES.txt
2025-07-16 21:17:07 +02:00

58 lines
1.9 KiB
Plaintext

Compile function Operation_Services(@Service, @Params)
#pragma precomp SRP_PreCompiler
Declare function Database_Services, SRP_Json
Declare subroutine Database_Services, SRP_Json, Btree.Extract
$insert LOGICAL
$Insert OPERATION_EQUATES
Options OPERATION_TYPE = 'CLEAN', 'THICK_METROLOGY', 'RES_METROLOGY', 'SURFACE_METROLOGY', 'VISUAL_INSPECTION', 'PACKAGING'
GoToService
Return Response or ""
//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
Service ConvertRecordToJson(OperationId)
JsonString = ''
objJSON = ''
OperationRec = Database_Services('ReadDataRow', 'OPERATION', OperationId, True$, 0, False$)
If SRP_JSON(objJSON, 'New', 'Object') then
SRP_JSON(objJSON, 'SetValue', 'OperationId', OperationId)
SRP_JSON(objJSON, 'SetValue', 'Active', OperationRec<OPERATION_ACTIVE$>, 'Boolean')
SRP_JSON(objJSON, 'SetValue', 'ClassId', OperationRec<OPERATION_CLASS_ID$>, 'String')
SRP_JSON(objJSON, 'SetValue', 'Description', OperationRec<OPERATION_OPERATION_DESCRIPTION$>, 'String')
SRP_JSON(objJSON, 'SetValue', 'Type', OperationRec<OPERATION_TYPE$>, 'String')
JsonString = SRP_JSON(objJSON, 'Stringify', 'Styled')
SRP_JSON(objJSON, 'Release')
end
Response = JsonString
End Service
Service GetOperations(Class, ActiveFlag)
ErrorMessage = ''
RTFOperationKeys = ''
Open 'DICT.OPERATION' to DICT then
SearchString = 'CLASS_ID':@VM:Class:@FM
SearchString := 'ACTIVE':@VM:True$:@FM
Option = ''
Flag = ''
Btree.Extract(SearchString, 'OPERATION', DICT, RTFOperationKeys, Option, Flag)
end else
ErrorMessage = 'Error opening OPERATION table dictionary.'
end
Response = RTFOperationKeys
end service