system.kanoa.schedule.scheduleOperation
Description
Schedules an operation that flexibly adheres to the asset's shift schedule, while also avoiding any currently existing schedule blocksSyntax
scheduleOperation(scheduleBlockInfo, scheduleConfig, scheduleOption, userId)- scheduleBlockInfo (dict)
- - scheduleBlockName (str): Name of the schedule block
- - assetId (int)
- - itemId (int)
- - workOrderId (int)
- - scheduledQty (int)
- - modeId (int)
- - startDate (datetime)
- - endDate (datetime)
- - notes (str)
- - rruleStr (str): Recurrence rule string (e.g., 'FREQ=DAILY;INTERVAL=1')
- - color (str)
- scheduleConfig (dict)
- - shiftTimeOnly (bool): If True, event times will be adjusted to schedule during shift times
- - intelligentScheduling (bool): When enabled, we will check if the event overlaps with existing events
- scheduleOption (string): i.e. 'default'- does not affect existing events, 'fixed' - modifies overlapping events, 'override' - deletes overlapping events, 'wrap' - wraps around existing events
- userId (int)
- scheduleBlockIds (list[int]): List of new schedule blocks added for this operation
- msg (str): None if successful
Code Example
# Example Usage:
scheduleBlockinfo = {
'scheduleBlockName': 'Maintenance',
'assetId': 1,
'itemId': None,
'workOrderId': None,
'scheduledQty': None,
'modeId': 3,
'startDate': system.date.parse("2025-01-01 00:00:00"),
'endDate': system.date.parse("2025-01-07 00:00:00"),
'notes': 'Maintenance notes',
'rruleStr': 'FREQ=DAILY;INTERVAL=1',
'color': '#FF0000'
}
userId = 123
scheduleConfig = {'shiftTimeOnly': True, 'intelligentScheduling': True}
scheduleOption = 'default'
scheduleBlockId = system.kanoa.schedule.scheduleOperation(scheduleBlockinfo, scheduleConfig, scheduleOption, userId)
>