cityworks 1.0.4 → 1.0.5
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/dist/activity_link.d.ts +5 -0
- 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 +1 -1
- package/dist/activity_link.js +0 -219
- package/dist/briefcase.js +0 -327
- package/dist/case.d.ts +0 -114
- package/dist/case_admin.js +0 -821
- package/dist/case_assets.js +0 -129
- package/dist/case_data.js +0 -416
- package/dist/case_financial.js +0 -848
- package/dist/case_workflow.js +0 -455
- package/dist/cityworks.d.ts +0 -224
- package/dist/comments.js +0 -126
- package/dist/error.js +0 -30
- package/dist/event_layer.d.ts +0 -97
- package/dist/event_layer.js +0 -207
- package/dist/general.js +0 -212
- package/dist/gis.js +0 -250
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.modern.js +0 -2
- package/dist/index.modern.js.map +0 -1
- package/dist/inspection.js +0 -933
- package/dist/inspection_admin.js +0 -43
- package/dist/inspection_costs.js +0 -200
- package/dist/message_queue.js +0 -248
- package/dist/query.js +0 -242
- package/dist/request.js +0 -899
- package/dist/request_admin.js +0 -32
- package/dist/request_costs.js +0 -113
- package/dist/search.js +0 -371
- package/dist/workorder.js +0 -951
- package/dist/workorder_admin.js +0 -248
- package/dist/workorder_costs.js +0 -274
package/dist/workorder_admin.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkOrderAdmin = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
var WorkOrderAdmin = /** @class */ (function () {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
function WorkOrderAdmin(cw) {
|
|
10
|
-
this.cw = cw;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Get entity groups
|
|
14
|
-
*
|
|
15
|
-
* @category WorkOrders Admin
|
|
16
|
-
* @return {Object} Returns Promise that represents a collection of all entity groups
|
|
17
|
-
*/
|
|
18
|
-
WorkOrderAdmin.prototype.getEntityGroups = function () {
|
|
19
|
-
var _this = this;
|
|
20
|
-
return new Promise(function (resolve, reject) {
|
|
21
|
-
var data = {};
|
|
22
|
-
_this.cw.runRequest('Ams/Entity/Groups', data).then(function (r) {
|
|
23
|
-
resolve(r.Value);
|
|
24
|
-
}).catch(function (e) {
|
|
25
|
-
reject(e);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Get entity types
|
|
31
|
-
*
|
|
32
|
-
* @category WorkOrders Admin
|
|
33
|
-
* @return {Object} Returns Promise that represents a collection of all GIS WorkOrder entity types
|
|
34
|
-
*/
|
|
35
|
-
WorkOrderAdmin.prototype.getEntityTypes = function (entityGroups) {
|
|
36
|
-
var _this = this;
|
|
37
|
-
return new Promise(function (resolve, reject) {
|
|
38
|
-
var data = { EntityGroups: entityGroups };
|
|
39
|
-
_this.cw.runRequest('Ams/Designer/WOTemplates', data).then(function (r) {
|
|
40
|
-
resolve(r.Value);
|
|
41
|
-
}).catch(function (e) {
|
|
42
|
-
reject(e);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Get WorkOrder templates
|
|
48
|
-
*
|
|
49
|
-
* @category WorkOrders Admin
|
|
50
|
-
* @return {Object} Returns Promise that represents a collection of all WorkOrder templates
|
|
51
|
-
*/
|
|
52
|
-
WorkOrderAdmin.prototype.getTemplates = function (entityType, includeComments, includeInstructions) {
|
|
53
|
-
var _this = this;
|
|
54
|
-
if (includeComments === void 0) { includeComments = true; }
|
|
55
|
-
if (includeInstructions === void 0) { includeInstructions = true; }
|
|
56
|
-
return new Promise(function (resolve, reject) {
|
|
57
|
-
var data = { EntityType: entityType, IncludeComments: includeComments, IncludeInstructions: includeInstructions };
|
|
58
|
-
_this.cw.runRequest('Ams/Designer/WOTemplates', data).then(function (r) {
|
|
59
|
-
resolve(r.Value);
|
|
60
|
-
}).catch(function (e) {
|
|
61
|
-
reject(e);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Update WorkOrder template
|
|
67
|
-
*
|
|
68
|
-
* @category WorkOrders Admin
|
|
69
|
-
* @param {Object} wOTemplate - Obect that describes the WorkOrder Template
|
|
70
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
71
|
-
*/
|
|
72
|
-
WorkOrderAdmin.prototype.updateTemplate = function (wOTemplate) {
|
|
73
|
-
var _this = this;
|
|
74
|
-
var valid_fields = ["AcctNum", "AutoCreateTask", "Cancel", "Comments", "CopyCustomFieldVal", "CycleFrom", "CycleIncludeWeekends", "CycleIntervalNum", "CycleIntervalUnit", "CycleType", "DaysToComplete", "DefaultProject", "DefaultProjectSid", "Description", "Effort", "ExpenseType", "Instructions", "IsReactive", "MaintScore", "NumDaysBefore", "Priority", "RequireAssetOnClose", "Shop", "Stage", "SubmitToEmployeeSid", "SupervisorEmployeeSid", "UnitsAccompDesc", "UnitsAccompDescLock", "WOCategory", "WOCustFieldCatId", "WOPrintTmpt", "WOTemplateId", "WorkMonth"];
|
|
75
|
-
return new Promise(function (resolve, reject) {
|
|
76
|
-
var data = wOTemplate;
|
|
77
|
-
_this.cw.runRequest('Ams/Designer/WOTemplates', data).then(function (r) {
|
|
78
|
-
resolve(r.Value);
|
|
79
|
-
}).catch(function (e) {
|
|
80
|
-
reject(e);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Get template group rights for provided WorkOrder Templates
|
|
86
|
-
*
|
|
87
|
-
* @category WorkOrders Admin
|
|
88
|
-
* @param {Array<number>} wOTemplateIds - Array one or more WorkOrder Template IDs
|
|
89
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
90
|
-
*/
|
|
91
|
-
WorkOrderAdmin.prototype.getTemplateGroupRights = function (wOTemplateIds) {
|
|
92
|
-
var _this = this;
|
|
93
|
-
return new Promise(function (resolve, reject) {
|
|
94
|
-
var data = { WOTemplateIds: wOTemplateIds };
|
|
95
|
-
_this.cw.runRequest('Ams/Designer/WOTemplates', data).then(function (r) {
|
|
96
|
-
resolve(r.Value);
|
|
97
|
-
}).catch(function (e) {
|
|
98
|
-
reject(e);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Get template activity services for provided WorkOrder Templates
|
|
104
|
-
*
|
|
105
|
-
* @category WorkOrders Admin
|
|
106
|
-
* @param {Array<number>} wOTemplateIds - Array one or more WorkOrder Template IDs
|
|
107
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
108
|
-
*/
|
|
109
|
-
WorkOrderAdmin.prototype.getTemplateActivity = function (wOTemplateIds) {
|
|
110
|
-
var _this = this;
|
|
111
|
-
return new Promise(function (resolve, reject) {
|
|
112
|
-
var data = { WOTemplateIds: wOTemplateIds };
|
|
113
|
-
_this.cw.runRequest('Ams/Designer/WOTemplateActivityService', data).then(function (r) {
|
|
114
|
-
resolve(r.Value);
|
|
115
|
-
}).catch(function (e) {
|
|
116
|
-
reject(e);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Get fields which will be updated when provided WorkOrder Template instance closes
|
|
122
|
-
*
|
|
123
|
-
* @category WorkOrders Admin
|
|
124
|
-
* @param {Array<number>} wOTemplateIds - Array one or more WorkOrder Template IDs
|
|
125
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
126
|
-
*/
|
|
127
|
-
WorkOrderAdmin.prototype.getUpdateFields = function (wOTemplateIds) {
|
|
128
|
-
var _this = this;
|
|
129
|
-
return new Promise(function (resolve, reject) {
|
|
130
|
-
var data = { WOTemplateIds: wOTemplateIds };
|
|
131
|
-
_this.cw.runRequest('Ams/Designer/WOTemplateUpdateFields', data).then(function (r) {
|
|
132
|
-
resolve(r.Value);
|
|
133
|
-
}).catch(function (e) {
|
|
134
|
-
reject(e);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Get equipment
|
|
140
|
-
*
|
|
141
|
-
* @category WorkOrders Admin
|
|
142
|
-
* @param {Array<number>} wOTemplateIds - WorkOrder Template ID
|
|
143
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
144
|
-
*/
|
|
145
|
-
WorkOrderAdmin.prototype.getTemplateEquipment = function (wOTemplateId) {
|
|
146
|
-
var _this = this;
|
|
147
|
-
return new Promise(function (resolve, reject) {
|
|
148
|
-
var data = { WOTemplateId: wOTemplateId };
|
|
149
|
-
_this.cw.runRequest('Ams/Designer/WOTemplateEquipment', data).then(function (r) {
|
|
150
|
-
resolve(r.Value);
|
|
151
|
-
}).catch(function (e) {
|
|
152
|
-
reject(e);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Get labor
|
|
158
|
-
*
|
|
159
|
-
* @category WorkOrders Admin
|
|
160
|
-
* @param {Array<number>} wOTemplateIds - WorkOrder Template ID
|
|
161
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
162
|
-
*/
|
|
163
|
-
WorkOrderAdmin.prototype.getTemplateLabor = function (wOTemplateId) {
|
|
164
|
-
var _this = this;
|
|
165
|
-
return new Promise(function (resolve, reject) {
|
|
166
|
-
var data = { WOTemplateId: wOTemplateId };
|
|
167
|
-
_this.cw.runRequest('Ams/Designer/WOTemplateLabor', data).then(function (r) {
|
|
168
|
-
resolve(r.Value);
|
|
169
|
-
}).catch(function (e) {
|
|
170
|
-
reject(e);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
/**
|
|
175
|
-
* Get material
|
|
176
|
-
*
|
|
177
|
-
* @category WorkOrders Admin
|
|
178
|
-
* @param {number} wOTemplateId - WorkOrder Template ID
|
|
179
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
180
|
-
*/
|
|
181
|
-
WorkOrderAdmin.prototype.getTemplateMaterial = function (wOTemplateId) {
|
|
182
|
-
var _this = this;
|
|
183
|
-
return new Promise(function (resolve, reject) {
|
|
184
|
-
var data = { WOTemplateId: wOTemplateId };
|
|
185
|
-
_this.cw.runRequest('Ams/Designer/WOTemplateMaterial', data).then(function (r) {
|
|
186
|
-
resolve(r.Value);
|
|
187
|
-
}).catch(function (e) {
|
|
188
|
-
reject(e);
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
/**
|
|
193
|
-
* Get map layer fields configured for provided WorkOrder template
|
|
194
|
-
*
|
|
195
|
-
* @category WorkOrders Admin
|
|
196
|
-
* @param {number} wOTemplateId - WorkOrder Template ID
|
|
197
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
198
|
-
*/
|
|
199
|
-
WorkOrderAdmin.prototype.getTemplateMapLayerFields = function (wOTemplateId) {
|
|
200
|
-
var _this = this;
|
|
201
|
-
return new Promise(function (resolve, reject) {
|
|
202
|
-
var data = { WorkOrderTemplateId: wOTemplateId };
|
|
203
|
-
_this.cw.runRequest('Ams/Designer/WorkOrderTemplateMapLayerFields', data).then(function (r) {
|
|
204
|
-
resolve(r.Value);
|
|
205
|
-
}).catch(function (e) {
|
|
206
|
-
reject(e);
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* Get tasks configured for provided WorkOrder template
|
|
212
|
-
*
|
|
213
|
-
* @category WorkOrders Admin
|
|
214
|
-
* @param {number} wOTemplateId - WorkOrder Template ID
|
|
215
|
-
* @return {Object} Returns Promise that represents a collection of all tasks on WorkOrder template
|
|
216
|
-
*/
|
|
217
|
-
WorkOrderAdmin.prototype.getTemplateTasks = function (wOTemplateId) {
|
|
218
|
-
var _this = this;
|
|
219
|
-
return new Promise(function (resolve, reject) {
|
|
220
|
-
var data = { WOTemplateId: wOTemplateId };
|
|
221
|
-
_this.cw.runRequest('Ams/Tasks/ByWorkOrderTemplate', data).then(function (r) {
|
|
222
|
-
resolve(r.Value);
|
|
223
|
-
}).catch(function (e) {
|
|
224
|
-
reject(e);
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
/**
|
|
229
|
-
* Get inspections connected to provided WorkOrder template
|
|
230
|
-
*
|
|
231
|
-
* @category WorkOrders Admin
|
|
232
|
-
* @param {number} wOTemplateId - WorkOrder Template ID
|
|
233
|
-
* @return {Object} Returns Promise that represents a collection of all tasks on WorkOrder template
|
|
234
|
-
*/
|
|
235
|
-
WorkOrderAdmin.prototype.getRelatedInspectionTemplates = function (wOTemplateId) {
|
|
236
|
-
var _this = this;
|
|
237
|
-
return new Promise(function (resolve, reject) {
|
|
238
|
-
var data = { WOTemplateId: wOTemplateId };
|
|
239
|
-
_this.cw.runRequest('Ams/Designer/WOTemplateInspections', data).then(function (r) {
|
|
240
|
-
resolve(r.Value);
|
|
241
|
-
}).catch(function (e) {
|
|
242
|
-
reject(e);
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
return WorkOrderAdmin;
|
|
247
|
-
}());
|
|
248
|
-
exports.WorkOrderAdmin = WorkOrderAdmin;
|
package/dist/workorder_costs.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkOrderCosts = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
var WorkOrderCosts = /** @class */ (function () {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
function WorkOrderCosts(cw) {
|
|
10
|
-
this.cw = cw;
|
|
11
|
-
this.currentActivityType = "WorkOrder";
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Get Cost Codes
|
|
15
|
-
*
|
|
16
|
-
* @category Labor Costs
|
|
17
|
-
* @param {Array<number>} employeeSids - A list of Employee IDs for which to get the job codes.
|
|
18
|
-
* @param {boolean} commonOnly - Set to true to get the Cost Codes that are common to ALL employees in the list, otherwise get all job codes that apply to at least one employee in the list.
|
|
19
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
20
|
-
*/
|
|
21
|
-
WorkOrderCosts.prototype.getCodes = function (employeeSids, commonOnly) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
if (commonOnly === void 0) { commonOnly = false; }
|
|
24
|
-
return new Promise(function (resolve, reject) {
|
|
25
|
-
var data = {
|
|
26
|
-
EmployeeSids: employeeSids,
|
|
27
|
-
CommonCodesOnly: commonOnly
|
|
28
|
-
};
|
|
29
|
-
_this.cw.runRequest('Ams/LaborCost/CostCodes', data).then(function (r) {
|
|
30
|
-
resolve(r.Value);
|
|
31
|
-
}).catch(function (e) {
|
|
32
|
-
reject(e);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Get Job Codes
|
|
38
|
-
*
|
|
39
|
-
* @category Labor Costs
|
|
40
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
41
|
-
*/
|
|
42
|
-
WorkOrderCosts.prototype.getJobCodes = function () {
|
|
43
|
-
var _this = this;
|
|
44
|
-
return new Promise(function (resolve, reject) {
|
|
45
|
-
_this.cw.runRequest('Ams/LaborCost/JobCodes').then(function (r) {
|
|
46
|
-
resolve(r.Value);
|
|
47
|
-
}).catch(function (e) {
|
|
48
|
-
reject(e);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Add WorkOrder Labor Costs
|
|
54
|
-
*
|
|
55
|
-
* @category WorkOrder Costs
|
|
56
|
-
* @param {number} workOrderSid - Array of inspection labor costings
|
|
57
|
-
* @param {number} hours - Number of hours to add
|
|
58
|
-
* @param {Object} options - options for the work order
|
|
59
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
60
|
-
*/
|
|
61
|
-
WorkOrderCosts.prototype.addLabor = function (workOrderSid, hours, options) {
|
|
62
|
-
var _this = this;
|
|
63
|
-
return new Promise(function (resolve, reject) {
|
|
64
|
-
var data = {
|
|
65
|
-
WorkOrderSid: workOrderSid,
|
|
66
|
-
Hours: hours
|
|
67
|
-
};
|
|
68
|
-
if (typeof (options) != 'undefined') {
|
|
69
|
-
data = _.merge(data, options);
|
|
70
|
-
}
|
|
71
|
-
// TODO: ensure each object has Hours & InspectionId
|
|
72
|
-
_this.cw.runRequest('Ams/LaborCost/AddWorkOrderCosts', data).then(function (response) {
|
|
73
|
-
resolve(response.Value);
|
|
74
|
-
}).catch(function (e) {
|
|
75
|
-
reject(e);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Get Labor Costs for WorkOrder(s)
|
|
81
|
-
*
|
|
82
|
-
* @category WorkOrder Costs
|
|
83
|
-
* @param {Array<number>} workOrderSids - Array of request Ids to get costs for
|
|
84
|
-
* @param {boolean} estimated - Whether to get estimates or actuals (defaults to false -- get actuals)
|
|
85
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
86
|
-
*/
|
|
87
|
-
WorkOrderCosts.prototype.getLabor = function (workOrderSids, estimated) {
|
|
88
|
-
var _this = this;
|
|
89
|
-
if (estimated === void 0) { estimated = false; }
|
|
90
|
-
return new Promise(function (resolve, reject) {
|
|
91
|
-
var data = {
|
|
92
|
-
Estimated: estimated,
|
|
93
|
-
WorkOrderSids: workOrderSids
|
|
94
|
-
};
|
|
95
|
-
_this.cw.runRequest('Ams/LaborCost/WorkOrderCostsByWorkOrder', data).then(function (response) {
|
|
96
|
-
resolve(response.Value);
|
|
97
|
-
}).catch(function (e) {
|
|
98
|
-
reject(e);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Delete WorkOrder Labor Costs
|
|
104
|
-
*
|
|
105
|
-
* @category WorkOrder Costs
|
|
106
|
-
* @param {Array<number>} laborCostIds - List of labor cost IDs to delete
|
|
107
|
-
* @param {boolean} estimated - Whether to delete estimates or actuals (defaults to false -- delete actuals)
|
|
108
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
109
|
-
*/
|
|
110
|
-
WorkOrderCosts.prototype.deleteLabor = function (laborCostIds, estimated) {
|
|
111
|
-
var _this = this;
|
|
112
|
-
if (estimated === void 0) { estimated = false; }
|
|
113
|
-
return new Promise(function (resolve, reject) {
|
|
114
|
-
var data = {
|
|
115
|
-
LaborCostIds: laborCostIds,
|
|
116
|
-
Estimated: estimated
|
|
117
|
-
};
|
|
118
|
-
_this.cw.runRequest('Ams/LaborCost/DeleteWorkOrderCosts', data).then(function (response) {
|
|
119
|
-
resolve(response.Value);
|
|
120
|
-
}).catch(function (e) {
|
|
121
|
-
reject(e);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Add WorkOrder Equipment Costs
|
|
127
|
-
*
|
|
128
|
-
* @category WorkOrder Costs
|
|
129
|
-
* @param {Object} workOrderSid - the work order to add the equipment costs to
|
|
130
|
-
* @param {Object} options - additional options
|
|
131
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
132
|
-
*/
|
|
133
|
-
WorkOrderCosts.prototype.addEquipment = function (workOrderSid, options) {
|
|
134
|
-
var _this = this;
|
|
135
|
-
return new Promise(function (resolve, reject) {
|
|
136
|
-
var data = {
|
|
137
|
-
WorkOrderSid: workOrderSid
|
|
138
|
-
};
|
|
139
|
-
if (typeof (options) != 'undefined') {
|
|
140
|
-
data = _.merge(data, options);
|
|
141
|
-
}
|
|
142
|
-
// TODO: ensure each object has Hours & InspectionId
|
|
143
|
-
_this.cw.runRequest('Ams/EquipmentCost/AddWorkOrderCosts', data).then(function (response) {
|
|
144
|
-
resolve(response.Value);
|
|
145
|
-
}).catch(function (e) {
|
|
146
|
-
reject(e);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
/**
|
|
151
|
-
* Get Equipment Costs for WorkOrder(s)
|
|
152
|
-
*
|
|
153
|
-
* @category WorkOrder Costs
|
|
154
|
-
* @param {number} workOrderSid - the work order to add the equipment costs to
|
|
155
|
-
* @param {boolean} estimated - true to get estimated costs. defaults to false
|
|
156
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
157
|
-
*/
|
|
158
|
-
// WorkOrderCostsByWorkOrderList<EquipmentCost>
|
|
159
|
-
WorkOrderCosts.prototype.getEquipment = function (workOrderSid, estimated) {
|
|
160
|
-
var _this = this;
|
|
161
|
-
if (estimated === void 0) { estimated = false; }
|
|
162
|
-
return new Promise(function (resolve, reject) {
|
|
163
|
-
var data = {
|
|
164
|
-
WorkOrderSid: workOrderSid,
|
|
165
|
-
Estimated: estimated
|
|
166
|
-
};
|
|
167
|
-
// TODO: ensure each object has Hours & InspectionId
|
|
168
|
-
_this.cw.runRequest('Ams/EquipmentCost/WorkOrderCostsByWorkOrder', data).then(function (response) {
|
|
169
|
-
resolve(response.Value);
|
|
170
|
-
}).catch(function (e) {
|
|
171
|
-
reject(e);
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Delete WorkOrder Equipment Costs
|
|
177
|
-
*
|
|
178
|
-
* @category WorkOrder Costs
|
|
179
|
-
* @param {Object}
|
|
180
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
181
|
-
*/
|
|
182
|
-
WorkOrderCosts.prototype.deleteEquipment = function (equipmentCostIds, estimated) {
|
|
183
|
-
var _this = this;
|
|
184
|
-
if (estimated === void 0) { estimated = false; }
|
|
185
|
-
return new Promise(function (resolve, reject) {
|
|
186
|
-
var data = {
|
|
187
|
-
EquipmentCostIds: equipmentCostIds,
|
|
188
|
-
Estimated: estimated
|
|
189
|
-
};
|
|
190
|
-
_this.cw.runRequest('Ams/EquipmentCost/DeleteWorkOrderCosts', data).then(function (response) {
|
|
191
|
-
resolve(response.Value);
|
|
192
|
-
}).catch(function (e) {
|
|
193
|
-
reject(e);
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* Add WorkOrder Material Costs
|
|
199
|
-
*
|
|
200
|
-
* @category WorkOrder Costs
|
|
201
|
-
* @param {number} workOrderSid - Work Order SID number to add the material to
|
|
202
|
-
* @param {number} units - Decimal units for material
|
|
203
|
-
* @param {Object} options - Additional work order options
|
|
204
|
-
* @param {boolean} combineIssuesByMaterialSid - Combine issues with the same MaterialSid into a single commit, default is true
|
|
205
|
-
* @return {Object} Returns Promise that represents a collection describing the work order material costs
|
|
206
|
-
*/
|
|
207
|
-
WorkOrderCosts.prototype.addMaterial = function (workOrderSid, units, options, combineIssuesByMaterialSid) {
|
|
208
|
-
var _this = this;
|
|
209
|
-
if (combineIssuesByMaterialSid === void 0) { combineIssuesByMaterialSid = true; }
|
|
210
|
-
return new Promise(function (resolve, reject) {
|
|
211
|
-
var data = {
|
|
212
|
-
Units: units,
|
|
213
|
-
WorkOrderSid: workOrderSid,
|
|
214
|
-
CombineIssuesByMaterialSid: combineIssuesByMaterialSid
|
|
215
|
-
};
|
|
216
|
-
if (typeof (options) != 'undefined') {
|
|
217
|
-
data = _.merge(data, options);
|
|
218
|
-
}
|
|
219
|
-
_this.cw.runRequest('Ams/MaterialCost/AddWorkOrderCosts', data).then(function (response) {
|
|
220
|
-
resolve(response.Value);
|
|
221
|
-
}).catch(function (e) {
|
|
222
|
-
reject(e);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* Get Material Costs for WorkOrder(s)
|
|
228
|
-
*
|
|
229
|
-
* @category WorkOrder Costs
|
|
230
|
-
* @param {number} workOrderSid - the work order to add the equipment costs to
|
|
231
|
-
* @param {boolean} estimated - true to get estimated costs. defaults to false and gets actuals.
|
|
232
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
233
|
-
*/
|
|
234
|
-
WorkOrderCosts.prototype.getMaterial = function (workOrderSid, estimated) {
|
|
235
|
-
var _this = this;
|
|
236
|
-
if (estimated === void 0) { estimated = false; }
|
|
237
|
-
return new Promise(function (resolve, reject) {
|
|
238
|
-
var data = {
|
|
239
|
-
WorkOrderSid: workOrderSid,
|
|
240
|
-
Estimated: estimated
|
|
241
|
-
};
|
|
242
|
-
_this.cw.runRequest('Ams/MaterialCost/AddWorkOrderCosts', data).then(function (response) {
|
|
243
|
-
resolve(response.Value);
|
|
244
|
-
}).catch(function (e) {
|
|
245
|
-
reject(e);
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
};
|
|
249
|
-
/**
|
|
250
|
-
* Delete WorkOrder Material Costs
|
|
251
|
-
*
|
|
252
|
-
* @category WorkOrder Costs
|
|
253
|
-
* @param {Array<number>} materialCostIds - list of material cost IDs to delete
|
|
254
|
-
* @param {boolean} estimated - true to delete the estimated costs. defaults to false and deletes actuals.
|
|
255
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
256
|
-
*/
|
|
257
|
-
WorkOrderCosts.prototype.deleteMaterial = function (materialCostIds, estimated) {
|
|
258
|
-
var _this = this;
|
|
259
|
-
if (estimated === void 0) { estimated = false; }
|
|
260
|
-
return new Promise(function (resolve, reject) {
|
|
261
|
-
var data = {
|
|
262
|
-
MaterialCostIds: materialCostIds,
|
|
263
|
-
Estimated: estimated
|
|
264
|
-
};
|
|
265
|
-
_this.cw.runRequest('Ams/MaterialCost/DeleteWorkOrderCosts', data).then(function (response) {
|
|
266
|
-
resolve(response.Value);
|
|
267
|
-
}).catch(function (e) {
|
|
268
|
-
reject(e);
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
return WorkOrderCosts;
|
|
273
|
-
}());
|
|
274
|
-
exports.WorkOrderCosts = WorkOrderCosts;
|