alsmanager_lib 3.0.224 → 3.0.225
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/lib/modules.js +52 -0
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -4413,7 +4413,50 @@ function queryDeviceByIdentificativo(db_used, identificativo) {
|
|
|
4413
4413
|
return query;
|
|
4414
4414
|
}
|
|
4415
4415
|
//End Get Device by Identificativo
|
|
4416
|
+
// Manage Devices annotations
|
|
4417
|
+
function getDeviceAnnotationsByIdDevice(id_device) {
|
|
4418
|
+
var query = "select da.id, da.date_annotation, da.annotation, a.name from device_annotations da ";
|
|
4419
|
+
query += "join annotation_types a on a.id = da.annotation_type ";
|
|
4420
|
+
query += "where id_device = " + id_device + " ";
|
|
4421
|
+
query += "order by date_annotation";
|
|
4422
|
+
return query;
|
|
4423
|
+
}
|
|
4424
|
+
function insertDeviceAnnotation(id_device, date_annot, annot, annot_type) {
|
|
4425
|
+
var query = "insert into device_annotations (id_device, date_annotation, annotation, annotation_type) values (";
|
|
4426
|
+
var dt_str = convertDateToStringDB(date_annot);
|
|
4427
|
+
query += id_device + ", ";
|
|
4428
|
+
query += "'" + dt_str + "', ";
|
|
4429
|
+
query += "'" + annot + "', ";
|
|
4430
|
+
query += annot_type;
|
|
4431
|
+
query += ")";
|
|
4432
|
+
return query;
|
|
4433
|
+
}
|
|
4434
|
+
function updateDeviceAnnotation(id_annot, date_annot, annot, annot_type) {
|
|
4435
|
+
var query = "update device_annotations set ";
|
|
4436
|
+
var dt_str = convertDateToStringDB(date_annot);
|
|
4437
|
+
query += "date_annotation = '" + dt_str + "', ";
|
|
4438
|
+
query += "annotation = '" + annot + "', ";
|
|
4439
|
+
query += "annotation_type = " + annotation_type + " ";
|
|
4440
|
+
query += "where id = " + id_annot;
|
|
4441
|
+
return query;
|
|
4442
|
+
}
|
|
4443
|
+
function removeDeviceAnnotation(id_annot) {
|
|
4444
|
+
var query = "delete from device_annotations ";
|
|
4445
|
+
query += "where id = " + id_annot;
|
|
4446
|
+
return query;
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4449
|
+
function selectAnnotationTypes() {
|
|
4450
|
+
var query = "select id, name, description from annotation_types ";
|
|
4451
|
+
return query;
|
|
4452
|
+
}
|
|
4416
4453
|
|
|
4454
|
+
function selectAnnotationTypesInfos(id_annot_type) {
|
|
4455
|
+
var query = "select id, name, description from annotation_types ";
|
|
4456
|
+
query += "where id = " + id_annot_type;
|
|
4457
|
+
return query;
|
|
4458
|
+
}
|
|
4459
|
+
//End Manage Devices annotations
|
|
4417
4460
|
|
|
4418
4461
|
|
|
4419
4462
|
//Get Device Status
|
|
@@ -17301,6 +17344,9 @@ function getNotesByIdDevice(id_device) {
|
|
|
17301
17344
|
query += "UNION ";
|
|
17302
17345
|
query += "select CONCAT('INTERVENTO n. ', di.id) as Tipo, di.date_start as Data, di.note_intervento as note from device_interventi di ";
|
|
17303
17346
|
query += "where di.id_device = " + id_device + " and di.note_intervento is not null ";
|
|
17347
|
+
query += "UNION ";
|
|
17348
|
+
query += "select 'ANNOTAZIONI' as Tipo, da.date_annotation as Data, da.annotation as note from device_annotation da ";
|
|
17349
|
+
query += "where da.id_device = " + id_device + " and da.annotation is not null ";
|
|
17304
17350
|
return query;
|
|
17305
17351
|
}
|
|
17306
17352
|
|
|
@@ -17331,6 +17377,12 @@ module.exports = {
|
|
|
17331
17377
|
getDevicesSelectBySite,
|
|
17332
17378
|
queryDeviceById,
|
|
17333
17379
|
queryDeviceByIdentificativo,
|
|
17380
|
+
getDeviceAnnotationsByIdDevice,
|
|
17381
|
+
insertDeviceAnnotation,
|
|
17382
|
+
updateDeviceAnnotation,
|
|
17383
|
+
removeDeviceAnnotation,
|
|
17384
|
+
selectAnnotationTypes,
|
|
17385
|
+
selectAnnotationTypesInfos,
|
|
17334
17386
|
queryDeviceForConsegneById,
|
|
17335
17387
|
getDevicesCounterBySite,
|
|
17336
17388
|
getDevicesCounterByPlace,
|