cityworks 0.0.36 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/cityworks.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -1
- package/index.js +0 -1
- package/src/activity_link.ts +0 -241
- package/src/case.ts +0 -282
- package/src/case_admin.ts +0 -883
- package/src/case_assets.ts +0 -129
- package/src/case_data.ts +0 -446
- package/src/case_financial.ts +0 -848
- package/src/case_workflow.ts +0 -462
- package/src/cityworks.ts +0 -719
- package/src/comments.ts +0 -167
- package/src/costs.ts +0 -289
- package/src/error.ts +0 -56
- package/src/event_layer.ts +0 -231
- package/src/general.ts +0 -143
- package/src/gis.ts +0 -242
- package/src/index.ts +0 -1
- package/src/inspection.ts +0 -851
- package/src/inspection_admin.ts +0 -45
- package/src/message_queue.ts +0 -243
- package/src/request.ts +0 -823
- package/src/request_admin.ts +0 -35
- package/src/search.ts +0 -339
- package/src/workorder.ts +0 -838
- package/src/workorder_admin.ts +0 -248
- package/test/01.cityworksTest.js +0 -80
- package/test/02.activitylinkTest.js +0 -58
- package/test/03.generalTest.js +0 -87
- package/test/04.requestTest.js +0 -293
- package/test/05.caseTest.js +0 -110
- package/test/06.caseFinancialTest.js +0 -172
- package/test/07.searchTest.js +0 -191
- package/test/08.workOrderTest.js +0 -48
- package/test/09.caseAssetsTest.js +0 -72
- package/test/09.inspectionTest.js +0 -28
- package/tsconfig.json +0 -68
package/src/workorder.ts
DELETED
|
@@ -1,838 +0,0 @@
|
|
|
1
|
-
import { CWError } from './error'
|
|
2
|
-
const _ = require('lodash')
|
|
3
|
-
import { WorkOrderAdmin } from './workorder_admin'
|
|
4
|
-
import { Comments } from './comments'
|
|
5
|
-
|
|
6
|
-
export class WorkOrder {
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
cw: any
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WorkOrder Administration methods
|
|
14
|
-
*/
|
|
15
|
-
admin: Object
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* WorkOrder Comments methods
|
|
19
|
-
*/
|
|
20
|
-
comment: Object
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
constructor(cw) {
|
|
26
|
-
this.cw = cw
|
|
27
|
-
this.admin = new WorkOrderAdmin(cw)
|
|
28
|
-
this.comment = new Comments(cw, 'WorkOrder')
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Create new workorders, including linkin to Requests & Inspections (optionally)
|
|
33
|
-
*
|
|
34
|
-
* @category WorkOrders
|
|
35
|
-
* @param {Object} wo_data - See /{subdirectory}/apidocs/#/data-type-infodataType=WorkOrder on the Cityworks instance
|
|
36
|
-
* @param {Array<number>} [inspectionIds] - The inspection IDs which the workorder should be linked to.
|
|
37
|
-
* @param {Array<number>} [requestIds] - The inspection IDs which the workorder should be linked to.
|
|
38
|
-
* @return {Object} Returns Promise that represents an object describing the newly-created workorder
|
|
39
|
-
*/
|
|
40
|
-
create(wo_data: Object, inspectionIds?: Array<number>, requestIds?: Array<number>) {
|
|
41
|
-
return new Promise((resolve, reject) => {
|
|
42
|
-
if(!_.has(wo_data, 'WOTemplateId') || !_.has(wo_data, 'EntityType')) {
|
|
43
|
-
reject(new CWError(2, 'WOTemplateId & EntityType must be provided.', {'provided': wo_data}))
|
|
44
|
-
} else {
|
|
45
|
-
var data = wo_data;
|
|
46
|
-
if(typeof inspectionIds != 'undefined' && inspectionIds != null && !_.has(data, 'InspectionIds')) {
|
|
47
|
-
_.set(data, 'InspectionIds', inspectionIds);
|
|
48
|
-
}
|
|
49
|
-
if(typeof requestIds != 'undefined' && requestIds != null && !_.has(data, 'RequestIds')) {
|
|
50
|
-
_.set(data, 'RequestIds', requestIds);
|
|
51
|
-
}
|
|
52
|
-
this.cw.runRequest('Ams/WorkOrder/Create', data).then(r => {
|
|
53
|
-
resolve(r.Value)
|
|
54
|
-
}).catch(e => {
|
|
55
|
-
reject(e)
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Create new workorder linked to parent workorder
|
|
63
|
-
*
|
|
64
|
-
* @category WorkOrders
|
|
65
|
-
* @param {Object} wo_data - See /{subdirectory}/apidocs/#/data-type-infodataType=WorkOrder on the Cityworks instance
|
|
66
|
-
* @param {string|number} workOrderSId - The workorder S/ID which the entities should be added to. # for SID, string for ID.
|
|
67
|
-
* @return {Object} Returns Promise that represents an object describing the newly-created workorder
|
|
68
|
-
*/
|
|
69
|
-
createFromParent(wo_data: Object, workOrderSId: string|number, s: boolean = true) {
|
|
70
|
-
return new Promise((resolve, reject) => {
|
|
71
|
-
if(!_.has(wo_data, 'WOTemplateId') || !_.has(wo_data, 'EntityType')) {
|
|
72
|
-
reject(new CWError(2, 'WOTemplateId & EntityType must be provided.', {'provided': wo_data}))
|
|
73
|
-
} else {
|
|
74
|
-
var data = wo_data;
|
|
75
|
-
if(_.isString(workOrderSId)) {
|
|
76
|
-
_.set(data, 'WorkOrderId', workOrderSId)
|
|
77
|
-
} else {
|
|
78
|
-
_.set(data, 'WorkOrderSid', workOrderSId)
|
|
79
|
-
}
|
|
80
|
-
this.cw.runRequest('Ams/WorkOrder/Create', data).then(r => {
|
|
81
|
-
resolve(r.Value)
|
|
82
|
-
}).catch(e => {
|
|
83
|
-
reject(e)
|
|
84
|
-
})
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Update a WorkOrder
|
|
91
|
-
*
|
|
92
|
-
* @category WorkOrders
|
|
93
|
-
* @param {object} wo_data - See /{subdirectory}/apidocs/#/data-type-infodataType=WorkOrder on the Cityworks instance
|
|
94
|
-
* @return {Object} Returns Promise that represents an object describing the updated workorder
|
|
95
|
-
*/
|
|
96
|
-
update(wo_data: Object) {
|
|
97
|
-
return new Promise((resolve, reject) => {
|
|
98
|
-
if(!_.has(wo_data, 'WorkOrderSid') && !_.has(wo_data, 'WorkOrderId')) {
|
|
99
|
-
reject(new CWError(3, 'WorkOrderId or WorkOrderSid must be provided.', {'provided': wo_data}))
|
|
100
|
-
} else {
|
|
101
|
-
this.cw.runRequest('Ams/WorkOrder/Update', wo_data).then(r => {
|
|
102
|
-
resolve(r.Value)
|
|
103
|
-
}).catch(e => {
|
|
104
|
-
reject(e)
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Combine WorkOrders
|
|
112
|
-
*
|
|
113
|
-
* @category WorkOrders
|
|
114
|
-
* @param {Array<string>} fromWorkOrderIds - The workorder IDs which should be combined.
|
|
115
|
-
* @param {string} toWorkOrderId - The WorkOrder ID for the single WorkOrder that should contain the info/entities from the other WorkOrders
|
|
116
|
-
* @param {boolean} cancelCombinedWorkOrders - If the WorkOrders combined into the single should then be canceled, default is true.
|
|
117
|
-
* @return {Object} Returns object that represents a collection of WorkOrders
|
|
118
|
-
*/
|
|
119
|
-
combine(fromWorkOrderIds: Array<string>, toWorkOrderId: string, cancelCombinedWorkOrders: boolean = true) {
|
|
120
|
-
return new Promise((resolve, reject) => {
|
|
121
|
-
var data = {
|
|
122
|
-
CancelCombinedWorkOrders: cancelCombinedWorkOrders,
|
|
123
|
-
ToWorkOrderId: toWorkOrderId,
|
|
124
|
-
FromWorkOrderIds: fromWorkOrderIds
|
|
125
|
-
}
|
|
126
|
-
this.cw.runRequest('Ams/WorkOrder/Combine', data).then(r => {
|
|
127
|
-
if(r.Status>0) {
|
|
128
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
129
|
-
} else {
|
|
130
|
-
resolve(r.Value)
|
|
131
|
-
}
|
|
132
|
-
}).catch(e => {
|
|
133
|
-
reject(e)
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Move a workorder's point
|
|
141
|
-
*
|
|
142
|
-
* @category WorkOrders
|
|
143
|
-
* @param {string} workOrderId
|
|
144
|
-
* @param {number} x
|
|
145
|
-
* @param {number} y
|
|
146
|
-
* @param {Object} projection - Should include WKT or WKID attribute. Can also include VcsWKID attribute.
|
|
147
|
-
* @param {number} [z] - Optional Z coordinate
|
|
148
|
-
* @return {Object} Returns Promise that represents an object describing the updated workorder
|
|
149
|
-
*/
|
|
150
|
-
move(workOrderId: string, x: number, y: number, projection: Object, z?: number) {
|
|
151
|
-
return new Promise((resolve, reject) => {
|
|
152
|
-
if(!_.has(projection, 'WKID') && !_.has(projection, 'WKT')) {
|
|
153
|
-
// Throw error
|
|
154
|
-
reject(new CWError(6, 'You must provide either the WKID or WKT for the x/y coordinates.', {'projection': projection}))
|
|
155
|
-
}
|
|
156
|
-
var base_data = {
|
|
157
|
-
WorkOrderId: workOrderId,
|
|
158
|
-
X: x,
|
|
159
|
-
Y: y
|
|
160
|
-
};
|
|
161
|
-
if(typeof(z)!='undefined') {
|
|
162
|
-
_.set(base_data, 'z', z)
|
|
163
|
-
}
|
|
164
|
-
var data = _.merge(base_data, projection);
|
|
165
|
-
this.cw.runRequest('Ams/WorkOrder/Move', data).then(r => {
|
|
166
|
-
resolve(r.Value)
|
|
167
|
-
}).catch(e => {
|
|
168
|
-
reject(e)
|
|
169
|
-
})
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Get a workorder by S/ID
|
|
175
|
-
*
|
|
176
|
-
* @category WorkOrders
|
|
177
|
-
* @param {string|number} workOrderSId - The S/ID of the workorder to retrieve. # for SID, string for ID.
|
|
178
|
-
* @param {boolean} s - Whether first argument is an SID (true) or an ID (false). Defaults to true.
|
|
179
|
-
* @return {Object} Returns Promise that represents an object describing the workorder
|
|
180
|
-
*/
|
|
181
|
-
getById(workOrderSId: string|number, s: boolean = true) {
|
|
182
|
-
return new Promise((resolve, reject) => {
|
|
183
|
-
var data = {}
|
|
184
|
-
if(_.isString(workOrderSId)) {
|
|
185
|
-
_.set(data, 'WorkOrderId', workOrderSId)
|
|
186
|
-
var path = 'Ams/WorkOrder/ById';
|
|
187
|
-
} else {
|
|
188
|
-
_.set(data, 'WorkOrderSid', workOrderSId)
|
|
189
|
-
var path = 'Ams/WorkOrder/BySid';
|
|
190
|
-
}
|
|
191
|
-
this.cw.runRequest(path, data).then(r => {
|
|
192
|
-
resolve(r.Value)
|
|
193
|
-
}).catch(e => {
|
|
194
|
-
reject(e)
|
|
195
|
-
})
|
|
196
|
-
})
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Get workorders by an array of S/IDs
|
|
201
|
-
*
|
|
202
|
-
* @category WorkOrders
|
|
203
|
-
* @param {Array<string|number>} workOrderSIds - The workorder S/IDs to retrieve. If providing WorkOrderID, should be all strings, else provide all numbers for WorkOrderSID
|
|
204
|
-
* @return {Object} Returns Promise that represents a collection of Objects describing the workorders
|
|
205
|
-
*/
|
|
206
|
-
getByIds(workOrderSIds: Array<string|number>) {
|
|
207
|
-
return new Promise((resolve, reject) => {
|
|
208
|
-
var data = {}
|
|
209
|
-
if(workOrderSIds.length==0) {
|
|
210
|
-
// throw error
|
|
211
|
-
reject(new CWError(101, 'No workorder S/IDs were provided.', {'workorderSId': workOrderSIds}))
|
|
212
|
-
} else {
|
|
213
|
-
var path = 'Ams/WorkOrder/ByIds';
|
|
214
|
-
if(_.isString(workOrderSIds[0])) {
|
|
215
|
-
_.set(data, 'WorkOrderIds', workOrderSIds)
|
|
216
|
-
path = 'Ams/WorkOrder/ByIds';
|
|
217
|
-
} else if(_.isNumber(workOrderSIds[0])) {
|
|
218
|
-
_.set(data, 'WorkOrderSids', workOrderSIds)
|
|
219
|
-
path = 'Ams/WorkOrder/BySids';
|
|
220
|
-
} else {
|
|
221
|
-
// throw error - was not number or string
|
|
222
|
-
reject(new CWError(9, 'No workorder S/IDs were provided.', {'workorderSId': workOrderSIds}))
|
|
223
|
-
}
|
|
224
|
-
this.cw.runRequest(path, data).then(r => {
|
|
225
|
-
resolve(r.Value)
|
|
226
|
-
}).catch(e => {
|
|
227
|
-
reject(e)
|
|
228
|
-
})
|
|
229
|
-
}
|
|
230
|
-
})
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Get instructions by an array of workorders S/IDs
|
|
235
|
-
*
|
|
236
|
-
* @category WorkOrders
|
|
237
|
-
* @param {Array<string|number>} workOrderSIds - The workorder S/IDs to retrieve. If providing WorkOrderID, should be all strings, else provide all numbers for WorkOrderSID
|
|
238
|
-
* @return {Object} Returns Promise that represents an array of String, String describing the workorder instructions
|
|
239
|
-
*/
|
|
240
|
-
getInstructions(workOrderSIds: Array<string|number>) {
|
|
241
|
-
return new Promise((resolve, reject) => {
|
|
242
|
-
var data = {}
|
|
243
|
-
if(workOrderSIds.length==0) {
|
|
244
|
-
// throw error
|
|
245
|
-
reject(new CWError(102, 'No workorder S/IDs were provided.', {'workorderSId': workOrderSIds}))
|
|
246
|
-
} else {
|
|
247
|
-
var path = 'Ams/WorkOrder/ByIds';
|
|
248
|
-
if(_.isString(workOrderSIds[0])) {
|
|
249
|
-
_.set(data, 'WorkOrderIds', workOrderSIds)
|
|
250
|
-
path = 'Ams/WorkOrder/InstructionsByWorkOrderIds';
|
|
251
|
-
} else if(_.isNumber(workOrderSIds[0])) {
|
|
252
|
-
_.set(data, 'WorkOrderSids', workOrderSIds)
|
|
253
|
-
path = 'Ams/WorkOrder/InstructionsByWorkOrderSids';
|
|
254
|
-
} else {
|
|
255
|
-
// throw error - was not number or string
|
|
256
|
-
reject(new CWError(9, 'No workorder S/IDs were provided.', {'workorderSId': workOrderSIds}))
|
|
257
|
-
}
|
|
258
|
-
this.cw.runRequest(path, data).then(r => {
|
|
259
|
-
resolve(r.Value)
|
|
260
|
-
}).catch(e => {
|
|
261
|
-
reject(e)
|
|
262
|
-
})
|
|
263
|
-
}
|
|
264
|
-
})
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Get the audit log for a specific workorder
|
|
269
|
-
*
|
|
270
|
-
* @category WorkOrder
|
|
271
|
-
* @param {number} workOrderSId - A WorkOrder S/ID to get the audit log for. SID is default.
|
|
272
|
-
* @return {Object} Returns Promise that represents a collection of Cityworks Metadata Objects
|
|
273
|
-
*/
|
|
274
|
-
getAuditLog(workOrderSId: number) {
|
|
275
|
-
return new Promise((resolve, reject) => {
|
|
276
|
-
var data = {}
|
|
277
|
-
if(_.isString(workOrderSId)) {
|
|
278
|
-
_.set(data, 'WorkOrderId', workOrderSId)
|
|
279
|
-
} else if(_.isNumber(workOrderSId)) {
|
|
280
|
-
_.set(data, 'WorkOrderSid', workOrderSId)
|
|
281
|
-
} else {
|
|
282
|
-
// throw error - was not number or string
|
|
283
|
-
reject(new CWError(9, 'Workorder S/IDs was not provided.', {'workorderSId': workOrderSId}))
|
|
284
|
-
}
|
|
285
|
-
this.cw.runRequest('Ams/WorkOrder/AuditLog', data).then(r => {
|
|
286
|
-
resolve(r.Value)
|
|
287
|
-
}).catch(e => {
|
|
288
|
-
reject(e)
|
|
289
|
-
})
|
|
290
|
-
})
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Get custom field values for the workorder S/IDs
|
|
295
|
-
*
|
|
296
|
-
* @category WorkOrders
|
|
297
|
-
* @param {Array<string|number>} workOrderSIds - The workorder S/IDs to retrieve. #s for SID, strings for ID.
|
|
298
|
-
* @return {Object} Returns Promise that represents a collection of Objects describing the workorders
|
|
299
|
-
*/
|
|
300
|
-
getCustomFieldValues(workOrderSIds: Array<string|number>) {
|
|
301
|
-
return new Promise((resolve, reject) => {
|
|
302
|
-
var data = {}
|
|
303
|
-
var path = 'Ams/WorkOrder/CustomFields';
|
|
304
|
-
if(_.isString(workOrderSIds[0])) {
|
|
305
|
-
_.set(data, 'WorkOrderIds', workOrderSIds)
|
|
306
|
-
var path = 'Ams/WorkOrder/CustomFields';
|
|
307
|
-
} else if(_.isNumber(workOrderSIds[0])) {
|
|
308
|
-
_.set(data, 'WorkOrderSids', workOrderSIds)
|
|
309
|
-
var path = 'Ams/WorkOrder/CustomFieldsByWorkOrderSids';
|
|
310
|
-
} else {
|
|
311
|
-
// throw error - was not number or string
|
|
312
|
-
reject(new CWError(9, 'No workorder S/IDs were provided.', {'workorderSIds': workOrderSIds}))
|
|
313
|
-
}
|
|
314
|
-
this.cw.runRequest(path, data).then(r => {
|
|
315
|
-
resolve(r.Value)
|
|
316
|
-
}).catch(e => {
|
|
317
|
-
reject(e)
|
|
318
|
-
})
|
|
319
|
-
})
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Get entities on an existing WorkOrder
|
|
324
|
-
*
|
|
325
|
-
* @category WorkOrders
|
|
326
|
-
* @param {Array<string|number>} workOrderSIds - The workorder S/IDs which the entities should be added to. # for SID, string for ID.
|
|
327
|
-
* @param {boolean} getGisData - Query gis to populate Entity.Attributes with current gis data. Defaults to true.
|
|
328
|
-
* @return {Object} Returns object that represents a list of entities removed.
|
|
329
|
-
*/
|
|
330
|
-
getEntities(workOrderSIds: Array<string|number>, getGisData: boolean = true) {
|
|
331
|
-
return new Promise((resolve, reject) => {
|
|
332
|
-
var data = {
|
|
333
|
-
GetGisData: getGisData
|
|
334
|
-
}
|
|
335
|
-
if(workOrderSIds.length==0) {
|
|
336
|
-
// throw error
|
|
337
|
-
reject(new CWError(11, 'No workorder S/IDs were provided.', {'workorderSId': workOrderSIds}))
|
|
338
|
-
} else {
|
|
339
|
-
if(_.isString(workOrderSIds[0])) {
|
|
340
|
-
_.set(data, 'WorkOrderIds', workOrderSIds)
|
|
341
|
-
} else if(_.isNumber(workOrderSIds[0])) {
|
|
342
|
-
_.set(data, 'WorkOrderSids', workOrderSIds)
|
|
343
|
-
} else {
|
|
344
|
-
reject(new CWError(12, 'No workorder S/IDs were provided.', {'workorderSId': workOrderSIds}))
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
this.cw.runRequest('Ams/WorkOrder/Entities', data).then(r => {
|
|
348
|
-
if(r.Status>0) {
|
|
349
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
350
|
-
} else {
|
|
351
|
-
resolve(r.Value)
|
|
352
|
-
}
|
|
353
|
-
}).catch(e => {
|
|
354
|
-
reject(e)
|
|
355
|
-
})
|
|
356
|
-
})
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Add entities to an existing WorkOrder
|
|
361
|
-
*
|
|
362
|
-
* @category WorkOrders
|
|
363
|
-
* @param {string|number} workOrderSId - The workorder S/ID which the entities should be added to. # for SID, string for ID.
|
|
364
|
-
* @param {Object} entityInfo - Entity info object including: (req) EntityType: {string}, (req) EntityUids: {Array<string>}, Facility_Id: {string}, Level_Id: {string}
|
|
365
|
-
* @param {boolean} updateXY - Update WorkOrder xy after adding entit(y|ies), default is true.
|
|
366
|
-
* @return {Object} Returns object that represents a list of entities removed.
|
|
367
|
-
*/
|
|
368
|
-
addEntities(workOrderSId: string|number, entityInfo: Object, updateXY: boolean = true) {
|
|
369
|
-
return new Promise((resolve, reject) => {
|
|
370
|
-
var data = {
|
|
371
|
-
UpdateXY: updateXY
|
|
372
|
-
}
|
|
373
|
-
if(_.isString(workOrderSId)) {
|
|
374
|
-
_.set(data, 'WorkOrderId', workOrderSId)
|
|
375
|
-
} else {
|
|
376
|
-
_.set(data, 'WorkOrderSid', workOrderSId)
|
|
377
|
-
}
|
|
378
|
-
if(_.has(entityInfo, 'Facility_Id'))
|
|
379
|
-
_.set(data, 'Facility_Id', _.get(entityInfo, 'Facility_Id'))
|
|
380
|
-
if(_.has(entityInfo, 'Level_Id'))
|
|
381
|
-
_.set(data, 'Level_Id', _.get(entityInfo, 'Level_Id'))
|
|
382
|
-
if(_.has(entityInfo, 'EntityUids') && _.has(entityInfo, 'EntityType')) {
|
|
383
|
-
_.set(data, 'EntityUids', _.get(entityInfo, 'EntityUids'))
|
|
384
|
-
_.set(data, 'EntityType', _.get(entityInfo, 'EntityType'))
|
|
385
|
-
} else {
|
|
386
|
-
reject(new CWError(7, 'No entity info was provided.', {'workorderSId': workOrderSId,'entityInfo': entityInfo}))
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
this.cw.runRequest('Ams/WorkOrder/AddEntities', data).then(r => {
|
|
390
|
-
if(r.Status>0) {
|
|
391
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
392
|
-
} else {
|
|
393
|
-
resolve(r.Value)
|
|
394
|
-
}
|
|
395
|
-
}).catch(e => {
|
|
396
|
-
reject(e)
|
|
397
|
-
})
|
|
398
|
-
})
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Update a WorkOrder entity
|
|
403
|
-
*
|
|
404
|
-
* @category WorkOrders
|
|
405
|
-
* @param {string|number} workOrderSId - The workorder S/ID which the entities should be added to. # for SID, string for ID.
|
|
406
|
-
* @param {Object} entityInfo - Entity info object including: (req) EntityType: {string}, (req) EntityUid: {string}, Facility_Id: {string}, Level_Id: {string}
|
|
407
|
-
* @param {boolean} workComplete - Update WorkOrder completeness, default is true.
|
|
408
|
-
* @return {Object} Returns object that represents a list of entities removed.
|
|
409
|
-
*/
|
|
410
|
-
updateEntity(workOrderSId: string|number, entityInfo: Object, workComplete: boolean = false) {
|
|
411
|
-
return new Promise((resolve, reject) => {
|
|
412
|
-
var data = {
|
|
413
|
-
WorkComplete: workComplete
|
|
414
|
-
}
|
|
415
|
-
if(_.isString(workOrderSId)) {
|
|
416
|
-
_.set(data, 'WorkOrderId', workOrderSId)
|
|
417
|
-
} else {
|
|
418
|
-
_.set(data, 'WorkOrderSid', workOrderSId)
|
|
419
|
-
}
|
|
420
|
-
if(_.has(entityInfo, 'Facility_Id'))
|
|
421
|
-
_.set(data, 'Facility_Id', _.get(entityInfo, 'Facility_Id'))
|
|
422
|
-
if(_.has(entityInfo, 'Level_Id'))
|
|
423
|
-
_.set(data, 'Level_Id', _.get(entityInfo, 'Level_Id'))
|
|
424
|
-
if(_.has(entityInfo, 'EntityUids') && _.has(entityInfo, 'EntityType')) {
|
|
425
|
-
_.set(data, 'EntityUid', _.get(entityInfo, 'EntityUid'))
|
|
426
|
-
_.set(data, 'EntityType', _.get(entityInfo, 'EntityType'))
|
|
427
|
-
} else {
|
|
428
|
-
reject(new CWError(7, 'No entity info was provided.', {'workorderSId': workOrderSId,'entityInfo': entityInfo}))
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
this.cw.runRequest('Ams/WorkOrder/UpdateEntity', data).then(r => {
|
|
432
|
-
if(r.Status>0) {
|
|
433
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
434
|
-
} else {
|
|
435
|
-
resolve(r.Value)
|
|
436
|
-
}
|
|
437
|
-
}).catch(e => {
|
|
438
|
-
reject(e)
|
|
439
|
-
})
|
|
440
|
-
})
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Remove entities from a WorkOrder. Provide WorkOrderId and either ObjectIds or EntityType and EntityUids
|
|
445
|
-
*
|
|
446
|
-
* @category WorkOrders
|
|
447
|
-
* @param {number} workOrderSId - The workorder S/ID which the entities should be removed from. # for SID, string for ID.
|
|
448
|
-
* @param {Object} entityInfo - Remove entities by WorkOrderEntity.ObjectId (not gis objectId).
|
|
449
|
-
* @param {boolean} updateXY - Update WorkOrder xy after removing entities, default is true.
|
|
450
|
-
* @return {Object} Returns object that represents a list of entities removed.
|
|
451
|
-
*/
|
|
452
|
-
removeEntities(workOrderSId: string|number, entityInfo: Object, updateXY: boolean = true) {
|
|
453
|
-
return new Promise((resolve, reject) => {
|
|
454
|
-
var data = {
|
|
455
|
-
UpdateXY: updateXY
|
|
456
|
-
}
|
|
457
|
-
if(_.isString(workOrderSId)) {
|
|
458
|
-
_.set(data, 'WorkOrderId', workOrderSId)
|
|
459
|
-
} else {
|
|
460
|
-
_.set(data, 'WorkOrderSid', workOrderSId)
|
|
461
|
-
}
|
|
462
|
-
if(_.has(entityInfo, 'ObjectIds')) {
|
|
463
|
-
_.set(data, 'ObjectIds', _.get(entityInfo, 'ObjectIds'))
|
|
464
|
-
} else if(_.has(entityInfo, 'EntityUids') && _.has(entityInfo, 'EntityType')) {
|
|
465
|
-
_.set(data, 'EntityUids', _.get(entityInfo, 'EntityUids'))
|
|
466
|
-
_.set(data, 'EntityType', _.get(entityInfo, 'EntityType'))
|
|
467
|
-
} else {
|
|
468
|
-
reject(new CWError(8, 'No entity info was provided.', {'workorderSId': workOrderSId,'entityInfo': entityInfo}))
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
this.cw.runRequest('Ams/WorkOrder/RemoveEntities', data).then(r => {
|
|
472
|
-
if(r.Status>0) {
|
|
473
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
474
|
-
} else {
|
|
475
|
-
resolve(r.Value)
|
|
476
|
-
}
|
|
477
|
-
}).catch(e => {
|
|
478
|
-
reject(e)
|
|
479
|
-
})
|
|
480
|
-
})
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Cancel workorders
|
|
485
|
-
*
|
|
486
|
-
* @category WorkOrders
|
|
487
|
-
* @param {Array<number>} workOrderIds - An array of the IDs to cancel the matched workorders
|
|
488
|
-
* @param {string} [cancelReason] - A reason for cancelling the workorder(s)
|
|
489
|
-
* @param {datetime} [dateCancelled] - The date/time that it should be indicated the workorder was cancelled
|
|
490
|
-
* @return {Object} Returns object that represents a collection of workorders
|
|
491
|
-
*/
|
|
492
|
-
cancel(workOrderIds: Array<number>, cancelReason?: string, dateCancelled?: Date) {
|
|
493
|
-
return new Promise((resolve, reject) => {
|
|
494
|
-
var m = new Date()
|
|
495
|
-
var data: {WorkOrderIds: Array<number>, CancelReason?: string, DateCancelled?: Date} = { WorkOrderIds: workOrderIds }
|
|
496
|
-
if(typeof(cancelReason)!=='undefined')
|
|
497
|
-
_.set(data, 'CancelReason', cancelReason);
|
|
498
|
-
if(typeof(dateCancelled)!=='undefined')
|
|
499
|
-
_.set(data, 'DateCancelled', dateCancelled);
|
|
500
|
-
this.cw.runRequest('Ams/WorkOrder/Cancel', data).then(r => {
|
|
501
|
-
resolve(r.Value)
|
|
502
|
-
}).catch(e => {
|
|
503
|
-
reject(e)
|
|
504
|
-
})
|
|
505
|
-
})
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Uncancel workorders
|
|
510
|
-
*
|
|
511
|
-
* @category WorkOrders
|
|
512
|
-
* @param {Array<number>} workOrderIds - An array of the IDs to uncancel the matched workorders
|
|
513
|
-
* @return {Object} Returns object that represents a collection of workorders
|
|
514
|
-
*/
|
|
515
|
-
uncancel(workOrderIds: Array<number>) {
|
|
516
|
-
return new Promise((resolve, reject) => {
|
|
517
|
-
var data = {
|
|
518
|
-
WorkOrderIds: workOrderIds
|
|
519
|
-
}
|
|
520
|
-
this.cw.runRequest('Ams/WorkOrder/Uncancel', data).then(r => {
|
|
521
|
-
resolve(r.Value)
|
|
522
|
-
}).catch(e => {
|
|
523
|
-
reject(e)
|
|
524
|
-
})
|
|
525
|
-
})
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* Close WorkOrders
|
|
530
|
-
*
|
|
531
|
-
* @category WorkOrders
|
|
532
|
-
* @param {Array<number>} workOrderIds - An array of the IDs to close the matched WorkOrders
|
|
533
|
-
* @return {Object} Returns object that represents a collection of WorkOrders
|
|
534
|
-
*/
|
|
535
|
-
close(workOrderIds: Array<number>) {
|
|
536
|
-
return new Promise((resolve, reject) => {
|
|
537
|
-
var data = {
|
|
538
|
-
WorkOrderIds: workOrderIds
|
|
539
|
-
}
|
|
540
|
-
this.cw.runRequest('Ams/WorkOrder/Close', data).then(r => {
|
|
541
|
-
if(r.Status>0) {
|
|
542
|
-
reject(new CWError(5, r.Message, {'response': r}))
|
|
543
|
-
} else {
|
|
544
|
-
resolve(r.Value)
|
|
545
|
-
}
|
|
546
|
-
}).catch(e => {
|
|
547
|
-
reject(e)
|
|
548
|
-
})
|
|
549
|
-
})
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Reopen closed WorkOrders
|
|
554
|
-
*
|
|
555
|
-
* @category WorkOrders
|
|
556
|
-
* @param {Array<number>} workOrderIds - An array of the IDs to reopen the matched WorkOrders
|
|
557
|
-
* @return {Object} Returns object that represents a collection of WorkOrders
|
|
558
|
-
*/
|
|
559
|
-
reopen(workOrderIds: Array<number>) {
|
|
560
|
-
return new Promise((resolve, reject) => {
|
|
561
|
-
var data = {
|
|
562
|
-
WorkOrderIds: workOrderIds
|
|
563
|
-
}
|
|
564
|
-
this.cw.runRequest('Ams/WorkOrder/ReOpen', data).then(r => {
|
|
565
|
-
resolve(r.Value)
|
|
566
|
-
}).catch(e => {
|
|
567
|
-
reject(e)
|
|
568
|
-
})
|
|
569
|
-
})
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
/**
|
|
573
|
-
* Delete WorkOrders
|
|
574
|
-
*
|
|
575
|
-
* @category WorkOrders
|
|
576
|
-
* @param {Array<number>} workOrderIds - An array of the IDs to delete the matched WorkOrders
|
|
577
|
-
* @return {Object} Returns object that represents a collection of WorkOrder Ids which have been deleted
|
|
578
|
-
*/
|
|
579
|
-
delete(workOrderIds: Array<number>) {
|
|
580
|
-
return new Promise((resolve, reject) => {
|
|
581
|
-
var data = {
|
|
582
|
-
WorkOrderIds: workOrderIds
|
|
583
|
-
}
|
|
584
|
-
this.cw.runRequest('Ams/WorkOrder/Delete', data).then(r => {
|
|
585
|
-
if(r.Status>0) {
|
|
586
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
587
|
-
} else {
|
|
588
|
-
resolve(r.Value)
|
|
589
|
-
}
|
|
590
|
-
}).catch(e => {
|
|
591
|
-
reject(e)
|
|
592
|
-
})
|
|
593
|
-
})
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Get WorkOrderS/IDs connected to provided entities
|
|
598
|
-
*
|
|
599
|
-
* @category WorkOrder Search
|
|
600
|
-
* @param {string} entityType - The entity type to find connected WorkOrders
|
|
601
|
-
* @param {Array<string>} entityUIDs - The list of entities to search for connected WorkOrders
|
|
602
|
-
* @param {boolean} s - Get WorkOrderSids. Defaults to true. When false, returned list is WorkOrderIds
|
|
603
|
-
* @param {Object} [search] - Any additional search properties of the WorkOrder (open/closed, etc)
|
|
604
|
-
* @return {Object} Returns Promise that represents an array of WorkOrderS/IDs
|
|
605
|
-
*/
|
|
606
|
-
getWOsByEntities(entityType: string, entityUids: Array<string>, search?: Array<string|number>, s: boolean = true) {
|
|
607
|
-
return new Promise((resolve, reject) => {
|
|
608
|
-
var data = {}
|
|
609
|
-
if(typeof(search)!='undefined') {
|
|
610
|
-
_.merge(data, search)
|
|
611
|
-
}
|
|
612
|
-
if(!_.has(data, 'EntityType')) {
|
|
613
|
-
_.set(data, 'EntityType', entityType)
|
|
614
|
-
}
|
|
615
|
-
if(!_.has(data, 'EntityUids')) {
|
|
616
|
-
_.set(data, 'EntityUids', entityUids)
|
|
617
|
-
}
|
|
618
|
-
var path = 'Ams/WorkOrder/SearchForSids'
|
|
619
|
-
if(!s) {
|
|
620
|
-
path = 'Ams/WorkOrder/Search'
|
|
621
|
-
}
|
|
622
|
-
this.cw.runRequest(path, data).then(r => {
|
|
623
|
-
if(r.Status>0) {
|
|
624
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
625
|
-
} else {
|
|
626
|
-
resolve(r.Value)
|
|
627
|
-
}
|
|
628
|
-
}).catch(e => {
|
|
629
|
-
reject(e)
|
|
630
|
-
})
|
|
631
|
-
})
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* Get WorkOrderSid and description for provided WorkOrderId
|
|
636
|
-
*
|
|
637
|
-
* @category WorkOrder Search
|
|
638
|
-
* @param {string} workOrderId - The WorkOrderId for which to get the WorkOrderSid and description
|
|
639
|
-
* @return {Object} Returns Promise that represents an object with WorkOrderS/IDs & Description
|
|
640
|
-
*/
|
|
641
|
-
getSearchList(workOrderId: string) {
|
|
642
|
-
return new Promise((resolve, reject) => {
|
|
643
|
-
var data = {}
|
|
644
|
-
_.set(data, 'WorkOrderId', workOrderId)
|
|
645
|
-
this.cw.runRequest('Ams/WorkOrder/SearchObject', data).then(r => {
|
|
646
|
-
if(r.Status>0) {
|
|
647
|
-
reject(new CWError(4, r.Message, {'response': r}))
|
|
648
|
-
} else {
|
|
649
|
-
resolve(r.Value)
|
|
650
|
-
}
|
|
651
|
-
}).catch(e => {
|
|
652
|
-
reject(e)
|
|
653
|
-
})
|
|
654
|
-
})
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* Get WorkOrder Employee lists
|
|
659
|
-
*
|
|
660
|
-
* @category WorkOrder Options
|
|
661
|
-
* @param {string} listType - Which list (endpoint) to get. Includes Supervisors & SubmitTos.
|
|
662
|
-
* @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
|
|
663
|
-
* @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
|
|
664
|
-
* @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
|
|
665
|
-
*/
|
|
666
|
-
getEmployeeLists(listType: string, includeInactiveEmployees: boolean = false, domainIds?: Array<number>) {
|
|
667
|
-
return new Promise((resolve, reject) => {
|
|
668
|
-
var data = {
|
|
669
|
-
IncludeInactiveEmployees: includeInactiveEmployees
|
|
670
|
-
}
|
|
671
|
-
if(typeof(domainIds)!='undefined' && domainIds!=null) {
|
|
672
|
-
_.set(data, 'DomainIds', domainIds)
|
|
673
|
-
}
|
|
674
|
-
if(!_.includes(['Supervisors', 'SubmitTos'], listType)) {
|
|
675
|
-
reject(new CWError(2, 'listType must be either SubmitTos or Supervisors.', {'provided': listType}))
|
|
676
|
-
} else {
|
|
677
|
-
this.cw.runRequest(`Ams/WorkOrder/${listType}`, data).then(r => {
|
|
678
|
-
resolve(r.Value)
|
|
679
|
-
}).catch(e => {
|
|
680
|
-
reject(e)
|
|
681
|
-
})
|
|
682
|
-
}
|
|
683
|
-
})
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
/**
|
|
687
|
-
* Get SubmitTo list
|
|
688
|
-
*
|
|
689
|
-
* @category WorkOrder Options
|
|
690
|
-
* @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
|
|
691
|
-
* @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
|
|
692
|
-
* @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
|
|
693
|
-
*/
|
|
694
|
-
getSubmitTos(includeInactiveEmployees: boolean = false, domainIds?: Array<number>) {
|
|
695
|
-
return this.getEmployeeLists('SubmitTos', includeInactiveEmployees, domainIds);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
/**
|
|
699
|
-
* Get Supervisors list
|
|
700
|
-
*
|
|
701
|
-
* @category WorkOrder Options
|
|
702
|
-
* @param {boolean} includeInactiveEmployees - Whether to include inactive employees in the returned list. Defaults to false.
|
|
703
|
-
* @param {Array<number>} [domainIds] - Filter to certain domains within the Cityworks instance.
|
|
704
|
-
* @return {Object} Returns Promise that represents a collection of employees. See: /{subdirectory}/apidocs/#/data-type-info;dataType=EmployeeNameId
|
|
705
|
-
*/
|
|
706
|
-
getSupervisors(includeInactiveEmployees: boolean = false, domainIds?: Array<number>) {
|
|
707
|
-
return this.getEmployeeLists('Supervisors', includeInactiveEmployees, domainIds);
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
/**
|
|
711
|
-
* Get Status Options
|
|
712
|
-
*
|
|
713
|
-
* @category WorkOrder Options
|
|
714
|
-
* @return {Object} Returns Promise that represents a collection of codes. See: /{subdirectory}/apidocs/#/data-type-info;dataType=CodeDesc
|
|
715
|
-
*/
|
|
716
|
-
getStatuses() {
|
|
717
|
-
return new Promise((resolve, reject) => {
|
|
718
|
-
this.cw.runRequest('Ams/WorkOrder/Statuses', {}).then(r => {
|
|
719
|
-
resolve(r.Value)
|
|
720
|
-
}).catch(e => {
|
|
721
|
-
reject(e)
|
|
722
|
-
})
|
|
723
|
-
})
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Get Categories
|
|
728
|
-
*
|
|
729
|
-
* @category WorkOrder Options
|
|
730
|
-
* @return {Object} Returns Promise that represents an array of configured workorder category code descriptions
|
|
731
|
-
*/
|
|
732
|
-
getCategories() {
|
|
733
|
-
return new Promise((resolve, reject) => {
|
|
734
|
-
this.cw.runRequest('Ams/WorkOrder/Categories', {}).then(r => {
|
|
735
|
-
resolve(r.Value)
|
|
736
|
-
}).catch(e => {
|
|
737
|
-
reject(e)
|
|
738
|
-
})
|
|
739
|
-
})
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* Get Priorities
|
|
744
|
-
*
|
|
745
|
-
* @category WorkOrder Options
|
|
746
|
-
* @return {Object} Returns Promise that represents an array of configured workorder priorities
|
|
747
|
-
*/
|
|
748
|
-
getPriorities() {
|
|
749
|
-
return new Promise((resolve, reject) => {
|
|
750
|
-
this.cw.runRequest('Ams/WorkOrder/Priorities', {}).then(r => {
|
|
751
|
-
resolve(r.Value)
|
|
752
|
-
}).catch(e => {
|
|
753
|
-
reject(e)
|
|
754
|
-
})
|
|
755
|
-
})
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
/**
|
|
759
|
-
* Get Cycle From
|
|
760
|
-
*
|
|
761
|
-
* @category WorkOrder Options
|
|
762
|
-
* @return {Object} Returns Promise that represents an array of string/string Cycle From options for workorders
|
|
763
|
-
*/
|
|
764
|
-
getCycleFrom() {
|
|
765
|
-
return new Promise((resolve, reject) => {
|
|
766
|
-
this.cw.runRequest('Ams/WorkOrder/CycleFrom', {}).then(r => {
|
|
767
|
-
resolve(r.Value)
|
|
768
|
-
}).catch(e => {
|
|
769
|
-
reject(e)
|
|
770
|
-
})
|
|
771
|
-
})
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* Get Cycle Intervals
|
|
776
|
-
*
|
|
777
|
-
* @category WorkOrder Options
|
|
778
|
-
* @return {Object} Returns Promise that represents an array of string/string Cycle Interval options for workorders
|
|
779
|
-
*/
|
|
780
|
-
getCycleIntervals() {
|
|
781
|
-
return new Promise((resolve, reject) => {
|
|
782
|
-
this.cw.runRequest('Ams/WorkOrder/CycleIntervals', {}).then(r => {
|
|
783
|
-
resolve(r.Value)
|
|
784
|
-
}).catch(e => {
|
|
785
|
-
reject(e)
|
|
786
|
-
})
|
|
787
|
-
})
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
* Get Cycle Types
|
|
792
|
-
*
|
|
793
|
-
* @category WorkOrder Options
|
|
794
|
-
* @return {Object} Returns Promise that represents an array of string/string Cycle Type options for workorders
|
|
795
|
-
*/
|
|
796
|
-
getCycleTypes() {
|
|
797
|
-
return new Promise((resolve, reject) => {
|
|
798
|
-
this.cw.runRequest('Ams/WorkOrder/CycleTypes', {}).then(r => {
|
|
799
|
-
resolve(r.Value)
|
|
800
|
-
}).catch(e => {
|
|
801
|
-
reject(e)
|
|
802
|
-
})
|
|
803
|
-
})
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
/**
|
|
807
|
-
* Get WorkOrder Stages
|
|
808
|
-
*
|
|
809
|
-
* @category WorkOrder Options
|
|
810
|
-
* @return {Object} Returns Promise that represents an array of string/string Stage options for WorkOrders
|
|
811
|
-
*/
|
|
812
|
-
getStages() {
|
|
813
|
-
return new Promise((resolve, reject) => {
|
|
814
|
-
this.cw.runRequest('Ams/WorkOrder/Stages', {}).then(r => {
|
|
815
|
-
resolve(r.Value)
|
|
816
|
-
}).catch(e => {
|
|
817
|
-
reject(e)
|
|
818
|
-
})
|
|
819
|
-
})
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* Get Expense Types
|
|
824
|
-
*
|
|
825
|
-
* @category WorkOrder Options
|
|
826
|
-
* @return {Object} Returns Promise that represents an array of string/string Expense Type options for workorders
|
|
827
|
-
*/
|
|
828
|
-
getExpenseTypes() {
|
|
829
|
-
return new Promise((resolve, reject) => {
|
|
830
|
-
this.cw.runRequest('Ams/WorkOrder/ExpenseTypes', {}).then(r => {
|
|
831
|
-
resolve(r.Value)
|
|
832
|
-
}).catch(e => {
|
|
833
|
-
reject(e)
|
|
834
|
-
})
|
|
835
|
-
})
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
}
|