|
Http Verb |
POST |
|---|---|
|
Url |
/work-orders/execution/r1/interventions/{interventionId}/intervention-start |
|
Permissions required |
|
|
Personally Identifiable Information (PII) |
No |
|
Sensitive Information |
No |
|
Last Modified Version |
r1 |
|
Released since |
2024 W3 (FSM 18.0) |
|
Deprecated since |
|
|
Removed since |
|
|
Tech Tags |
PAGINATION ORDERING-SERVER-SIDE |
Business Logic
This API sets the start date of a work order operation using its intervention Id.
The start date must be set after the arrival on site of the intervention. You can set the arrival on site date of the intervention using this API: POST /work-orders/execution/r1/interventions/{interventionId}/arrival-on-site.
In a team scenario, assistants follow the same rules as the foreman, but their intervention information is linked to the foreman's intervention.
The result of this API call can be viewed by calling GET /work-orders/execution/r1/interventions/outcomes/{outcomeId}and passing the intervention Id as the outcome Id in the path parameter.
It is possible to skip this step in the intervention process and directly call the following API POST /work-orders/execution/r1/interventions/{interventionId}/outcomes
Steps
Retrieve Intervention
We will refer to interventionFromInputId as the intervention record with intervention.id equal to interventionId provided in the path parameter of this API.
Example:
-
interventionFromInputId.statusIdwill be thestatusIdfield of the intervention withidequal tointerventionId. -
interventionFromInputId.outcomewill be the Intervention outcome of the intervention withidequal tointerventionId, that can be retrieved by calling GET /work-orders/execution/r1/interventions/outcomes/{outcomeId} .
-
Validate Intervention Status
-
Check if
interventionFromInputId.statusIdis ‘IN_EXECUTION’.-
If not, return the error EXECUTION_002.
-
-
Check if
interventionFromInputId.workOrderOperationIdis null.-
If yes, return the error WORKORDERS_ORCHESTRATOR_006.
-
-
Check if Core System Setting field
"Outcome Minimum Date" < interventionStartDate:-
if not, return the error EXECUTION_003.
-
-
Check if
interventionStartDate < Date.now() + 1(it should be at most a date in the present, not in the future):-
if not return the error BASE_0016.
-
-
Check if workOrderHeader.isWoByOrder())
-
If TRUE ->operation.getParentOperation() != null → you can take in charge an intervention only if it is the one of the parent operation
-
if not return the error EXECUTION_005.
-
-
-
Handle Existing Interventions
-
Search for all intervention records associated with the same resource with
statusIdvalues ‘IN_CHARGE' or 'IN_EXECUTION’ andworkOrderOperationIdnot equal tointerventionFromInputId.workOrderOperationId -
We will refer to this list of intervention records as
interventionsToBeDeleted. -
For each
interventionin theinterventionsToBeDeletedlist:-
Set
intervention.arrivalDateto null -
Set
intervention.takeInChargeDateto null -
Set
intervention.startDateto null -
Change
intervention.statusIdto ‘SUBMITTED’ by passing the ‘SUBMIT’ action. -
Update
intervention.workOrderOperationId.statusId -
Update
intervention.workOrderOperationId.workOrderId.statusId -
Retrieve all records of
resourceAccountedHourentity withresourceAccountedHour.interventionIdequal tointervention.idandresourceAccountedHour.outcomeEndDateequal to null.-
For each record, set:
-
resourceAccountedHour.takeInChargeto null -
resourceAccountedHour.arrivalDateto null -
resourceAccountedHour.outcomeStartDateto null
-
-
-
-
-
Take In Charge the Intervention
-
If
interventionFromInputId.outcome.startDateis null:-
Set
interventionFromInputId.outcome.startDate=interventionStartDate
-
-
If
interventionFromInputId.outcome.arrivalDateis null:-
Set
interventionFromInputId.outcome.arrivalDate=interventionStartDate
-
-
If
interventionFromInputId.outcome.takeInChangeDateis null:-
Set
interventionFromInputId.outcome.takeInChangeDate=interventionStartDate
-
-
If
company.fsm.accounting.emptyAgendaResourceDeletionproperty is enabled, remove all emptyresourceAccountedHourassociated with the sameinterventionFromInputId, they will be removed ifresourceAccountedHour.spentTime,resourceAccountedHour.takeInChargeDateare null and ifresourceAccountedHour.resourceis different from the resource associated with theinterventionFromInputId -
Update
interventionFromInputId.workOrderOperationId.statusId -
Update
interventionFromInputId.workOrderOperationId.workOrderId.statusId
-
Header Parameters
Default.
Request Body Parameters
|
Field |
Validations |
Note |
|---|---|---|
|
interventionStartDate |
|
|
Response documentation
Response payload fields
Response error codes
NOT_FOUND, BASE_0001, BASE_0003, BASE_0010, BASE_0011, WORKORDERS_ORCHESTRATOR_006, EXECUTION_002, EXECUTION_003, BASE_0016.