Work Order Generation

I am working on a condition based maintenance application where a change of state will generate a work order in a maintenance system. What I would like to do if check to see if the previous work order has been completed before generating a new work order.

I currently generate a payload using a change block that is used by an http request block. The response from the maintenance system (UpKeep) includes an "id" and "status". The idea is to check if this "id" not not equal to "closed" in which case it would prevent the creation of a new one.

Thoughts?

Bit of an open-ended question. What is it that you are looking for? You don't really give anything specific to help us answer.

Seems like a perfectly reasonable piece of processing and not difficult if your maintenance system has the API to give you the data.

Apologies. I didn't want to provide a pile of information on the front end in the event it wasn't helpful.

I am using the Node-RED that is embedded in an Opto22 groov RIO device. The goal is to generate work orders as the result of a process condition (analog or digital) on the RIO without generating multiples WOs before the first one is complete.

Using an http request, the UpKeep API returns fairly robust payload. Currently, I use a change block to remove everything but the 'id' of the generated work order. What I would like to do is to store this 'id' and check the 'status' of it before the flow would be allowed to create a new one. I am not sure the best way to store it.

https://api.onupkeep.com/api/v2/work-orders/

{
"success": true,
"result": {
"id": "6yDTWLAEmh",
"workOrderNo": "006",
"title": "Repair sink",
"description": "Sink broke yesterday",
"status": "open",

The API enables me to retrieve a specific work order based on its 'id'. The syntax requires the 'id' append at end of the GET url. What I think would be easiest would be to check the status of the stored 'id' from above and then check to see if the status is 'closed'.

https://api.onupkeep.com/api/v2/work-orders/HW2I379ErS

success": true,
"result": {
"id": "HW2I379ErS",
"workOrderNo": "014",
"title": "Replace the warp drive on the fusion reactor",
"description": "Warp drive has been malfunctioning, check the coils that generate the warp field.",
"status": "onHold",

Not sure if I am explaining this very well.

There really is no need to do that. In the next node, you may or may not need all the info, but you don't have to use all the info. Only delete if you MUST. Otherwise wasted cycles.

This definitely sounds like a job for a database. Sqlite or mysql would be fine.

Something like. ...

API payload >> generate SQL SELECT * where ID == {{payload.id}} >> call to database >> check if there is an open work order >> make new work order if none exists by generating a SQL INSERT

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.