|
Http Verb |
DELETE |
|---|---|
|
Url |
/work-orders/execution/r1/interventions/resources-accounted-hours |
|
Permissions required |
Work Order Accounting Edit: fsm.core.workorder.accounting.edit |
|
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 removes the accounted hours of a resource related to a specific intervention and working hour type.
During the removal, also the record of Total Accounted Hours corresponding to the same resource and working hour type is updated or deleted.
Related APIs
-
Search Interventions: GET /work-orders/execution/r1/interventions
-
Search Resources: GET /workforce/resources/r1/resources
-
Search Existing Accounted Hours: GET /work-orders/execution/r1/interventions/resources-accounted-hours
-
Search Total Accounted Hours: GET /work-orders/execution/r1/interventions/total-accounted-hours
-
Decode Working Hour Type: GET /work-orders/r1/execution/working-hours-types
Validations
-
Check Intervention Validation Status:
Check if the related intervention validation status record meets the following condition:-
RescoureAccountedHour.validationStatusId = AUTOMATIC_VALIDATION -
RescoureAccountedHour.validationStatusId = MANUALLY_VALIDATED
If yes, return error WORKORDERS_ORCHESTRATOR_013.
-
-
Check User Id:
-
Check if the userId of the API call matches with the
ResourceAccountedHours.manualLockUserIdof the record is intended to delete.
-
If not, return error WORKORDERS_ORCHESTRATOR_014.
-
Intervention Status Check:
-
If
ResourceAccountedHours.interventionId.workOrderOperationId.workOrderId.statusisALIGNED,CLOSED, orCANCELLED, return error WORKORDERS_ORCHESTRATOR_012..
-
Business Logic
-
Total Spent Time Calculation:
-
Retrieve the
TotalAccountedHourrecord with:-
resourceId = requestBody.resourceId -
workingHourType = requestBody.workingHourType -
workOrderOperationId = requestBody.interventionId.workOrderOperationId
-
-
From the retrieved
TotalAccountedHourrecord get the spentTime field and subtract the value of ResourcedAccountedHour.spentTime.TotalAccountedHour.spentTime goes to zero, the TotalAccountedHour record is deleted. This means that only on ResourcedAccountedHour record was present with sameresourceId,workingHourTypeandworkOrderOperationId.
-
-
Delete ResourceAccountedHour record:
-
Delete retrieved ResourceAccountedHour record.
-
Header Parameters
Default.
Query String Parameters
Since it is a DELETE API, there is no request body, but since it is necessary to pass some parameter to identify the record to remove, it has been decided to add them as query params.
|
Field |
Note |
|---|---|
|
interventionId |
|
|
resourceId |
|
|
workingHourTypeId |
|
Request Body Parameters
Response documentation
Response payload fields
Response error codes
BASE_0001, WORKORDERS_ORCHESTRATOR_013, WORKORDERS_ORCHESTRATOR_014