@daynite/workordersbyserialnumber
v2.6.0
Published
Pull work order information from sampro database using equipment serial numbers
Downloads
164
Readme
Usage:
Arguments into the getWO function are:
- String of comma seperated serial numbers
- A date filter (open date for wos where the wo open dates are >= given date). Date filter format is YYYY-MM-DD.
- API key
const serialNumbers = '12345678,87654321';
const key = 'XXXXXXXXXXXXXXXXXXXXXX';
const dateFilter= '2024-01-12';
try {
const result = await getWOs(serialNumbers, dateFilter, key);
console.log(result);
} catch (error) {
console.error('Error:', error);
}
Result
Returns array of work order objects with nested equipment and purchase order objects.
Each item in the area should be a different work order and can have one or more equipment and zero or more purchase orders
Purchase orders can have the same ID but will have a different line number per purchase order id
structure of objects:
WorkOrder Object{
WorkOrder_id: string,
WorkOrder_date: string ex. YYYY-MM-DD,
OpenDate: string ex. YYYY-MM-DD,
work_requested: string,
status: string,
woEquipment: array of woEquipment objects (see below)
woPurchaseOrders: array of woPurchaseOrders objects (see below)
WO_ID: string,
Equipment_ID: string,
Equipment_rn: string,
Equipment_Serial: string,
Date: string ex. YYYY-MM-DD,
Category: string,
SubCategory: string,
Parts: Array of strings,
Work_Type: string
WorkOrder_id: string
WorkOrder_date: string
work_requested:string
woEquipment: array of woEquipment objects (see below)
woPurchaseOrders: array of woPurchaseOrders objects (see below)
}
woEquipment Object{
WorkOrder_equipmentnumber: string
WorkOrder_equipment_work_perf: string
WorkOrder_equipment_work_req: string
Equipment_name: string
Equipment_rn: int,
Serialnumber: string,
Manufacturer: string,
Model: string
}
woPurchaseOrders Object{
PurchaseOrder_id: string
prchseordrlst_ln: 1,
PurchaseOrder_vendorpart_num: string
PurchaseOrder_item_desc: string
PurchaseOrder_quantity: int,
PurchaseOrder_cost: float,
PurchaseOrder_date_requested: string
PurchaseOrder_date_promised: string
Vendorname: string
}
Return value example
[
{
"WorkOrder_id": "123456",
"WorkOrder_date": "2023-01-01",
"work_requested": "Some work requested text",
"woEquipment": [
{
"WorkOrder_equipmentnumber": 7891234,
"WorkOrder_equipment_work_perf": "Some work performed text",
"WorkOrder_equipment_work_req": "",
"Equipment_name": "Name",
"Equipment_rn": 7891234,
"Serialnumber": "123456",
"Manufacturer": "STAR",
"Model": "G12-Y"
}
],
"woPurchaseOrders": [
{
"PurchaseOrder_id": "12345",
"prchseordrlst_ln": 1,
"PurchaseOrder_vendorpart_num": "2A-6904",
"PurchaseOrder_item_desc": "LEG",
"PurchaseOrder_quantity": 1,
"PurchaseOrder_cost": 2.4,
"PurchaseOrder_date_requested": "2010-04-27",
"PurchaseOrder_date_promised": "1900-01-01",
"Vendorname": "9 wire southern tech"
}
]
}
]