# Schedule Operations

In this section we'll start scheduling activities on our assets.

::embed-section{src="../../../kanoa-ops/schedule-operations.md" collapsed="true" summary="Reference Materials: Operations Scheduling. Learn how Kanoa manages production schedules."}

:::action[Schedule a non-production event]
1. Navigate to **Ops → Scheduling → Operations**.
2. Select the `Machine 1` asset.
3. Schedule a non-production event such as:

   ```text
   Mode: Engineering
   Asset: Machine 1
   Time Window: Choose a short training window
   ```
4. You can make it recurring if you'd like.
:::

:::action[Schedule generic production]

Generic production scheduling is useful when no formal work order exists yet, when a customer wants to schedule by item only, or when the schedule is an operational plan rather than an ERP order plan.

1. Select the time window on the calendar and click the add button to create a new schedule block.
2. Select `Spray Line 1` and the **Production** mode, and the item `SC-2024-STD`. Leave the work order blank.
3. Set the start and end times and save the schedule.
:::

:::action[Schedule a production order]
1. Select `Machine 1` and click the order selector button in the top bar to show the production orders that can run on this asset.
2. Drag production order `260526-001` onto the schedule.
3. Kanoa uses the item-asset scheduled rate (or the standard rate, if no scheduled rate is set) to estimate the duration.
4. Save the schedule.

Events that have a production order associated with them can't be recurring.
:::
***
### Enforcing Shift Schedules
By default, operations can be scheduled at any time. If you want to ensure that production schedules are only scheduled during active shifts, you can configure the asset model to use
`Shift Time Only`. When enabled, scheduled operations are forced to fit within the asset's shift times, which are shown as the white sections of the calendar.

::::action[Schedule within shift time]

1. Navigate to **Configuration → Ops → Assets**.
2. Select `Philadelphia` and enable 'Shift Time Only'.

:::tip
By setting Shift time Only at the site level, all assets beneath the site will inherit this setting. If you have a particular area or line that doesn't need to adhere to shifts,
you can set their `Shift Time Only` setting to False. The concept of inheritance is to set what is most common for your plant and then place overrides on just the exceptions.
:::

3. Navigate to **Ops → Scheduling → Operations**.
4. Select the `Machine 1` asset.
5. Delete the currently scheduled production order `260526-001`.
6. Drag production order `260526-001` onto `Machine 1` again, starting just before the end of the Evening Shift.
7. Notice that the operation is split into multiple events, each scheduled at the earliest available shift time.
::::

:::check

Copy this script into the Ignition Designer Script Console (**Tools → Script Console**) and run it. It lists what's scheduled on Machine 1, Spray Line 1 and Manual Pack 1 (in the site's time zone), then ticks off each scheduling step from this lesson that it can see. It doesn't change anything.

<details>
<summary>Show the check script</summary>

::check-script{src="ops/02-scheduling/3-operations-scheduling.py" title="checkLesson-scheduleOperations.py"}

</details>

:::
