Skip to main content

system.kanoa.schedule.scheduleOperation

Description

Schedules an operation that flexibly adheres to the asset's shift schedule, while also avoiding any currently existing schedule blocks

Syntax

scheduleOperation(scheduleBlockInfo, scheduleConfig, scheduleOption, userId)

Parameters:
  • scheduleBlockInfo (dict): Dictionary containing schedule block details.
  • scheduleConfig (dict): Dictionary containing scheduling configuration.
  • 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): ID of the user scheduling the operation.

  • Returns:
  • scheduleBlockIds (list[int]): List of new schedule blocks added for this operation
  • msg (str): None if successful
  • Dictionary

    scheduleBlockInfo
    ParameterTypeRequiredNotes
    scheduleBlockNamestrNoName of the schedule block
    assetIdintNo
    itemIdintNo
    workOrderIdintNo
    scheduledQtyintNo
    modeIdintNo
    startDatedatetimeNo
    endDatedatetimeNo
    notesstrNo
    rruleStrstrNoRecurrence rule string (e.g., 'FREQ=DAILY;INTERVAL=1')
    colorstrNo

    Dictionary

    scheduleConfig
    ParameterTypeRequiredNotes
    shiftTimeOnlyboolNoIf True, event times will be adjusted to schedule during shift times
    intelligentSchedulingboolNoWhen enabled, we will check if the event overlaps with existing events

    Code Examples

    # 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)
    >