optimized get nica orders services
This commit is contained in:
parent
f9573b518c
commit
49f61982de
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -903,11 +903,9 @@ end service
|
||||
Service GetRlChecklistActive(RLKey)
|
||||
|
||||
If RLKey NE '' then
|
||||
ActiveTubeChangeIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR_LOG', RLKey, 'ASM_HTR_TUBE_CHANGE')
|
||||
ActiveAnnualPmIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR_LOG', RLKey, 'ASM_HTR_ANNUAL_PM')
|
||||
ActiveSemiannualPmIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR_LOG', RLKey, 'ASM_HTR_SEMIANNUAL_PM')
|
||||
ActiveFiveAndTenPmIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR_LOG', RLKey, 'ASM_HTR_FIVE_AND_TEN_YEAR_PM')
|
||||
Response = ( (ActiveTubeChangeIds NE '') or (ActiveAnnualPmIds NE '') or (ActiveSemiannualPmIds NE '') or (ActiveFiveAndTenPmIds NE '') )
|
||||
OrderTypes = 'ASM_HTR_TUBE_CHANGE' : @VM : 'ASM_HTR_ANNUAL_PM' : @VM : 'ASM_HTR_SEMIANNUAL_PM' : @VM : 'ASM_HTR_FIVE_AND_TEN_YEAR_PM'
|
||||
ActiveRlOrderIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR_LOG', RLKey, OrderTypes)
|
||||
Response = ( ActiveRlOrderIds NE '' )
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Null ReactNo passed into service.')
|
||||
end
|
||||
@ -948,3 +946,4 @@ ClearCursors:
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
@ -3614,11 +3614,10 @@ end service
|
||||
|
||||
Service GetProveInActive(ReactNo)
|
||||
|
||||
If ReactNo NE '' then
|
||||
ActiveChangeoverIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'CHANGEOVER')
|
||||
ActiveInitIdleIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'INITIATE_IDLE')
|
||||
ActiveIdleIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'IDLE')
|
||||
Response = ( (ActiveChangeoverIds NE '') or (ActiveInitIdleIds NE '') or (ActiveIdleIds NE '') )
|
||||
If ReactNo NE '' then
|
||||
OrderTypes = 'CHANGEOVER' : @VM : 'INITIATE_IDLE' : @VM : 'IDLE'
|
||||
ActiveProveInIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, OrderTypes)
|
||||
Response = (ActiveProveInIds NE '')
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Null ReactNo passed into service.')
|
||||
end
|
||||
@ -3642,13 +3641,9 @@ end service
|
||||
|
||||
Service GetActiveProveInOrderIds(ReactNo)
|
||||
|
||||
If ReactNo NE '' then
|
||||
ActiveChangeoverIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'CHANGEOVER')
|
||||
ActiveInitIdleIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'INITIATE_IDLE')
|
||||
ActiveIdlesIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'IDLE')
|
||||
If (ActiveChangeoverIds NE '') then Response<0, -1> = ActiveChangeoverIds
|
||||
If (ActiveInitIdleIds NE '') then Response<0, -1> = ActiveInitIdleIds
|
||||
If (ActiveIdlesIds NE '') then Response<0, -1> = ActiveInitIdleIds
|
||||
If ReactNo NE '' then
|
||||
OrderTypes = 'CHANGEOVER' : @VM : 'INITIATE_IDLE' : @VM : 'IDLE'
|
||||
Response = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, OrderTypes)
|
||||
end else
|
||||
Error_Services('Add', 'Error in ':Service:' service. Null ReactNo passed into service.')
|
||||
end
|
||||
@ -3693,3 +3688,4 @@ ClearCursors:
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user