optimized get nica orders services

This commit is contained in:
Infineon\StieberD
2025-01-20 15:58:00 -07:00
parent f9573b518c
commit 49f61982de
3 changed files with 28 additions and 26 deletions

View File

@ -54,21 +54,27 @@ Options ORDER_STATUSES = 'new','creating','not-started','in-progress','cancelled
// SERVICES
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Service GetOrderIds(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES, OrderStatus=ORDER_STATUSES, IsComplete=BOOLEAN)
Service GetOrderIds(EntityType=ENTITY_TYPES, EntityID, OrderTypes=ORDER_TYPES, OrderStatus=ORDER_STATUSES, IsComplete=BOOLEAN)
OrderKeys = ''
ErrorMsg = ''
If ( (EntityType NE '') or (EntityID NE '') or (OrderType NE '') or (OrderStatus NE '') or (IsComplete NE '') ) then
If ( (EntityType NE '') or (EntityID NE '') or (OrderTypes NE '') or (OrderStatus NE '') or (IsComplete NE '') ) then
Open 'DICT.NICA_ORDERS' to hDict then
Query = ''
Table = 'NICA_ORDERS'
Option = 'E'
Flag = ''
If EntityType NE '' then Query := 'ENTITY_TYPE' : @VM : EntityType : @FM
If EntityID NE '' then Query := 'ENTITY_ID' : @VM : EntityID : @FM
If OrderType NE '' then Query := 'ORDER_TYPE' : @VM : OrderType : @FM
If OrderStatus NE '' then Query := 'ORDER_STATUS' : @VM : OrderStatus : @FM
If IsComplete NE '' then Query := 'IS_COMPLETE' : @VM : IsComplete : @FM
If EntityType NE '' then Query := 'ENTITY_TYPE' : @VM : EntityType : @FM
If EntityID NE '' then Query := 'ENTITY_ID' : @VM : EntityID : @FM
If OrderTypes NE '' then
Query := 'ORDER_TYPE'
For each OrderType in OrderTypes using @VM
Query := @VM : OrderType
Next OrderType
Query := @FM
end
If OrderStatus NE '' then Query := 'ORDER_STATUS' : @VM : OrderStatus : @FM
If IsComplete NE '' then Query := 'IS_COMPLETE' : @VM : IsComplete : @FM
Btree.Extract(Query, Table, hDict, OrderKeys, Option, Flag)
If Flag NE 0 then
ErrorMsg = 'Error in ':Service:' service. Btree.Extract call failed.'
@ -103,9 +109,9 @@ Service GetOrderUpdates()
end service
Service GetActiveOrders(EntityType=ENTITY_TYPES, EntityId, OrderType=ORDER_TYPES)
Service GetActiveOrders(EntityType=ENTITY_TYPES, EntityId, OrderTypes=ORDER_TYPES)
Response = Nica_Orders_Services('GetOrderIds', EntityType, EntityID, OrderType, '#cancelled', False$)
Response = Nica_Orders_Services('GetOrderIds', EntityType, EntityID, OrderTypes, '#cancelled', False$)
end service
@ -563,3 +569,4 @@ end service