@openinc/parse-server-opendash 4.0.27 → 4.0.28
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/hooks/MES_Order.js +0 -12
- package/package.json +1 -1
package/dist/hooks/MES_Order.js
CHANGED
|
@@ -80,8 +80,6 @@ async function init() {
|
|
|
80
80
|
scheduleOrderStartedStatusCheck("0 * * * * *");
|
|
81
81
|
(0, index_js_2.beforeSaveHook)(index_js_3.MES_Order, async (request) => {
|
|
82
82
|
const { object, original, user } = request;
|
|
83
|
-
console.log("===".repeat(10) + " BEFORE SAVE HOOK " + "===".repeat(10));
|
|
84
|
-
console.log("[MES] - beforeSaveHook: Received order \n" + JSON.stringify(object.toJSON(), null, 2) + "\n with original \n" + JSON.stringify(original?.toJSON(), null, 2) + "\n by user " + user?.getEmail());
|
|
85
83
|
await (0, index_js_2.defaultHandler)(request);
|
|
86
84
|
await (0, index_js_2.defaultAclHandler)(request, {
|
|
87
85
|
allowCustomACL: true,
|
|
@@ -152,13 +150,9 @@ async function init() {
|
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
|
-
console.log("[MES] - beforeSaveHook: Finished processing order " + object.id + " with final status " + object.get("status"));
|
|
156
|
-
console.log("===".repeat(10) + " END BEFORE SAVE HOOK " + "===".repeat(10));
|
|
157
153
|
});
|
|
158
154
|
(0, index_js_2.afterSaveHook)(index_js_3.MES_Order, async (request) => {
|
|
159
155
|
const { object, original, user } = request;
|
|
160
|
-
console.log("===".repeat(10) + " AFTER SAVE HOOK " + "===".repeat(10));
|
|
161
|
-
console.log("[MES] - afterSaveHook: Received order \n" + JSON.stringify(object.toJSON(), null, 2) + " with original \n" + JSON.stringify(original?.toJSON(), null, 2) + " by user \n" + user?.getEmail());
|
|
162
156
|
try {
|
|
163
157
|
if (original) {
|
|
164
158
|
// If the order is canceled, publish it as canceled
|
|
@@ -193,7 +187,6 @@ async function init() {
|
|
|
193
187
|
runningData.name = "Order_Running";
|
|
194
188
|
console.log("-".repeat(20));
|
|
195
189
|
console.log("Publishing running order " + object.id);
|
|
196
|
-
console.log("Data:", JSON.stringify(runningData));
|
|
197
190
|
console.log("-".repeat(20));
|
|
198
191
|
await (0, index_js_1.publishDataItem)(runningData, user?.getEmail() || undefined, true);
|
|
199
192
|
}
|
|
@@ -202,12 +195,9 @@ async function init() {
|
|
|
202
195
|
console.error(e);
|
|
203
196
|
console.log("Order Data not published:" + e.message, e);
|
|
204
197
|
}
|
|
205
|
-
console.log("[MES] - afterSaveHook: Finished processing order " + object.id);
|
|
206
|
-
console.log("===".repeat(10) + " END AFTER SAVE HOOK " + "===".repeat(10));
|
|
207
198
|
});
|
|
208
199
|
}
|
|
209
200
|
async function object2OWItem(object) {
|
|
210
|
-
console.log("[MES] - object2OWItem: Converting order " + JSON.stringify(object.toJSON(), null, 2) + " to DataItemInterface");
|
|
211
201
|
const tag = object.get("tag");
|
|
212
202
|
const configString = await new node_1.default.Query("OD3_Config")
|
|
213
203
|
.equalTo("key", "ow.mes.unitInfo")
|
|
@@ -280,7 +270,6 @@ function createCustomValueTypes(object, fields, fieldInfos) {
|
|
|
280
270
|
});
|
|
281
271
|
}
|
|
282
272
|
async function createValueArrayForObject(object, extraValues, fields) {
|
|
283
|
-
console.log("[MES] - createValueArrayForObject: Creating values object " + JSON.stringify(object.toJSON(), null, 2) + " with extraValues " + JSON.stringify(extraValues));
|
|
284
273
|
const values = [];
|
|
285
274
|
const status = object.get("status");
|
|
286
275
|
const ordernr = object.get("ordernr");
|
|
@@ -319,7 +308,6 @@ async function createValueArrayForObject(object, extraValues, fields) {
|
|
|
319
308
|
}
|
|
320
309
|
values.push(value);
|
|
321
310
|
}
|
|
322
|
-
console.log("[MES] - createValueArrayForObject: Created values object for order " + object.id + ": ", values);
|
|
323
311
|
return [{ date: object.get("start").getTime(), value: values }];
|
|
324
312
|
}
|
|
325
313
|
function scheduleOrderStartedStatusCheck(cronInterval) {
|