Skip to main content

system.kanoa.quality.config.addChkShtTrigger(triggerInfo, userId)

Adds a check sheet trigger. All triggerInfo keys are required.


Parameters​

triggerInfo Dictionary

- chkShtIdInteger
- comingDueMinsInteger# of minutes after being triggered that a check sheet will be in 'Coming Due' state
- delayMinsInteger# of minutes after triggered that a check sheet will be created. Used to prevent flooding of required checks after a shift change
- enabledBoolean
- graceMinsInteger# of minutes a check sheet will remain in 'Over due' before becoming 'Missed'
- intervalMinsInteger# of minutes between new checks sheets being triggered
- modeIdIntegerCan be None for all modes
- modifierStringCan Be None
- overDueMinsInteger# of minutes after 'Due' state before a check sheet will transtion to 'Over due'
- productionCountFloatCan be None. For a count trigger (Infeed, Outfeed, Waste or General Count), a check is created every productionCount counts
- shiftNameIdIntegerCan be None for all shifts
- triggerTypeIdInteger
- fromModeIdIntegerMode Change only, optional: the mode the asset must be changing from. None for a change from any mode
- stateIdsListState Change only, required: the states it fires on, as a list or a comma separated String
- minStateMinsFloatState Change only: minutes the asset must be in the state before a check is created. None is 0
- counterNameStringGeneral Count only, required: the name of the asset's general counter

userId Integer: Id of user executing the function


Returns​

chkShtTriggerId Integer


Example​

triggerInfo = {
'chkShtId': 4,
'triggerTypeId':2,
'modeId': None,
'shiftNameId': None,
'intervalMins': 10,
'delayMins': 5,
'productionCount': None,
'comingDueMins': 5,
'overDueMins': 5,
'graceMins': 10,
'enabled': True,
'modifier': None
}
userId = 5
chkShtTriggerId = system.kanoa.quality.config.addChkShtTrigger(triggerInfo, userId)

A State Change trigger: a check once the asset has been Blocked or Starved (state ids 7 and 9) for 10 minutes

stateChangeId = system.kanoa.utilities.getFieldValue('triggerTypeId', system.kanoa.quality.config.getTriggerTypes({'triggerTypeName': 'State Change'}))
triggerInfo = {'chkShtId': 4, 'triggerTypeId': stateChangeId, 'stateIds': [7, 9], 'minStateMins': 10, 'modeId': None, 'shiftNameId': None,
'intervalMins': 0, 'delayMins': 0, 'productionCount': None, 'comingDueMins': 0, 'overDueMins': 15, 'graceMins': 10,
'enabled': True, 'modifier': None}
chkShtTriggerId = system.kanoa.quality.config.addChkShtTrigger(triggerInfo, 5)