NextGen APIs

POST /scheduling/manual/r1/scheduling/activities-assignments

Http Verb

POST

Url

/scheduling/manual/r1/scheduling/activities-assignments

Permissions required


Personally Identifiable Information (PII)

No

Sensitive Information

No

Last Modified Version

r1 - 2024 W3 (FSM 18.0)

Released since

2024 W2 (FSM 17.0)

Deprecated since


Removed since


Tech Tags


Business Logic

This API is designed for assign a single work order operation to a scheduling resource (2024 W2 - FSM 17.0), a crew shell or a team (2024 W3 - FSM 18.0). This new assignation process is a simplified version respect to the assignation process of the daily plan.

It is possible to call:

Key Differences from the Daily Plan Functionality

  • Linked activity and work order by order are not supported.

  • Real-time management is not supported.

  • Activities cannot be split across multiple work shifts.

  • Timesheet, Multistage, Bundler, DCS, and other FSM modules are not managed.

  • Only one work order operation can be assigned at a time.

  • The activity can only be assigned as the last work shift activity.

  • Only the real plan is considered.

Preliminary Workflow

  • If assistantsWorkShiftsId is null, the assignment is for a work shift related to a single resource or a Crew Shell. Otherwise, the request is related to a Team.

A - Case Single Resource or Crew Shell Assignment

  1. Check Crew Shell Membership

    • If workShiftId is related to a member of a crew shell, return error MANUAL_SCHED_026.

  2. If crew shell check that crew shell is active, if not return error MANUAL_SCHED_030.

  3. Activity Check

    • Check if the workOrderOperation is schedulable. Examples:

      1. Verify if workOrderOperationId.statusId is one of the following: SCHEDULABLE, TO_RESCHEDULE, LOCKED. If not, return error MANUAL_SCHED_003.

      2. Verify if workOrderOperationId.workOrderId.operationsAssignment is DISTINCT. If not, return error MANUAL_SCHED_028.

  4. Check Freezing Day

    • Check if the operation center from workOrderOperationId.workOrderId.operationCenterId has daily freezing active. If yes, the start date of the work shift cannot be earlier than yesterday. If not active, calculate the date beyond which pasting is not allowed. If the start date of the work shift is earlier than this freezing day, the paste is not possible.

  5. Retrieve Intervention

    • Search for an intervention record with intervention.workOrderOperationId = {workOrderOperationId}. If a record is found use this record.

    • Otherwise, create a new intervention.

  6. Create Scheduling Record

    • Set scheduling.workShiftId = {workShiftId}.

    • Set scheduling.interventionId to the previously created interventionId.

    • Set scheduling.stateId to SCHEDULED.

    • Set scheduling.workOrderOperationId = {workOrderOperationId}.

    • Set scheduling.realPlan to true.

    • If workOrderOperationId.currentDuration is not null, get workOrderOperationId.defaultDuration; otherwise, get currentDuration.

      • Set the retrieved value to scheduling.duration.

    • Calculate Coordinates of the Previous Activity (or Start of Shift Coordinates):

      • Uses the VRP using the coordinates of the previous activity and the coordinates of the new activity to determine the transfer time and distance for the new activity.

      • Set related scheduling fields:

        • Set scheduling.distanceFromPrevious

        • Set scheduling.timeFromPrevious

        • Set scheduling.distanceToNext

        • Set scheduling.timeToNext

        • Set scheduling.startDate

        • Set scheduling.endDate

        • Set scheduling.arrivalDate

        • Set scheduling.breakTime

    • Update Work Shift Tour Data :

      • We take all the activities present in the shift and calculate the start and end coordinates and the time taken.

      • Check scheduled time on the work shift.

        • If endTourDate is greater than workShiftId.endDate:

          • If operationCenterId.admittedOvertime is greater than 0:

            • Calculate endOverTimeDate from workShiftId.endDate and admitted overtime. If admittedOvertime is greater than 0 and endTourDate is greater than endOvertimeDate, return error MANUAL_SCHED_022.

          • Otherwise, return error MANUAL_SCHED_021.

  7. Update Intervention data:

    • If automaticValidation is true and scheduling.interventionId.statusId is OPEN:

      • Set scheduling.interventionId.statusId to FIXED.

      • If we are in crew shell assignment the business logic triggers the checks for crew shells(i.e. check if crew shell is not empty and with a foreman assigned).

    • set scheduling.interventionId.defaultDuration = scheduling.duration

    • set scheduling.interventionId.foremanId = scheduling.foreman

  8. Update Work Order and Work Order Operation Status:

    • Calculate and update workOrderOperationId.stateId.

    • Calculate and update workOrderOperationId.workOrderId.stateId.

B - Case Team Assignment

  1. Activity Check

    • Check if the workOrderOperation is schedulable. Examples:

      1. Verify if workOrderOperationId.statusId is one of the following: SCHEDULABLE, TO_RESCHEDULE, LOCKED. If not, return error MANUAL_SCHED_003.

      2. Verify if workOrderOperationId.workOrderId.operationsAssignment is DISTINCT. If not, return error MANUAL_SCHED_028.

  2. Check Freezing Day

    • Check if the operation center from workOrderOperationId.workOrderId.operationCenterId has daily freezing active. If yes, the start date of the work shift cannot be earlier than yesterday. If not active, calculate the date beyond which pasting is not allowed. If the start date of the work shift is earlier than this freezing day, the paste is not possible.

  3. Retrieve Intervention

    • Search for an intervention record with intervention.workOrderOperationId = {workOrderOperationId}. If a record is found use this record.

    • Otherwise, create a new intervention.

  4. Create Scheduling Record

    • For each Team resource member

      • Set scheduling.workShiftId = {workShiftId}.

      • Set scheduling.interventionId to the previously created interventionId.

      • Set scheduling.stateId to SCHEDULED.

      • Set scheduling.workOrderOperationId = {workOrderOperationId}.

      • Set scheduling.realPlan to true.

      • If workOrderOperationId.currentDuration is not null, get workOrderOperationId.defaultDuration; otherwise, get currentDuration.

        • Set the retrieved value to scheduling.duration.

    • For each team member scheduling record, set the schedulingId related to the team foreman. The field on the internal entity is called foremanScheduling, but for the moment it will be not exposed via API.

    • For each Team resource member scheduling:

      • Calculate Coordinates of the Previous Activity (or Start of Shift Coordinates):

        • Uses the VRP using the coordinates of the previous activity and the coordinates of the new activity to determine the transfer time and distance for the new activity.

        • Set related scheduling fields:

          • Set scheduling.distanceFromPrevious

          • Set scheduling.timeFromPrevious

          • Set scheduling.distanceToNext

          • Set scheduling.timeToNext

          • Set scheduling.startDate

          • Set scheduling.endDate

          • Set scheduling.arrivalDate

          • Set scheduling.breakTime

      • Update Work Shift Tour Data :

        • We take all the activities present in the shift and calculate the start and end coordinates and the time taken.

        • Check scheduled time on the work shift.

          • If endTourDate is greater than workShiftId.endDate:

            • If operationCenterId.admittedOvertime is greater than 0:

              • Calculate endOverTimeDate from workShiftId.endDate and admitted overtime. If admittedOvertime is greater than 0 and endTourDate is greater than endOvertimeDate, return error MANUAL_SCHED_022.

            • Otherwise, return error MANUAL_SCHED_021.

  5. Update Intervention data:

    • If automaticValidation is true and scheduling.interventionId.statusId is OPEN:

      • Set scheduling.interventionId.statusId to FIXED.

    • set scheduling.interventionId.defaultDuration = scheduling.duration

    • set scheduling.interventionId.foremanId = scheduling.foreman

  6. Update Work Order and Work Order Operation Status:

    • Calculate and update workOrderOperationId.stateId.

    • Calculate and update workOrderOperationId.workOrderId.stateId.


Header Parameters

Default.

Request Body Parameters

Field

Validations

Note

workOrderOperationId


 

workShiftId


  • single assignation: is the workshift of the resource

  • team assignation: is the workshift of the foreman

  • crew shell assignation: is the workshift of the crew shell

forceOvertimeAssignment



automaticValidation



assistantsWorkShiftsId


  • available since 2024 W3 (FSM 18.0)

  • Collection of ids - used only for team assignment (ids of the assistants)

Response documentation

Response payload fields

Field

Note

schedulingId

 the list of created schedulings

Response error codes

MANUAL_SCHED_001, MANUAL_SCHED_002, MANUAL_SCHED_003, MANUAL_SCHED_004, MANUAL_SCHED_005, MANUAL_SCHED_006, MANUAL_SCHED_007, MANUAL_SCHED_008, MANUAL_SCHED_009, MANUAL_SCHED_010, MANUAL_SCHED_011, MANUAL_SCHED_012, MANUAL_SCHED_013, MANUAL_SCHED_014, MANUAL_SCHED_015, MANUAL_SCHED_016, MANUAL_SCHED_018, MANUAL_SCHED_019, MANUAL_SCHED_021, MANUAL_SCHED_022, MANUAL_SCHED_023, MANUAL_SCHED_024, MANUAL_SCHED_025, MANUAL_SCHED_026, MANUAL_SCHED_027, MANUAL_SCHED_028, MANUAL_SCHED_030