WebAPI

WebAPI – Work Orders

167 views 28 April, 2017 12 July, 2019 Valuekeep 0

This service allows you to retrieve and handle Work Orders in Valuekeep. Below you can find an analysis of the methods available through the service.

Get Work Orders

GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrdersByFilter
This method allows you to retrieve a list of WOs, applying several filters. You can retrieve the list of WOs using the following filters:

  • StateKey: States list (values in "WO States Table")
  • MaxRecords: Maximum number of records (you can request 200 records at a time)
  • DaysLimit: Maximum number of days after the WO’s creation date
  • AssignedTo: Username of the employee assigned to the WO's tasks
  • Version: Version
  • WOResponsible: Person in Charge of WO
  • WCResponsible: Person in Charge of the Work Center
  • WOOrWCResponsible: Person in Charge of the WO or Work Center

All filters are optional. The list of WOs returned is sorted by version ascendingly. If you set the user filter, the system will only return the tasks assigned to that user for each WO.
Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrdersByFilter?stateKey=001&stateKey=002&maxRecords=50&daysLimit=30&assignedTo=myuser&version=AAAAAAAAAAA=
Retrieves a maximum of 50 WOs in the "Pending" and "Waiting for Approval" states, created within the last 30 days, with tasks assigned to the employee with the "myuser" username and version "AAAAAAAAAAA=" or later.   GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrdersByFilterForMobile
This method allows you to retrieve a list of WOs, applying several filters. You can retrieve the list of WOs using the following filters:

  • StateKey: States list (values in "WO States Table")
  • MaxRecords: Maximum number of records (you can request 200 records at a time)
  • AssignedTo: Username of the employee assigned to the WO's tasks
  • CreatedBy: Username of the employee who created the WO
  • Version: Version
  • WOOrWCResponsible: Person in Charge of the WO or Work Center
  • CanceledStates: Boolean value that specifies whether to include WOs in the canceled state
  • FinalState: Boolean value that specifies whether to include WOs in the final state
  • FinalStateDaysLimit: Maximum number of days after the WO’s closing date

All filters are optional. The list of WOs returned is sorted by version ascendingly. If you set the user filter, the system will only return the tasks assigned to that user for each WO. If the CanceledStates and FinalState parameters are not specified, the method does not return the WOs in canceled and final states. If they are specified, the method will return WOs in the canceled and/or final state, according to the parameters defined.
Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrdersByFilterForMobile?maxRecords=100&canceledStates=true&finalState=true&finalStateDaysLimit=30&assignedTo=myuser&version=AAAAAAAAAAA=
Retrieves a maximum of 100 WOs in the canceled and final states, closed in the last 30 days, with tasks assigned to the employee with the "myuser" username and version "AAAAAAAAAAA=" or later.

Get Work Order Costs

GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrderCostsByFilter
This method allows you to retrieve the list of WO Costs, applying several filters. You can retrieve the list of WO Costs using the following filters:

  • WorkOrderKey: The WO's key.
  • IssueKey: The key of the issue associated with the WO.
  • MaxRecords: Maximum number of records (you can request 200 records at a time)
  • Issuer: Username of the employee who requested the issue associated with the WO.
  • Version: Version
  • HasIssue: Field that specifies if the list only includes WOs with associated issues
  • DaysLimit: Maximum number of days since the Work Order was created.
  • Year: Year of the issue
  • Responsible: Username of the user in charge of the asset, location or work order route.
  • WOResponsible: Person in Charge of WO
  • WCResponsible: Person in Charge of the Work Center
  • WOOrWCResponsible: Person in Charge of the WO or Work Center
  • Createdby: Username of the employee who created the WO

All filters are optional. The list of WO Costs returned is sorted by version ascendingly.
Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrderCostsByFilter?issuer=myuser&issueKey=IC0001&maxrecords=50&version=AAAAAAAAAAA=&hasIssue=true Retrieves a maximum of 50 Costs of WOs with an issue assigned, created by the user with the "myuser" login details and using version "AAAAAAAAAAA=" or later.

Get List of Work Orders Response Time

GET /api/mytenant/myorganization/maintenancemanagementcore/ResponseTimesOfWorkOrders/GetResponseTimesOfWorkOrdersByFilter
This method allows you to retrieve a list of Response Times for Work Orders, applying several filters. You can retrieve the list of Work Order Response Times using the following filters:

  • StateKey: States list (values in "Table of Work Order States")
  • MaxRecords: Maximum number of records (you can request 200 records at a time)
  • WorkOrderKey: Through the Work Order's key
  • Version: Version
  • DaysLimit: Maximum number of days since the Work Order was created
  • Year: Year of work orders. All work orders for which the year is after the value set in the filter are displayed
  • Responsible: Username of the employee in charge of the work order's asset
  • WOResponsible: Person in Charge of WO
  • WCResponsible: Person in Charge of the Work Center
  • WOOrWCResponsible: Person in Charge of the WO or Work Center

All filters are optional. The list of Work Orders Response Time returned is sorted by version ascendingly.
Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/ResponseTimesOfWorkOrders/GetResponseTimesOfWorkOrdersByFilter?stateKey=001&stateKey=002&maxRecords=50&woresponsible=myuser&version=AAAAAAAAAAA=
Retrieves a maximum of 200 Work Order Response Times in the "Waiting for Approval" and "Approved" states, where the person in charge of the work order is the employee with the "myuser" username and using version "AAAAAAAAAAA=" or later.

Get Employees Assigned to the Work Order

GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrderAssignedEmployees
This method allows you to retrieve the list of Employees assigned to the WO, applying several filters. You can retrieve the list of Employees assigned to the WO using the following filters:

  • WorkOrderKey: The WO’s key;
  • StateKey: States list (values in "WO States Table");
  • MaxRecords: Maximum number of records (you can request 200 records at a time);
  • HasIssue: Field that specifies if the list only includes WOs with associated issues;
  • DaysLimit: Maximum number of days since the Work Order was created;
  • CreationYear: Year when the WO was created;
  • Version: Version;
  • WOResponsible: Person in Charge of WO;
  • WCResponsible: Person in Charge of the Work Center;

All filters are optional. The list of Employees assigned to the WO returned is sorted by version ascendingly.
Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrderAssignedEmployees?maxrecords=50&version=AAAAAAAAAAA=&hasIssue=true Retrieves a maximum of 50 assignment records with issues and version "AAAAAAAAAAA=" later.

Create a Work Order

POST /api/mytenant/myorganization/maintenancemanagementcore/workorders/CreateWorkOrder
This method offers a simple way of creating a Work Order for a specific Asset, Location, Asset Route or Location Route. The “body” of the message must follow the structure for the WorkOrderInfoResource.

Example:

{ "WorkOrderKey": "WO135", "Description": "Work Order", "WorkOrderTypeKey": "PR", "AssetKey": "AC-0022", "LocationKey": null, "AssetRouteKey": null, "LocationRouteKey": null, "MaintenancePlanKeys": ["PM-000012.1", "PM-000013.1"], "WorkCenterKey": "CTEGH", "PriorityLevelKey": "HIGH", "Remarks": "General Remarks", "Date": "2015-08-31T11:15:17.477+00:00" }

Assign a Work Order

POST /api/mytenant/myorganization/maintenancemanagementcore/workordertaskassignments/AssignWorkOrder
This method offers a simple way of assigning Work Orders to an Employee. The “body” of the message must follow the structure for the WorkOrderAssignmentResource.

Example:

{ "WorkOrderKey": "WO0034", "EmployeesToAssign": [ "0002", "0006" ] }

Unassign a Work Order

POST /api/mytenant/myorganization/maintenancemanagementcore/workordertaskassignments/AssignWorkOrder
This method offers a simple way of unassigning Work Orders from an Employee. The “body” of the message must follow the structure for the WorkOrderAssignmentResource.

Example:

{ "WorkOrderKey": "WO0022", "EmployeesToUnassign": [ "0002", "0006" ] }

Update a Work Order

PUT /api/mytenant/myorganization/maintenancemanagementcore/workorders/{workOrderKey}
This method allows you to update a Work Order. To that end, the http message should have the “body” filled in with the full structure of the resource WorkOrderResource (including the unchanged ones).

Delete a Work Order

DELETE /api/mytenant/myorganization/maintenancemanagementcore/workorders/{workOrderKey}
This method allows you to delete a specific Work Order by its natural key.
Example:
Delete the Order with the Sample001 natural key
DELETE /api/mytenant/myorganization/maintenancemanagementcore/workorders/Sample001

Change Work Order State

PUT /api/mytenant/myorganization/maintenancemanagementcore/workorders/ChangeWorkOrderState
This method allows you to change the state of several Work Orders. For this, you need to fill in the StateResource. This resource is filled in with the WorkOrder's Natural Key (EntityKey), the State’s Natural Key (NewState), the reason for the change (only used in case it is rejected) and the date of the state change (StateChangeDate).
Example:
{ "StateLines" : [ { "EntityKey" : "OT0004", "NewState" : "003.WORKORDER", "Reason" : "TESTE", "StateChangeDate" : "2015-07-27T11:15:17.477+00:00", }, { "EntityKey" : "OT0005", "NewState" : "003.WORKORDER", "Reason" : "TESTE3", "StateChangeDate" : "2015-07-27T11:15:17.477+00:00", } ] }

Table of Work Order States

These are the default states available for the WOs. To retrieve the states configured use the method described in "Get WO States List".

Code State
001 Waiting for Approval
002 Pending
003 Approved
004 In Progress
005 Canceled
006 Closed
007 Executed
008 Suspended

Change Work Order fields

PUT /api/mytenant/myorganization/maintenancemanagementcore/WorkOrders/UpdateWorkOrderInfo
This method allows you to change some fields of the Work Order; the required resource is described here:

  • WorkOrderKey: The WO’s key
  • Description: The WO’s description
  • WorkOrderTypeKey: The key of the WO type
  • WorkCenterKey: The key of the WO's work center
  • AssetKey: The key of the asset associated with the WO
  • LocationKey: The key of the location associated with the WO
  • PriorityLevelKey: The key of the priority level of the WO's requester
  • OperatingConditionKey: The key of the WO's operating state
  • Remarks: Comments about the WO
  • MaintenancePlanKeys: The list of keys for the WO's maintenance plans
  • Date: Date when the WO was created

Example:
{ "WorkOrderKey" : "WO000020", "Description" : "Change oil.", "WorkOrderTypeKey" : "CR", "WorkCenterKey" : "MN", "AssetKey" : "A-00012", "LocationKey" : "", "PriorityLevelKey" : "N", "OperatingConditionKey": "DS" "Remarks" : "", "MaintenancePlanKeys": ["MP-00002.1", "MP-00003.1"], "Date": "2017-08-31T11:15:17.477+00:00" }

Get WO States List

GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrderStates?version=AAAA
This method allows you to retrieve the list of WO states. Only the Version filter is required for this list.

Get detailed information on the WO

Using the following method, you can get detailed information on the WO:

  • Consumptions
  • Labor
  • Meters
  • Monitorings
  • Other Costs

Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrderReportInfo?workOrderKey=OT0040

Get the number of work orders assigned by state

Using the following method, you can get number of work orders assigned by state, using these parameters:

  • assignedTo – assigned to the technician.
  • version

returns the list and number of work orders assigned, grouped by state.
Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/GetWorkOrdersAssignedByStates?assignedTo=admin&version=AAAA

User Fields

Using the methods below you can retrieve and change the values of user fields without editing the WO directly. List of user fields:
Example:
GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/getuserfields GET /api/mytenant/myorganization/maintenancemanagementcore/workorders/getuserfields?workorderkey=WO0001 The method without parameters returns user fields associated with the Work Order entity with default or empty values. The method with parameters returns a list of user fields and corresponding values for the specified WO.   Change user field values:
Example:
PUT /api/mytenant/myorganization/maintenancemanagementcore/workorders/updateuserfields?workOrderKey=WO0001 [ { "Name": "USER_CHAVEALT", "Value": "xxx1" }, { "Name" : "USER_CONTABILIDAD", "Value" : false } ]   This method updates the values of WO user fields. You must use the name returned by the previous method. This method supports the following field types: Short Text (20), Text (100), Long Text (255), Boolean, Date, Time and Date, Number, Decimal, Percent, Email, URL.

Tags:

Foi útil?