Updated solution to support merging of ABORT_ALARM and INTRUSIVE_MAINT

orders
This commit is contained in:
Infineon\StieberD 2025-06-05 13:42:38 -07:00
parent f3ad7adfa8
commit 5eec9386c2
4 changed files with 267 additions and 29 deletions

View File

@ -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
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -2031,16 +2031,35 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
If ErrorMsg EQ '' then
AbortAlarmFeatureFlag = Xlate('FEATURE_FLAGS', 'NICA_ABORT_ALARM', FEATURE_FLAGS.ENABLED$, 'X')
If AbortAlarmFeatureFlag EQ True$ then
If IntrMaintFeatureFlag EQ True$ then
AbortAlarmFromIntrusiveMaintRequired = Nica_Orders_Services('AbortAlarmFromIntrusiveMaintRequired', ReactNo)
ActiveIntrusiveMaintChecklists = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'INTRUSIVE_MAINT')
IntrusiveMaintChecklistActive = (ActiveIntrusiveMaintChecklists NE '')
end else
AbortAlarmFromIntrusiveMaintRequired = False$
IntrusiveMaintChecklistActive = False$
end
ModeSubCatFlowId = Xlate('REACT_PROB_CAT', ModeSubCatId, REACT_PROB_CAT_ABORT_ALARM_FLOW_ID$, 'X')
ModeSubCatRespLvl = Xlate('REACT_PROB_CAT', ModeSubCatId, REACT_PROB_CAT_ABORT_ALARM_RESPONSE_LEVEL$, 'X')
AbortAlarmComp = Xlate('REACTOR', ReactNo, REACTOR_ABORT_ALARM_COMPLETE$, 'X')
ActiveAbortAlarmOrders = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'ABORT_ALARM')
AbortAlarmOrderActive = (ActiveAbortAlarmOrders NE '')
ReactorType = Xlate('REACTOR', ReactNo, REACTOR_REACT_TYPE$, 'X')
ChecklistIds = Nica_Orders_Services('GetFlowChecklistIds', ModeSubCatFlowId, 'ABORT_ALARM', ReactorType)
CreateAbortAlarmOrder = False$
Intrusive = False$
Begin Case
Case ( AbortAlarmOrderActive and (SelE10State _EQC 'Productive') )
ErrorMsg = "An ABORT/ALARM Checklist is active for this reactor and must be completed or overridden in order to change to a productive state."
Case ( AbortAlarmOrderActive and IndexC(ModeSubCat, 'ABORT/ALARM', 1) and (ModeSubCatFlowId NE '') )
Case ( AbortAlarmFromIntrusiveMaintRequired and IndexC(ModeSubCat, 'ABORT/ALARM', 1) and (ModeSubCatFlowId NE '') and (ChecklistIds NE '') )
// INTRUSIVE_MAINT FIRST_PRODUCT_RUN_THICK or FIRST_PRODUCT_RUN_HGCV checklist started and
// ABORT/ALARM mode entered, so create an ABORT/ALARM order to contain product in reactor.
CreateAbortAlarmOrder = True$
Intrusive = True$
Case ( Not(IntrusiveMaintChecklistActive) and AbortAlarmOrderActive and IndexC(ModeSubCat, 'ABORT/ALARM', 1) and (ModeSubCatFlowId NE '') )
// If there is an active ABORT/ALARM NICA order, then we need to check if the new sub mode is different than the sub mode entered when the ABORT/ALARM
// NICA order was created and is of a higher response level or the new mode is WAITING_FOR_OPERATOR and the sub mode has changed. This means the maintenance
// team deemed the true ABORT/ALARM root cause was different than the cause the operators selected.
@ -2052,26 +2071,26 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
Next ActiveAbortAlarmRespLvl
If ( (Mode _EQC 'WAITING_FOR_OPERATOR') and (ModeSubCatFlowId NE ActiveAbortAlarmFlowIds) ) |
or ( (ModeSubCatFlowId NE ActiveAbortAlarmFlowIds) and (ModeSubCatRespLvl GT MaxActiveRespLvl) ) then
ReactorType = Xlate('REACTOR', ReactNo, REACTOR_REACT_TYPE$, 'X')
ChecklistIds = Nica_Orders_Services('GetFlowChecklistIds', ModeSubCatFlowId, 'ABORT_ALARM', ReactorType)
If ChecklistIds NE '' then
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactNo, 'ABORT_ALARM', ModeSubCatFlowId, ModeSubCatRespLvl, ChecklistIds)
RlComment = 'ABORT/ALARM initiated for flow ':ModeSubCatFlowId:'.'
CreateAbortAlarmOrder = True$
end
end
Case ( Not(AbortAlarmComp) and Not(AbortAlarmOrderActive) and IndexC(ModeSubCat, 'ABORT/ALARM', 1) and (ModeSubCatFlowId NE '') )
ReactorType = Xlate('REACTOR', ReactNo, REACTOR_REACT_TYPE$, 'X')
ChecklistIds = Nica_Orders_Services('GetFlowChecklistIds', ModeSubCatFlowId, 'ABORT_ALARM', ReactorType)
If ChecklistIds NE '' then
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactNo, 'ABORT_ALARM', ModeSubCatFlowId, ModeSubCatRespLvl, ChecklistIds)
RlComment = 'ABORT/ALARM initiated for flow ':ModeSubCatFlowId:'.'
end
Case ( Not(IntrusiveMaintChecklistActive) and Not(AbortAlarmComp) and Not(AbortAlarmOrderActive) and IndexC(ModeSubCat, 'ABORT/ALARM', 1) and (ModeSubCatFlowId NE '') and (ChecklistIds NE '') )
// Typical ABORT/ALARM case
CreateAbortAlarmOrder = True$
Case Otherwise$
// Don't create an ABORT/ALARM NICA order
Null
End Case
If CreateAbortAlarmOrder then
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactNo, 'ABORT_ALARM', ModeSubCatFlowId, ModeSubCatRespLvl, ChecklistIds, Intrusive)
RlComment = 'ABORT/ALARM initiated for flow ':ModeSubCatFlowId:'.'
end
end
end

View File

@ -1,7 +1,7 @@
compile insert NICA_CHECKLISTS_EQUATES
/*----------------------------------------
Author : Table Create Insert Routine
Written : 05/03/2025
Written : 03/06/2025
Description : Insert for Table NICA_CHECKLISTS
----------------------------------------*/
#ifndef __NICA_CHECKLISTS_EQUATES__
@ -13,6 +13,6 @@ compile insert NICA_CHECKLISTS_EQUATES
equ NICA_CHECKLISTS.NICA_ORDER_FLOW_TYPE$ to 4
equ NICA_CHECKLISTS.REACTOR_TYPES$ to 5
equ NICA_CHECKLISTS.REMOVE_IF_COMPLETE$ to 6
#endif
equ NICA_CHECKLISTS.REMOVE_IF_INTRUSIVE$ to 7
#endif

View File

@ -1,7 +1,7 @@
compile insert NICA_ORDERS_EQUATES
/*----------------------------------------
Author : Table Create Insert Routine
Written : 05/12/2024
Written : 28/05/2025
Description : Insert for Table NICA_ORDERS
----------------------------------------*/
#ifndef __NICA_ORDERS_EQUATES__
@ -16,9 +16,8 @@ compile insert NICA_ORDERS_EQUATES
equ NICA_ORDERS.ORDER_CHECKLIST_IDS$ to 7
equ NICA_ORDERS.ORDER_FLOW_IDS$ to 8
equ NICA_ORDERS.ORDER_RESPONSE_LEVEL$ to 9
equ NICA_ORDERS.CREATED_DTM$ to 10
equ NICA_ORDERS.CLOSED_DTM$ to 11
equ NICA_ORDERS.CREATED_DTM$ to 10
equ NICA_ORDERS.CLOSED_DTM$ to 11
equ NICA_ORDERS.INTRUSIVE$ to 12
#endif