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, userId)- scheduleBlockInfo (dict) - Dictionary containing information about the schedule block.
- - scheduleBlockName (string): Name of the schedule block
- - assetId (int): ID of the asset associated with the schedule block
- - itemId (int): ID of the item associated with the schedule block or None
- - workOrderId (int): ID of the work order associated with the schedule block or None
- - scheduledQty (int): Quantity scheduled
- - modeId (int): ID of the mode associated with the schedule block
- - startDate (datetime): Start date of the schedule block
- - endDate (datetime): End date of the schedule block
- - notes (string): Additional notes for the schedule block
- - rruleStr (string): Recurrence rule string (e.g., 'FREQ=DAILY;INTERVAL=1')
- - color (string): Color code for the schedule block
- shiftAdherence (bool): If True, event times will be adjusted to schedule during shift times
- scheduleOption (string): i.e. 'default'- does not affect existing events, 'fixed' - modifies overlapping events, 'override' - deletes overlapping events, 'wrap' - wraps around existing events
- deviceUTCOffsetHrs (int)
- userId (int)
- addedScheduleBlockIds (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': ..., 'endDate': ..., 'notes': 'Maintenance notes', 'rruleStr': 'FREQ=DAILY;INTERVAL=1', 'color': 'FF0000'}
userId = 123
shiftAdherence = False
scheduleOption = 'default'
deviceUTCOffsetHrs = -8.0
schedule_block_id = system.kanoa.schedule.scheduleOperation(scheduleBlockinfo, shiftAdherence, scheduleOption, deviceUTCOffsetHrs, userId)
>