Updated solution to support merging of ABORT_ALARM and INTRUSIVE_MAINT
orders
This commit is contained in:
@ -50,11 +50,13 @@ Return Response or ""
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Service Parameter Options
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
Options BOOLEAN = True$, False$
|
||||
Options ENTITY_TYPES = 'REACTOR','REACTOR_LOG'
|
||||
Options ORDER_TYPES = 'INTRUSIVE_MAINT','CHANGEOVER','INITIATE_IDLE','IDLE','ASM_HTR_TUBE_CHANGE','ASM_HTR_ANNUAL_PM','ASM_HTR_SEMIANNUAL_PM','ASM_HTR_FIVE_AND_TEN_YEAR_PM','IQS_HGCV_ALARM','ABORT_ALARM'
|
||||
Options ORDER_STATUSES = 'new','creating','not-started','in-progress','cancelled','done'
|
||||
Options REACTOR_TYPES = 'ASM','ASM+','HTR','EPP'
|
||||
Options BOOLEAN = True$, False$
|
||||
Options ENTITY_TYPES = 'REACTOR','REACTOR_LOG'
|
||||
Options ORDER_TYPES = 'INTRUSIVE_MAINT','CHANGEOVER','INITIATE_IDLE','IDLE','ASM_HTR_TUBE_CHANGE','ASM_HTR_ANNUAL_PM','ASM_HTR_SEMIANNUAL_PM','ASM_HTR_FIVE_AND_TEN_YEAR_PM','IQS_HGCV_ALARM','ABORT_ALARM'
|
||||
Options ORDER_STATUSES = 'new','in-edit','creating','not-started','in-progress','cancelled','done'
|
||||
Options REACTOR_TYPES = 'ASM','ASM+','HTR','EPP'
|
||||
Options ORDER_CHECKLIST_STATUSES = 'not-started','in-progress','paused','done'
|
||||
Options NICA_CHECKLISTS = 'PROCESS_INTERRUPTION_FLOW_C_PRE','PROCESS_INTERRUPTION_FLOW_A_PRE','PROCESS_INTERRUPTION_FLOW_B_PRE','PROCESS_INTERRUPTION_LAST_KNOWN_PRODUCT_THICKNESS_SHEETRHO','PROCESS_INTERRUPTION_LAST_KNOWN_PRODUCT_VISUAL_INSPECTION','PROCESS_INTERRUPTION_TEST_WAFER','PROCESS_INTERRUPTION_ASM_PARTICLE_QUAL_VISUAL_INSPECTION','PROCESS_INTERRUPTION_HTR_PARTICLE_QUAL_VISUAL_INSPECTION','SUSCEPTOR_PREP','1_PCRC','2_PCRC','BD','INTRINSIC','SPV-FE','CLEANUP','TEST_WAFER_VERIFICATION','PARTICLE_QUAL_ASM','PARTICLE_QUAL_HTR','FIRST_PRODUCT_RUN_HGCV','FIRST_PRODUCT_RUN_THICK','PROCESS_INTERRUPTION_FLOW_B_POST'
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// SERVICES
|
||||
@ -85,6 +87,7 @@ Service GetOrderIds(EntityType=ENTITY_TYPES, EntityID, OrderTypes=ORDER_TYPES, O
|
||||
For each Val in IsComplete using @VM
|
||||
Query := @VM : Val
|
||||
Next Val
|
||||
Query := @FM
|
||||
end
|
||||
Btree.Extract(Query, Table, hDict, OrderKeys, Option, Flag)
|
||||
If Flag NE 0 then
|
||||
@ -106,6 +109,64 @@ Service GetOrderIds(EntityType=ENTITY_TYPES, EntityID, OrderTypes=ORDER_TYPES, O
|
||||
End Service
|
||||
|
||||
|
||||
Service GetOrderChecklistIds(NicaOrdersIds, NicaChecklistIds=NICA_CHECKLISTS, IsComplete=BOOLEAN, ChecklistOrderStates=ORDER_CHECKLIST_STATUSES)
|
||||
|
||||
OrderChecklistIds = ''
|
||||
ErrorMsg = ''
|
||||
If ( (NicaOrdersIds NE '') or (IsComplete NE '') or (ChecklistOrderStates NE '') ) then
|
||||
Open 'DICT.NICA_ORDERS_CHECKLISTS' to hDict then
|
||||
Query = ''
|
||||
Table = 'NICA_ORDERS_CHECKLISTS'
|
||||
Option = 'E'
|
||||
Flag = ''
|
||||
If (NicaOrdersIds NE '') then
|
||||
Query := 'NICA_ORDERS_ID'
|
||||
For each NicaOrderId in NicaOrdersIds using @VM
|
||||
Query := @VM : NicaOrderId
|
||||
Next NicaOrderId
|
||||
Query := @FM
|
||||
end
|
||||
If (NicaChecklistIds NE '') then
|
||||
Query := 'NICA_CHECKLISTS_ID'
|
||||
For each NicaChecklistId in NicaChecklistIds using @VM
|
||||
Query := @VM : NicaChecklistId
|
||||
Next NicaChecklistId
|
||||
Query := @FM
|
||||
end
|
||||
If (IsComplete NE '') then
|
||||
Query := 'IS_COMPLETE'
|
||||
For each Val in IsComplete using @VM
|
||||
Query := @VM : Val
|
||||
Next Val
|
||||
Query := @FM
|
||||
end
|
||||
If (ChecklistOrderStates NE '') then
|
||||
Query := 'STATE'
|
||||
For each ChecklistOrderState in ChecklistOrderStates using @VM
|
||||
Query := @VM : ChecklistOrderState
|
||||
Next ChecklistOrderState
|
||||
Query := @FM
|
||||
end
|
||||
Btree.Extract(Query, Table, hDict, OrderChecklistIds, Option, Flag)
|
||||
If Flag NE 0 then
|
||||
ErrorMsg = 'Error in ':Service:' service. Btree.Extract call failed.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Failed to open DICT.NICA_ORDERS_CHECKLISTS.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. At least one search parameter must be provided.'
|
||||
end
|
||||
|
||||
If ErrorMsg EQ '' then
|
||||
Response = OrderChecklistIds
|
||||
end else
|
||||
Error_Services('Add', ErrorMsg)
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service GetOrderUpdates()
|
||||
|
||||
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||
@ -188,13 +249,15 @@ end service
|
||||
|
||||
|
||||
Service GetActiveOrders(EntityType=ENTITY_TYPES, EntityId, OrderTypes=ORDER_TYPES)
|
||||
|
||||
|
||||
Response = Nica_Orders_Services('GetOrderIds', EntityType, EntityID, OrderTypes, '#cancelled', False$:@VM:'')
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES, OrderFlows, OrderResponseLevel, ChecklistIds)
|
||||
Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES, OrderFlows, OrderResponseLevel, ChecklistIds, Intrusive=BOOLEAN)
|
||||
|
||||
If Intrusive NE True$ then Intrusive = False$
|
||||
|
||||
ErrorMsg = ''
|
||||
EntityTypes = 'REACTOR,REACTOR_LOG'
|
||||
@ -229,7 +292,39 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
|
||||
LogData<3> = 'Attempting to create NICA order for entity ':EntityType:' ' :EntityID:' of type ':OrderType
|
||||
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, False$)
|
||||
|
||||
CurrActiveOrders = Nica_Orders_Services('GetActiveOrders', EntityType, EntityID, OrderType)
|
||||
Begin Case
|
||||
|
||||
Case OrderType _EQC 'ABORT_ALARM'
|
||||
|
||||
OrderTypes = OrderType:@VM:'INTRUSIVE_MAINT'
|
||||
CurrActiveOrders = Nica_Orders_Services('GetActiveOrders', EntityType, EntityID, OrderTypes)
|
||||
If CurrActiveOrders NE '' then
|
||||
// If any active ABORT_ALARM orders are marked as intrusive (i.e., they were merged
|
||||
// with an INTRUSIVE_MAINT order then mark the new order as intrusive).
|
||||
ActiveOrdersIntrusive = Sum(Xlate('NICA_ORDERS', CurrActiveOrders, 'INTRUSIVE', 'X'))
|
||||
If ActiveOrdersIntrusive then Intrusive = True$
|
||||
end
|
||||
|
||||
Case OrderType _EQC 'INTRUSIVE_MAINT'
|
||||
|
||||
Intrusive = True$
|
||||
CurrActiveOrders = Nica_Orders_Services('GetActiveOrders', EntityType, EntityID, OrderType)
|
||||
CurrActiveAbortAlarmOrders = Nica_Orders_Services('GetActiveOrders', EntityType, EntityID, 'ABORT_ALARM')
|
||||
If CurrActiveAbortAlarmOrders NE '' then
|
||||
CurrActiveOrders<-1> = CurrActiveAbortAlarmOrders
|
||||
// Merge INTRUSIVE_MAINT and ABORT_ALARM orders into one ABORT_ALARM order.
|
||||
// Preserve ABORT_ALARM order flow ids for Reactor mode change logic that relies on these
|
||||
// to determine whether or not to trigger a new ABORT/ALARM order when changing ABORT/ALARM sub modes.
|
||||
OrderType = 'ABORT_ALARM'
|
||||
OrderFlows = Xlate('NICA_ORDERS', CurrActiveAbortAlarmOrders, 'ORDER_FLOW_IDS', 'X')
|
||||
OrderFlows = SRP_Array('Clean', OrderFlows, 'TrimAndMakeUnique', @VM)
|
||||
end
|
||||
|
||||
Case Otherwise$
|
||||
CurrActiveOrders = Nica_Orders_Services('GetActiveOrders', EntityType, EntityID, OrderType)
|
||||
|
||||
End Case
|
||||
|
||||
OrderTypeAlreadyActive = (CurrActiveOrders NE '')
|
||||
|
||||
If ( (OrderTypeAlreadyActive EQ False$) or (OrderType EQ 'INTRUSIVE_MAINT') or (OrderType EQ 'ABORT_ALARM') ) then
|
||||
@ -300,6 +395,17 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
|
||||
end
|
||||
|
||||
NewChecklistIds = SRP_Array('Clean', NewChecklistIds, 'TrimAndMakeUnique', @VM)
|
||||
If Intrusive then
|
||||
// Remove checklist ids with REMOVE_IF_INRUSIVE flag set to True$
|
||||
ChecklistIdsToRemove = Nica_Orders_Services('GetChecklistIds', '', '', '', '', '', '', True$)
|
||||
If ChecklistIdsToRemove NE '' then
|
||||
For each ChecklistIdToRemove in ChecklistIdsToRemove using @VM
|
||||
Locate ChecklistIdToRemove in NewChecklistIds using @VM setting vPos then
|
||||
NewChecklistIds = Delete(NewChecklistIds, 0, vPos, 0)
|
||||
end
|
||||
Next ChecklistIdToRemove
|
||||
end
|
||||
end
|
||||
NewChecklistPriorities = Xlate('NICA_CHECKLISTS', NewChecklistIds, 'PRIORITY', 'X')
|
||||
ChecklistArray = NewChecklistIds:@FM:NewChecklistPriorities
|
||||
ChecklistArray = SRP_Array('SortRows', ChecklistArray, 'AR2', 'ARRAY', @FM, @VM)
|
||||
@ -369,6 +475,7 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
|
||||
end
|
||||
NicaOrderRec<NICA_ORDERS.ORDER_FLOW_IDS$> = OrderFlows
|
||||
NicaOrderRec<NICA_ORDERS.ORDER_RESPONSE_LEVEL$> = OrderResponseLevel
|
||||
NicaOrderRec<NICA_ORDERS.INTRUSIVE$> = Intrusive
|
||||
LogNicaOrderRec = NicaOrderRec
|
||||
Swap @FM with ',' in LogNicaOrderRec
|
||||
LogData = ''
|
||||
@ -900,6 +1007,119 @@ Service GetAvailableFlowIds(NicaOrderType=ORDER_TYPES)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service AbortAlarmFromIntrusiveMaintRequired(ReactNo)
|
||||
|
||||
ErrorMsg = ''
|
||||
AbortAlarmFromIntrusiveMaintRequired = ''
|
||||
If ReactNo NE '' then
|
||||
If RowExists('REACTOR', ReactNo) then
|
||||
ActiveIntrusiveMaintOrderIds = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'INTRUSIVE_MAINT')
|
||||
IntrusiveMaintOrderActive = (ActiveIntrusiveMaintOrderIds NE '')
|
||||
If IntrusiveMaintOrderActive then
|
||||
// If any FIRST_PRODUCT_RUN_THICK or FIRST_PRODUCT_RUN_HGCV associated with active INTRUSIVE_MAINT
|
||||
// orders have been started or completed, then an ABORT/ALARM order should be triggerd.
|
||||
ChecklistIdsToSearch = 'FIRST_PRODUCT_RUN_THICK':@VM:'FIRST_PRODUCT_RUN_HGCV'
|
||||
InProcessOrCompleteOrderChecklistIds = Nica_Orders_Services('GetOrderChecklistIds', ActiveIntrusiveMaintOrderIds, ChecklistIdsToSearch, '', '#not-started')
|
||||
AbortAlarmFromIntrusiveMaintRequired = (InProcessOrCompleteOrderChecklistIds NE '')
|
||||
end else
|
||||
AbortAlarmFromIntrusiveMaintRequired = False$
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. REACTOR ':ReactNo:' does not exist.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Null ReactNo passed into service.'
|
||||
end
|
||||
|
||||
If ErrorMsg EQ '' then
|
||||
Response = AbortAlarmFromIntrusiveMaintRequired
|
||||
end else
|
||||
Error_Services('Add', ErrorMsg)
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service GetChecklistIds(Priorities, NicaBaseInstructionIds, NicaOrderFlowIds, NicaOrderFlowTypes, ReactorTypes, RemoveIfComplete=BOOLEAN, RemoveIfIntrusive=BOOLEAN)
|
||||
|
||||
ChecklistIds = ''
|
||||
ErrorMsg = ''
|
||||
If ( (Priorities NE '') or (NicaBaseInstructionIds NE '') or (NicaOrderFlowIds NE '') or (NicaOrderFlowTypes NE '') |
|
||||
or (ReactorTypes NE '') or (RemoveIfComplete NE '') or (RemoveIfIntrusive NE '') ) then
|
||||
Open 'DICT.NICA_CHECKLISTS' to hDict then
|
||||
Query = ''
|
||||
Table = 'NICA_CHECKLISTS'
|
||||
Option = 'E'
|
||||
Flag = ''
|
||||
If (Priorities NE '') then
|
||||
Query := 'PRIORITY'
|
||||
For each Priority in Priorities using @VM
|
||||
Query := @VM : Priority
|
||||
Next Priority
|
||||
Query := @FM
|
||||
end
|
||||
If (NicaBaseInstructionIds NE '') then
|
||||
Query := 'NICA_BASE_INSTRUCTION_ID'
|
||||
For each NicaBaseInstructionId in NicaBaseInstructionIds using @VM
|
||||
Query := @VM : NicaBaseInstructionId
|
||||
Next NicaBaseInstructionId
|
||||
Query := @FM
|
||||
end
|
||||
If (NicaOrderFlowIds NE '') then
|
||||
Query := 'NICA_ORDER_FLOW_IDS'
|
||||
For each NicaOrderFlowId in NicaOrderFlowIds using @VM
|
||||
Query := @VM : NicaOrderFlowId
|
||||
Next NicaOrderFlowId
|
||||
Query := @FM
|
||||
end
|
||||
If (NicaOrderFlowTypes NE '') then
|
||||
Query := 'NICA_ORDER_FLOW_TYPE'
|
||||
For each NicaOrderFlowType in NicaOrderFlowTypes using @VM
|
||||
Query := @VM : NicaOrderFlowType
|
||||
Next NicaOrderFlowTypes
|
||||
Query := @FM
|
||||
end
|
||||
If (ReactorTypes NE '') then
|
||||
Query := 'REACTOR_TYPES'
|
||||
For each NicaOrderFlowType in NicaOrderFlowTypes using @VM
|
||||
Query := @VM : NicaOrderFlowType
|
||||
Next NicaOrderFlowTypes
|
||||
Query := @FM
|
||||
end
|
||||
If (RemoveIfComplete NE '') then
|
||||
Query := 'REMOVE_IF_COMPLETE'
|
||||
For each Val in RemoveIfComplete using @VM
|
||||
Query := @VM : Val
|
||||
Next RemoveIfComplete
|
||||
Query := @FM
|
||||
end
|
||||
If (RemoveIfIntrusive NE '') then
|
||||
Query := 'REMOVE_IF_INTRUSIVE'
|
||||
For each Val in RemoveIfIntrusive using @VM
|
||||
Query := @VM : Val
|
||||
Next Val
|
||||
Query := @FM
|
||||
end
|
||||
Btree.Extract(Query, Table, hDict, ChecklistIds, Option, Flag)
|
||||
If Flag NE 0 then
|
||||
ErrorMsg = 'Error in ':Service:' service. Btree.Extract call failed.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Failed to open DICT.NICA_CHECKLISTS.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. At least one search parameter must be provided.'
|
||||
end
|
||||
|
||||
If ErrorMsg EQ '' then
|
||||
Response = ChecklistIds
|
||||
end else
|
||||
Error_Services('Add', ErrorMsg)
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user