system.kanoa.schedule.checkScheduleOverlap
Description
Takes scheduleBlockInfo which contains info on a scheduled event to be created, checking to see if the start and end times interfere with any existing scheduled events at the asset.Syntax
checkScheduleOverlap(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)
- overlapFound (bool): True if scheduleBlock overlaps
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)
>