ready for deployment
This commit is contained in:
committed by
Stieber Daniel (CSC FI SPS MESLEO)
parent
6aad8036e5
commit
550f376a0b
@ -20,62 +20,110 @@ Compile function React_Item_Services(@Service, @Params)
|
||||
08/02/22 djs Original programmer.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
$Insert LOGICAL
|
||||
$Insert APP_INSERTS
|
||||
$Insert SERVICE_SETUP
|
||||
$Insert RLIST_EQUATES
|
||||
$Insert REACT_ITEM_EQUATES
|
||||
|
||||
Declare function Database_Services, Error_Services, SRP_JSON, NextKey
|
||||
Declare subroutine SRP_JSON, Error_Services, Btree.Extract, Database_Services
|
||||
GoToService
|
||||
Declare function Database_Services, Error_Services, SRP_JSON, NextKey, SRP_Date, obj_React_Item, SRP_Array
|
||||
Declare subroutine SRP_JSON, Error_Services, Btree.Extract, Database_Services, Update_Index
|
||||
|
||||
Return Response or ""
|
||||
GoToService else
|
||||
Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
|
||||
end
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// SERVICES
|
||||
//-----------------------------------------------------------------------------
|
||||
Return Response else ''
|
||||
|
||||
Service GetAllReactItemKeys()
|
||||
AllKeys = ''
|
||||
RList('SELECT REACT_ITEM', TARGET_ACTIVELIST$, '', '', '')
|
||||
Done = False$
|
||||
Reactors = ''
|
||||
Loop
|
||||
Readnext keyId else Done = True$
|
||||
Until Done
|
||||
AllKeys<1,-1> = keyId
|
||||
Repeat
|
||||
Response = AllKeys
|
||||
end service
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Service Parameter Options
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
Options BOOLEAN = True$, False$
|
||||
|
||||
Service GetReactItems(RIType, CurrStatus)
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Services
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Service GetReactItems(RIType, CurrStatus, EntryDtStart, EntryDtEnd, RetireDtStart, RetireDtEnd, IncludeNullRetireDt=BOOLEAN)
|
||||
|
||||
ErrorMsg = ''
|
||||
Response = ''
|
||||
Swap ',' with @VM in RIType
|
||||
Swap ',' with @VM in CurrStatus
|
||||
|
||||
Open 'DICT.REACT_ITEM' to DictReactItem then
|
||||
|
||||
SearchString = ''
|
||||
If RIType NE '' then SearchString := 'RI_TYPE':@VM:RIType:@FM
|
||||
If CurrStatus NE '' then SearchString := 'CURR_STATUS':@VM:CurrStatus:@FM
|
||||
RIKeys = ''
|
||||
Btree.Extract(SearchString, 'REACT_ITEM', DictReactItem, RIKeys, '', '')
|
||||
ErrCode = ''
|
||||
IF Get_Status(ErrCode) then
|
||||
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract. Error code ':ErrCode:'.'
|
||||
If ( (RIType NE '') or (CurrStatus NE '') or (EntryDtStart NE '') or (EntryDtEnd NE '') or (RetireDtStart NE '') or (RetireDtEnd NE '') or (IncludeNullRetireDt NE '') ) then
|
||||
If EntryDtStart NE '' and Not(Num(EntryDtStart)) then EntryDtStart = IConv(EntryDtStart, 'D')
|
||||
If EntryDtEnd NE '' and Not(Num(EntryDtEnd)) then EntryDtEnd = IConv(EntryDtEnd, 'D')
|
||||
If RetireDtStart NE '' and Not(Num(RetireDtStart)) then RetireDtStart = IConv(RetireDtStart, 'D')
|
||||
If RetireDtEnd NE '' and Not(Num(RetireDtEnd)) then RetireDtEnd = IConv(RetireDtEnd, 'D')
|
||||
Open 'DICT.REACT_ITEM' to DictReactItem then
|
||||
SearchString = ''
|
||||
If RIType NE '' then
|
||||
Swap ',' with @VM in RIType
|
||||
SearchString := 'RI_TYPE':@VM:RIType:@FM
|
||||
end
|
||||
Begin Case
|
||||
Case ( (EntryDtStart NE '') and (EntryDtEnd NE '') )
|
||||
EntryDtStart = OConv(EntryDtStart - 1, 'D4/')
|
||||
EntryDtEnd = OConv(EntryDtEnd + 1, 'D4/')
|
||||
SearchString := 'ENTER_DT':@VM:EntryDtStart:'~':EntryDtEnd:@FM
|
||||
Case (EntryDtStart NE '')
|
||||
EntryDtStart = OConv(EntryDtStart, 'D4/')
|
||||
SearchString := 'ENTER_DT':@VM:'>=':EntryDtStart:@FM
|
||||
Case (EntryDtEnd NE '')
|
||||
SearchString := 'ENTER_DT':@VM:'<=':EntryDtEnd:@FM
|
||||
Case Otherwise$
|
||||
Null
|
||||
End Case
|
||||
Begin Case
|
||||
Case ( (RetireDtStart NE '') and (RetireDtEnd NE '') )
|
||||
RetireDtStart = OConv(RetireDtStart - 1, 'D4/')
|
||||
RetireDtEnd = OConv(RetireDtEnd + 1, 'D4/')
|
||||
SearchString := 'RETIRE_DT':@VM:RetireDtStart:'~':RetireDtEnd
|
||||
If IncludeNullRetireDt then SearchString := @VM:''
|
||||
SearchString := @FM
|
||||
Case (RetireDtStart NE '')
|
||||
RetireDtStart = OConv(RetireDtStart, 'D4/')
|
||||
SearchString := 'RETIRE_DT':@VM:'>=':RetireDtStart
|
||||
If IncludeNullRetireDt then SearchString := @VM:''
|
||||
SearchString := @FM
|
||||
Case (RetireDtEnd NE '')
|
||||
SearchString := 'RETIRE_DT':@VM:'<=':RetireDtEnd
|
||||
If IncludeNullRetireDt then SearchString := @VM:''
|
||||
SearchString := @FM
|
||||
Case IncludeNullRetireDt
|
||||
SearchString := 'RETIRE_DT':@VM:'':@FM
|
||||
Case Otherwise$
|
||||
Null
|
||||
End Case
|
||||
If CurrStatus NE '' then
|
||||
Swap ',' with @VM in CurrStatus
|
||||
SearchString := 'CURR_STATUS_STATIC':@VM:CurrStatus:@FM
|
||||
end
|
||||
Flag = ''
|
||||
RIKeys = ''
|
||||
Btree.Extract(SearchString, 'REACT_ITEM', DictReactItem, RIKeys, 'E', Flag)
|
||||
If Flag EQ 0 then
|
||||
EnterDtms = Xlate('REACT_ITEM', RIKeys, 'ENTER_DTM', 'X')
|
||||
Array = RIKeys:@FM:EnterDtms
|
||||
Array = SRP_Array('SortRows', Array, 'DN2', 'ARRAY', @FM, @VM)
|
||||
Response = Array<1>
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract.'
|
||||
end
|
||||
end else
|
||||
Response = RIKeys
|
||||
ErrorMsg = 'Error in ':Service:' service. Error opening REACT_ITEM dictionary.'
|
||||
end
|
||||
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error opening REACT_ITEM dictionary.'
|
||||
AllKeys = ''
|
||||
RList('SELECT REACT_ITEM', TARGET_ACTIVELIST$, '', '', '')
|
||||
Done = False$
|
||||
Loop
|
||||
Readnext KeyId else Done = True$
|
||||
Until Done
|
||||
AllKeys<1, -1> = KeyId
|
||||
Repeat
|
||||
Response = AllKeys
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
Error_Services('Add', ErrorMsg)
|
||||
end
|
||||
@ -155,7 +203,6 @@ Service ConvertRecordToJSON(KeyID, Record, ItemURL)
|
||||
|
||||
Response = jsonRecord
|
||||
|
||||
|
||||
end service
|
||||
|
||||
|
||||
@ -326,11 +373,11 @@ Service GetReactItemTemplateJSON()
|
||||
|
||||
Response = jsonRecord
|
||||
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service CreateReactItem(Record)
|
||||
|
||||
ErrMsg = ''
|
||||
KeyID = ''
|
||||
If Record NE '' then
|
||||
@ -355,6 +402,7 @@ Service CreateReactItem(Record)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service ConvertRecordToJSONQuick(KeyID, Record, ItemURL)
|
||||
|
||||
jsonRecord = ''
|
||||
@ -407,6 +455,32 @@ Service ConvertRecordToJSONQuick(KeyID, Record, ItemURL)
|
||||
Response = jsonRecord
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service UpdateReactItemStatus(RINo)
|
||||
|
||||
If RINo NE '' then
|
||||
If RowExists('REACT_ITEM', RINo) then
|
||||
RIRec = Database_Services('ReadDataRow', 'REACT_ITEM', RINo)
|
||||
If Error_Services('NoError') then
|
||||
Update_Index('REACT_ITEM_HIST', 'RI_NO', False$, True$)
|
||||
ReactItemCurrStatus = obj_React_Item('CurrStatus', RINo:@RM:RIRec)
|
||||
ReactItemCurrStatusStatic = RIRec<REACT_ITEM_CURR_STATUS_STATIC$>
|
||||
If ReactItemCurrStatus NE ReactItemCurrStatusStatic then
|
||||
Open 'REACT_ITEM' to hTable then
|
||||
WriteV ReactItemCurrStatus on hTable, RINo, REACT_ITEM_CURR_STATUS_STATIC$ else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error writing CURR_STATUS_STATIC, ':ReactItemCurrStatus:', for REACT_ITEM ':RINo:'.')
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error opening REACT_ITEM table for status update.')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -419,6 +493,3 @@ ClearCursors:
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user