Restored obj_RDS('MetPropFlag') to previous version for performance reasons. Refactored Supplement_Services to improve performance.
This commit is contained in:
@ -128,6 +128,12 @@ Service CreateSupplement(LotType=LOTTYPES, LotID, Stage=STAGES, SupplText, Entry
|
||||
NewSupRec<SUPPLEMENTS_SUPPL_TEXT$> = SupplText
|
||||
NewSupRec<SUPPLEMENTS_ENTRY_USER$> = EntryUser
|
||||
NewSupRec<SUPPLEMENTS_ENTRY_DATETIME$> = Datetime()
|
||||
If Stages NE False$ then
|
||||
StageList = Stages<1>
|
||||
Locate Stage in StageList using @VM setting StageIndex then
|
||||
NewSupRec<SUPPLEMENTS_STAGE_INDEX$> = StageIndex
|
||||
end
|
||||
end
|
||||
Database_Services('WriteDataRow', 'SUPPLEMENTS', SupplID, NewSupRec, True$, False$, False$)
|
||||
If Error_Services('NoError') then
|
||||
Response = SupplID
|
||||
@ -305,49 +311,30 @@ Service GetSupplementsForLot(LotType=LOTTYPES, LotID, Stage=STAGES)
|
||||
|
||||
Response = False$
|
||||
If ( (LotType NE '') and (LotID NE '') ) then
|
||||
If (Stage EQ '') then
|
||||
KeyList = ''
|
||||
Query = ''
|
||||
Query<1> = 'LOT_TYPE' : @VM : LotType
|
||||
Query<2> = 'LOT_ID' : @VM : LotID : @FM
|
||||
Flag = ''
|
||||
Open 'DICT.SUPPLEMENTS' to hDict then
|
||||
Btree.Extract(Query, 'SUPPLEMENTS', hDict, KeyList, 'E', Flag)
|
||||
If (Flag EQ 0) then
|
||||
If (KeyList NE '') then
|
||||
SupplementList = ''
|
||||
Stages = Supplement_Services('GetStagesForLot', LotType, LotID)
|
||||
StageCount = Dcount(Stages<1>, @VM)
|
||||
For I = 1 to StageCount
|
||||
SupplementStage = Supplement_Services('GetSupplementsForLot', LotType, LotID, Stages<1,I>)
|
||||
If SupplementStage NE False$ then SupplementList<-1> = SupplementStage
|
||||
Next I
|
||||
If SupplementList NE '' then Response = SupplementList
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error calling Btree.Extract')
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error opening SUPPLEMENTS dictionary.')
|
||||
end
|
||||
end else
|
||||
StageSupplementList = ''
|
||||
Query = ''
|
||||
Query<1> = 'LOT_TYPE' : @VM : LotType
|
||||
Query<2> = 'LOT_ID' : @VM : LotID
|
||||
Query<3> = 'STAGE' : @VM : Stage : @FM
|
||||
Flag = ''
|
||||
Open 'DICT.SUPPLEMENTS' to hDict then
|
||||
Btree.Extract(Query, 'SUPPLEMENTS', hDict, StageSupplementList, 'E', Flag)
|
||||
If (Flag EQ 0) then
|
||||
If StageSupplementList NE '' then Response = StageSupplementList
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error calling Btree.Extract')
|
||||
If Stage EQ '' then Stage = '#0'
|
||||
StageSupplementList = ''
|
||||
Query = ''
|
||||
Query<1> = 'LOT_TYPE' : @VM : LotType
|
||||
Query<2> = 'LOT_ID' : @VM : LotID
|
||||
Query<3> = 'STAGE' : @VM : Stage : @FM
|
||||
Flag = ''
|
||||
Open 'DICT.SUPPLEMENTS' to hDict then
|
||||
Btree.Extract(Query, 'SUPPLEMENTS', hDict, StageSupplementList, 'E', Flag)
|
||||
If (Flag EQ 0) then
|
||||
If StageSupplementList NE '' then
|
||||
StageIndexes = Xlate('SUPPLEMENTS', StageSupplementList, 'STAGE_INDEX', 'X')
|
||||
SortArray = StageIndexes:@FM:StageSupplementList
|
||||
SortArray = SRP_Array('SortRows', SortArray, 'AR1', 'ARRAY', @FM, @VM)
|
||||
SortedStageSupplementList = SortArray<2>
|
||||
Convert @VM to @FM in SortedStageSupplementList
|
||||
Response = SortedStageSupplementList
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error opening SUPPLEMENTS dictionary.')
|
||||
end
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error calling Btree.Extract')
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Error opening SUPPLEMENTS dictionary.')
|
||||
end
|
||||
end else
|
||||
Error_Services('Add', 'LotType or LotID was missing in the ' : Service : ' service.')
|
||||
end
|
||||
@ -683,6 +670,3 @@ Service SendNotifications(RDSList, EditEvent, Instructions, EntryUser)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user